编码改完GBK

This commit is contained in:
zhangxinah@yonyou.com 2025-05-12 16:45:50 +08:00
parent 6c01f422a0
commit 0c2a41c678
3 changed files with 53 additions and 56 deletions

View File

@ -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() {

View File

@ -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<SaDemandVO> 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<SaDemandVO> 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<SaDemandVO> 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<SaDemandVO> 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<SaDemandVO> 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<SaAnalysisVO> voup = new VOUpdate();
voup.update(sas, new String[]{"nsetsnum", "nremainnum", "nsetsasnum", "nassremainnum"});
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> {
@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);
}
}
@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;
}
}