diff --git a/src/pages/wms/product/OfflineStorage/index.vue b/src/pages/wms/product/OfflineStorage/index.vue index 843b518..2f46873 100644 --- a/src/pages/wms/product/OfflineStorage/index.vue +++ b/src/pages/wms/product/OfflineStorage/index.vue @@ -37,6 +37,10 @@ 产品名称: {{ orderNoItemList && orderNoItemList.productName }} + + 批次号: + {{ orderNoItemList && orderNoItemList.batchNumber }} + 订单数量: @@ -49,8 +53,16 @@ 入库数量: - {{ orderNoItemList && orderNoItemList.putQuantity }} + + + + 出库仓库: + + + @@ -60,16 +72,16 @@ - + - + 箱数: {{ item.number }} @@ -88,7 +100,7 @@ - 删除 + 删除 @@ -141,6 +153,11 @@ 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; +} //import { session } from '@/store/modules/session'; @Component({ components: { @@ -157,6 +174,11 @@ export default class OfflineStorage extends BasePage { itemdetail: any = ''; showmodal = false; content: any = ''; + number1: number; + border = true; + delindex = -1; + cimWl = {} as OptionType; + warehouselist = []; // remove: any = {}; // async onReady() { // await this.model.queryLocation(); @@ -169,10 +191,21 @@ export default class OfflineStorage extends BasePage { histroyItem: any = {}; barcode: any = ''; productCodeList: any = {}; + async onReady() { + await this.model.getwarehouselist(); + this.warehouselist = model.warehouselist; + const cimWl = this.warehouselist.find((item) => item.value === '0004'); + if (cimWl) { + this.cimWl = cimWl; + } else { + this.cimWl = this.warehouselist[0]; + } + } //列表删除按钮 - async onPassdelet(item) { + async onPassdelet(item, index) { console.log('1234567', item); this.itemdetail = item; + this.delindex = index; this.showmodal = true; this.content = '是否删除?'; // let params = { @@ -182,20 +215,25 @@ export default class OfflineStorage extends BasePage { async confirm() { 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(); - } + this.list.splice(this.delindex, 1); + // 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(); + // } + } + //选择出库仓库 + warehouseChange(e: any) { + this.cimWl = e.pickerName; } //取消按钮 nopoup() { @@ -214,10 +252,11 @@ export default class OfflineStorage extends BasePage { await this.model.queryOrderNo(this.orderNo); if (model.orderNoItemList) { this.orderNoItemList = model.orderNoItemList; + this.number1 = this.orderNoItemList.attr3; } else { this.orderNoItemList = {}; } - this.getlist(); + //this.getlist(); } //入库确认按钮 async onSubmit() { @@ -240,27 +279,44 @@ export default class OfflineStorage extends BasePage { this.list.forEach((item) => { insertTarynumber = insertTarynumber + parseInt(item.number); }); - console.log(insertTarynumber, model.orderNoItemList.putQuantity, insertTarynumber == model.orderNoItemList.putQuantity); - if (insertTarynumber == model.orderNoItemList.putQuantity) { - await this.model.handPut(this.list); + //console.log(insertTarynumber, model.orderNoItemList.putQuantity, insertTarynumber == model.orderNoItemList.putQuantity); + if (insertTarynumber <= this.number1) { + let params = { + workOrder: this.orderNoItemList.workOrder, + factoryCode: session.FactoryCode, + whCode: this.cimWl.value, //――仓库编号 + productName: this.orderNoItemList.productName, + productCode: this.orderNoItemList.productCode, + planQuantity: this.orderNoItemList.planQuantity, + putQuantity: this.number1, + batchNumber: this.orderNoItemList.batchNumbe, //――批次 + createBy: session.loginName, + unitOfMeasure: this.orderNoItemList.unitOfMeasure, + productOrder: this.orderNoItemList.productOrder, //――单位 + wmsProductPut: this.list, + }; + //console.log('参数',params); + await this.model.handPut(params); if (this.model.SubmitCode == '200') { (this.$refs.uToast as any).show({ title: '成功', type: 'success', }); this.show = false; - this.getlist(); + this.list = []; + this.query(); + //this.getlist(); } else { (this.$refs.uToast as any).show({ title: '失败', type: 'error', }); this.show = false; - this.getlist(); + //this.getlist(); } } else { (this.$refs.uToast as any).show({ - title: '入库数量不等于订单数量,请正确入库', + title: '实际入库总数量不能超过入库数量,请正确入库', // url: '/pages/user/index' }); } @@ -288,10 +344,10 @@ export default class OfflineStorage extends BasePage { this.list.forEach((item) => { insertTarynumber = insertTarynumber + parseInt(item.number); }); - let ordernumber = model.orderNoItemList.putQuantity; + let ordernumber = this.number1 || 0; if (insertTarynumber >= ordernumber) { (this.$refs.uToast as any).show({ - title: '入库数量大于订单数量,请先删除再入库', + title: '实际入库数量不能大于入库数量,请先删除再入库', // url: '/pages/user/index' }); return; @@ -311,23 +367,29 @@ export default class OfflineStorage extends BasePage { }); return; } - - await this.model.insertTary(this.form5); - if (this.model.SubmitCode == '200') { - (this.$refs.uToast as any).show({ - title: '成功', - type: 'success', - }); - this.show = false; - this.getlist(); - } else { - (this.$refs.uToast as any).show({ - title: '失败', - type: 'error', - }); - this.show = false; - this.getlist(); - } + this.list.push({ + number: this.form5.number, + wlCode: this.form5.wlCode, + sn: this.form5.sn, + //batchNumber: this.orderNoItemList.batchNumber, + }); + this.show = false; + // await this.model.insertTary(this.form5); + // if (this.model.SubmitCode == '200') { + // (this.$refs.uToast as any).show({ + // title: '成功', + // type: 'success', + // }); + // this.show = false; + // this.getlist(); + // } else { + // (this.$refs.uToast as any).show({ + // title: '失败', + // type: 'error', + // }); + // this.show = false; + // this.getlist(); + // } // //入库后的查询下面列表的接口 // await this.model.queryOrderNo(this.form5); // this.list = model.orderNoItemList; diff --git a/src/pages/wms/product/OfflineStorage/model.ts b/src/pages/wms/product/OfflineStorage/model.ts index c3b8913..314d9f5 100644 --- a/src/pages/wms/product/OfflineStorage/model.ts +++ b/src/pages/wms/product/OfflineStorage/model.ts @@ -15,10 +15,12 @@ export class OfflineStorage extends VuexModule { orderNoItemList: any = []; @MutationAction async queryOrderNo(orderNo: any) { - const result: any = await http.get(url.lanjuwms.product.OfflineStorage.queryinformation + orderNo, { - headers: { - poolName: session.PoolName, - }, + const result: any = await http.post(url.lanjuwms.product.OfflineStorage.queryinformation, { + workOrder: orderNo, + factoryCode: session.FactoryCode, + // headers: { + // poolName: session.PoolName, + // }, }); // http.defaults.headers.common['Accept-Language'] = session.PoolName; const orderNoItemList = result.data; @@ -47,10 +49,23 @@ export class OfflineStorage extends VuexModule { } @MutationAction async handPut(params: any) { - const result: any = await http.post(url.lanjuwms.product.OfflineStorage.handPut, params); + const result: any = await http.post(url.lanjuwms.product.OfflineStorage.WmsProductPutByWorkOrderConfirm, params); const SubmitCode = result.code; return { SubmitCode }; } + warehouselist: any = []; + @MutationAction + async getwarehouselist() { + const result = await http.post(url.lanjuwms.raw.ProductionREQ.warehouselist, { + factoryCode: session.FactoryCode, + }); + const warehouselist = result.data.map((element: any) => ({ + label: element.warehouseName, + value: element.warehouseCode, + ...element, + })); + return { warehouselist }; + } } export default getModule(OfflineStorage); diff --git a/src/utils/url.ts b/src/utils/url.ts index 7c1aed2..340533b 100644 --- a/src/utils/url.ts +++ b/src/utils/url.ts @@ -41,11 +41,12 @@ export const url = { product: { // 下线入库 OfflineStorage: { - queryinformation: qianzhuione + '/wms/put/s/', + queryinformation: qianzhuione + '/wms/WmsToWCSmission/WmsProductPutByWorkOrderquery', insertTary: qianzhuione + '/wms/tray/insertTary', deleteTray: qianzhuione + '/wms/tray/deleteTray', handPut: qianzhuione + '/wms/tray/wms/handPut', list: qianzhuione + '/wms/tray/listTary', + WmsProductPutByWorkOrderConfirm: qianzhuione + '/wms/WmsToWCSmission/WmsProductPutByWorkOrderConfirm', }, // 销售出库/sellout/showProduceCode/ /sellout/s/订单号/产品编码