From 38a408ecbb8d34610b8d65815504b11da9f4601d Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Thu, 21 Dec 2023 13:13:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98=E8=BD=AC?= =?UTF-8?q?=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/request2.js | 13 + common/array.js | 10 +- mycomponents/status/statusEdit.vue | 2 +- pages/inventoryMove/coms/comMove.vue | 228 ++++++++++++------ pages/inventoryMove/coms/comMoveRecord.vue | 9 +- pages/inventoryMove/coms/comMovebalance.vue | 4 +- pages/inventoryMove/record/holdToOkRecord.vue | 2 +- .../record/holdToScrapRecord.vue | 2 +- pages/inventoryMove/record/moveFreeRecord.vue | 2 +- pages/inventoryMove/record/okToHoldRecord.vue | 2 +- .../inventoryMove/record/oktoScrapRecord.vue | 2 +- .../record/scrapToHoldRecord.vue | 2 +- static/config.json | 2 +- 13 files changed, 191 insertions(+), 89 deletions(-) diff --git a/api/request2.js b/api/request2.js index 94572f52..396c52c8 100644 --- a/api/request2.js +++ b/api/request2.js @@ -1134,6 +1134,19 @@ export function inventoryMoveSubmit(params) { }); } +/** + * 库存转移记录 提交 + * @param {*} 任务id + * + */ +export function inventoryMoveRecordSubmit(params) { + return request({ + url: baseApi + "/wms/inventorymove-record-main/create", + method: "post", + data: params, + }); +} + /** * 盘点 任务 * status 任务状态 diff --git a/common/array.js b/common/array.js index b570adaf..5bc8ea6f 100644 --- a/common/array.js +++ b/common/array.js @@ -233,19 +233,19 @@ export function getEditRemoveOption() { export function getInventoryStatusArray() { let array = [{ text: '待检', - value: "kcztINSP" + value: "INSP" }, { text: '合格', - value: "kcztOK" + value: "OK" }, { text: '不合格', - value: "kcztNOK" + value: "NOK" }, { text: '隔离', - value: "kcztHOLD" + value: "HOLD" }, { text: '报废', - value: "kcztSCRAP" + value: "SCRAP" }] return array; } diff --git a/mycomponents/status/statusEdit.vue b/mycomponents/status/statusEdit.vue index 22473275..f626d4e2 100644 --- a/mycomponents/status/statusEdit.vue +++ b/mycomponents/status/statusEdit.vue @@ -75,7 +75,7 @@ close() { this.$refs.popup.close() }, - statusStyle: function(val) { + statusStyle(val) { return getInventoryStatusStyle(val); }, tagClick(item) { diff --git a/pages/inventoryMove/coms/comMove.vue b/pages/inventoryMove/coms/comMove.vue index 3dd792d0..8e4959a8 100644 --- a/pages/inventoryMove/coms/comMove.vue +++ b/pages/inventoryMove/coms/comMove.vue @@ -10,7 +10,8 @@ + :isShowStatus="isShowStatus" @updateData="updateData" @removePack='removePack' + :allowEditStatus ="allowEditStatus"> @@ -34,7 +35,7 @@ + :locationTypeList="fromlocationTypeList"> @@ -49,13 +50,21 @@ import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import comMessage from '@/mycomponents/common/comMessage.vue' import { - getBalanceByUniquecode, - } from '@/api/request.js'; + inventoryMoveRecordSubmit, + } from '@/api/request2.js'; import { getDirectoryItemArray } from '@/common/directory.js'; + import { + getPrecisionStrategyList + } from '@/common/balance.js'; + + import { + getPackingNumberAndBatchByList + } from '@/common/basic.js'; + import { getBusinessType, createItemInfo, @@ -84,9 +93,14 @@ // default: "" // }, isShowStatus: { + type: Boolean, + default: true + }, + allowEditStatus: { type: Boolean, default: false }, + businessTypeCode: { type: String, default: "Move" @@ -95,14 +109,17 @@ data() { return { fromLocationCode: "", - fromLocationInfo: {}, - fromLocationTypeArray: [], toLocationCode: "", toLocationInfo: {}, toLocationTypeArray: [], toInventoryStatus: "", businessType: {}, //业务类型 detailSource: [], //绑定在页面上的数据源 + title:"", + dataContent:{}, + toWarehouseCode:"", + fromlocationTypeList: [], + tolocationTypeList: [], } }, @@ -114,7 +131,7 @@ this.tolocationTypeList = res.tolocationTypeList; this.showFromLocationPopup(); } else { - this.$refs.comMessage.showBreakMessage(res.message ); + this.showErrorMessage(res.message) } }); this.updateTitle(); @@ -126,27 +143,27 @@ methods: { updateTitle() { - var name ="" - if(this.businessTypeCode=="Move"){ - name = "库存转移记录"; + if(this.businessTypeCode=="InventoryMoveRecord"){ + this.title = "库存转移记录"; + this.toInventoryStatus = "OK" }else if(this.businessTypeCode=="HoldToOkRecord"){ - name = "隔离转合格记录"; + this.title = "隔离转合格记录"; this.toInventoryStatus = "OK" }else if(this.businessTypeCode=="HoldToScrapRecord"){ - name = "隔离转报废记录"; + this.title = "隔离转报废记录"; this.toInventoryStatus = "SCRAP" }else if(this.businessTypeCode=="OkToHoldRecord"){ - name = "合格转隔离记录"; + this.title = "合格转隔离记录"; this.toInventoryStatus ="HOLD" }else if(this.businessTypeCode=="OktoScrapRecord"){ - name = "合格转报废记录"; + this.title = "合格转报废记录"; this.toInventoryStatus ="SCRAP" }else if(this.businessTypeCode=="ScrapToHoldRecord"){ - name = "报废转隔离记录"; + this.title = "报废转隔离记录"; this.toInventoryStatus ="HOLD" } uni.setNavigationBarTitle({ - title: name + title: this.title }) }, openScanPopup() { @@ -166,11 +183,11 @@ this.getfromLocationCode(location) }, getfromLocationCode(location) { - this.fromLocationInfo = location; this.fromLocationCode = location.code; this.openScanPopup(); }, getToLocationCode(location, code) { + this.toWarehouseCode = location.warehouseCode this.toLocationCode = code; }, getScanResult(result) { @@ -188,6 +205,8 @@ if (item == undefined) { var itemp = createItemInfo(balance,pack); let newDetail = createDetailInfo(balance, pack); // + newDetail.inventoryStatus =balance.inventoryStatus; + newDetail.toInventoryStatus =this.toInventoryStatus itemp.subList.push(newDetail); this.detailSource.push(itemp) } else { @@ -203,6 +222,8 @@ if (detail == undefined) { let newDetail = createDetailInfo(balance, pack); + newDetail.inventoryStatus = balance.inventoryStatus; + newDetail.toInventoryStatus =this.toInventoryStatus item.subList.push(newDetail); } else { this.showErrorMessage(balance.packingNumber + "已经在列表中") @@ -212,41 +233,6 @@ }, - createItemInfo(balance, pack) { - let item = { - itemCode: pack.itemCode, - itemName: pack.itemName, - stdPackQty: pack.stdPackQty, - stdPackUnit: pack.stdPackUnit, - qty: balance.qty, - handleQty: 0, - uom: pack.uom, - subList: [] - } - return item; - }, - - createDetailInfo(data, pack) { - data.scaned = true; - data.toInventoryStatus = this.toInventoryStatus == "" ? data.inventoryStatus : this.toInventoryStatus; - let detail = {}; - Object.assign(detail, data) - detail.balanceQty = detail.qty - detail.package = pack - return detail; - }, - - calcHandleQty() { - for (let item of this.detailSource) { - item.qty = 0; - for (let detail of item.subList) { - if (detail != undefined) { - item.qty += detail.qty - } - } - } - this.$forceUpdate(); - }, showErrorMessage(message) { this.$refs.comMessage.showErrorMessage(message, res => { @@ -283,35 +269,133 @@ } } }, - commit() { - uni.showLoading({ - title: "提交中....", - mask: true - }); + showCommitSuccessMessage(hint) { + this.$refs.comMessage.showSuccessMessage(hint, res => { + this.fromLocationCode = ''; + this.subList = []; + this.detailSource = []; + this.toLocationCode = ''; + this.dataContent = {} + this.toWarehouseCode = "" + }) + }, + commit() { + + if (this.toLocationCode == "") { + this.showMessage("请先选择目标库位") + return; + } if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { - console.log("提交参数", JSON.stringify(params)); + //查询管理模式 + uni.showLoading({ + title: "提交中....", + mask: true + }); + this.managementList = []; + var precisionStrategParams = this.setPrecisionStrategParams() + + getPrecisionStrategyList(precisionStrategParams, res => { + if (res.success) { + this.managementList = res.list; + var params = this.setParams() + console.log("提交" + JSON.stringify(params)) + inventoryMoveRecordSubmit(params).then(res => { + uni.hideLoading() + if (res.data) { + this.showCommitSuccessMessage("提交成功
生成"+this.title+"记录
" + res.data) + } else { + this.showErrorMessage("提交失败[" + res.msg + "]") + } + }).catch(error => { + uni.hideLoading() + this.showErrorMessage(error) + }) - //直接创建记录 - //采购退货直接出库,不用查询管理模式 - var params = this.setRecordParams(true) - console.log("提交参数", JSON.stringify(params)); - - purchaseReturnRecordSubmit(params).then(res => { - uni.hideLoading() - if (res.data) { - this.showCommitSuccessMessage("提交成功
生成采购退货记录" + res.data) } else { - this.showErrorMessage("提交失败" + res.msg) + uni.hideLoading(); + this.showErrorMessage(res.message); } - }).catch(error => { - uni.hideLoading() - this.showErrorMessage(error) + }) + } else { - this.showErrorMessage("没有要提交的数据") + this.showErrorMessage("没有要提交的数据,请先扫描") } + + }, + + setPrecisionStrategParams() { + var itemList = [] + this.detailSource.forEach(item => { + item.subList.forEach(detail => { + if (detail.scaned) { + detail.toLocationCode = this.toLocationCode; + var filterResult = itemList.filter(res => { + if (res.itemCode == item.itemCode && + detail.toLocationCode == res.locationCode) { + return res + } + }) + //去掉重复元素 + if (filterResult.length == 0) { + var result = { + itemCode: item.itemCode, + locationCode: detail.toLocationCode + } + itemList.push(result) + } + + } + }) + }) + return itemList; + }, + setParams() { + + var subList = [] + var creator = this.$store.state.user.id + this.detailSource.forEach(item => { + item.subList.forEach(detail => { + if (detail.scaned) { + var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, + detail.packingNumber, detail.toLocationCode, detail.batch); + detail.itemCode = detail.itemCode; + detail.itemName = detail.package.itemName; + detail.itemDesc1 = detail.package.itemDesc1; + detail.itemDesc2 = detail.package.itemDesc2; + + detail.fromInventoryStatus = detail.inventoryStatus; + // detail.toInventoryStatus = this.toInventoryStatus; + + detail.fromPackingNumber = info.packingNumber; + detail.toPackingNumber = info.packingNumber; + + detail.fromContainerNumber = detail.containerNumber; + detail.toContainerNumber = detail.containerNumber + + detail.fromBatch = info.batch; + detail.toBatch = info.batch; + + detail.fromLocationCode = detail.locationCode; + detail.toLocationCode = detail.toLocationCode; + + subList.push(detail) + } + }) + }) + this.dataContent.subList = subList; + this.dataContent.creator = creator; + this.dataContent.fromWarehouseCode = this.detailSource[0].subList[0].warehouseCode; + this.dataContent.toWarehouseCode = this.toWarehouseCode; + this.dataContent.businessType = this.businessTypeCode; + return this.dataContent; }, + + + + + } } diff --git a/pages/inventoryMove/coms/comMoveRecord.vue b/pages/inventoryMove/coms/comMoveRecord.vue index 837b7ddf..5df8a95a 100644 --- a/pages/inventoryMove/coms/comMoveRecord.vue +++ b/pages/inventoryMove/coms/comMoveRecord.vue @@ -24,7 +24,7 @@ - + @@ -75,9 +75,14 @@ default: "" }, isShowStatus: { + type: Boolean, + default: true + }, + allowEditStatus: { type: Boolean, default: false - } + }, + }, watch: { diff --git a/pages/inventoryMove/coms/comMovebalance.vue b/pages/inventoryMove/coms/comMovebalance.vue index 95a78b0d..10dd29ab 100644 --- a/pages/inventoryMove/coms/comMovebalance.vue +++ b/pages/inventoryMove/coms/comMovebalance.vue @@ -19,14 +19,14 @@ :fromInventoryStatus="fromInventoryStatus" :toInventoryStatus="toInventoryStatus"> - + diff --git a/pages/inventoryMove/record/holdToOkRecord.vue b/pages/inventoryMove/record/holdToOkRecord.vue index 83724f83..76c60d7c 100644 --- a/pages/inventoryMove/record/holdToOkRecord.vue +++ b/pages/inventoryMove/record/holdToOkRecord.vue @@ -1,6 +1,6 @@ diff --git a/pages/inventoryMove/record/holdToScrapRecord.vue b/pages/inventoryMove/record/holdToScrapRecord.vue index 706ca3c8..9887e2d0 100644 --- a/pages/inventoryMove/record/holdToScrapRecord.vue +++ b/pages/inventoryMove/record/holdToScrapRecord.vue @@ -1,6 +1,6 @@ diff --git a/pages/inventoryMove/record/moveFreeRecord.vue b/pages/inventoryMove/record/moveFreeRecord.vue index 258ba26f..45c0dadc 100644 --- a/pages/inventoryMove/record/moveFreeRecord.vue +++ b/pages/inventoryMove/record/moveFreeRecord.vue @@ -1,6 +1,6 @@ diff --git a/pages/inventoryMove/record/okToHoldRecord.vue b/pages/inventoryMove/record/okToHoldRecord.vue index 422a1694..db8932c0 100644 --- a/pages/inventoryMove/record/okToHoldRecord.vue +++ b/pages/inventoryMove/record/okToHoldRecord.vue @@ -1,6 +1,6 @@ diff --git a/pages/inventoryMove/record/oktoScrapRecord.vue b/pages/inventoryMove/record/oktoScrapRecord.vue index 4e67af57..79e69ce3 100644 --- a/pages/inventoryMove/record/oktoScrapRecord.vue +++ b/pages/inventoryMove/record/oktoScrapRecord.vue @@ -1,6 +1,6 @@ diff --git a/pages/inventoryMove/record/scrapToHoldRecord.vue b/pages/inventoryMove/record/scrapToHoldRecord.vue index d4efb820..6a52c442 100644 --- a/pages/inventoryMove/record/scrapToHoldRecord.vue +++ b/pages/inventoryMove/record/scrapToHoldRecord.vue @@ -1,6 +1,6 @@ diff --git a/static/config.json b/static/config.json index 7426682e..f1ce854b 100644 --- a/static/config.json +++ b/static/config.json @@ -18,7 +18,7 @@ "request_url": { "name": "request_url", - "value": "http://dev.ccwin-in.com:25100/api/admin-api", + "value": "http://192.168.0.180:12080/admin-api", "dev2": "http://192.168.0.157:12080/admin-api", "chefang": "http://192.168.0.180:12080/admin-api", "chenxinming": "http://192.168.0.230:12080/admin-api",