647556386
2025-10-18 d01658c63cd541fe4ea5cec5c4bd7f23b9408cdb
¼ª°²PDA/pages/stash/raworderboxing.vue
@@ -22,9 +22,6 @@
                        v-model="Initiallife" />
                  </uni-forms-item>
                  <!-- <uni-forms-item>
                     <checkbox checked="check">是否满盘</checkbox>
                  </uni-forms-item> -->
                  <uni-forms-item>
                     <view style="display: flex;justify-content: space-around;margin-top: 2%;">
                        <button @click="reset" type="default" size="default"
@@ -34,16 +31,6 @@
                  </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">
@@ -54,7 +41,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>
                              <!-- ç›´æŽ¥ç¼–辑Q值对应的quantity字段 -->
                              <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.quantity"
                                    @input="handleQuantityChange(item)"
                                 />
                              </view>
                              <view class="uni-note">生产日期:{{item.productionDate}}</view>
                              <view class="uni-note">有效期:{{item.effectiveDate}}</view>
                              <view class="uni-note">交货单号:{{item.deliveryNote}}</view>
@@ -92,8 +89,6 @@
                              <view style="font-size: 18px;">单据号:{{orderNo}}</view>
                              <view style="font-size: 18px;">物料编码:{{item.materielCode}}</view>
                              <view>物料名称:{{item.materielName}}</view>
                              <!-- <view>物料规格:{{item.materielSpec}}</view> -->
                              <!-- <view style="font-size: 18px;">物料名称:{{item.matName}}</view> -->
                              <view style="font-size: 18px;">数量:{{item.orderQuantity}}</view>
                              <view style="font-size: 18px;">组盘数量:{{item.receiptQuantity}}</view>
                           </view>
@@ -132,7 +127,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>
                              <!-- ç›´æŽ¥ç¼–辑Q值对应的quantity字段 -->
                              <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.quantity"
                                    @input="handlePkQuantityChange(item)"
                                 />
                              </view>
                              <view class="uni-note">生产日期:{{item.productionDate}}</view>
                              <view class="uni-note">有效期:{{item.effectiveDate}}</view>
                              <view class="uni-note">交货单号:{{item.deliveryNote}}</view>
