647556386
2025-10-18 d01658c63cd541fe4ea5cec5c4bd7f23b9408cdb
¼ª°²PDA/pages/stash/boxing.vue
@@ -18,24 +18,11 @@
                     <uni-easyinput type="text" :placeholder="Testplaceholder" ref='midInput'
                        v-model="Initiallife" />
                  </uni-forms-item>
                  <!-- <uni-forms-item>
                     <checkbox checked="check">是否满盘</checkbox>
                  </uni-forms-item> -->
                  <uni-forms-item>
                     <button @click="submit" type="primary" size="default" style="margin-top: 2%;">组盘</button>
                  </uni-forms-item>
               </uni-forms>
               <uni-list>
                  <!-- <uni-list-item direction="column" v-for="item in matTotal" :key="item.matCode">
                     <template v-slot:body>
                        <view class="uni-list-box">
                           <view class="uni-content">
                              <view class="uni-title-sub uni-ellipsis-2">物料编码:{{item.matCode}}</view>
                              <view class="uni-title-sub uni-ellipsis-2">数量:{{item.matQuantity}}</view>
                           </view>
                        </view>
                     </template>
                  </uni-list-item> -->
                  <uni-list-item direction="column" v-for="(item,index) in matInfos" :key="index">
                     <template v-slot:body>
                        <view class="uni-list-box">
@@ -46,7 +33,17 @@
                              <view class="uni-title-sub uni-ellipsis-2">采购单号:{{item.purchaseOrderNo}}</view>
                              <view class="uni-note">物料编码:{{item.materielCode}}</view>
                              <view class="uni-note">批次号:{{item.lotNo}}</view>
                              <view class="uni-note">数量:{{item.quantity}}</view>
                              <!-- æ•°é‡ç¼–辑框 -->
                              <view class="uni-note" style="display: flex; align-items: center; gap: 10rpx;">
                                 æ•°é‡ï¼š
                                 <uni-easyinput
                                    type="number"
                                    min="1"
                                    style="width: 150rpx; display: inline-block;"
                                    v-model="item.editableQuantity"
                                    @input="handleQuantityChange(item)"
                                 />
                              </view>
                              <view class="uni-note">生产日期:{{item.productionDate}}</view>
                              <view class="uni-note">有效期:{{item.effectiveDate}}</view>
                           </view>
@@ -122,7 +119,17 @@
                              <view class="uni-title-sub uni-ellipsis-2">采购单号:{{item.purchaseOrderNo}}</view>
                              <view class="uni-note">物料编码:{{item.materielCode}}</view>
                              <view class="uni-note">批次号:{{item.lotNo}}</view>
                              <view class="uni-note">数量:{{item.quantity}}</view>
                              <!-- æ•°é‡ç¼–辑框 -->
                              <view class="uni-note" style="display: flex; align-items: center; gap: 10rpx;">
                                 æ•°é‡ï¼š
                                 <uni-easyinput
                                    type="number"
                                    min="1"
                                    style="width: 150rpx; display: inline-block;"
                                    v-model="item.editableQuantity"
                                    @input="handlePkQuantityChange(item)"
                                 />
                              </view>
                              <view class="uni-note">生产日期:{{item.productionDate}}</view>
                              <view class="uni-note">有效期:{{item.effectiveDate}}</view>
                           </view>
