From 5f9780a983655f9249792c1b767282deec012cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Tue, 19 Mar 2024 15:44:32 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90NEV-PC=E3=80=91=E5=9B=9E=E6=94=B6?= =?UTF-8?q?=E6=96=99recDetails=E4=BC=A0=E5=8F=82=E6=9B=B4=E6=94=B9+?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=E6=89=93=E5=8D=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../materialsAdjustmentFunc.vue | 205 ++++++++++++------ 1 file changed, 136 insertions(+), 69 deletions(-) diff --git a/fe/PC/src/views/inventoryManage/recycledMaterials/materialsAdjustmentFunc.vue b/fe/PC/src/views/inventoryManage/recycledMaterials/materialsAdjustmentFunc.vue index 8434c2d77..ed367a5cd 100644 --- a/fe/PC/src/views/inventoryManage/recycledMaterials/materialsAdjustmentFunc.vue +++ b/fe/PC/src/views/inventoryManage/recycledMaterials/materialsAdjustmentFunc.vue @@ -73,7 +73,6 @@
原料 { return this.getFilterList(type, val, "basedata/Item-Basic",this.isFilter("isRecycled","true"),1000)}, + focus: (type,val) => { return this.getFilterList(type, val, "basedata/Item-Basic", + this.isFilter("isRecycled","true"),1000 + )}, // searchButton: (val) => { this.showSerarchPage(val, 'basedata/Item-Basic', 'ItemBasic', '物品选择', this.addPopData_HB) }, width:"auto" }, @@ -243,7 +245,7 @@ export default { //混拌料表头信息 addPopColumns_HB:[ { type: "filterSelect", label: "物品代码", prop: "itemCode", optionsLabel: "name", optionsValue: "code", - focus: (type,val) => { return this.getFilterList(type, val, "basedata/Item-Basic",this.isFilterForHB(),1000)}, + focus: (type,val) => { return this.getFilterList(type, val, "basedata/Item-Basic",this.isFilter("isRecycled","false"),1000)}, // searchButton: (val) => { this.showSerarchPage(val, 'basedata/Item-Basic', 'ItemBasic', '物品选择', this.addPopData_HB) }, width:"auto", }, @@ -294,24 +296,24 @@ export default { }, methods:{ // 混拌料物品筛选,不可选粉碎料选过的 - isFilterForHB(){ - let _items = [] - this.addPopData_FS.forEach(item=>{ - if(item.itemCode)_items.push(item.itemCode) - }) - if(_items.length <= 0){ - return [] - } - let filter = [ - { - logic: "And", - column: 'code', - action: "NotIn", - value: JSON.stringify(_items) - } - ] - return filter - }, + // isFilterForHB(){ + // let _items = [] + // this.addPopData_FS.forEach(item=>{ + // if(item.itemCode)_items.push(item.itemCode) + // }) + // if(_items.length <= 0){ + // return [] + // } + // let filter = [ + // { + // logic: "And", + // column: 'code', + // action: "NotIn", + // value: JSON.stringify(_items) + // } + // ] + // return filter + // }, //过滤查询条件 isFilter (val, data) { let filter = [ @@ -434,32 +436,37 @@ export default { } _details.push(_item) }) - let _recDetail= [ - { + + let _recDetail= [] + this.addPopData_FS.forEach((item,index)=>{ + let _itemInfoFS = this.itemStagingLists[item.itemCode] + let _locationInfoFS = this.locationStagingLists[item.locationCode] + let _item = { remark: null, - itemCode: _toItemInfo.code || null, - itemName: _toItemInfo.name || null, - itemDesc1: _toItemInfo.desc1 || null, - itemDesc2: _toItemInfo.desc2 || null, - lot: _toData_new.lot || null, - supplierBatch: _toData_new.supplierBatch || null, - arriveDate: _toData_new.arriveDate || null, - produceDate: _toData_new.produceDate || null, - expireDate: _toData_new.expireDate || null, - packingCode: _toData_new.code, - containerCode: _toData_new.containerCode || null, - uom: _toItemInfo.basicUom || null, - qty: _toData.qty, - stdPackQty: Number(_toItemInfo.stdPackQty) || 0, - locationCode: _toData.locationCode || null, - locationArea: _toLocationInfo.areaCode || null, - locationGroup: _toLocationInfo.locationGroupCode || null, - locationErpCode: _toLocationInfo.erpLocationCode || null, + itemCode: _itemInfoFS.code || null, + itemName: _itemInfoFS.name || null, + itemDesc1: _itemInfoFS.desc1 || null, + itemDesc2: _itemInfoFS.desc2 || null, + lot: this.newPackArr[index].lot || null, + supplierBatch: this.newPackArr[index].supplierBatch || null, + arriveDate: this.newPackArr[index].arriveDate || null, + produceDate: this.newPackArr[index].produceDate || null, + expireDate: this.newPackArr[index].expireDate || null, + packingCode: this.newPackArr[index].code, + containerCode: this.newPackArr[index].containerCode || null, + uom: _itemInfoFS.basicUom || null, + qty: item.qty, + stdPackQty: Number(_itemInfoFS.stdPackQty) || 0, + locationCode: item.locationCode || null, + locationArea: _locationInfoFS.areaCode || null, + locationGroup: _locationInfoFS.locationGroupCode || null, + locationErpCode: _locationInfoFS.erpLocationCode || null, status: 1, - warehouseCode: _toLocationInfo.warehouseCode || null, + warehouseCode: _locationInfoFS.warehouseCode || null, reasonCode: null, } - ] + _recDetail.push(_item) + }) let _finalData = { tenantId: null, remark: "", @@ -472,11 +479,45 @@ export default { details:_details, recDetails:_recDetail } + itemTransformNewCreate(_finalData) .then(item=>{ - this.$successMsg("提交成功!") - this.initAddPopData() this.Loading.appMainLoading = false + // 提示是否打印箱码,之后在清除数据 + this.$confirm('提交成功, 是否需要打印箱标签?', '提示', { + confirmButtonText: '打印', + cancelButtonText: '关闭', + type: 'warning' + }).then(() => { + let _HBPack = this.newPackArr[this.newPackArr.length - 1] + let _printData = { + supplierSimpleName:_HBPack.supplierSimpleName || "", + supplierCode:_HBPack.supplierCode || "", + contacts:_HBPack.contacts || "", + customerAddressCode:_HBPack.customerAddressCode || "", + remark:_HBPack.remark || "", + planArriveDate:_HBPack.planArriveDate || "", + poNumber:_HBPack.poNumber || "", + asnNumber:_HBPack.asnNumber || "", + details:[], + } + _HBPack.packingCode = _HBPack.code + _printData.details.push(_HBPack) + let _data = initPrintPackingCodeData(_printData); + this.Loading.appMainLoading = true + this.Print(_data) + .then(data=>{ + this.initAddPopData() + this.Loading.appMainLoading = false + }) + .catch(err=>{ + this.$errorMsg(`打印失败,可去标签查询中重新打印,箱标签为${_HBPack.packingCode}`) + this.initAddPopData() + this.Loading.appMainLoading = false + }) + }).catch(() => { + this.initAddPopData() + }); }) .catch(err=>{ this.$errorMsg("提交失败!请重试") @@ -515,7 +556,7 @@ export default { itemName: _item_info.name || null, itemDesc1: _item_info.desc1 || null, itemDesc2: _item_info.desc2 || null, - lot: formatTimeStampToNorm(new Date(),'date'), + lot: formatTimeStampToNorm(new Date(),'date').replaceAll("-",""), arriveDate: getNowToT(), produceDate: getNowToT(), expireDate: "9999-12-31", @@ -536,11 +577,11 @@ export default { team: null, shift: null, specifications: null, - supplierBatch: null,//todo - supplierName: null,//todo:basedata/supplier-item/list中无此字段 + supplierBatch: null, + supplierName: null, supplierSimpleName: _supplier_info.supplierSimpleName, supplierItemCode: _supplier_info.supplierItemCode, - supplierItemName: null,//todo:basedata/supplier-item/list中无此字段 + supplierItemName: _supplier_info.itemName, labelType: 1,//采购标签 planArriveDate: "9999-12-31", remark:null, @@ -555,7 +596,8 @@ export default { }, // 提交 addPopSureHandle(){ - // 检测【粉碎料】信息是否填全 + + // 验证【粉碎料】信息是否填全 let _err_FS=0 this.addPopData_FS.forEach(item=>{ if(!item.itemCode || Number(item.qty <= 0) || !item.locationCode || !item.supplierCode || !item.poNumber){ @@ -563,10 +605,10 @@ export default { } }) if(_err_FS > 0){ - return this.$warningMsg("粉碎料信息未填全,请填写") + return this.$warningMsg("【粉碎料】信息未填全,请填写") } - // 检测【原料】信息是否填全 + // 验证【原料】信息是否填全 let _err_YL=0 this.addPopData_YL.forEach(item=>{ if(!item.itemCode || Number(item.inventoryQty <= 0) || Number(item.qty <= 0) || !item.locationCode || !item.packingCode || item.packingCode.length <= 0){ @@ -574,10 +616,21 @@ export default { } }) if(_err_YL > 0){ - return this.$warningMsg("原料信息未填全,请填写") + return this.$warningMsg("【原料】信息未填全,请填写") + } + + // 验证 【原料】的数量是否符合要求 + let notPass_YL = 0 + this.addPopData_YL.forEach(item=>{ + if(item.qty > item.inventoryQty){ + notPass_YL++ + } + }) + if(notPass_YL > 0){ + return this.$warningMsg("【原料】数量不可以大于库存数量,请更改") } - // 检测【混拌料】信息是否填全 + // 验证【混拌料】信息是否填全 let _err_HB=0 this.addPopData_HB.forEach(item=>{ if(!item.itemCode || Number(item.qty <= 0) || !item.locationCode || !item.supplierCode || !item.poNumber){ @@ -585,7 +638,15 @@ export default { } }) if(_err_HB > 0){ - return this.$warningMsg("混拌料信息未填全,请填写") + return this.$warningMsg("【混拌料】信息未填全,请填写") + } + + // 验证混拌料的值,不可以大于粉碎料+原料 + let _maxQty_HB = 0 + this.addPopData_FS.forEach(item=>{ _maxQty_HB += Number(item.qty) }) + this.addPopData_YL.forEach(item=>{ _maxQty_HB += Number(item.qty) }) + if(Number(this.addPopData_HB[0].qty) > _maxQty_HB){ + return this.$warningMsg(`【混拌料】数量,不可大于${_maxQty_HB} (粉碎料数量加原料数量的总和)`) } // 全部通过验证 @@ -605,12 +666,12 @@ export default { pushFS(data){ if(data[1].prop == "itemCode"){ this.itemStagingLists[data[2]] = data[0] - if(data[2] == this.addPopData_HB[0].itemCode){ - this.$warningMsg("不可选择与混拌料相同的物料") - this.$nextTick(()=>{ - this.addPopData_FS[data[3].$index].itemCode = null - }) - } + // if(data[2] == this.addPopData_HB[0].itemCode){ + // this.$warningMsg("不可选择与混拌料相同的物料") + // this.$nextTick(()=>{ + // this.addPopData_FS[data[3].$index].itemCode = null + // }) + // } this.addPopData_FS[data[3].$index].supplierCode = null this.addPopData_FS[data[3].$index].poNumber = null this.addPopData_FS[data[3].$index].locationCode = null @@ -627,8 +688,10 @@ export default { }, // 粉碎料清空 clearHandle_FS(item,scope){ - this.addPopData_FS[scope.$index].supplierCode = null - this.addPopData_FS[scope.$index].poNumber = null + if(item.prop == "itemCode" || item.prop == "supplierCode"){ + this.addPopData_FS[scope.$index].supplierCode = null + this.addPopData_FS[scope.$index].poNumber = null + } }, // 原料下拉 pushYL(data){ @@ -667,10 +730,12 @@ export default { }, // 原料清空 clearHandle_YL(item,scope){ - this.addPopData_YL[scope.$index].packingCode = null - this.addPopData_YL[scope.$index].inventoryQty = null - this.addPopData_YL[scope.$index].locationCode = null - this.addPopData_YL[scope.$index].qty = null + if(item.prop == "itemCode" || item.prop == "packingCode"){ + this.addPopData_YL[scope.$index].packingCode = null + this.addPopData_YL[scope.$index].inventoryQty = null + this.addPopData_YL[scope.$index].locationCode = null + this.addPopData_YL[scope.$index].qty = null + } }, // 混拌料下拉 pushHB(data){ @@ -691,8 +756,10 @@ export default { }, // 粉碎料清空 clearHandle_HB(item,scope){ - this.addPopData_HB[scope.$index].supplierCode = null - this.addPopData_HB[scope.$index].poNumber = null + if(item.prop == "itemCode" || item.prop == "supplierCode"){ + this.addPopData_HB[scope.$index].supplierCode = null + this.addPopData_HB[scope.$index].poNumber = null + } }, } };