@@ -153,7 +158,7 @@
   export default {
      data() {
         return {
            items: ['组盘', '入库', '单据信息'], //, '解盘'
            items: ['组盘', '入库', '单据信息'],
            current: 0,
            matTotal: [],
            matInfos: [],
@@ -212,12 +217,17 @@
         this.getData();
      },
      methods: {
         // voiceSpeech(src) {
         //    innerAudioContext.src = src; // '../../static/success.mp3';
         //    innerAudioContext.play();
         // },
         // ç»„盘页数量编辑校验(直接修改原生quantity字段)
         handleQuantityChange(item) {
            item.quantity = item.quantity ? Math.max(1, parseInt(item.quantity)) : 1;
         },
         // å…¥å¹³åº“页数量编辑校验(直接修改原生quantity字段)
         handlePkQuantityChange(item) {
            item.quantity = item.quantity ? Math.max(1, parseInt(item.quantity)) : 1;
         },
         updateFocus() {
            debugger
            this.$nextTick(() => {
               this.materSn = '';
               if (!this.focus) {
@@ -225,13 +235,14 @@
               }
            });
         },
         barcodeFocus() {
            debugger
            this.barcode = '';
            if (this.focus) {
               this.focus = false;
            }
         },
         getData() {
            var postData = {
               MainData: {
@@ -247,6 +258,7 @@
               }
            })
         },
         onClickItem(e) {
            this.focus = false;
            this.addressFocus = false;
@@ -257,108 +269,127 @@
               }
            }
         },
         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"
                  //    })
                  // }
               }
            })
         },
         // ç»„盘页内箱码解析(直接操作原生quantity字段)
         snInput() {
            this.$nextTick(() => {
               if (this.materSn != "") {
               if (!this.materSn) return;
               // å»¶è¿Ÿ100ms确保扫码完成
               setTimeout(() => {
                  this.focus = false;
                  var matSn = this.materSn;
                  let matSn = this.materSn.trim();
                  // ä»“库11的特殊处理
                  if (this.warehouseId == 11) {
                     matSn = matSn.replace(/,SC.*/, '');
                  }
                  //查询matSn是否存在字符
                  if(matSn.indexOf("PO")>0){
                  // æ ¡éªŒå†…箱码完整性
                  const requiredFields = ['M:', 'BS:', 'DM:', 'DE:', 'Q:', 'PO:', 'DN:'];
                  const hasAllFields = requiredFields.every(field => matSn.includes(field));
                  if (!hasAllFields) {
                     this.$refs.uToast.show({
                        title: "内箱码不完整,请重新扫描",
                        type: "error"
                     });
                     this.materSn = "";
                     return;
                  }
                  // æ ¡éªŒPO字段存在性
                  if (matSn.indexOf("PO") <= 0) {
                     this.$refs.uToast.show({
                        title: "内箱码格式错误(无PO标识)",
                        type: "error"
                     });
                     this.materSn = "";
                     return;
                  }
                  // è§£æžå†…箱码(直接使用返回的quantity作为Q值)
                     this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
                        this.Testcheck = false;
                        if (res.status) {
                           this.sns.push(res.data.serialNumber);
                           this.matInfos.push(res.data);
                           if (res.message) {
                              this.$refs.uToast.show({
                                 title: res.message,
                                 type: "error"
                              })
                              // setTimeout(() => {
                              //    this.voiceSpeech('../../static/fail.mp3');
                              // }, 100);
                              return;
                              type: "warning"
                           });
                           }
                           // setTimeout(() => {
                           //    this.voiceSpeech('../../static/success.mp3');
                           // }, 100);
                        } else {
                           this.$refs.uToast.show({
                              title: res.message,
                              type: "error"
                           })
                           // setTimeout(() => {
                           //    this.voiceSpeech('../../static/fail.mp3');
                           // }, 100);
                        });
                        }
                     })
                  }
                  setTimeout(() => {
                  });
                     this.materSn = "";
                  }, 100);
               }
               }, 1000);
            })
         },
         // å…¥å¹³åº“页内箱码解析(直接操作原生quantity字段)
         pksnInput() {
            this.$nextTick(() => {
               if (this.pkmaterSn != "") {
               if (!this.pkmaterSn) return;
                  
                  var matSn = this.pkmaterSn;
               // å»¶è¿Ÿ100ms确保扫码完成
               setTimeout(() => {
                  let matSn = this.pkmaterSn.trim();
                  
                  if(matSn.indexOf("PO")>0){
                  // æ ¡éªŒå†…箱码完整性
                  const requiredFields = ['M:', 'BS:', 'DM:', 'DE:', 'Q:', 'PO:', 'DN:'];
                  const hasAllFields = requiredFields.every(field => matSn.includes(field));
                  if (!hasAllFields) {
                     this.$refs.uToast.show({
                        title: "内箱码不完整,请重新扫描",
                        type: "error"
                     });
                     this.pkmaterSn = "";
                     return;
                  }
                  // æ ¡éªŒPO字段存在性
                  if (matSn.indexOf("PO") <= 0) {
                     this.$refs.uToast.show({
                        title: "内箱码格式错误(无PO标识)",
                        type: "error"
                     });
                     this.pkmaterSn = "";
                     return;
                  }
                  // è§£æžå†…箱码(直接使用返回的quantity作为Q值)
                     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.$refs.uToast.show({
                                 title: res.message,
                                 type: "error"
                              })
                              // setTimeout(() => {
                              //    this.voiceSpeech('../../static/fail.mp3');
                              // }, 100);
                              return;
                           }
                           // setTimeout(() => {
                           //    this.voiceSpeech('../../static/success.mp3');
                           // }, 100);
                           return;
                        } else {
                           this.$refs.uToast.show({
                              title: res.message,
                              type: "error"
                           })
                           // setTimeout(() => {
                           //    this.voiceSpeech('../../static/fail.mp3');
                           // }, 100);
                        });
                        }
                     })
                  }
                  setTimeout(() => {
                  });
                     this.pkmaterSn = "";
                  }, 100);
               }
            })
         },
         inbound() {
            if (this.inboundBarcode == "") {
               this.$refs.uToast.show({
@@ -405,6 +436,7 @@
               })
            })
         },
         inputChangebarcode() {
            this.addressFocus = false;
            this.$nextTick(function(x) {
@@ -413,29 +445,34 @@
               }
            })
         },
         deleteList(res) {
            this.matInfos.splice(res, 1);
            this.sns.splice(res, 1);
         },
         pkdeleteList(res) {
            this.pkmatInfos.splice(res, 1);
            this.pksns.splice(res, 1);
         },
         reset() {
            this.barcode = "";
            this.matInfos = [];
            this.sns = [];
            this.materSn = "";
            if (this.warehouseId = !6) {
            if (this.warehouseId != 6) {
               this.Initiallife = 0;
            }
         },
         resetInPk() {
            this.pkmaterSn = "";
            this.pkfocus = false;
            this.pkmatInfos = [];
            this.pksns = [];
         },
         pksubmit() {
            if (this.pkmatInfos.length == 0) {
               this.$refs.uToast.show({
@@ -444,8 +481,15 @@
               })
               return;
            }
            this.$u.post('/api/InboundOrder/InPinKu?warehouseId=' + this.warehouseId + "&orderNo=" + this.orderNo, this
               .pksns).then(res => {
            // ç›´æŽ¥ä½¿ç”¨ä¿®æ”¹åŽçš„quantity(对应Q值)提交
            const submitData = this.pkmatInfos.map(item => ({
               serialNumber: item.serialNumber,
               quantity: item.quantity
            }));
            this.$u.post('/api/InboundOrder/InPinKu?warehouseId=' + this.warehouseId + "&orderNo=" + this.orderNo, submitData)
               .then(res => {
               if (res.status) {
                  this.$refs.uToast.show({
                     title: "入库成功",
@@ -462,6 +506,7 @@
               }
            })
         },
         submit() {
            if (this.barcode == "") {
               this.$refs.uToast.show({
@@ -494,21 +539,29 @@
                  return;
               }
            }
            if (this.warehouseId == 2) { //油墨仓库区ID
               this.sn = this.sns[0];
            // ç›´æŽ¥ä½¿ç”¨ä¿®æ”¹åŽçš„quantity(对应Q值)提交
            let submitSns = this.matInfos.map(item => ({
               serialNumber: item.serialNumber,
               quantity: item.quantity
            }));
            // æ²¹å¢¨ä»“库特殊处理
            if (this.warehouseId == 2) {
               const firstItem = submitSns[0];
               for (var i = 0; i < this.Initiallife - 1; i++) {
                  this.sns.push(this.sn);
                  submitSns.push({...firstItem});
               }
            }
            this.$u.post('/api/InboundOrder/MaterielGroup', {
               MainData: {
                  "palletCode": this.barcode,
                  "orderNo": this.orderNo,
                  "initiallife": this.Initiallife,
                  // "isFull": this.check
                  "warehouseId": this.warehouseId
               },
               DelKeys: this.sns
               DelKeys: submitSns
            }).then(res => {
               this.Testcheck = false;
               if (res.status) {
@@ -521,7 +574,7 @@
                  this.matInfos = [];
                  this.sns = [];
                  this.matTotal = [];
                  if (this.warehouseId != 6) { //测试架仓库区ID
                  if (this.warehouseId != 6) {
                     this.Initiallife = "";
                  }
               } else {
@@ -558,3 +611,4 @@
      width: 90%;
   }
</style>