helongyang
13 小时以前 dc06f58d8ed537555fd529551180f43a0586ec3f
´úÂë¹ÜÀí/»´°²PDA/pages/stash/receiveorderoutbound.vue
@@ -9,7 +9,7 @@
               <!-- <uni-forms-item label="单据类型:生产领料单" style="margin-top: -20px;"></uni-forms-item> -->
               <uni-forms-item label="内箱码:" style="margin-top: -20px;">
                  <uni-easyinput type="text" placeholder="请扫描内箱码" ref='midInput' :focus="!focus"
                     v-model="innerCode" @input="innercodeInput" />
                     v-model="innerCode" @confirm="innercodeInput" />
               </uni-forms-item>
               <uni-forms-item :label="PurchaseOrderNo" style="margin-top: -20px;"></uni-forms-item>
               <uni-forms-item :label="matCode" style="margin-top: -20px;"></uni-forms-item>
@@ -22,10 +22,19 @@
               </uni-forms-item>
            </uni-forms>
            <uni-forms-item>
               <button @click="submit" type="primary" size="default" style="margin-top: 2%;">确认收货</button>
               <view class="uni-flex uni-row" style="justify-content: space-between;margin-top: 2%;height: 45px;width: 520rpx;margin: 0px auto;">
                  <view>
                     <button @click="resetReceive" type="default" size="default" style="width: 200rpx;border: 1rpx solid #007aff;color: #007aff;">重置</button>
                  </view>
                  <view>
                     <button @click="submit" type="primary" size="default" style="width: 220rpx;">确认收货</button>
                  </view>
               </view>
            </uni-forms-item>
            <uni-forms-item>
               <button @click="submit1" type="primary" size="default" style="margin-top: 2%;">完成收货</button>
               <view style="margin-top: 2%;height: 45px;width: 520rpx;margin: 0px auto;">
                  <button @click="submit1" type="primary" size="default" style="margin-top: 2%;backgroundColor:#1AAD19;borderColor:#1AAD19">完成收货</button>
               </view>
            </uni-forms-item>
         </view>
      </view>
@@ -49,6 +58,8 @@
                           <view>收货单号:{{orderNo}}</view>
                           <view>采购单号:{{item.purchaseOrderNo}}</view>
                           <view>物料编号:{{item.materielCode}}</view>
                           <view>物料名称:{{item.materielName}}</view>
                           <view>物料规格:{{item.materielSpec}}</view>
                           <view>批次号:{{item.lotNo}}</view>
                           <view>收货数量:{{item.receivedQuantity}}</view>
                           <view>是否质检:{{item.ifInspection==1?"是":"否"}}</view>
@@ -166,6 +177,7 @@
   import {
      config
   } from '../../common/config';
import message from '../../tuniao-ui/libs/function/message';
   const innerAudioContext = uni.createInnerAudioContext();
   export default {
      data() {
@@ -219,7 +231,9 @@
            endTypeRange: [],
            sns: "",
            receiveOrderId: 0,
            warehouseId:""
            warehouseId:"",
            toastQueue: [], // æç¤ºé˜Ÿåˆ—
            isShowingToast: false
         }
      },
