Mr.Zhang
2023-09-07 1e993780749c9525be74e77e4c81b7db2c88da6f
minipro_standard/pages/OutOperation/OutOperation.vue
@@ -2,7 +2,7 @@
   <view>
      <InOutInfo :info="info" />
      <uni-collapse @change="change" @close="close" @open="open">
         <uni-collapse-item v-if="type==7" v-for="(item1, index) in warehouseList" :key="index">
         <uni-collapse-item :open="item1.wtransferDetailList.length" v-if="type==7" v-for="(item1, index) in warehouseList" :key="index">
            <view class="p30 cY" style="border-bottom: 4rpx solid #f7f7f7;" slot="title">
               <image src="../../static/chuku_ic_cangku@2x.png" class="img36 mr10" mode=""></image>
               <view>{{ item1.warehouseName }}</view>
@@ -19,7 +19,7 @@
                  <div class="page_content_title">
                     <div class="page_content_title_top">
                        <span>{{ item.materialName + ' | ' + item.materialCode }}</span>
                        <span>待出{{ item.materialName + ' | ' + item.materialCode }}</span>
                        <span>待出<span>{{ item.outPlannum }}</span> {{ item.unitName }}</span>
                     </div>
                     <div class="page_content_title_bottom">
                        <span class="green" v-if="item.qualityType === 0">合格&nbsp;<span
@@ -33,18 +33,18 @@
                        <span>{{item.batch ? item.batch : '-'}}</span>
                     </div>
                  </div>
                  <div class="page_content_list">
                  <div class="page_content_list" v-for="(childer, idxs) in item.wstockExtListVOList" :key="idxs">
                     <div class="page_content_list_item">
                        <div class="page_content_list_item_label">出库货位:</div>
                        <div class="page_content_list_item_nr">
                           {{item.outLocationName ? item.outLocationName : '-'}}
                        </div>
                        <div class="page_content_list_item_nr">{{ childer.locationName }}</div>
                     </div>
                     <div class="page_content_list_items">
                        <div class="page_content_list_item_label">数量:</div>
                        <div class="page_content_list_item_nr">
                           {{item.outPlannum ? item.outPlannum : '-'}}{{item.unitName}}
                        </div>
                        <div class="page_content_list_item_nr">{{ childer.num }}{{ childer.unitName }}</div>
                     </div>
                     <div class="page_content_list_item">
                        <div class="page_content_list_item_label">批次号:</div>
                        <div class="page_content_list_item_nr">{{ childer.batch ? childer.batch : '-' }}</div>
                     </div>
                  </div>
               </div>
@@ -142,7 +142,7 @@
                     </div>
                  </div>
                  <div class="dele" @click="dele(index)">
                     <!-- <img src="@/assets/icon/chuku_ic_delete@2x.png" alt="" /> -->
                     <!-- <img src="@/assets/icon/chuku_ic_delete@2x.png" alt="" /> -->
                     <image src="../../static/chuku_ic_delete@2x.png" class="img24" mode=""></image>
                  </div>
               </div>
@@ -157,7 +157,7 @@
            <span>确认出库</span>
         </div>
      </div>
      <SelectTraMultipleMaterial ref="selectTraMultipleMaterial" />
      <SelectTraMultipleMaterial ref="selectTraMultipleMaterial" @selectes="selectMaterail" />
   </view>
</template>
@@ -262,20 +262,114 @@
         close() {},
         open() {},
         openxz() {
            // let arr = []
            // if (this.info.wtransferRedisCodeBeanList.length !== 0) {
            //    this.info.wtransferRedisCodeBeanList.forEach(element => {
            //       arr.push(element.appliancesId)
            //    })
            //    this.ids = arr.join(',')
            // } else {
            //    this.ids = ''
            // }
            this.$refs.selectTraMultipleMaterial.open({
               transferId: this.id,
               warehouseId: this.warehouseId
            this.$refs.selectTraMultipleMaterial.open({
               transferId: this.id,
               warehouseId: this.warehouseId
            })
         },
         selectMaterail(v) {
            let tempList = this.warehouseList[0].wtransferDetailList
            let materials = v.materials
            materials.forEach(materail => {
               tempList.forEach(item => {
                  if (materail.materialId == item.materialId && materail.procedureId == item
                     .procedureId && materail.qualityType == item.qualityType && materail.batch ==
                     item.batch) {
                     let isExist = false
                     this.outboundList.forEach(selected => {
                        if (selected.newId == materail.id) {
                           isExist = true
                           return
                        }
                     })
                     if (isExist) {
                        uni.$u.toast('该物料批次已存在')
                        return
                     }
                     let obj = JSON.parse(JSON.stringify(materail))
                     obj.newId = item.id
                     this.outboundList.push(obj)
                  }
               })
            })
         },
         submit() {
            if (this.type == QRCodeType.ZKD) {
               if (this.outboundList.length > 0) {
                  let result = this.outboundList.reduce((a, b) => {
                     if (a[b.newId]) {
                        a[b.newId].push(b);
                     } else {
                        a[b.newId] = [b];
                     }
                     return a;
                  }, {});
                  let tempList = this.warehouseList[0].wtransferDetailList
                  for (let i = 0; i < tempList.length; i++) {
                     let item = tempList[i]
                     for (let a in result) {
                        if (item.id == a) {
                           let total = 0
                           for (let b = 0; b < result[a].length; b++) {
                              total = Number(total) + Number(result[a][b].num)
                           }
                           if (!total || total <= 0) {
                              uni.$u.toast('出库物料数量必须大于0')
                              return
                           }
                           console.log(total, item.outPlannum);
                           if (total > item.outPlannum) {
                              uni.$u.toast('出库数量不能大于待出库数量')
                              return
                           }
                        }
                     }
                  }
                  let submitTransferOutDetailDTOList = []
                  this.outboundList.forEach(item => {
                     tempList.forEach(child => {
                        if (item.newId == child.id) {
                           submitTransferOutDetailDTOList.push({
                              outNum: item.num,
                              wstockId: item.id,
                              wtransferDetailId: child.id
                           })
                        }
                     })
                  })
                  transferToOutNew({
                     submitTransferOutDetailDTOList,
                     wtransferId: this.id
                  }).then(res => {
                     if (res.code === 200) {
                        this.$store.dispatch.dispatch('getUpcomingNum')
                        uni.$u.toast('操作成功')
                        // setTimeout(() => {
                        //   router.replace({ name: 'wTransferDetail', query: { id: info.value.wtransfer.id, dbid: route.query.dbid } })
                        // }, 2000)
                     }
                  })
               } else {
                  uni.$u.toast('请选择出库物料')
               }
            } else if (this.type === QRCodeType.CKD) {
               wOutBoundForUpload({
                  id: info.value.woutbound.id,
                  wOutboundType: 0
               }).then(res => {
                  if (res.code === 200) {
                     this.$store.dispatch.dispatch('getUpcomingNum')
                     uni.$u.toast('操作成功')
                     // setTimeout(() => {
                     //   // router.go(-1)
                     //   router.replace({ name: 'wOutboundDetail', query: { id: info.value.wtransfer.id } })
                     // }, 2000)
                  }
               })
            }
         }
      }
   }
