whycq
2024-10-18 2b5bf2b63f6b8718a396f16f02c682f635744425
pages/phyz/stationManage/pickAgain.vue
@@ -8,6 +8,7 @@
            <view>名称:{{orderDetl.maktx}}</view>
            <view>库存数量:{{orderDetl.anfme}}</view>
            <view>订单可出数量:{{orderDetl.stock}}</view>
            <view>已拣数量:{{orderDetl.pickedAnfme}}</view>
            <view>拣料数量:{{orderDetl.count}}</view>
         </view>
         <view class="list-right" @click="addItem(index)">
@@ -35,7 +36,7 @@
      </view>
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" type="primary" @click="confirmPick('warn')">确认拣料</button>
         <button size="mini" type="primary" @click="confirmPick('warn')" :disabled="pickAgaDis">确认拣料</button>
      </view>
   </view>
</template>
@@ -51,7 +52,9 @@
            count: 0,
            maxCount: 0,
            wrkNo: '',
            locNo: ''
            locNo: '',
            pickedAnfme: 0,
            pickAgaDis: false
         }
      },
      onShow() {
@@ -62,7 +65,7 @@
         const eventChannel = this.getOpenerEventChannel();
         // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
         eventChannel.on('item', function(data) {
            console.log(data);
            // console.log(data);
            _this.pickList = data.wrkDetls
            _this.wrkNo = data.wrkDetls[0].wrkNo
            _this.locNo = data.item.sourceLocNo
@@ -83,8 +86,10 @@
               method: 'GET',
               success(res) {
                  res = res.data
                  console.log(res);
                  // console.log(res);
                  if (res.code === 200) {
                     _this.chosed(_this.pickList,res.data.records)
                     return
                     let enbleList = [], isfl;
                     for (let k of res.data.records) {
                        isfl = false;
@@ -116,19 +121,61 @@
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
               },
            })
         },
         // 已选拣料列表
         orderCar() {
         chosed(wrkDetls,locDetls) {
            console.log(wrkDetls,locDetls);
            let isfl = false, enbleList = []
            for (let locDetl of locDetls) {
               locDetl['color'] = 'order-sts-start'
               locDetl['pickedAnfme'] = 0
               locDetl['count'] = 0
               for (let wrkDetl of wrkDetls) {
                  console.log(wrkDetl);
                  if (wrkDetl.threeCode.replace(/\s/g, "") == locDetl.threeCode.replace(/\s/g, "") && wrkDetl.matnr == locDetl.matnr) {
                     console.log(wrkDetl);
                     locDetl['pickedAnfme'] = wrkDetl.anfme
                     if (locDetl.stock == -1) {
                        locDetl.stock = 0
                     }
                     if (wrkDetl.anfme < locDetl.anfme) {
                        locDetl['color'] = 'order-sts-working'
                        locDetl['pickedAnfme'] = wrkDetl.anfme
                        locDetl['count'] = 0
                     } else {
                        locDetl['color'] = 'order-sts-end'
                     }
                     break
                  }
               }
            }
            this.dataList = locDetls
         },
         // 添加入库商品至 待组托列表
         addItem(index) {
            // 判断添加的商品是否和已经添加的重复
            let dataList = this.dataList
            this.index = index
            this.maxCount = this.dataList[index].stock
            let orderCount = this.dataList[index].stock
            let locCount = this.dataList[index].anfme
            let pickedAnfme = this.dataList[index].pickedAnfme
            // 预计最大要出库
            let ftCount = pickedAnfme + orderCount
            if (orderCount > locCount) {
               this.maxCount = locCount - pickedAnfme
            } else {
               if (ftCount > locCount) {
                  this.maxCount = locCount -pickedAnfme
               } else {
                  this.maxCount = orderCount
               }
            }
            this.$refs.addItem.open()
         },
         addClose() {
@@ -144,6 +191,7 @@
         },
         // 确认再次拣料
         confirmPick() {
            this.pickAgaDis = true
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/agvMobile/pick/again/auth`,
@@ -155,8 +203,8 @@
               }),
               method: 'POST',
               success(res) {
                  _this.pickAgaDis = false
                  res = res.data
                  console.log(res);
                  if  (res.code === 200) {
                     _this.getOpenerEventChannel().emit('acceptDataFromOpenedPage', {data: 1});
                     setTimeout(()=>{
@@ -170,6 +218,9 @@
                  }
               }
            })
         },
         fail(res) {
            _this.pickAgaDis = false
         }
      }
   }