@@ -205,10 +212,17 @@
         this.getData();
      },
      methods: {
         // voiceSpeech(src) {
         //    innerAudioContext.src = src; // '../../static/success.mp3';
         //    innerAudioContext.play();
         // },
         // ç»„盘页数量变更校验
         handleQuantityChange(item) {
            // ç¡®ä¿æ•°é‡ä¸ºæ­£æ•´æ•°
            item.editableQuantity = item.editableQuantity ? Math.max(1, parseInt(item.editableQuantity)) : 1;
         },
         // å…¥å¹³åº“页数量变更校验
         handlePkQuantityChange(item) {
            item.editableQuantity = item.editableQuantity ? Math.max(1, parseInt(item.editableQuantity)) : 1;
         },
         //wms入平库
         pksubmit() {
            if (this.pkmatInfos.length == 0) {
@@ -218,9 +232,14 @@
               })
               return;
            }
            this.$u.post('/api/InboundOrder/WMSInPinKu?warehouseId=' + this.warehouseId, this
               .pksns).then(res => {
               debugger
            // å‡†å¤‡æäº¤æ•°æ®ï¼ŒåŒ…含编辑后的数量
            const submitData = this.pkmatInfos.map(item => ({
               serialNumber: item.serialNumber,
               quantity: item.editableQuantity
            }));
            this.$u.post('/api/InboundOrder/WMSInPinKu?warehouseId=' + this.warehouseId, submitData).then(res => {
               if (res.status) {
                  this.$refs.uToast.show({
                     title: "入库成功",
@@ -237,45 +256,49 @@
               }
            })
         },
         pksnInput() {
            this.$nextTick(() => {
               if (this.pkmaterSn != "") {
                  this.focus = false;
                  var matSn = this.pkmaterSn;
               if (!this.pkmaterSn) return;
               // å»¶è¿Ÿ100ms确保扫码完成
                  setTimeout(() => {
                     this.pkmaterSn = "";
                  }, 10);
                  this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
                     if (res.status) {
                        this.pksns.push(res.data.serialNumber);
                        this.pkmatInfos.push(res.data);
                        if (!res.status) {
                  this.focus = false;
                  // æ ¡éªŒå†…箱码完整性
                  const requiredFields = ['M:', 'BS:', 'DM:', 'DE:', 'Q:', 'PO:', 'DN:'];
                  const hasAllFields = requiredFields.every(field => this.pkmaterSn.includes(field));
                  if (!hasAllFields) {
                           this.$refs.uToast.show({
                              title: res.message,
                        title: "内箱码不完整,请重新扫描",
                              type: "error"
                           })
                           // setTimeout(() => {
                           //    this.voiceSpeech('../../static/fail.mp3');
                           // }, 100);
                     });
                     this.pkmaterSn = "";
                           return;
                        }
                        // setTimeout(() => {
                        //    this.voiceSpeech('../../static/success.mp3');
                        // }, 100);
                        return;
                  const matSn = this.pkmaterSn;
                  this.pkmaterSn = "";
                  this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
                     if (res.status) {
                        // æ–°å¢žå¯ç¼–辑数量字段
                        const tempData = res.data;
                        tempData.editableQuantity = tempData.quantity;
                        this.pksns.push(tempData.serialNumber);
                        this.pkmatInfos.push(tempData);
                     } else {
                        this.$refs.uToast.show({
                           title: res.message,
                           type: "error"
                        })
                        // setTimeout(() => {
                        //    this.voiceSpeech('../../static/fail.mp3');
                        // }, 100);
                     }
                  })
               }
               }, 100);
            })
         },
         //解盘
         releasebox() {
            if (this.value.length == 0) {
@@ -315,6 +338,7 @@
               }
            })
         },
         releaseboxInput() {
            this.$nextTick(() => {
               if (this.value.length == 0) {
@@ -361,7 +385,6 @@
         },
         updateFocus() {
            debugger
            this.$nextTick(() => {
               this.materSn = '';
               if (!this.focus) {
@@ -369,13 +392,14 @@
               }
            });
         },
         barcodeFocus() {
            debugger
            this.barcode = '';
            if (this.focus) {
               this.focus = false;
            }
         },
         getData() {
            var postData = {
               MainData: {
@@ -391,6 +415,7 @@
               }
            })
         },
         onClickItem(e) {
            this.focus = false;
            this.addressFocus = false;
@@ -401,77 +426,75 @@
               }
            }
         },
         barcodeInput() {
            this.$nextTick(function(x) {
               if (this.barcode.length > 0) {
                  // if (this.barcode.substring(0, 1) == 'A' || this.barcode.substring(0, 2) == 'TP') {
                  this.focus = true;
                  // } else {
                  //    this.$refs.uToast.show({
                  //       title: "扫码错误,请扫描托盘码",
                  //       type: "error"
                  //    })
                  // }
               }
            })
         },
         snInput() {
            this.$nextTick(() => {
               if (!this.materSn) return;
               // å»¶è¿Ÿ100ms确保扫码完成
               setTimeout(() => {
                  this.focus = false;
                  // ä»“库11的特殊处理
                  if(this.warehouseId==11){
                     this.materSn=this.materSn.replace(/,SC.*/, '');
                  }
                  // æ ¡éªŒå†…箱码完整性
                  const requiredFields = ['M:', 'BS:', 'DM:', 'DE:', 'Q:', 'PO:', 'DN:'];
                  const hasAllFields = requiredFields.every(field => this.materSn.includes(field));
                  if (!hasAllFields) {
                     this.$refs.uToast.show({
                        title: "内箱码不完整,请重新扫描",
                        type: "error"
                     });
                     this.materSn = "";
                     return;
                  }
                  // ä»“库特定逻辑
               if (this.warehouseId == 6 || this.warehouseId == 2 || this.warehouseId == 3) {
                  if (this.sns.length > 0) {
                     this.sns = [];
                  }
               }
               if (this.materSn != "") {
                  this.focus = false;
                  if(this.warehouseId==11){
                     this.materSn=this.materSn.replace(/,SC.*/, '');
                  }
                  if (this.materSn.split(',').length != 6) {
                  const matSn = this.materSn;
                     this.materSn = "";
                     return;
                  }
                  var matSn = this.materSn;
                  //setTimeout(() => {
                  this.materSn = "";
                  //}, 10);
                  this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
                     this.Testcheck = false;
                     if (res.status) {
                        this.sns.push(res.data.serialNumber);
                        if (this.warehouseId == 6 || this.warehouseId == 2 || this.warehouseId ==
                           3) {
                        // æ–°å¢žå¯ç¼–辑数量字段
                        const tempData = res.data;
                        tempData.editableQuantity = tempData.quantity;
                        this.sns.push(tempData.serialNumber);
                        if (this.warehouseId == 6 || this.warehouseId == 2 || this.warehouseId == 3) {
                           if (this.matInfos.length > 0) {
                              this.matInfos = [];
                           }
                        }
                        this.matInfos.push(res.data);
                        if (!res.status) {
                           this.$refs.uToast.show({
                              title: res.message,
                              type: "error"
                           })
                           // setTimeout(() => {
                           //    this.voiceSpeech('../../static/fail.mp3');
                           // }, 100);
                           return;
                        }
                        // setTimeout(() => {
                        //    this.voiceSpeech('../../static/success.mp3');
                        // }, 100);
                        this.matInfos.push(tempData);
                     } else {
                        this.$refs.uToast.show({
                           title: res.message,
                           type: "error"
                        })
                        // setTimeout(() => {
                        //    this.voiceSpeech('../../static/fail.mp3');
                        // }, 100);
                     }
                  })
               }
               }, 100);
            })
         },
         inbound() {
            if (this.inboundBarcode == "") {
               this.$refs.uToast.show({
@@ -521,6 +544,7 @@
               })
            })
         },
         inputChangebarcode() {
            this.addressFocus = false;
            this.$nextTick(function(x) {
@@ -537,18 +561,16 @@
                     }
                  };
                  this.$u.post('/api/StockInfo/StockQueryData', postData).then(res => {
                     // this.stockInfo = [];
                     this.stockInfoDetail = [];
                     if (res.status) {
                        // this.stockInfo = res.data,
                        this.stockInfoDetail = res.data.details
                        //获取总数量
                        this.Summmary = 0;
                        this.stockInfoDetail.forEach(item => {
                           this.Summmary += item.stockQuantity;
                        });
                     } else {
                        this.$refs.uToast.show({
                           // title: "未找到托盘信息",
                           title: res.message,
                           type: "error"
                        })
@@ -557,10 +579,17 @@
               }
            })
         },
         deleteList(res) {
            this.matInfos.splice(res, 1);
            this.sns.splice(res, 1);
         },
         pkdeleteList(res) {
            this.pkmatInfos.splice(res, 1);
            this.pksns.splice(res, 1);
         },
         submit() {
            if (this.barcode == "") {
               this.$refs.uToast.show({
@@ -593,16 +622,27 @@
                  return;
               }
            }
            if (this.warehouseId == 2) { //油墨仓库区ID
               this.sn = this.sns[0];
               for (var i = 0; i < this.Initiallife - 1; i++) {
                  this.sns.push(this.sn);
               }
            }
            let url = 'palletCode=' + this.barcode + '&initiallife=' + this.Initiallife + '&warehouseId=' + this
               .warehouseId;
            this.$u.post('/api/InboundOrder/ManualMaterielGroup?' + url, this.sns).then(res => {
            // å‡†å¤‡æäº¤æ•°æ®ï¼ŒåŒ…含编辑后的数量
            const submitSns = this.matInfos.map(item => ({
               serialNumber: item.serialNumber,
               quantity: item.editableQuantity
            }));
            if (this.warehouseId == 2) { //油墨仓库区ID
               // ç‰¹æ®Šå¤„理保持不变,但使用编辑后的数量
               const firstItem = this.matInfos[0];
               for (var i = 0; i < firstItem.editableQuantity - 1; i++) {
                  submitSns.push({
                     serialNumber: firstItem.serialNumber,
                     quantity: 1
                  });
               }
            }
            let url = 'palletCode=' + this.barcode + '&initiallife=' + this.Initiallife + '&warehouseId=' + this.warehouseId;
            this.$u.post('/api/InboundOrder/ManualMaterielGroup?' + url, submitSns).then(res => {
               this.Testcheck = false;
               if (res.status) {
                  this.$refs.uToast.show({