diff --git a/src/pages/wms/product/SaleOutWH/index.vue b/src/pages/wms/product/SaleOutWH/index.vue index 8360f00..514fee0 100644 --- a/src/pages/wms/product/SaleOutWH/index.vue +++ b/src/pages/wms/product/SaleOutWH/index.vue @@ -16,7 +16,7 @@ - 提单 + 提单 @@ -24,8 +24,24 @@ + + + + 出库仓库: + + + + 客户名称: + {{ orderNoItemList && orderNoItemList.attr1 }} + + - 成品库 + @@ -54,28 +70,33 @@ - + + + {{ item.name }} + + + - + - 批次号: - {{ item.lotNumber }} + 托盘号: + {{ item.sn }} 箱码: - {{ item.barcode }}件 + {{ item.barcode }} - + 库位码: {{ item.wlCode }} @@ -87,7 +108,7 @@ - 删除 + 删除 @@ -114,6 +135,7 @@ import { Component } from 'vue-property-decorator'; import { BasePage } from '@/components/base/page'; import jPicker from '@/components/J-Picker/jPicker.vue'; import model from './model'; +import { session } from '@/store/modules/session'; interface OptionType { label: string; value: string; @@ -127,7 +149,9 @@ interface OptionType { export default class SaleOutWH extends BasePage { model = model; list: any = []; - aimWl = {} as OptionType; + //productCodebiaozhiwei = ''; + cimWl = {} as OptionType; + aimWl: any = {}; boxnumber: any = ''; materilist = []; // remove: any = {}; @@ -144,33 +168,54 @@ export default class SaleOutWH extends BasePage { showProduceCodeList: any = []; itemdetail: any = ''; outnumber: any = 0; + warehouselist = []; + Radiolist = [ + { + code: 0, + name: '整托扫描', + disabled: false, + }, + { + code: 1, + name: '单箱扫描', + disabled: false, + }, + ]; + selectvalue: any = 0; + async onLoad() { + await this.model.getwarehouselist(); + this.warehouselist = model.warehouselist; + this.cimWl = this.warehouselist[0]; + } bookTypeChange(e: any) { this.aimWl = e.pickerName; - this.getlist(); - this.queryinformation(); + this.orderNoItemList = e.pickerName; + this.list = []; + this.outnumber = this.orderNoItemList.outQuantity; + } + wlChange(e: any) { + this.cimWl = e.pickerName; + } + // 选中任一radio时,由radio-group触发 + radioGroupChange(e) { + console.log(e); + console.log('selectvalue', this.selectvalue); } //收货按钮 - async ondelete(item) { - console.log('1234567', item); - this.itemdetail = item; - // this.showmodal = true; - // this.content = '是否删除?'; - this.itemdetail.orderNo = this.orderNo; - console.log(this.itemdetail, this.orderNo); - await this.model.deleteTray(this.itemdetail); - if (this.model.SubmitCode == '200') { - (this.$refs.uToast as any).show({ - title: '删除成功', - type: 'success', - }); - this.getlist(); - } else { - (this.$refs.uToast as any).show({ - title: '删除失败', - type: 'error', - }); - this.getlist(); - } + async ondelete(item, index) { + console.log('this.list', Array.isArray(this.list)); + const newList = [...this.list]; // 创建一个新的数组 + newList.splice(index, 1); // 在新数组上执行 splice 操作 + this.list = newList; // 将新数组赋值回原数组 + (this.$refs.uToast as any).show({ + title: '删除成功', + type: 'success', + }); + console.log('this.outnumber', this.outnumber); + this.outnumber = this.outnumber - 1; + // if(!this.list.length){ + // this.productCodebiaozhiwei = ''; + // } } //查询货单关联采购单信息 async query() { @@ -184,53 +229,20 @@ export default class SaleOutWH extends BasePage { await this.model.showProduceCode(this.orderNo); if (model.orderNoItemList) { this.materilist = []; - let a: any = {}; - model.orderNoItemList.forEach((item) => { - a.label = item.productName; - a.value = item.productCode; - this.materilist.push(a); + //let a: any = {}; + this.model.orderNoItemList.forEach((item) => { + item.label = item.productName; + item.value = item.productCode; + this.materilist.push(item); }); this.aimWl.value = this.materilist[0].value; - this.queryinformation(); - this.getlist(); + this.orderNoItemList = this.materilist[0]; + this.outnumber = this.orderNoItemList.outQuantity; } else { this.materilist = []; } } - //查询货单关联采购单信息 - async queryinformation() { - if (this.orderNo == '' || this.orderNo.length == 0) { - (this.$refs.uToast as any).show({ - title: '请输入备货单号', - // url: '/pages/user/index' - }); - return; - } - let item: any = {}; - item.orderNo = this.orderNo; - item.value = this.aimWl.value; - await this.model.queryinformation(item); - if (model.information) { - this.orderNoItemList = model.information; - } else { - this.orderNoItemList = {}; - } - // this.getlist(); - } - async getlist() { - let item: any = {}; - item.orderNo = this.orderNo; - item.value = this.aimWl.value; - await (this.model as any).showTrays(item); - if (model.TraysList.length > 0) { - this.list = model.TraysList; - this.outnumber = model.TraysList.length; - } else { - this.list = []; - this.outnumber = 0; - } - console.log(model.TraysList); - } + async addlist() { if (this.orderNo == '' || this.orderNo.length == 0) { (this.$refs.uToast as any).show({ @@ -246,25 +258,76 @@ export default class SaleOutWH extends BasePage { }); return; } - let item: any = {}; - item.productCode = this.aimWl.value; - item.barcode = this.boxnumber; - await this.model.selloutconntray(item); - if (this.model.SubmitCode == '200') { - (this.$refs.uToast as any).show({ - title: '成功', - type: 'success', - }); - this.getlist(); - this.boxnumber = ''; - } else { - (this.$refs.uToast as any).show({ - title: '失败', - type: 'error', - }); - this.getlist(); - this.boxnumber = ''; + + if (this.selectvalue == 0) { + //选择整托扫描 + let item: any = {}; + item.sn = this.boxnumber; + item.siteCode = session.FactoryCode; + await this.model.ScanCodeWholePallet(item); + if (this.model.scanCode == '200') { + (this.$refs.uToast as any).show({ + title: '成功', + type: 'success', + }); + // if (this.productCodebiaozhiwei == ''&&model.scandatalist.length) { + // this.productCodebiaozhiwei = model.scandatalist[0].productCode; + // } + model.scandatalist.map((item) => { + if (item.productCode == this.aimWl.value) { + this.list.push({ sn: item.sn, barcode: item.barcode, wlCode: item.wlCode, storageId: item.storageId }); + this.outnumber += 1; + } else { + (this.$refs.uToast as any).show({ + title: '必须是同一种物料的', + type: 'error', + }); + } + }); + // this.list.push() + + this.boxnumber = ''; + } else { + (this.$refs.uToast as any).show({ + title: '失败', + type: 'error', + }); + this.boxnumber = ''; + } + } else if (this.selectvalue == 1) { + let item: any = {}; + item.barcode = this.boxnumber; + item.siteCode = session.FactoryCode; + await this.model.ScanCodeSingleBox(item); + if (this.model.scanCode == '200') { + // if (this.productCodebiaozhiwei == ''&& model.scandata) { + // this.productCodebiaozhiwei = model.scandata.productCode; + // } + let scandata = model.scandata; + if (this.aimWl.value == scandata.productCode) { + (this.$refs.uToast as any).show({ + title: '成功', + type: 'success', + }); + this.list.push({ sn: scandata.sn, barcode: scandata.barcode, wlCode: scandata.wlCode, storageId: scandata.storageId }); + this.outnumber += 1; + } else { + (this.$refs.uToast as any).show({ + title: '必须是同一种物料的', + type: 'error', + }); + } + + this.boxnumber = ''; + } else { + (this.$refs.uToast as any).show({ + title: '失败', + type: 'error', + }); + this.boxnumber = ''; + } } + // //入库后的查询下面列表的接口 // await this.model.queryOrderNo(this.form5); // this.list = model.orderNoItemList; @@ -285,22 +348,34 @@ export default class SaleOutWH extends BasePage { }); return; } - this.list[0].outnumber = this.outnumber; - await this.model.out(this.list); + //this.list[0].outnumber = this.outnumber; + let item = { + factoryCode: session.FactoryCode, + whCode: this.cimWl.value, + id: this.orderNoItemList.id, + productCode: this.orderNoItemList.productCode, + productName: this.orderNoItemList.productName, + wmsProductPutTrayCodeList: this.list, + }; + await this.model.out(item); if (this.model.SubmitCode == '200') { (this.$refs.uToast as any).show({ title: '成功', type: 'success', }); - this.getlist(); + this.list = []; + this.query(); + //this.productCodebiaozhiwei = ''; } else { (this.$refs.uToast as any).show({ title: '失败', type: 'error', }); - this.getlist(); } } + async tidan() { + //提单方法 + } }