dengjunjie
2025-05-21 aa63e0401cea4e367c9d9fd620d996a688c0a01f
ÏîÄ¿´úÂë/ÎߺþÈýÒ»PDA/pages/stash/raworderboxing.vue
@@ -6,126 +6,24 @@
         <view v-if="current === 0" class="headerstyle">
            <view class="itemstyle">
               <uni-forms label-width="180">
                  <uni-forms-item :label="label">
                  <uni-forms-item :label="orderNolabel">
                  </uni-forms-item>
                  <uni-forms-item :label="batchNolabel">
                  </uni-forms-item>
                  <uni-forms-item label="托盘条码:">
                     <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="!focus"
                        v-model="barcode" @input="barcodeInput" />
                  </uni-forms-item>
                  <uni-forms-item label="内箱标签:">
                     <uni-easyinput type="text" placeholder="请扫描内箱标签" ref='midInput' :focus="focus"
                        v-model="materSn" @input="snInput" />
                  </uni-forms-item>
                  <uni-forms-item :label="Testlabel" v-if="Test">
                     <uni-easyinput type="text" :placeholder="Testplaceholder" ref='midInput'
                        v-model="Initiallife" />
                  </uni-forms-item>
                  <!-- <uni-forms-item>
                     <checkbox checked="check">是否满盘</checkbox>
                  </uni-forms-item> -->
                  <uni-forms-item>
                     <button @click="submit" type="primary" size="default" style="margin-top: 2%;">组盘</button>
                  </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">
                           <uni-icons type="trash" size="22" style="position: absolute;right: 5%;"
                              @click="deleteList(index)">
                           </uni-icons>
                           <view class="uni-content">
                              <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>
                              <view class="uni-note">生产日期:{{item.productionDate}}</view>
                              <view class="uni-note">有效期:{{item.effectiveDate}}</view>
                           </view>
                        </view>
                     </template>
                  </uni-list-item>
               </uni-list>
            </view>
         </view>
         <view v-if="current === 1" class="headerstyle">
            <view class="itemstyle">
               <uni-forms label-width="120">
                  <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="address" :disabled="addressdisabled"
                        placeholder="请扫描地址条码" ref='midInput' :focus="addressFocus" />
                     <button @click="submit" type="primary" size="default" style="margin-top: 2%;">组盘入库</button>
                  </uni-forms-item>
                  <uni-forms-item>
                     <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">入库确认</button>
                     <button @click="ReleaseCompleted" 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-list :border="true">
                  <uni-list-item direction="column" v-for="(item,index) in orderInfo" :key="index">
                     <template v-slot:body>
                        <view class="uni-list-box">
                           <view class="uni-content">
                              <view style="font-size: 18px;">单据号:{{orderNo}}</view>
                              <view style="font-size: 18px;">物料编码:{{item.materielCode}}</view>
                              <!-- <view style="font-size: 18px;">物料名称:{{item.matName}}</view> -->
                              <view style="font-size: 18px;">数量:{{item.orderQuantity+item.unit}}</view>
                              <view style="font-size: 18px;">组盘数量:{{item.receiptQuantity}}</view>
                           </view>
                        </view>
                     </template>
                  </uni-list-item>
               </uni-list>
            </view>
         </view>
         <view v-if="current === 3" class="headerstyle">
            <view class="itemstyle">
               <uni-forms label-width="180">
                  <uni-forms-item label="内箱标签:">
                     <uni-easyinput type="text" placeholder="请扫描内箱标签" ref='midInput' :focus="pkfocus"
                        v-model="pkmaterSn" @input="pksnInput" />
                  </uni-forms-item>
                  <uni-forms-item>
                     <button @click="pksubmit" type="primary" size="default" style="margin-top: 2%;">入平库</button>
                  </uni-forms-item>
               </uni-forms>
               <uni-list>
                  <uni-list-item direction="column" v-for="(item,index) in pkmatInfos" :key="index">
                     <template v-slot:body>
                        <view class="uni-list-box">
                           <uni-icons type="trash" size="22" style="position: absolute;right: 5%;"
                              @click="pkdeleteList(index)">
                           </uni-icons>
                           <view class="uni-content">
                              <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>
                              <view class="uni-note">生产日期:{{item.productionDate}}</view>
                              <view class="uni-note">有效期:{{item.effectiveDate}}</view>
                           </view>
                        </view>
                     </template>
                  </uni-list-item>
               </uni-list>
            </view>
         </view>
      </view>