@@ -249,16 +263,52 @@
         }
      },
      methods: {
         showToast(options) {
                     this.toastQueue.push(options);
                     this.processToastQueue();
                 },
                 // å¤„理提示队列
                 processToastQueue() {
                     // å¦‚果正在显示提示或队列为空,则不执行
                     if (this.isShowingToast || this.toastQueue.length === 0) return;
                     this.isShowingToast = true;
                     const toastOptions = this.toastQueue.shift();
                     // æ˜¾ç¤ºæç¤º
                     this.$refs.uToast.show({
                         ...toastOptions,
                         complete: () => {
                             // æç¤ºå…³é—­åŽå¤„理下一个
                             this.isShowingToast = false;
                             this.processToastQueue();
                         }
                     });
                 },
         inputDialogToggle(itemCode) {
            this.itemCode = itemCode;
            this.$refs.inputDialog.open()
         },
         voiceSpeech(src) {
            innerAudioContext.src = src; // '../../static/success.mp3';
            innerAudioContext.play();
         },
         // voiceSpeech(src) {
         //    innerAudioContext.src = src; // '../../static/success.mp3';
         //    innerAudioContext.play();
         // },
         search() {
            this.getData();
         },
         resetReceive(){
            this.PurchaseOrderNo="采购单号:";
            this.matCode="物料编码:";
            this.LotNo="物料批次:";
            this.orderQty="订单数量:";
            this.ProductionDate="生产日期:";
            this.EffectiveDate="有效日期:";
            this.Quantity="";
            setTimeout(() => {
               this.innerCode="";
               this.focus=false;
            }, 10);
         },
         releasebox() {
            if (this.releasevalue.length == 0) {
@@ -352,42 +402,91 @@
            });
         },
         submit() {
            if (this.sns == "") {
               this.$refs.uToast.show({
                  title: "请扫描内箱标签",
                  type: 'error'
             // æå–生产日期(格式为"生产日期:YYYY-MM")
             const productionDateStr = this.ProductionDate.replace('生产日期:', '');
             if (!productionDateStr) {
               this.showToast({
                     title: "未获取到生产日期",
                     type: 'error'
                 });
                 return;
             }
             // è§£æžç”Ÿäº§æ—¥æœŸçš„年月
             const [prodYear, prodMonth] = productionDateStr.split('-').map(Number);
             // èŽ·å–å½“å‰æ—¥æœŸçš„å¹´æœˆ
             const currentDate = new Date();
             const currentYear = currentDate.getFullYear();
             const currentMonth = currentDate.getMonth() + 1;
             // æ¯”较年月是否一致
             const isDateMismatch = prodYear !== currentYear || prodMonth !== currentMonth;
             if (isDateMismatch) {
                 this.showToast({
                     title: "该物料生产日期的年月与当前年月不一致",
                     type: 'warning',
                     duration: 1500
                 });
             }
             // åŽŸæœ‰çš„ç¡®è®¤æ”¶è´§é€»è¾‘
             if (this.sns == "") {
                 this.$refs.uToast.show({
                     title: "请扫描内箱标签",
                     type: 'error'
                 })
                 return;
             }
             if (this.Quantity == "") {
                 this.$refs.uToast.show({
                     title: "请输入实际数量",
                     type: 'error'
                 })
                 return;
             }
             if(this.warehouseId==2){
                 //替换指定两个字符间的字符
                 this.sns = this.sns.replace(/(Q:)([^,PO]+)(,PO)/, (match, p1, p2, p3) => {
                     return p1 + this.Quantity + p3;
                 });
             }
            const sendRequest = () => {
               this.$u.post('/api/ReceiveOrderDetail/AddReceiveOrderDetail?serNum=' + this.sns + '&orderNo=' + this
                  .orderNo, {}).then(res => {
                  if (res.status) {
                     this.PurchaseOrderNo="采购单号:";
                     this.matCode="物料编码:";
                     this.LotNo="物料批次:";
                     this.orderQty="订单数量:";
                     this.ProductionDate="生产日期:";
                     this.EffectiveDate="有效日期:";
                     this.Quantity="";
                     setTimeout(() => {
                        this.innerCode="";
                        this.focus=false;
                     }, 100);
                     this.orderInfo=[];
                     this.sns = "";
                     this.$refs.uToast.show({
                        title:"确认收货成功",
                        type: "success"
                     })
                  } else {
                     this.$refs.uToast.show({
                        title: res.message,
                        type: "error"
                     })
                  }
               })
               return;
            };
            // å¦‚果有日期不匹配提示,等待提示完成后发送请求
            if (isDateMismatch) {
                setTimeout(sendRequest, 1500); // ç­‰å¾…1.5秒(与提示时长一致)
            } else {
                sendRequest(); // æ²¡æœ‰æ—¥æœŸæç¤ºï¼Œç«‹å³å‘送请求
            }
            if (this.Quantity == "") {
               this.$refs.uToast.show({
                  title: "请输入实际数量",
                  type: 'error'
               })
               return;
            }
            if(this.warehouseId==2){
               //替换指定两个字符间的字符
               this.sns = this.sns.replace(/(Q:)([^,PO]+)(,PO)/, (match, p1, p2, p3) => {
                 return p1 + this.Quantity + p3;
               });
            }
            this.$u.post('/api/ReceiveOrderDetail/AddReceiveOrderDetail?serNum=' + this.sns + '&orderNo=' + this
               .orderNo, {}).then(res => {
               if (res.status) {
                  this.$refs.uToast.show({
                     title: "确认收货成功",
                     type: "success"
                  })
                  this.orderInfo=[];
                  this.sns = "";
               } else {
                  this.$refs.uToast.show({
                     title: res.message,
                     type: "error"
                  })
               }
            })
         },
         submit1() {
            this.$u.post('/api/ReceiveOrder/FeedbackReceiveOrder?orderId=' + this
@@ -455,6 +554,7 @@
            })
         },
         onClickItem(e) {
            console.log(1)
            this.focus = false;
            this.addressFocus = false;
            if (this.current !== e.currentIndex) {
@@ -486,46 +586,42 @@
                  return;
               }
               var innerCode = this.innerCode;
               setTimeout(() => {
                  this.innerCode = "";
                  this.focus=false;
               }, 1);
               this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + innerCode, {}).then((res) => {
                  if (res.status) {
                     this.sns = res.data.serialNumber;
                     // this.matInfos.splice(0, this.matInfos.length);
                     // this.matInfos.push(res.data);
                     this.matCode = "物料编码:" + res.data.materielCode;
                     this.LotNo = "物料批次:" + res.data.lotNo;
                     this.PurchaseOrderNo = "采购单号:" + res.data.purchaseOrderNo;
                     this.EffectiveDate = "有效日期:" + res.data.effectiveDate;
                     this.ProductionDate = "生产日期:" + res.data.productionDate;
                     this.orderQty = "订单数量:" + res.data.quantity;
                     this.Quantity = res.data.quantity;
                     if (!res.status) {
               //将innerCode,SC后面的进行替换空
               if(this.warehouseId==11){
                  innerCode=innerCode.replace(/,SC.*/, '');
               }
               if(innerCode.indexOf("POHA")>0){
                  this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + innerCode, {}).then((res) => {
                     if (res.status) {
                        this.sns = res.data.serialNumber;
                        // this.matInfos.splice(0, this.matInfos.length);
                        // this.matInfos.push(res.data);
                        this.matCode = "物料编码:" + res.data.materielCode;
                        this.LotNo = "物料批次:" + res.data.lotNo;
                        this.PurchaseOrderNo = "采购单号:" + res.data.purchaseOrderNo;
                        this.EffectiveDate = "有效日期:" + res.data.effectiveDate;
                        this.ProductionDate = "生产日期:" + res.data.productionDate;
                        this.orderQty = "订单数量:" + res.data.quantity;
                        this.Quantity = res.data.quantity;
                        // setTimeout(() => {
                        //    this.voiceSpeech('../../static/success.mp3');
                        // }, 100);
                     } else {
                        this.$refs.uToast.show({
                           title: res.message,
                           type: "error"
                        })
                        setTimeout(() => {
                           this.voiceSpeech('../../static/fail.mp3');
                        }, 100);
                        return;
                        // setTimeout(() => {
                        //    this.voiceSpeech('../../static/fail.mp3');
                        // }, 100);
                     }
                     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.innerCode = "";
                  this.focus=true;
               }, 100);
            })
         },
         tagInput() {