关于生产领料的超领,系统逻辑大概是这样的,如果生产BOM的已发放数量超过了Max(估计数量,开始的数量),如果在新建一笔领料,在建一笔退料(退料数量如果小于超过已放数量超过的那一部分)系统就会报这个错,根据代码的逻辑也是这样判断的,系统认为你已经发超了,会尝试清除你当前生产BOM的剩余数量,但是如果你还有在单的领料,退料时,系统就会判断,你当前已发超的数量-需要退的数量>0,系统就要求你 必须先处理这笔领料。如下图:
已发放数量已经超过MAX(估计,已开始)
建一笔领料数量20和和两笔退料数量分别是10和30。
图一:数量为20的领料
图二:数量为10的退料,无法正常过账
图三:数量为30 的退料,能正常过账
解决办法
1:遇到这种情况,让用户主动去清除这笔在单的领料(这样估计客户很难接受)
2:用户不能接受,那就只能去修改代码了
具体修改地方有ProdJournalBOM表里的两个计算剩余数方法
InventQty calcRemainInventPhysical(ProdBOM prodBOM) { InventQty inventRemain; InventQty remainInventFinancial; if (! prodBOM.RecId) prodBOM = ProdBOM::findTransId(this.InventTransId); if (!this.InventReturnFlag) { inventRemain = prodBOM.RemainInventPhysical - this.InventConsump; if (inventRemain* prodBOM.RemainInventPhysical <= 0) inventRemain = 0; } else { inventRemain = 0; if (prodBOM.QtyInventCalc && ! prodBOM.isReportedAsFinished()) { remainInventFinancial = prodBOM.remainInventFinancial(); if (abs(remainInventFinancial + this.InventConsump) < abs(prodBOM.maxQtyCalcStUpInvent())) { inventRemain = prodBOM.maxQtyCalcStUpInvent() - remainInventFinancial - this.InventConsump; if (abs(inventRemain) < abs(prodBOM.RemainInventPhysical)) inventRemain = prodBOM.RemainInventPhysical; } //by kim 140319 start else inventRemain = prodBOM.RemainInventPhysical; //by kim 140319 end } //by kim 140319 start if (prodBOM.QtyInventCalc && prodBOM.isReportedAsFinished()) { remainInventFinancial = prodBOM.remainInventFinancial(); if (abs(remainInventFinancial + this.InventConsump) < abs(prodBOM.maxQtyCalcStUpInvent())) { inventRemain = prodBOM.maxQtyCalcStUpInvent() - remainInventFinancial - this.InventConsump; if (abs(inventRemain) < abs(prodBOM.RemainInventPhysical)) inventRemain = prodBOM.RemainInventPhysical; } else inventRemain = prodBOM.RemainInventPhysical; } //by kim 140319 end } return inventRemain; }
UnitQty calcRemainBOMPhysical(ProdBOM prodBOM) { UnitQty bomRemain; if (! prodBOM.RecId) prodBOM = ProdBOM::findTransId(this.InventTransId); if (!this.InventReturnFlag) { bomRemain = prodBOM.RemainBOMPhysical - this.bomConsump; if (bomRemain* prodBOM.RemainBOMPhysical <= 0) bomRemain = 0; } else { bomRemain = 0; if (prodBOM.QtyBOMCalc && ! prodBOM.isReportedAsFinished()) { if (abs(prodBOM.RemainBOMFinancial + this.bomConsump) < abs(prodBOM.maxQtyCalcStUpBOM())) { bomRemain = prodBOM.maxQtyCalcStUpBOM() - prodBOM.RemainBOMFinancial - this.bomConsump; if (abs(bomRemain) < abs(prodBOM.RemainBOMPhysical)) bomRemain = prodBOM.RemainBOMPhysical; } //by kim 140319 start else bomRemain = prodBOM.RemainBOMPhysical; //by kim 140319 end } //by kim 140319 start if(prodBOM.QtyBOMCalc && prodBOM.isReportedAsFinished()) { if (abs(prodBOM.RemainBOMFinancial + this.bomConsump) < abs(prodBOM.maxQtyCalcStUpBOM())) { bomRemain = prodBOM.maxQtyCalcStUpBOM() - prodBOM.RemainBOMFinancial - this.bomConsump; if (abs(bomRemain) < abs(prodBOM.RemainBOMPhysical)) bomRemain = prodBOM.RemainBOMPhysical; } else bomRemain = prodBOM.RemainBOMPhysical; } //by kim 140319 end } return bomRemain; }
最后是InventMovement的setPreTransEstimated方法
void setPreTransEstimated(InventMovement this_Orig, InventUpd_Estimated updateNow) { InventQty preEstimated; InventQty transEstimated; InventQty sumQty;//by kim 140410 if (! this_Orig) { preEstimated = 0; if (this.mustBeUpdatedExpected()) transEstimated= this.remainPhysical(); else transEstimated= 0; } else { if (! this.mustBeUpdatedExpected() && ! this_Orig.mustBeUpdatedExpected()) { preEstimated = 0; transEstimated= 0; } else if (! this.mustBeUpdatedExpected() && this_Orig.mustBeUpdatedExpected()) { preEstimated = this_Orig.remainPhysical(); transEstimated= 0; } else if (this.mustBeUpdatedExpected() && ! this_Orig.mustBeUpdatedExpected()) { preEstimated = 0; transEstimated= this.remainPhysical(); } else { //by kim 140319 start preEstimated = this_Orig.remainPhysical(); if(classidget(this_Orig) == classnum(InventMov_ProdLine)) { if(abs(this_Orig.remainPhysical()) > 0 && abs(this.IWS_remainFinancial()) > max(abs(this_Orig.IWS_prodBOM().QtyBOMStUp),abs(this_Orig.IWS_prodBOM().QtyBOMCalc))) preEstimated = 0; } transEstimated = this.remainPhysical(); //by kim 140319 end } } if (this_Orig && this_Orig.mayScrapBeExpected() && this_Orig.doScrap()) { preEstimated = 0; } if (this.mayScrapBeExpected() && this.doScrap()) { transEstimated = 0; } updateNow.parmPreEstimated(preEstimated); updateNow.parmTransEstimated(transEstimated); }