wangxinhui
2025-10-26 733c975cd8647f6d006736f1863bad731e32e6fb
ÏîÄ¿´úÂë/ÁúÀûµÃPDA/pages/stash/boxing.vue
@@ -10,6 +10,10 @@
                     <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="!focus"
                        v-model="barcode" @confirm="barcodeInput" />
                  </uni-forms-item>
                  <uni-forms-item label="RFID:">
                     <uni-easyinput type="text" v-model="rfid" placeholder="请扫描纸卷RFID" ref='midInput'
                        :focus="focus" />
                  </uni-forms-item>
                  <uni-forms-item label="物料:">
                     <uni-easyinput type="text" placeholder="请输入物料" ref='midInput' v-model="materSn" />
                  </uni-forms-item>
@@ -22,6 +26,10 @@
                  <uni-forms-item label="重量:">
                     <uni-easyinput type="text" trim="all" placeholder="请输入重量(kg)" ref='midInput'
                        v-model="weight" />
                  </uni-forms-item>
                  <uni-forms-item label="总长:">
                     <uni-easyinput type="text" trim="all" placeholder="请输入总长(m)" ref='midInput'
                        v-model="lengthStock" />
                  </uni-forms-item>
                  <uni-forms-item>
                     <button @click="submit" type="primary" size="default" style="margin-top: 2%;">组盘</button>
@@ -41,8 +49,11 @@
                  <uni-forms-item label="物料编码">
                     <uni-easyinput type="text" v-model="matCode" placeholder="请输入物料编码" ref='midInput' />
                  </uni-forms-item>
                  <uni-forms-item label="物料数量">
                     <uni-easyinput type="number" v-model="matCount" placeholder="请输入物料数量" ref='midInput' />
                  <uni-forms-item label="单个数量">
                     <uni-easyinput type="number" v-model="OneCount" placeholder="请输入单个数量" ref='midInput' />
                  </uni-forms-item>
                  <uni-forms-item label="物料总数">
                     <uni-easyinput type="number" v-model="matCount" placeholder="请输入物料总数" ref='midInput' />
                  </uni-forms-item>
                  <uni-forms-item>
                     <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">入库确认</button>
@@ -51,7 +62,19 @@
            </view>
         </view>
         <view v-if="current === 1" class="headerstyle">
            <view class="itemstyle">
            <view class="itemstyle" v-if="warehouseId==1">
               <uni-forms label-width="180">
                  <uni-forms-item label="条码:">
                     <uni-easyinput type="text" placeholder="请扫描纸卷条码" ref='midInput' :focus="!focus"
                        v-model="bindCode" @confirm="barcodeInput" />
                  </uni-forms-item>
                  <uni-forms-item>
                     <button @click="Bindrfid" type="primary" size="default" style="margin-top: 2%;">绑定</button>
                  </uni-forms-item>
               </uni-forms>
            </view>
            <view class="itemstyle" v-else>
               <uni-forms label-width="120">
                  <uni-forms-item label="托盘条码">
                     <uni-easyinput type="text" :focus="!addressEmptyFocus" v-model="emptyCode"
@@ -63,6 +86,26 @@
                  </uni-forms-item>
                  <uni-forms-item>
                     <button @click="inEmpty" type="primary" size="default" style="margin-top: 2%;">入库确认</button>
                  </uni-forms-item>
               </uni-forms>
            </view>
         </view>
         <view v-if="current === 2" class="headerstyle">
            <view class="itemstyle">
               <uni-forms label-width="120">
                  <uni-forms-item label="物料编码">
                     <uni-easyinput type="text" v-model="materialCode" placeholder="请输入物料编码" ref='midInput' />
                  </uni-forms-item>
                  <uni-forms-item label="出库数量">
                     <uni-easyinput type="number" v-model="outCount" placeholder="请输入出库数量" ref='midInput' />
                  </uni-forms-item>
                  <uni-forms-item label="出库点位">
                     <uni-data-select placeholder="请选择" v-model="targetId"
                        :localdata="startPointRange"></uni-data-select>
                  </uni-forms-item>
                  <uni-forms-item>
                     <button @click="OutBound" type="primary" size="default"
                        style="margin-top: 2%;">出库确认</button>
                  </uni-forms-item>
               </uni-forms>
            </view>
