diff --git a/src/pages/product/inbound/finishProductOffline/index.vue b/src/pages/product/inbound/finishProductOffline/index.vue index 6946e2c..0689aec 100644 --- a/src/pages/product/inbound/finishProductOffline/index.vue +++ b/src/pages/product/inbound/finishProductOffline/index.vue @@ -15,6 +15,9 @@ + + {{ $t('message.product_add') }} + @@ -142,8 +145,6 @@ export default class finishProductOfflineDom extends BasePage { // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕 async onReady() { this.$form.setRules(this.rules); - await model.queryReturningTypeList(); - this.form.aimWl = model.firstLocation; } /** * 处理选择行 选中一条执行一次 @@ -155,6 +156,7 @@ export default class finishProductOfflineDom extends BasePage { const { lineData: item } = line; this.selectMaterielList.push(item); }); + console.log('this.selectMaterielList', this.selectMaterielList); } back() { this.form.barCode = ''; @@ -211,20 +213,11 @@ export default class finishProductOfflineDom extends BasePage { } else { this.$form.validate(async (valid: boolean) => { if (!valid) return; - // if (!this.form.aimWl.value) { - // uni.showToast({ - // icon: 'none', - // title: this.$t('message.product_Tip3') as string, - // }); - // return; - // } this.selectMaterielList.forEach((item: any) => { item.factoryCode = session.factoryCode; //工厂 item.warehouseCode = session.warehouseCode; //仓库 item.regionCode = session.regionCode; //区域 item.areaCode = session.regionCode; //库区 - // item.locCode = this.form.dockName; //库位 - // item.locCode = this.form.aimWl.value; //库位 item.operator = session.loginName; //操作人 item.loginName = session.loginName; //操作人 }); @@ -242,11 +235,31 @@ export default class finishProductOfflineDom extends BasePage { this.$table.onEmpty(); } } - getBarcode() { - if (this.form.aimWl.value == undefined) { - this.customToast(this.$t('message.product_Tip3') as string); + add() { + if (!this.form.barCode) { + this.customToast(this.$t('message.barcode') as string); return; } + if (this.materielList.length == 0) { + this.materielList.push(this.model.materielList[0]); + this.materielList[this.materielList.length - 1].locCode = this.form.aimWl.label; + } else { + let flag = 0; + for (let i = 0; i < this.materielList.length; i++) { + if (this.form.barCode == this.materielList[i].barcode) { + flag = 1; + break; + } + } + if (flag == 0) { + this.materielList.push(this.model.materielList[0]); + this.materielList[this.materielList.length - 1].locCode = this.form.aimWl.label; + } else { + this.customToast(this.$t('message.product_Tip7') as string); + } + } + } + async getBarcode() { if (this.form.barCode.length < 20) { this.customToast(this.$t('message.barCodeLength') as string); return; @@ -255,40 +268,11 @@ export default class finishProductOfflineDom extends BasePage { this.customToast(this.$t('message.standard') as string); return; } - console.log('this.form', this.form); - if (this.materielList.length == 0) { - this.model.queryOrderInInfo(this.form).then(async () => { - await this.materielList.push(this.model.materielList[0]); - this.$table.onCheckAllTap(); - }); - } else { - let flag = 0; - for (let i = 0; i < this.materielList.length; i++) { - console.log('11111', this.materielList[i]); - if (this.form.barCode == this.materielList[i].barcode) { - flag = 1; - break; - } - } - if (flag == 0) { - this.model.queryOrderInInfo(this.form).then(async () => { - await this.$table.onCheckAllTap(); - await this.materielList.push(this.model.materielList[0]); - this.$table.onCheckAllTap(); - }); - } else { - this.customToast(this.$t('message.product_Tip7') as string); - } + await this.model.queryOrderInInfo(this.form); + if (this.model.searchCode == '1') { + await this.model.queryTypeList(this.form.barCode); + this.form.aimWl = model.firstLocation; } - const item = { - ...this.form, - barCode: String(''), - }; - this.firstFocus = false; - setTimeout(() => { - this.form = item; - this.firstFocus = true; - }, 0); } } diff --git a/src/pages/product/inbound/finishProductOffline/model.ts b/src/pages/product/inbound/finishProductOffline/model.ts index 9dde266..efd0d47 100644 --- a/src/pages/product/inbound/finishProductOffline/model.ts +++ b/src/pages/product/inbound/finishProductOffline/model.ts @@ -24,6 +24,7 @@ export class PickingModule extends VuexModule { */ returningTypeList: any[] = []; firstLocation: any = {}; + searchCode: any = ''; /** * 物料列表 */ @@ -59,6 +60,22 @@ export class PickingModule extends VuexModule { // firstLocation.value = firstLocation.locationCode + '(' + firstLocation.sendSpot + ')'; return { returningTypeList, firstLocation }; } + //根据扫描的条码推荐库位 + @MutationAction + async queryTypeList(prodCode: any) { + const res: any = await http.post(url.inbound.finishProductOffline.SearchKuwei, { + factoryCode: session.factoryCode, + loginName: session.loginName, + prodCode: prodCode, + }); + console.log('data', res.data); + const returningTypeList = res.data.map((item: any) => ({ + label: item.locationCode, + value: item.locationCode + '(' + item.sendSpot + ')', + })); + const firstLocation = returningTypeList[0]; + return { returningTypeList, firstLocation }; + } /** * 查询条码号 * @param orderNo @@ -82,10 +99,11 @@ export class PickingModule extends VuexModule { //uni.showToast({ icon: "none", title: msg }); vm.customToast(msg); } + const searchCode = code; const materielList2 = []; materielList2.push(data); const materielList = materielList2; - return { materielList }; + return { searchCode, materielList }; } /** * 确认按钮 diff --git a/src/utils/url.ts b/src/utils/url.ts index 34983b5..171ff34 100644 --- a/src/utils/url.ts +++ b/src/utils/url.ts @@ -143,6 +143,7 @@ export const url = { inbound: { finishProductOffline: { kuwei: '/wmspda/fg/getMdLocation', + SearchKuwei: '/wmspda/fg/getMdLocationProd', barcode: '/wmspda/product/finished/show-info', confirm: '/wmspda/product/finished/batch-offline', },