@@ -138,63 +36,24 @@
   export default {
      data() {
         return {
            items: ['组盘', '入库', '单据信息'], //, '解盘'
            items: ['组盘'], //, '入库', '单据信息', '解盘'
            current: 0,
            matTotal: [],
            matInfos: [],
            orderNo: "",
            label: "",
            batchNo: "",
            orderNolabel: "",
            batchNolabel: "",
            orderInfo: [],
            focus: false,
            pkfocus: false,
            barcode: "",
            materSn: "",
            Initiallife: 1000,
            sns: [],
            pksns: [],
            addressFocus: false,
            inboundBarcode: "",
            address: "",
            check: true,
            value: "",
            matInfo: [],
            value2: "",
            matTotals: [],
            warehouseId: "",
            Test: false,
            Testlabel: "",
            Testplaceholder: "",
            Testcheck: false,
            pkmaterSn: "",
            pkmatInfos: [],
            addressdisabled: false
         }
      },
      onShow() {},
      onLoad(res) {
         this.focus = false;
         this.addressFocus = false;
         this.orderNo = res.orderNo;
         this.warehouseId = res.warehouseId;
         if (this.warehouseId == 6) { //测试架仓库区ID
            this.Test = true;
            this.Testlabel = "初始寿命:";
            this.Testplaceholder = "请输入初始寿命";
         } else if (this.warehouseId == 2) { //油墨仓库区ID
            this.Test = true;
            this.Testlabel = "数量:";
            this.Testplaceholder = "请输入数量";
            this.Initiallife = 16;
         } else if (this.warehouseId == 5) { //辅料
            this.items.push("入平库");
            this.items[1] = "入立库";
            this.address = "8005";
         } else if (this.warehouseId == 3) { //辅料
            this.address = "1011";
            this.addressdisabled = true;
         }
         this.label = "单据编号:" + this.orderNo;
         this.getData();
         this.batchNo = res.batchNo;
         this.orderNolabel = "批号:" + this.orderNo;
         this.batchNolabel = "柜号:" + this.batchNo;
         // this.getData();
      },
      methods: {
         voiceSpeech(src) {
@@ -218,19 +77,19 @@
            }
         },
         getData() {
            var postData = {
               MainData: {
                  orderNo: this.orderNo
               },
            }
            this.$u.post('/api/InboundOrderDetail/GetInboundOrderDetails', postData).then((res) => {
               if (res.status) {
                  this.orderInfo = res.data;
                  if (this.orderInfo.length > 3) {
                     this.loadVisible = true;
                  }
               }
            })
            // var postData = {
            //    MainData: {
            //       orderNo: this.orderNo
            //    },
            // }
            // this.$u.post('/api/InboundOrderDetail/GetInboundOrderDetails', postData).then((res) => {
            //    if (res.status) {
            //       this.orderInfo = res.data;
            //       if (this.orderInfo.length > 3) {
            //          this.loadVisible = true;
            //       }
            //    }
            // })
         },
         onClickItem(e) {
            this.focus = false;
@@ -256,165 +115,15 @@
               }
            })
         },
         snInput() {
            this.$nextTick(() => {
               if (this.materSn != "") {
                  this.focus = false;
                  var matSn = this.materSn;
                  setTimeout(() => {
                     this.materSn = "";
                  }, 10);
                  this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
                     this.Testcheck = false;
         ReleaseCompleted() {
            this.$u.post('http://192.168.10.88:8099/api/AGV/ReleaseCompleted').then(
               res => {
                     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;
                        }
                        setTimeout(() => {
                           this.voiceSpeech('../../static/success.mp3');
                        }, 100);
                     } else {
                        this.$refs.uToast.show({
                           title: res.message,
                           type: "error"
                        })
                        setTimeout(() => {
                           this.voiceSpeech('../../static/fail.mp3');
                        }, 100);
                     }
                  })
               }
            })
         },
         pksnInput() {
            this.$nextTick(() => {
               if (this.pkmaterSn != "") {
                  this.focus = false;
                  var matSn = this.pkmaterSn;
                  setTimeout(() => {
                     this.pkmaterSn = "";
                  }, 10);
                  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);
                     }
                  })
               }
            })
         },
         inbound() {
            if (this.inboundBarcode == "") {
               this.$refs.uToast.show({
                  title: "请扫描托盘条码",
                  type: "error"
               })
               return;
            }
            if (this.address == "") {
               this.$refs.uToast.show({
                  title: "请扫描地址条码",
                  type: "error"
               })
               return;
            }
            var postData = {
               MainData: {
                  "barcode": this.inboundBarcode,
                  "startPoint": this.address,
                  "warehouseId": this.warehouseId
               }
            }
            this.$u.post('/api/Task/RequestInboundTask', postData).then(res => {
               if (res.status) {
                  this.inboundBarcode = "";
                  if (this.warehouseId != 5) this.address = "";
                  setTimeout(() => {
                     this.addressFocus = false;
                     this.$refs.uToast.show({
                        title: "成功",
                        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"
               })
            })
         },
         inputChangebarcode() {
            this.addressFocus = false;
            this.$nextTick(function(x) {
               if (this.inboundBarcode != '') {
                  this.addressFocus = true;
               }
            })
         },
         deleteList(res) {
            this.matInfos.splice(res, 1);
            this.sns.splice(res, 1);
         },
         pkdeleteList(res) {
            this.pkmatInfos.splice(res, 1);
            this.pksns.splice(res, 1);
         },
         pksubmit() {
            if (this.pkmatInfos.length == 0) {
               this.$refs.uToast.show({
                  title: "请扫描内箱标签",
                  type: 'error'
               })
               return;
            }
            this.$u.post('/api/InboundOrder/InPinKu?warehouseId=' + this.warehouseId + "&orderNo=" + this.orderNo, this
               .pksns).then(res => {
               if (res.status) {
                  this.$refs.uToast.show({
                     title: "入库成功",
                     type: "success"
                  })
                  this.focus = false;
                  this.pkmatInfos = [];
                  this.pksns = [];
                     this.qty = "";
               } else {
                  this.$refs.uToast.show({
                     title: res.message,
@@ -431,43 +140,11 @@
               })
               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;
               }
            }
            if (this.warehouseId == 2) { //油墨仓库区ID
               this.sn = this.sns[0];
               for (var i = 0; i < this.Initiallife - 1; i++) {
                  this.sns.push(this.sn);
               }
            }
            this.$u.post('/api/InboundOrder/MaterielGroup', {
            this.$u.post('/api/PDA/InMateriel', {
               MainData: {
                  "palletCode": this.barcode,
                  "orderNo": this.orderNo,
                  "initiallife": this.Initiallife,
                  // "isFull": this.check
                  "warehouseId": this.warehouseId
                  "batchNo":this.batchNo
               },
               DelKeys: this.sns
            }).then(res => {
@@ -479,9 +156,6 @@
                  })
                  this.focus = false;
                  this.barcode = "";
                  this.matInfos = [];
                  this.sns = [];
                  this.matTotal = [];
               } else {
                  this.$refs.uToast.show({
                     title: res.message,