@@ -81,6 +124,7 @@
            materSn: "",
            wide: "",
            weight: "",
            lengthStock: "",
            thickness: "",
            barcode: "",
            focus: false,
@@ -97,24 +141,35 @@
            matCount: 0,
            matCode: "", //物料编码
            addressEmpty: "",
            OneCount: 0,
            targetId: "",
            materialCode: "",
            bindCode: "",
            rfidCode: "",
            rfid:"",
            outCount: 0,
            addressEmptyFocus: false,
            startPointRange: []
         }
      },
      onShow() {},
      onLoad(res) {
         this.focus = false;
         this.addressFocus = false;
         this.Test=false;
         this.Test = false;
         this.warehouseId = res.warehouseId;
         if (this.warehouseId == 1) {
            this.items = ['组盘'];
            this.items = ['组盘','绑定RFID'];
         }
         if (this.warehouseId == 2) {
            //仅显示uni-segmented-control为1和2的值
            this.items.push('辅料入库');
            this.items.push('空托入库');
            this.items.push('手动出库');
            //this.items移除组盘
            this.items.splice(0,1);
            this.items.splice(0, 1);
            console.log(this.items)
            this.getDictionary();
         }
      },
      methods: {
@@ -139,10 +194,10 @@
            } else {
               this.addressEmptyFocus = false;
            }
            if(this.inboundCode){
            if (this.inboundCode) {
               this.addressEmptyFocus = true;
            }else {
            } else {
               this.addressEmptyFocus = false;
            }
         },
