From 0c2a41c6780b2f621b79fdbc769779c982d19bed Mon Sep 17 00:00:00 2001 From: "zhangxinah@yonyou.com" Date: Mon, 12 May 2025 16:45:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E7=A0=81=E6=94=B9=E5=AE=8CGBK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mmpub/setanalysis/bp/SetAnalysisBP.java | 20 +++--- .../bp/multistorey/SaMultiStoreyBP.java | 28 ++++----- .../bp/rule/analysisAfterCheckRule.java | 61 +++++++++---------- 3 files changed, 53 insertions(+), 56 deletions(-) diff --git a/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/SetAnalysisBP.java b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/SetAnalysisBP.java index 93129b2..fe3826e 100644 --- a/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/SetAnalysisBP.java +++ b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/SetAnalysisBP.java @@ -26,30 +26,30 @@ public class SetAnalysisBP { addBeforeRule(); SaLogger.init(); UFDateTime tstarttime1 = new UFDateTime(); - SaLogger.debug("0.鍒嗘瀽寮濮媈^^^^^^^^^^^^^^^^^^^^^^^^^"); + SaLogger.debug("0.分析开始^^^^^^^^^^^^^^^^^^^^^^^^^^"); createMd5Function(); UFDateTime tstarttime2 = new UFDateTime(); - SaLogger.debug("1.鏀堕泦鏁版嵁"); + SaLogger.debug("1.收集数据"); SaMemoryBP.printMemory(); SaServiceProxy.getAnalysisService().gather_RequiresNew(this.context); - SaLogger.debug("鏁版嵁鏀堕泦鍏辫楁椂:" + SaLogger.getRunTime(tstarttime2)); + SaLogger.debug("数据收集共耗时:" + SaLogger.getRunTime(tstarttime2)); UFDateTime tstarttime3 = new UFDateTime(); - SaLogger.debug("2.鎵ц鍖归厤寮濮"); + SaLogger.debug("2.执行匹配开始"); SaServiceProxy.getAnalysisService().match_RequiresNew(this.context); - SaLogger.debug("鍖归厤鍏辫楁椂:" + SaLogger.getRunTime(tstarttime3)); + SaLogger.debug("匹配共耗时:" + SaLogger.getRunTime(tstarttime3)); UFDateTime tstarttime4 = new UFDateTime(); - SaLogger.debug("3.鍙嶇畻榻愬寮濮"); + SaLogger.debug("3.反算齐套开始"); SaServiceProxy.getAnalysisService().multiStorey_RequiresNew(this.context); - SaLogger.debug("鍙嶇畻榻愬缁撴潫,鍏辫楁椂:" + SaLogger.getRunTime(tstarttime4)); + SaLogger.debug("反算齐套结束,共耗时:" + SaLogger.getRunTime(tstarttime4)); SaMemoryBP.printMemory(); this.result(this.context.getAggs()); - //鍒嗘瀽鍚庤皟鐢ㄥ洖鍐欙紝榻愬鐜囪绠楁柟寮忓凡璋冩暣锛屾澶勪笉鐢紝娉ㄩ噴analysisAfterCheckRule + // 分析后调用回写,齐套率计算方式已调整,此处不用,注释analysisAfterCheckRule // this.analysisAfterCheckRule(); - SaLogger.debug("榻愬鍒嗘瀽绠楁硶缁撴潫,鍏辫楁椂:" + SaLogger.getRunTime(tstarttime1)); + SaLogger.debug("齐套分析算法结束,共耗时:" + SaLogger.getRunTime(tstarttime1)); return this.context.getAggs(); } catch (BusinessException e) { ExceptionUtils.wrappException(e); @@ -77,7 +77,7 @@ public class SetAnalysisBP { } private void addBeforeRule() { - + } private void analysisAfterCheckRule() { diff --git a/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/multistorey/SaMultiStoreyBP.java b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/multistorey/SaMultiStoreyBP.java index 5e69788..9bd79b7 100644 --- a/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/multistorey/SaMultiStoreyBP.java +++ b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/multistorey/SaMultiStoreyBP.java @@ -39,8 +39,8 @@ import nc.vo.pubapp.pattern.pub.MathTool; import nccloud.baseapp.core.log.NCCForUAPLogger; /** - * 榻愬鐜囧洖鍐欐祦绋嬬敓浜ц鍗 - * 2005閫傞厤2312 + * 齐套率回写流程生产订单 + * 2005适配2312 * * @author mzr * @date 2025/3/26 @@ -55,7 +55,7 @@ public class SaMultiStoreyBP { private SaAlgorithmBP algorithm; public SaMultiStoreyBP(SaContext sc) { - SaLogger.debug("3.1.鍙嶇畻榻愬鍒濆鍖栧紑濮"); + SaLogger.debug("3.1.反算齐套初始化开始"); this.algorithm = new SaAlgorithmBP(); this.setSc(sc); List sdList = SaVOUtils.getDemandList(sc.getSdVO()); @@ -73,7 +73,7 @@ public class SaMultiStoreyBP { } public void doMultiStorey() { - SaLogger.debug("3.2.鍙嶇畻榻愬寮濮嬭绠"); + SaLogger.debug("3.2.反算齐套开始计算"); if (!MMValueCheck.isEmpty(this.demand)) { for(int curLevel = this.maxLevel; curLevel > 0; --curLevel) { List sdList = this.demand.get(Integer.toString(curLevel)); @@ -83,7 +83,7 @@ public class SaMultiStoreyBP { } this.setDemandForAnalysis(sdList, Integer.toString(curLevel)); - SaLogger.debug("3.3.鍙嶇畻榻愬灞傜爜" + Integer.toString(curLevel)); + SaLogger.debug("3.3.反算齐套层码" + Integer.toString(curLevel)); } } } @@ -156,7 +156,7 @@ public class SaMultiStoreyBP { List demandList = (List)entry.getValue(); if (((SaDemandVO)demandList.get(0)).getFmatchtype().equals(SaMatchType.PD.toIntValue()) && ((SaDemandVO)demandList.get(0)).getFdemandtype().equals(SaDemandType.NR.toIntValue())) { nsetsnum = this.algorithm.minDemand((SaDemandVO[])demandList.toArray(new SaDemandVO[0])); - // 璁剧疆鐗╂枡鐨勬昏鏁般佹弧瓒抽綈濂楃殑鐗╂枡鐨勮鏁 + // 设置物料的总行数、满足齐套的物料的行数 nsetsnum.setGoodsnum(new UFDouble(sdList.size())); nsetsnum.setPass_goodsnum(new UFDouble(num)); this.setRewriteNmaterialnum(key, nsetsnum, false); @@ -170,7 +170,7 @@ public class SaMultiStoreyBP { List demandList = (List)entry.getValue(); if (!((SaDemandVO)demandList.get(0)).getFdemandtype().equals(SaDemandType.NR.toIntValue()) && demandList.size() > 0) { nsetsnum = this.algorithm.minDemand((SaDemandVO[])demandList.toArray(new SaDemandVO[0])); - // 璁剧疆鐗╂枡鐨勬昏鏁般佹弧瓒抽綈濂楃殑鐗╂枡鐨勮鏁 + // 设置物料的总行数、满足齐套的物料的行数 nsetsnum.setGoodsnum(new UFDouble(sdList.size())); nsetsnum.setPass_goodsnum(new UFDouble(num)); this.setRewriteNmaterialnum(key, nsetsnum, true); @@ -197,15 +197,15 @@ public class SaMultiStoreyBP { SaAnalysisVO analysis = agg.getParentVO(); analysis.setNsetsnum(MMNumberUtil.add(new UFDouble[]{nsetsnum.getNsetsnum(), nsetsnum.getNreplacesetsnum()})); if (isUpdateMatch) { - // 娴佺▼鐢熶骇璁㈠崟琛ㄤ綋涓婚敭 + // 流程生产订单表体主键 String cdemandbillbid = analysis.getCdemandbillbid(); - // 鐗╂枡鐨勬昏鏁 + // 物料的总行数 UFDouble goodsnum = nsetsnum.getGoodsnum().setScale(2, UFDouble.ROUND_HALF_UP); - // 婊¤冻榻愬鐨勭墿鏂欑殑琛屾暟 + // 满足齐套的物料的行数 UFDouble pass_goodsnum = nsetsnum.getPass_goodsnum().setScale(2, UFDouble.ROUND_HALF_UP); - // 榻愬鐜囪绠=婊¤冻鐨/鎬绘暟閲 + // 齐套率计算=满足的/总数量 UFDouble rate = pass_goodsnum.div(goodsnum, 2, UFDouble.ROUND_HALF_UP); - // 淇敼娴佺▼鐢熶骇璁㈠崟鐨勯綈濂楃巼銆佺墿鏂欑殑鎬昏鏁般佹弧瓒抽綈濂楃殑鐗╂枡鐨勮鏁 + // 修改流程生产订单的齐套率、物料的总行数、满足齐套的物料的行数 String sql = String.format("update mm_mo set vdef12 = '%s',vdef11 = '%s',vdef4 = '%s' where cmoid = '%s'", goodsnum, pass_goodsnum, rate.toString(), cdemandbillbid); updateDef4(sql); @@ -247,14 +247,14 @@ public class SaMultiStoreyBP { SaDemandInsertBP sdi = new SaDemandInsertBP(); List sdList = SaVOUtils.getDemandList(this.demand); if (!MMValueCheck.isEmpty(sdList)) { - SaLogger.debug("3.4.鍙嶇畻鎸佷箙鍖(鐩稿叧闇姹傦紝鍒嗘瀽瀵硅薄)" + sdList.size()); + SaLogger.debug("3.4.反算持久化(相关需求,分析对象)" + sdList.size()); sdi.insertDemand((SaDemandVO[])sdList.toArray(new SaDemandVO[0]), this.sc); SaAnalysisVO[] sas = SaVOUtils.construcVOs(this.getSc().getAggs()); SaMeasureUtil.setAnalysisNum(sas); VOUpdate voup = new VOUpdate(); voup.update(sas, new String[]{"nsetsnum", "nremainnum", "nsetsasnum", "nassremainnum"}); this.updateMatch(); - SaLogger.debug("3.5.鍙嶇畻鎸佷箙鍖栫粨鏉"); + SaLogger.debug("3.5.反算持久化结束"); } } diff --git a/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/rule/analysisAfterCheckRule.java b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/rule/analysisAfterCheckRule.java index e898745..302f3da 100644 --- a/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/rule/analysisAfterCheckRule.java +++ b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/rule/analysisAfterCheckRule.java @@ -8,38 +8,35 @@ import nc.vo.pub.BusinessException; public class analysisAfterCheckRule implements IRule { - @Override - public void process(AggAnalysisVO[] aggAnalysisVOS) { - try { - for (AggAnalysisVO vo : aggAnalysisVOS) { - SaAnalysisVO saAnalysisVO = vo.getParentVO(); - String cdemandbillbid = saAnalysisVO.getCdemandbillbid();//闇姹傚崟鎹槑缁唍setsnum - Object ntotaloutnumsObj = saAnalysisVO.getNsetsnum();//榻愬涓绘暟閲弉demandnum - String ntotaloutnums = (ntotaloutnumsObj != null) ? ntotaloutnumsObj.toString() : ""; - double ntotaloutnum = - (ntotaloutnums.isEmpty()) ? 0 : Double.parseDouble(ntotaloutnums);//榻愬涓绘暟閲 - Object ndemandnumObj = saAnalysisVO.getNdemandnum();//鍒嗘瀽涓绘暟閲 - String ndemandnums = (ndemandnumObj != null) ? ndemandnumObj.toString() : ""; - double ndemandnum = - (ndemandnums.isEmpty()) ? 0 : Double.parseDouble(ndemandnums);//鍒嗘瀽鏁伴噺 - double vdef4 = 0; - if (ndemandnum != 0) { - vdef4 = ntotaloutnum / ndemandnum; - } - String update = - " update mm_mo set vdef6=" + ntotaloutnum + ",vdef4=" + vdef4 + " where cmoid='" - + cdemandbillbid + "' "; - updateSaleBSQty(update); - } - } catch (BusinessException e) { - throw new RuntimeException(e); - } - } + @Override + public void process(AggAnalysisVO[] aggAnalysisVOS) { + try { + for (AggAnalysisVO vo : aggAnalysisVOS) { + SaAnalysisVO saAnalysisVO = vo.getParentVO(); + String cdemandbillbid = saAnalysisVO.getCdemandbillbid();// 需求单据明细nsetsnum + Object ntotaloutnumsObj = saAnalysisVO.getNsetsnum();// 齐套主数量ndemandnum + String ntotaloutnums = (ntotaloutnumsObj != null) ? ntotaloutnumsObj.toString() : ""; + double ntotaloutnum = (ntotaloutnums.isEmpty()) ? 0 : Double.parseDouble(ntotaloutnums);// 齐套主数量 + Object ndemandnumObj = saAnalysisVO.getNdemandnum();// 分析主数量 + String ndemandnums = (ndemandnumObj != null) ? ndemandnumObj.toString() : ""; + double ndemandnum = (ndemandnums.isEmpty()) ? 0 : Double.parseDouble(ndemandnums);// 分析数量 + double vdef4 = 0; + if (ndemandnum != 0) { + vdef4 = ntotaloutnum / ndemandnum; + } + String update = " update mm_mo set vdef6=" + ntotaloutnum + ",vdef4=" + vdef4 + " where cmoid='" + + cdemandbillbid + "' "; + updateSaleBSQty(update); + } + } catch (BusinessException e) { + throw new RuntimeException(e); + } + } - private int updateSaleBSQty(String sql) throws BusinessException { - BaseDAO baseDAO = new BaseDAO(); - int succInt = baseDAO.executeUpdate(sql); - return succInt; - } + private int updateSaleBSQty(String sql) throws BusinessException { + BaseDAO baseDAO = new BaseDAO(); + int succInt = baseDAO.executeUpdate(sql); + return succInt; + } }