1
wankeda
2025-03-22 867aba2636e34a1050b1c4c84bbe78cc9c39b553
´úÂë¹ÜÀí/AGVjiaoliaoPDA/pages/materielGroup/HCJStaue.vue
@@ -10,10 +10,6 @@
                     <uni-easyinput type="text" v-model="stationcode" placeholder="请扫瞄缓存点编号" ref='midInput'
                        :focus="addressFocus" />
                  </uni-forms-item>
                  <!--                   <uni-forms-item label="托盘条码">
                     <uni-easyinput type="text" :focus="!addressFocus" v-model="inboundBarcode"
                        placeholder="请扫描托盘条码" ref='midInput' @input="inputChangebarcode" />
                  </uni-forms-item> -->
                  <uni-forms-item label="物料类型">
                     <uni-easyinput type="text" v-model="PalletCode" placeholder="请扫描物料类型" ref='midInput'
                        :focus="addressFocus" />
@@ -21,9 +17,6 @@
                  <uni-forms-item label="缓存点状态">
                     <uni-data-checkbox v-model="value" :localdata="range" @change="change"></uni-data-checkbox>
                  </uni-forms-item>
               <!--    <uni-forms-item label="缓存点状态">
                     <uni-data-checkbox v-model="values" :localdata="ranges" @change="change"></uni-data-checkbox>
                  </uni-forms-item> -->
                  <uni-forms-item>
                     <button @click="inbound" type="primary" size="default"
                        style="margin-top: 2%;">状态修改确认</button>
@@ -41,7 +34,6 @@
   export default {
      data() {
         return {
            // items: ['组盘', '入库', '单据信息', '解盘'],
            items: ['缓存架状态修改'],
            current: 0,
            matTotal: [],
@@ -55,18 +47,16 @@
            sns: [],
            addressFocus: false,
            PalletCode: "",
            stationcode: "",
            stationcode: "", // ç¼“存点编号
            address: "",
            check: true,
            value: "",
            values: "",
            range: [{
               "value": 0,
               "text": "空闲"
            }, {
               "value": 1,
               "text": "锁定"
            }],
            range: [
               { value: 0, text: "空闲" },
               { value: 1, text: "锁定" },
               { value: 2, text: "有货" } // å‡è®¾æŽ¥å£è¿”回的状态值为 2,表示占用
            ],
            code: [],
         }
      },
@@ -77,11 +67,18 @@
         this.orderNo = res.orderNo;
         this.label = "单据编号:" + this.orderNo;
         this.getData();
         this.getEndLocations();
      },
      watch: {
         // ç›‘听 stationcode çš„变化
         stationcode(newVal, oldVal) {
            if (newVal && newVal !== oldVal) {
               this.getEndLocations(); // è‡ªåŠ¨è°ƒç”¨æŽ¥å£
            }
         }
      },
      methods: {
         voiceSpeech(src) {
            innerAudioContext.src = src; // '../../static/success.mp3';
            innerAudioContext.src = src;
            innerAudioContext.play();
         },
         updateFocus() {
@@ -99,8 +96,7 @@
            }
         },
         getData() {
            var postData = this.orderNo
            var postData = this.orderNo;
            this.$u.post('/api/InboundOrder/GetInboundOrderDetail', postData).then((res) => {
               if (res.status) {
                  this.orderDetail = res.data;
@@ -131,17 +127,16 @@
            var postData = {
               MainData: {
                  "stationcode": this.stationcode,
                  "PalletCode": this.PalletCode,
                  "palletCode": this.PalletCode,
                  "toaddress": this.value,
               }
            }
            this.$u.post('/api/Task/EmptyTask', postData).then(res => {
            this.$u.post('/api/CachePoint/UpdateHCJStaue', postData).then(res => {
               if (res.status) {
                  uni.$showMsg("任务添加成功");
                  uni.$showMsg("修改缓存架信息成功");
                  this.stationcode = "";
                  this.PalletCode = "";
                  this.toaddress = "";
                  this.value = "";
                  setTimeout(() => {
                     // this.materialtype = false;
                  }, 200);
@@ -158,7 +153,6 @@
               })
            })
         },
         inputChangebarcode() {
            this.addressFocus = false;
            this.$nextTick(function(x) {
@@ -167,19 +161,63 @@
               }
            })
         },
         // getEndLocations() {
         //    var stationcode=this.stationcode;
         //       this.$u.post('/api/CachePoint/GetHCJStaue?stationcode=' + stationcode, {}).then(res => {
         //          if (res.status) {
         //             this.value = 2;
         //             console.log(res.data);
         //             console.log(res.data.materialtype);
         //             this.PalletCode=res.data.materialtype;
         //             this.range.value=2;
         //          } else {
         //             this.$refs.uToast.show({
         //                title: res.message,
         //                type: "error"
         //             })
         //          }
         //       })
         // }
         getEndLocations() {
            this.$u.post('/api/CachePoint/GetHCJStaue?stationcode', null).then(res => {
               if (res.status) {
                  this.value = 2;
                  console.log(res.data);
               } else {
                  this.$refs.uToast.show({
                     title: res.message,
                     type: "error"
                  })
               }
            })
             var stationcode = this.stationcode;
             this.$u.post('/api/CachePoint/GetHCJStaue?stationcode=' + stationcode, {}).then(res => {
                 if (res.status) {
                     // å‡è®¾æŽ¥å£è¿”回的数据结构为 { status: true, data: { state: 1, materialtype: 'A' } }
                     const responseData = res.data;
                     // æ›´æ–°ç¼“存点状态
                     this.value = responseData.pointStatus; // å‡è®¾ state æ˜¯ç¼“存点状态的值
                     // æ›´æ–°ç‰©æ–™ç±»åž‹
                     this.PalletCode = responseData.materialtype; // å‡è®¾ materialtype æ˜¯ç‰©æ–™ç±»åž‹
                     // å¦‚果需要更新 range çš„选项
                     this.range = [
                         { value: 0, text: "空闲" },
                         { value: 1, text: "锁定" },
                         { value: 2, text: "有货" } // å‡è®¾æŽ¥å£è¿”回的状态值为 2,表示占用
                     ];
                     // å¦‚果需要根据状态值动态设置 range çš„默认值
                     this.range.forEach(item => {
                         if (item.value === responseData.state) {
                             this.value = item.value; // è®¾ç½®é»˜è®¤é€‰ä¸­é¡¹
                         }
                     });
                 } else {
                     this.$refs.uToast.show({
                         title: res.message,
                         type: "error"
                     });
                 }
             }).catch(err => {
                 this.$refs.uToast.show({
                     title: err.message,
                     type: "error"
                 });
             });
         }
      }
   }
</script>