生产领料的问题
关于生产领料的超领,系统逻辑大概是这样的,如果生产BOM的已发放数量超过了Max(估计数量,开始的数量),如果在新建一笔领料,在建一笔退料(退料数量如果小于超过已放数量超过的那一部分)系统就会报这个错,根据代码的逻辑也是这样判断的,系统认为你已经发超了,会尝试清除你当前生产BOM的剩余数量,但是如果你还有在单的领料,退料时,系统就会判断,你当前已发超的数量-需要退的数量>0,系统就要求你 必须先处理这笔领料。如下图:
已发放数量已经超过MAX(估计,已开始)
建一笔领料数量20和和两笔退料数量分别是10和30。
图一:数量为20的领料
图二:数量为10的退料,无法正常过账
图三:数量为30 的退料,能正常过账
解决办法
1:遇到这种情况,让用户主动去清除这笔在单的领料(这样估计客户很难接受)
2:用户不能接受,那就只能去修改代码了
具体修改地方有ProdJournalBOM表里的两个计算剩余数方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 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; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 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方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 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); } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?