1
wankeda
2026-03-31 36edb698388e79272608312820d869ab6f7cb304
¼ª°²PDA/pages/stash/CPraworderboxing.vue
@@ -12,7 +12,10 @@
                     <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="!focus"
                        v-model="barcode" @confirm="barcodeInput" />
                  </uni-forms-item>
                  <uni-forms-item label="内箱标签:">
                     <uni-easyinput type="text" placeholder="请扫描箱号(如BOX202510160019)" ref='midInput' :focus="focus"
                        v-model="materSn" @confirm="snInput" />
                  </uni-forms-item>
                  <uni-forms-item :label="Testlabel" v-if="Test">
                     <uni-easyinput type="text" :placeholder="Testplaceholder" ref='midInput'
@@ -84,8 +87,8 @@
            <view class="itemstyle">
               <uni-forms label-width="180">
                  <uni-forms-item label="内箱标签:">
                     <uni-easyinput type="text" placeholder="请扫描箱号(如BOX202510160019)" ref='midInput'
                        :focus="!pkfocus" v-model="pkmaterSn" @confirm="pksnInput" />
                     <uni-easyinput type="text" placeholder="请扫描箱号(如BOX202510160019)" ref='midInput' :focus="!pkfocus"
                        v-model="pkmaterSn" @confirm="pksnInput" />
                  </uni-forms-item>
                  <uni-forms-item>
@@ -184,7 +187,16 @@
         this.getData();
      },
      methods: {
         // ç»„盘页数量编辑校验
         handleQuantityChange(item) {
            item.quantity = item.quantity ? Math.max(1, parseInt(item.quantity)) : 1;
         },
         // å…¥å¹³åº“页数量编辑校验
         handlePkQuantityChange(item) {
            item.quantity = item.quantity ? Math.max(1, parseInt(item.quantity)) : 1;
         },
         updateFocus() {
            this.$nextTick(() => {
               this.materSn = '';
@@ -233,6 +245,96 @@
               if (this.barcode.length > 0) {
                  this.focus = true;
               }
            })
         },
         // ç»„盘页箱号扫描
         snInput() {
            this.$nextTick(() => {
               if (!this.materSn) return;
               // å»¶è¿Ÿ100ms确保扫码完成
               setTimeout(() => {
                  this.focus = false;
                  let boxNumber = this.materSn.trim();
                  // æ ¡éªŒæ˜¯å¦å·²æ‰«æè¿‡
                  const isAlreadyScanned = this.sns.some(sn => sn === boxNumber);
                  if (isAlreadyScanned) {
                     this.$refs.uToast.show({
                        title: "该箱号已扫描,请勿重复扫描",
                        type: "warning"
                     });
                     this.materSn = "";
                     return;
                  }
                  // ç®€å•校验箱号格式(以BOX开头)
                  if (!boxNumber.startsWith('BOX')) {
                     this.$refs.uToast.show({
                        title: "箱号格式错误,应以BOX开头",
                        type: "error"
                     });
                     this.materSn = "";
                     return;
                  }
                  // æ·»åŠ ç®±å·åˆ°åˆ—è¡¨
                  const boxData = {
                     boxNumber: boxNumber,
                     quantity: 1, // é»˜è®¤æ•°é‡ä¸º1
                     serialNumber: boxNumber // ç®±å·ä½œä¸ºåºåˆ—号
                  };
                  this.sns.push(boxNumber);
                  this.matInfos.push(boxData);
                  this.$refs.uToast.show({
                     title: "箱号添加成功",
                     type: "success"
                  });
                  this.materSn = "";
               }, 100);
            })
         },
         // å…¥å¹³åº“页箱号扫描
         pksnInput() {
            this.$nextTick(() => {
               if (!this.pkmaterSn) return;
               // å»¶è¿Ÿ100ms确保扫码完成
               setTimeout(() => {
                  let boxNumber = this.pkmaterSn.trim();
                  // ç®€å•校验箱号格式(以BOX开头)
                  if (!boxNumber.startsWith('BOX')) {
                     this.$refs.uToast.show({
                        title: "箱号格式错误,应以BOX开头",
                        type: "error"
                     });
                     this.pkmaterSn = "";
                     return;
                  }
                  // æ·»åŠ ç®±å·åˆ°åˆ—è¡¨
                  const boxData = {
                     boxNumber: boxNumber,
                     quantity: 1, // é»˜è®¤æ•°é‡ä¸º1
                     serialNumber: boxNumber // ç®±å·ä½œä¸ºåºåˆ—号
                  };
                  this.pksns.push(boxNumber);
                  this.pkmatInfos.push(boxData);
                  this.$refs.uToast.show({
                     title: "箱号添加成功",
                     type: "success"
                  });
                  this.pkmaterSn = "";
               }, 100);
            })
         },
@@ -312,6 +414,47 @@
            }
         },
         resetInPk() {
            this.pkmaterSn = "";
            this.pkfocus = false;
            this.pkmatInfos = [];
            this.pksns = [];
         },
         pksubmit() {
            if (this.pkmatInfos.length == 0) {
               this.$refs.uToast.show({
                  title: "请扫描箱号",
                  type: 'error'
               })
               return;
            }
            // ä½¿ç”¨ç®±å·æ•°æ®æäº¤
            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: "入库成功",
                        type: "success"
                     })
                     this.pkfocus = false;
                     this.pkmatInfos = [];
                     this.pksns = [];
                  } else {
                     this.$refs.uToast.show({
                        title: res.message,
                        type: "error"
                     })
                  }
               })
         },
         submit() {
            if (this.barcode == "") {
@@ -321,14 +464,55 @@
               })
               return;
            }
            if (this.matInfos.length == 0) {
               this.$refs.uToast.show({
                  title: "请扫描箱号",
                  type: 'error'
               })
               return;
            }
            if (this.Test) {
               if (!this.Testcheck) {
                  this.Testcheck = true;
                  if (this.warehouseId == 2) {
                     this.$refs.uToast.show({
                        title: "请确认数量",
                        type: 'error'
                     })
                  } else if (this.warehouseId == 6) {
                     this.$refs.uToast.show({
                        title: "请确认初始寿命",
                        type: 'error'
                     })
                  }
                  return;
               }
            }
            // ä½¿ç”¨ç®±å·æ•°æ®æäº¤
            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++) {
                  submitSns.push({
                     ...firstItem
                  });
               }
            }
            this.$u.post('/api/InboundOrder/CPMaterielGroup', {
               MainData: {
                  "palletCode": this.barcode,
                  "orderNo": this.orderNo,
                  "initiallife": this.Initiallife,
                  "warehouseId": this.warehouseId
               },
               DelKeys: submitSns
            }).then(res => {
               this.Testcheck = false;
               if (res.status) {