@@ -187,22 +242,113 @@
               })
            })
         },
         inbound() {
            if (this.matCount <= 0) {
         OutBound(){
            if (this.materialCode == "") {
               this.$refs.uToast.show({
                  title: "请输入物料数量",
                  title: "请输入物料",
                  type: "error"
               })
               return;
            }
            if(!this.Test){
            if (this.outCount <= 0) {
               this.$refs.uToast.show({
                  title: "请确认物料数量"+this.matCount,
                  type: "info"
                  title: "请输入出库数量",
                  type: "error"
               })
               this.Test=true;
               return;
            }
            if (this.targetId == "") {
               this.$refs.uToast.show({
                  title: "请选择出库点位",
                  type: "error"
               })
               return;
            }
            var url = "?materialCode=" + this.materialCode+ "&outCount=" + this.outCount + "&targetId=" + this.targetId;
            this.$u.post('/api/Task/RequestCPWMSTaskOut' + url, {}).then(res => {
               if (res.status) {
                  this.materialCode = "";
                  this.outCount = 0;
                  this.targetId = "";
                  setTimeout(() => {
                     this.$refs.uToast.show({
                        title: "成功",
                        type: "success"
                     })
                  }, 200);
               } else {
                  this.$refs.uToast.show({
                     title: res.message,
                     type: "error"
                  })
               }
            }).catch(err => {
               this.$refs.uToast.show({
                  title: err.message,
                  type: "error"
               })
            })
         },
         getDictionary() {
            var param = ["agvStationAreaEnum"];
            this.$u.post('api/Sys_Dictionary/GetVueDictionary', param).then(res => {
                  //将res.data中的value改成text,key改成value
                  res[0].data.forEach(item => {
                     var obj = {
                        value: item.key,
                        text: item.value
                     }
                     this.startPointRange.push(obj);
                  })
            }).catch(err => {
               this.$refs.uToast.show({
                  title: err.message,
                  type: "error"
               })
            })
         },
         Bindrfid(){
            if (this.bindCode == "") {
               this.$refs.uToast.show({
                  title: "请输入条码",
                  type: "error"
               })
               return;
            }
            var url = "?palletCode=" + this.bindCode;
            this.$u.post('/api/Task/PurchaseBoxing' + url, {}).then(res => {
               if (res.status) {
                  this.bindCode = "";
                  this.rfidCode = "";
                  setTimeout(() => {
                     this.$refs.uToast.show({
                        title: "成功",
                        type: "success"
                     })
                  }, 200);
               } else {
                  this.$refs.uToast.show({
                     title: res.message,
                     type: "error"
                  })
               }
            }).catch(err => {
               this.$refs.uToast.show({
                  title: err.message,
                  type: "error"
               })
            })
         },
         inbound() {
            if (this.matCount <= 0) {
               this.$refs.uToast.show({
                  title: "请输入物料总数",
                  type: "error"
               })
               return;
            }
            if (this.inboundCode == "") {
               this.$refs.uToast.show({
                  title: "请扫描托盘条码",
@@ -210,7 +356,7 @@
               })
               return;
            }
            if (this.address== "") {
            if (this.address == "") {
               this.$refs.uToast.show({
                  title: "请扫描地址条码",
                  type: "error"
@@ -224,16 +370,31 @@
               })
               return;
            }
            if (this.OneCount <= 0) {
               this.$refs.uToast.show({
                  title: "请输入单个数量",
                  type: "error"
               })
               return;
            }
            if (!this.Test) {
               this.$refs.uToast.show({
                  title: "请确认物料数量" + this.matCount,
                  type: "info"
               })
               this.Test = true;
               return;
            }
            var url = "?barCode=" + this.inboundCode + "&startPoint=" + this.address + "&matCode=" + this
               .matCode + "&matCount=" + this.matCount;
               .matCode + "&matCount=" + this.matCount + "&oneCount=" + this.OneCount;
            this.$u.post('/api/Task/InboundFLTask' + url, {}).then(res => {
               if (res.status) {
                  this.inboundCode = "";
                  this.address = "";
                  this.matCode = "";
                  this.matCount = 0;
                  this.Test=false;
                  this.Test = false;
                  this.OneCount = 0;
                  //获取总数量
                  setTimeout(() => {
                     this.addressEmptyFocus = false;
@@ -247,7 +408,7 @@
                     title: res.message,
                     type: "error"
                  })
                  this.Test=false;
                  this.Test = false;
               }
            }).catch(err => {
               this.$refs.uToast.show({
@@ -264,6 +425,48 @@
               })
               return;
            }
            if(this.rfid==""){
               this.$refs.uToast.show({
                  title: "请扫描RFID",
                  type: 'error'
               })
               return;
            }
            if (this.thickness == "") {
               this.$refs.uToast.show({
                  title: "请输入直径",
                  type: 'error'
               })
               return;
            }
            if (this.weight == "") {
               this.$refs.uToast.show({
                  title: "请输入重量",
                  type: 'error'
               })
               return;
            }
            if (this.wide == "") {
               this.$refs.uToast.show({
                  title: "请输入幅宽",
                  type: 'error'
               })
               return;
            }
            if (this.materSn == "") {
               this.$refs.uToast.show({
                  title: "请输入物料",
                  type: 'error'
               })
               return;
            }
            if (this.lengthStock == "") {
               this.$refs.uToast.show({
                  title: "请输入总长",
                  type: 'error'
               })
               return;
            }
            this.$u.post('/api/StockInfo/ManualMaterielGroup', {
               MainData: {
                  "palletCode": this.barcode,
@@ -271,6 +474,8 @@
                  "weight": this.weight,
                  "wide": this.wide,
                  "materSn": this.materSn,
                  "lengthStock": this.lengthStock,
                  "fridCode":this.rfid,
                  // "isFull": this.check
                  "warehouseId": this.warehouseId
               },
@@ -286,6 +491,7 @@
                  this.materSn = "";
                  this.wide = "";
                  this.weight = "";
                  this.lengthStock = "";
                  this.thickness = "";
               } else {
                  this.$refs.uToast.show({