diff --git a/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/SetAnalysisBP.java b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/SetAnalysisBP.java new file mode 100644 index 0000000..86a9b44 --- /dev/null +++ b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/SetAnalysisBP.java @@ -0,0 +1,88 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.bs.mmpub.setanalysis.bp; + +import nc.bs.mmpub.setanalysis.bp.log.SaMemoryBP; +import nc.bs.mmpub.setanalysis.bp.rule.analysisAfterCheckRule; +import nc.bs.mmpub.setanalysis.bp.utils.SaLogger; +import nc.bs.mmpub.setanalysis.bp.utils.SaScaleUtil; +import nc.bs.mmpub.setanalysis.bp.utils.SaVOUtils; +import nc.bs.mmpub.setanalysis.proxy.SaServiceProxy; +import nc.bs.mmpub.setanalysis.rule.SaCheckTsRule; +import nc.vo.mmpub.setanalysis.entity.AggAnalysisVO; +import nc.vo.mmpub.setanalysis.entity.SaAnalysisVO; +import nc.vo.mmpub.setanalysis.entity.SaContext; +import nc.vo.mmpub.setanalysis.utils.SaMeasureUtil; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; + +public class SetAnalysisBP { + + private SaContext context; + + public SetAnalysisBP(SaContext context) { + this.context = context; + } + + public AggAnalysisVO[] doSetAnalysis() { + try { + this.addBeforeRule(); + SaLogger.init(); + UFDateTime tstarttime1 = new UFDateTime(); + SaLogger.debug("0.分析开始^^^^^^^^^^^^^^^^^^^^^^^^^^"); + this.createMd5Function(); + UFDateTime tstarttime2 = new UFDateTime(); + SaLogger.debug("1.收集数据"); + SaMemoryBP.printMemory(); + SaServiceProxy.getAnalysisService().gather_RequiresNew(this.context); + SaLogger.debug("数据收集共耗时:" + SaLogger.getRunTime(tstarttime2)); + UFDateTime tstarttime3 = new UFDateTime(); + SaLogger.debug("2.执行匹配开始"); + SaServiceProxy.getAnalysisService().match_RequiresNew(this.context); + SaLogger.debug("匹配共耗时:" + SaLogger.getRunTime(tstarttime3)); + UFDateTime tstarttime4 = new UFDateTime(); + SaLogger.debug("3.反算齐套开始"); + SaServiceProxy.getAnalysisService().multiStorey_RequiresNew(this.context); + SaLogger.debug("反算齐套结束,共耗时:" + SaLogger.getRunTime(tstarttime4)); + SaMemoryBP.printMemory(); + this.result(this.context.getAggs()); + //分析后调用回写,齐套率计算方式已调整,此处不用,注释analysisAfterCheckRule + // this.analysisAfterCheckRule(); + SaLogger.debug("齐套分析算法结束,共耗时:" + SaLogger.getRunTime(tstarttime1)); + return this.context.getAggs(); + } catch (BusinessException var5) { + ExceptionUtils.wrappException(var5); + SaLogger.error(var5.getMessage()); + return null; + } + } + + private void printMemory(String operation) { + long totalMemory = Runtime.getRuntime().totalMemory() / 1024L / 1024L; + long freeMemory = Runtime.getRuntime().freeMemory() / 1024L / 1024L; + SaLogger.debug(operation + ":totalMemory->" + totalMemory + "MB,freeMemory->" + freeMemory + "MB"); + } + + private void createMd5Function() { + (new SaFunctionBP()).createMD5(); + } + + private void result(AggAnalysisVO[] aggs) { + SaScaleUtil scale = new SaScaleUtil(); + SaAnalysisVO[] savos = SaVOUtils.construcVOs(aggs); + scale.setScaleSuperVOs(savos, "cmeasureid", new String[]{"nsetsnum"}); + SaMeasureUtil.setAnalysisAssNum(aggs); + } + + private void addBeforeRule() { + (new SaCheckTsRule()).process(this.context.getAggs()); + } + + private void analysisAfterCheckRule() { + (new analysisAfterCheckRule()).process(this.context.getAggs()); + } +} 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 c38a8e3..53f1d9e 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 @@ -182,24 +182,19 @@ public class SaMultiStoreyBP { if (agg != null) { SaAnalysisVO analysis = agg.getParentVO(); analysis.setNsetsnum(nsetsnum.getNsetsnum()); - // 流程生产订单表体主键 - 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, 4, 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, cdemandbillbid); - try { - NCCForUAPLogger.debug("sql = " + sql); - BaseDAO bd = new BaseDAO(); - bd.executeUpdate(sql); - } catch (DAOException e) { - NCCForUAPLogger.debug("setRewriteNmaterialnum-exp:" + e.getMessage()); - throw new RuntimeException(e); + 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); } } @@ -218,6 +213,17 @@ public class SaMultiStoreyBP { } } + private int updateDef4(String sql) { + try { + NCCForUAPLogger.debug("sql = " + sql); + BaseDAO baseDAO = new BaseDAO(); + return baseDAO.executeUpdate(sql); + } catch (DAOException e) { + NCCForUAPLogger.debug("setRewriteNmaterialnum-exp:" + e.getMessage()); + throw new RuntimeException(e); + } + } + private int getLevel(String key) { return key.length() == 0 ? 0 : Integer.parseInt(key) - 1; }