Merge remote-tracking branch 'origin/main'

This commit is contained in:
张明 2025-05-12 17:21:17 +08:00
commit cd69de508d
3 changed files with 53 additions and 56 deletions

View File

@ -26,30 +26,30 @@ public class SetAnalysisBP {
addBeforeRule(); addBeforeRule();
SaLogger.init(); SaLogger.init();
UFDateTime tstarttime1 = new UFDateTime(); UFDateTime tstarttime1 = new UFDateTime();
SaLogger.debug("0.分析开始^^^^^^^^^^^^^^^^^^^^^^^^^^"); SaLogger.debug("0.分析开始^^^^^^^^^^^^^^^^^^^^^^^^^^");
createMd5Function(); createMd5Function();
UFDateTime tstarttime2 = new UFDateTime(); UFDateTime tstarttime2 = new UFDateTime();
SaLogger.debug("1.收集数据"); SaLogger.debug("1.收集数据");
SaMemoryBP.printMemory(); SaMemoryBP.printMemory();
SaServiceProxy.getAnalysisService().gather_RequiresNew(this.context); SaServiceProxy.getAnalysisService().gather_RequiresNew(this.context);
SaLogger.debug("数据收集共耗时:" + SaLogger.getRunTime(tstarttime2)); SaLogger.debug("数据收集共耗时:" + SaLogger.getRunTime(tstarttime2));
UFDateTime tstarttime3 = new UFDateTime(); UFDateTime tstarttime3 = new UFDateTime();
SaLogger.debug("2.执行匹配开始"); SaLogger.debug("2.执行匹配开始");
SaServiceProxy.getAnalysisService().match_RequiresNew(this.context); SaServiceProxy.getAnalysisService().match_RequiresNew(this.context);
SaLogger.debug("匹配共耗时:" + SaLogger.getRunTime(tstarttime3)); SaLogger.debug("匹配共耗时:" + SaLogger.getRunTime(tstarttime3));
UFDateTime tstarttime4 = new UFDateTime(); UFDateTime tstarttime4 = new UFDateTime();
SaLogger.debug("3.反算齐套开始"); SaLogger.debug("3.反算齐套开始");
SaServiceProxy.getAnalysisService().multiStorey_RequiresNew(this.context); SaServiceProxy.getAnalysisService().multiStorey_RequiresNew(this.context);
SaLogger.debug("反算齐套结束,共耗时:" + SaLogger.getRunTime(tstarttime4)); SaLogger.debug("反算齐套结束,共耗时:" + SaLogger.getRunTime(tstarttime4));
SaMemoryBP.printMemory(); SaMemoryBP.printMemory();
this.result(this.context.getAggs()); this.result(this.context.getAggs());
//分析后调用回写齐套率计算方式已调整此处不用注释analysisAfterCheckRule // 分析后调用回写齐套率计算方式已调整此处不用注释analysisAfterCheckRule
// this.analysisAfterCheckRule(); // this.analysisAfterCheckRule();
SaLogger.debug("齐套分析算法结束,共耗时:" + SaLogger.getRunTime(tstarttime1)); SaLogger.debug("齐套分析算法结束,共耗时:" + SaLogger.getRunTime(tstarttime1));
return this.context.getAggs(); return this.context.getAggs();
} catch (BusinessException e) { } catch (BusinessException e) {
ExceptionUtils.wrappException(e); ExceptionUtils.wrappException(e);
@ -77,7 +77,7 @@ public class SetAnalysisBP {
} }
private void addBeforeRule() { private void addBeforeRule() {
} }
private void analysisAfterCheckRule() { private void analysisAfterCheckRule() {

View File

@ -39,8 +39,8 @@ import nc.vo.pubapp.pattern.pub.MathTool;
import nccloud.baseapp.core.log.NCCForUAPLogger; import nccloud.baseapp.core.log.NCCForUAPLogger;
/** /**
* 齐套率回写流程生产订单 * 齐套率回写流程生产订单
* 2005适配2312 * 2005适配2312
* *
* @author mzr * @author mzr
* @date 2025/3/26 * @date 2025/3/26
@ -55,7 +55,7 @@ public class SaMultiStoreyBP {
private SaAlgorithmBP algorithm; private SaAlgorithmBP algorithm;
public SaMultiStoreyBP(SaContext sc) { public SaMultiStoreyBP(SaContext sc) {
SaLogger.debug("3.1.反算齐套初始化开始"); SaLogger.debug("3.1.反算齐套初始化开始");
this.algorithm = new SaAlgorithmBP(); this.algorithm = new SaAlgorithmBP();
this.setSc(sc); this.setSc(sc);
List<SaDemandVO> sdList = SaVOUtils.getDemandList(sc.getSdVO()); List<SaDemandVO> sdList = SaVOUtils.getDemandList(sc.getSdVO());
@ -73,7 +73,7 @@ public class SaMultiStoreyBP {
} }
public void doMultiStorey() { public void doMultiStorey() {
SaLogger.debug("3.2.反算齐套开始计算"); SaLogger.debug("3.2.反算齐套开始计算");
if (!MMValueCheck.isEmpty(this.demand)) { if (!MMValueCheck.isEmpty(this.demand)) {
for(int curLevel = this.maxLevel; curLevel > 0; --curLevel) { for(int curLevel = this.maxLevel; curLevel > 0; --curLevel) {
List<SaDemandVO> sdList = this.demand.get(Integer.toString(curLevel)); List<SaDemandVO> sdList = this.demand.get(Integer.toString(curLevel));
@ -83,7 +83,7 @@ public class SaMultiStoreyBP {
} }
this.setDemandForAnalysis(sdList, Integer.toString(curLevel)); 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<SaDemandVO> demandList = (List)entry.getValue(); List<SaDemandVO> demandList = (List)entry.getValue();
if (((SaDemandVO)demandList.get(0)).getFmatchtype().equals(SaMatchType.PD.toIntValue()) && ((SaDemandVO)demandList.get(0)).getFdemandtype().equals(SaDemandType.NR.toIntValue())) { 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 = this.algorithm.minDemand((SaDemandVO[])demandList.toArray(new SaDemandVO[0]));
// 设置物料的总行数满足齐套的物料的行数 // 设置物料的总行数满足齐套的物料的行数
nsetsnum.setGoodsnum(new UFDouble(sdList.size())); nsetsnum.setGoodsnum(new UFDouble(sdList.size()));
nsetsnum.setPass_goodsnum(new UFDouble(num)); nsetsnum.setPass_goodsnum(new UFDouble(num));
this.setRewriteNmaterialnum(key, nsetsnum, false); this.setRewriteNmaterialnum(key, nsetsnum, false);
@ -170,7 +170,7 @@ public class SaMultiStoreyBP {
List<SaDemandVO> demandList = (List)entry.getValue(); List<SaDemandVO> demandList = (List)entry.getValue();
if (!((SaDemandVO)demandList.get(0)).getFdemandtype().equals(SaDemandType.NR.toIntValue()) && demandList.size() > 0) { if (!((SaDemandVO)demandList.get(0)).getFdemandtype().equals(SaDemandType.NR.toIntValue()) && demandList.size() > 0) {
nsetsnum = this.algorithm.minDemand((SaDemandVO[])demandList.toArray(new SaDemandVO[0])); nsetsnum = this.algorithm.minDemand((SaDemandVO[])demandList.toArray(new SaDemandVO[0]));
// 设置物料的总行数满足齐套的物料的行数 // 设置物料的总行数满足齐套的物料的行数
nsetsnum.setGoodsnum(new UFDouble(sdList.size())); nsetsnum.setGoodsnum(new UFDouble(sdList.size()));
nsetsnum.setPass_goodsnum(new UFDouble(num)); nsetsnum.setPass_goodsnum(new UFDouble(num));
this.setRewriteNmaterialnum(key, nsetsnum, true); this.setRewriteNmaterialnum(key, nsetsnum, true);
@ -197,15 +197,15 @@ public class SaMultiStoreyBP {
SaAnalysisVO analysis = agg.getParentVO(); SaAnalysisVO analysis = agg.getParentVO();
analysis.setNsetsnum(MMNumberUtil.add(new UFDouble[]{nsetsnum.getNsetsnum(), nsetsnum.getNreplacesetsnum()})); analysis.setNsetsnum(MMNumberUtil.add(new UFDouble[]{nsetsnum.getNsetsnum(), nsetsnum.getNreplacesetsnum()}));
if (isUpdateMatch) { if (isUpdateMatch) {
// 流程生产订单表体主键 // 流程生产订单表体主键
String cdemandbillbid = analysis.getCdemandbillbid(); String cdemandbillbid = analysis.getCdemandbillbid();
// 物料的总行数 // 物料的总行数
UFDouble goodsnum = nsetsnum.getGoodsnum().setScale(2, UFDouble.ROUND_HALF_UP); UFDouble goodsnum = nsetsnum.getGoodsnum().setScale(2, UFDouble.ROUND_HALF_UP);
// 满足齐套的物料的行数 // 满足齐套的物料的行数
UFDouble pass_goodsnum = nsetsnum.getPass_goodsnum().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); 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'", String sql = String.format("update mm_mo set vdef12 = '%s',vdef11 = '%s',vdef4 = '%s' where cmoid = '%s'",
goodsnum, pass_goodsnum, rate.toString(), cdemandbillbid); goodsnum, pass_goodsnum, rate.toString(), cdemandbillbid);
updateDef4(sql); updateDef4(sql);
@ -247,14 +247,14 @@ public class SaMultiStoreyBP {
SaDemandInsertBP sdi = new SaDemandInsertBP(); SaDemandInsertBP sdi = new SaDemandInsertBP();
List<SaDemandVO> sdList = SaVOUtils.getDemandList(this.demand); List<SaDemandVO> sdList = SaVOUtils.getDemandList(this.demand);
if (!MMValueCheck.isEmpty(sdList)) { 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); sdi.insertDemand((SaDemandVO[])sdList.toArray(new SaDemandVO[0]), this.sc);
SaAnalysisVO[] sas = SaVOUtils.construcVOs(this.getSc().getAggs()); SaAnalysisVO[] sas = SaVOUtils.construcVOs(this.getSc().getAggs());
SaMeasureUtil.setAnalysisNum(sas); SaMeasureUtil.setAnalysisNum(sas);
VOUpdate<SaAnalysisVO> voup = new VOUpdate(); VOUpdate<SaAnalysisVO> voup = new VOUpdate();
voup.update(sas, new String[]{"nsetsnum", "nremainnum", "nsetsasnum", "nassremainnum"}); voup.update(sas, new String[]{"nsetsnum", "nremainnum", "nsetsasnum", "nassremainnum"});
this.updateMatch(); this.updateMatch();
SaLogger.debug("3.5.反算持久化结束"); SaLogger.debug("3.5.反算持久化结束");
} }
} }

View File

@ -8,38 +8,35 @@ import nc.vo.pub.BusinessException;
public class analysisAfterCheckRule implements IRule<AggAnalysisVO> { public class analysisAfterCheckRule implements IRule<AggAnalysisVO> {
@Override @Override
public void process(AggAnalysisVO[] aggAnalysisVOS) { public void process(AggAnalysisVO[] aggAnalysisVOS) {
try { try {
for (AggAnalysisVO vo : aggAnalysisVOS) { for (AggAnalysisVO vo : aggAnalysisVOS) {
SaAnalysisVO saAnalysisVO = vo.getParentVO(); SaAnalysisVO saAnalysisVO = vo.getParentVO();
String cdemandbillbid = saAnalysisVO.getCdemandbillbid();//需求单据明细nsetsnum String cdemandbillbid = saAnalysisVO.getCdemandbillbid();// 需求单据明细nsetsnum
Object ntotaloutnumsObj = saAnalysisVO.getNsetsnum();//齐套主数量ndemandnum Object ntotaloutnumsObj = saAnalysisVO.getNsetsnum();// 齐套主数量ndemandnum
String ntotaloutnums = (ntotaloutnumsObj != null) ? ntotaloutnumsObj.toString() : ""; String ntotaloutnums = (ntotaloutnumsObj != null) ? ntotaloutnumsObj.toString() : "";
double ntotaloutnum = double ntotaloutnum = (ntotaloutnums.isEmpty()) ? 0 : Double.parseDouble(ntotaloutnums);// 齐套主数量
(ntotaloutnums.isEmpty()) ? 0 : Double.parseDouble(ntotaloutnums);//齐套主数量 Object ndemandnumObj = saAnalysisVO.getNdemandnum();// 分析主数量
Object ndemandnumObj = saAnalysisVO.getNdemandnum();//分析主数量 String ndemandnums = (ndemandnumObj != null) ? ndemandnumObj.toString() : "";
String ndemandnums = (ndemandnumObj != null) ? ndemandnumObj.toString() : ""; double ndemandnum = (ndemandnums.isEmpty()) ? 0 : Double.parseDouble(ndemandnums);// 分析数量
double ndemandnum = double vdef4 = 0;
(ndemandnums.isEmpty()) ? 0 : Double.parseDouble(ndemandnums);//分析数量 if (ndemandnum != 0) {
double vdef4 = 0; vdef4 = ntotaloutnum / ndemandnum;
if (ndemandnum != 0) { }
vdef4 = ntotaloutnum / ndemandnum; String update = " update mm_mo set vdef6=" + ntotaloutnum + ",vdef4=" + vdef4 + " where cmoid='"
} + cdemandbillbid + "' ";
String update = updateSaleBSQty(update);
" update mm_mo set vdef6=" + ntotaloutnum + ",vdef4=" + vdef4 + " where cmoid='" }
+ cdemandbillbid + "' "; } catch (BusinessException e) {
updateSaleBSQty(update); throw new RuntimeException(e);
} }
} catch (BusinessException e) { }
throw new RuntimeException(e);
}
}
private int updateSaleBSQty(String sql) throws BusinessException { private int updateSaleBSQty(String sql) throws BusinessException {
BaseDAO baseDAO = new BaseDAO(); BaseDAO baseDAO = new BaseDAO();
int succInt = baseDAO.executeUpdate(sql); int succInt = baseDAO.executeUpdate(sql);
return succInt; return succInt;
} }
} }