</script>
@@ -558,135 +652,61 @@
               margin-top: 15rpx;
            }
            .page_yxwl_list_item_num {
               display: flex;
               flex-direction: column;
               // margin-top: 30rpx;
               &:first-child {
                  margin-top: 0;
               }
               .dis {
                  display: flex;
               }
               .itemy {
                  margin-top: 20rpx;
                  width: 100%;
                  display: flex;
                  align-items: center;
                  position: relative;
                  .itemy_item {
                     flex: 1;
                     display: flex;
                     align-items: center;
                     .label {
                        font-size: 26rpx;
                        font-weight: 400;
                        color: #666666;
                        flex-shrink: 0;
                     }
                     .nr {
                        font-size: 26rpx;
                        font-weight: 400;
                        color: #222222;
                        input {
                           width: 100rpx;
                           height: 35rpx;
                           border-radius: 8rpx;
                           border: 1rpx solid #E5E5E5;
                           margin-right: 10rpx;
                           margin-left: 5rpx;
                        }
                        span {
                           font-size: 26rpx;
                           font-weight: 400;
                           color: #222222;
                        }
                     }
                  }
                  .dele {
                     position: absolute;
                     right: -30rpx;
                     width: 48rpx;
                     height: 48rpx;
                     img {
                        width: 100%;
                        height: 100%;
                     }
                  }
               }
               .items {
                  width: 50%;
                  display: flex;
                  align-items: center;
                  .label {
                     font-size: 26rpx;
                     font-weight: 400;
                     color: #666666;
                     flex-shrink: 0;
                  }
                  .nr {
                     font-size: 26rpx;
                     font-weight: 400;
                     color: #222222;
                     input {
                        width: 100rpx;
                        height: 40rpx;
                        margin-right: 10rpx;
                     }
                     span {
                        font-size: 26rpx;
                        font-weight: 400;
                        color: #222222;
                     }
                  }
               }
               .item {
                  width: 70%;
                  display: flex;
                  align-items: center;
                  .label {
                     font-size: 26rpx;
                     font-weight: 400;
                     color: #666666;
                     flex-shrink: 0;
                  }
                  .nr {
                     font-size: 26rpx;
                     font-weight: 400;
                     color: #222222;
                     input {
                        width: 100rpx;
                        height: 40rpx;
                        margin-right: 10rpx;
                     }
                     span {
                        font-size: 26rpx;
                        font-weight: 400;
                        color: #222222;
                     }
                  }
               }
            }
            .page_yxwl_list_item_num {
                      display: flex;
                      position: relative;
                      margin-top: 36rpx;
                      &:first-child {
                        margin-top: 0;
                      }
                      .dele {
                        position: absolute;
                        right: -30rpx;
                        width: 48rpx;
                        height: 48rpx;
                        img {
                          width: 100%;
                          height: 100%;
                        }
                      }
                      .item {
                        width: 50%;
                        display: flex;
                        align-items: center;
                        .label {
                          flex-shrink: 0;
                          font-size: 26rpx;
                          font-weight: 400;
                          color: #666666;
                          flex-shrink: 0;
                        }
                        .nr {
                          flex: 1;
                          display: flex;
                          align-items: center;
                          input {
                            width: 130rpx;
                            height: 40rpx;
                            border-radius: 8rpx;
                            border: 1rpx solid #E5E5E5;
                            margin-right: 10rpx;
                          }
                          span {
                            font-size: 26rpx;
                            font-weight: 400;
                            color: #222222;
                          }
                        }
                      }
                    }
         }
      }