齐套率计算调整小数位数

This commit is contained in:
mzr 2025-11-19 18:41:55 +08:00
parent 1f374f464e
commit d1d78484ac
1 changed files with 26 additions and 30 deletions

View File

@ -5,11 +5,6 @@
package nc.bs.mmpub.setanalysis.bp.multistorey;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.bs.mmpub.setanalysis.bp.SaMonolayerBP;
@ -24,11 +19,7 @@ import nc.impl.pubapp.pattern.data.vo.VOUpdate;
import nc.impl.pubapp.pattern.data.vo.VOUpdateTS;
import nc.util.mmf.framework.base.MMNumberUtil;
import nc.util.mmf.framework.base.MMValueCheck;
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.entity.SaDemandVO;
import nc.vo.mmpub.setanalysis.entity.SaMatchVO;
import nc.vo.mmpub.setanalysis.entity.*;
import nc.vo.mmpub.setanalysis.enumeration.SaDemandType;
import nc.vo.mmpub.setanalysis.enumeration.SaMatchType;
import nc.vo.mmpub.setanalysis.utils.SaMeasureUtil;
@ -38,6 +29,11 @@ import nc.vo.pubapp.pattern.pub.MapList;
import nc.vo.pubapp.pattern.pub.MathTool;
import nccloud.baseapp.core.log.NCCForUAPLogger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 齐套率回写流程生产订单
* 2005适配2312
@ -75,10 +71,10 @@ public class SaMultiStoreyBP {
public void doMultiStorey() {
SaLogger.debug("3.2.反算齐套开始计算");
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));
if (!MMValueCheck.isEmpty(sdList)) {
for(SaDemandVO sa : sdList) {
for (SaDemandVO sa : sdList) {
this.algorithm.setNum(sa);
}
@ -95,8 +91,8 @@ public class SaMultiStoreyBP {
if (!MMValueCheck.isEmpty(sdList)) {
MapList<String, SaDemandVO> demandMap = SaVOUtils.getSortMapList(sdList, "pk_analysis");
if (!MMValueCheck.isEmpty(demandMap)) {
for(Map.Entry<String, List<SaDemandVO>> entry : demandMap.toMap().entrySet()) {
List<SaDemandVO> demandList = (List)entry.getValue();
for (Map.Entry<String, List<SaDemandVO>> entry : demandMap.toMap().entrySet()) {
List<SaDemandVO> demandList = (List) entry.getValue();
this.setDemandForFatherid(demandList, key);
}
}
@ -108,8 +104,8 @@ public class SaMultiStoreyBP {
if (!MMValueCheck.isEmpty(sdList)) {
MapList<String, SaDemandVO> demandMap = SaVOUtils.getSortMapList(sdList, "vfatherid");
if (!MMValueCheck.isEmpty(demandMap)) {
for(Map.Entry<String, List<SaDemandVO>> entry : demandMap.toMap().entrySet()) {
List<SaDemandVO> demandList = SaArrayUtil.getMultiDemandSort((List)entry.getValue());
for (Map.Entry<String, List<SaDemandVO>> entry : demandMap.toMap().entrySet()) {
List<SaDemandVO> demandList = SaArrayUtil.getMultiDemandSort((List) entry.getValue());
SaDemandVO nsetsnum = new SaDemandVO();
if (MMValueCheck.isNotEmpty(demandList)) {
if (SaBooleanUtils.isReplace(demandList)) {
@ -152,10 +148,10 @@ public class SaMultiStoreyBP {
.count();
MapList<String, SaDemandVO> demandMap = SaVOUtils.getSortMapList(sdList, "vmatchfatherid");
if (!MMValueCheck.isEmpty(demandMap)) {
for(Map.Entry<String, List<SaDemandVO>> entry : demandMap.toMap().entrySet()) {
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]));
for (Map.Entry<String, List<SaDemandVO>> entry : demandMap.toMap().entrySet()) {
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));
@ -166,10 +162,10 @@ public class SaMultiStoreyBP {
}
}
for(Map.Entry<String, List<SaDemandVO>> entry : demandMap.toMap().entrySet()) {
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]));
for (Map.Entry<String, List<SaDemandVO>> entry : demandMap.toMap().entrySet()) {
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));
@ -192,7 +188,7 @@ public class SaMultiStoreyBP {
int level = this.getLevel(key);
if (level == 0) {
if (this.aggPkMap != null) {
AggAnalysisVO agg = (AggAnalysisVO)this.aggPkMap.get(nsetsnum.getVfatherid());
AggAnalysisVO agg = (AggAnalysisVO) this.aggPkMap.get(nsetsnum.getVfatherid());
if (agg != null) {
SaAnalysisVO analysis = agg.getParentVO();
analysis.setNsetsnum(MMNumberUtil.add(new UFDouble[]{nsetsnum.getNsetsnum(), nsetsnum.getNreplacesetsnum()}));
@ -204,7 +200,7 @@ public class SaMultiStoreyBP {
// 满足齐套的物料的行数
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, 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.toString(), cdemandbillbid);
@ -214,7 +210,7 @@ public class SaMultiStoreyBP {
}
} else if (this.demandPkMap != null) {
new SaDemandVO();
SaDemandVO var7 = (SaDemandVO)this.demandPkMap.get(nsetsnum.getVfatherid());
SaDemandVO var7 = (SaDemandVO) this.demandPkMap.get(nsetsnum.getVfatherid());
if (!isUpdateMatch) {
UFDouble nmatch = MMNumberUtil.add(new UFDouble[]{var7.getNmatchnum(), nsetsnum.getNsetsnum()});
var7.setNmaterialnum(nmatch);
@ -248,7 +244,7 @@ public class SaMultiStoreyBP {
List<SaDemandVO> sdList = SaVOUtils.getDemandList(this.demand);
if (!MMValueCheck.isEmpty(sdList)) {
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());
SaMeasureUtil.setAnalysisNum(sas);
VOUpdate<SaAnalysisVO> voup = new VOUpdate();
@ -263,7 +259,7 @@ public class SaMultiStoreyBP {
SaMatchVO sm = new SaMatchVO();
sm.setPk_match(saDemand.getVmatchfatherid());
sm.setNmaterialnum(saDemand.getNsetsnum());
UFDouble nsetsnum = SaMonolayerBP.getNsetsnum(hDemand, saDemand.getNsetsnum(), (UFDouble)null);
UFDouble nsetsnum = SaMonolayerBP.getNsetsnum(hDemand, saDemand.getNsetsnum(), (UFDouble) null);
sm.setNsetsnum(nsetsnum);
this.getSmVO().add(sm);
}
@ -271,7 +267,7 @@ public class SaMultiStoreyBP {
}
private void updateMatch() {
SaMatchVO[] sms = (SaMatchVO[])this.getSmVO().toArray(new SaMatchVO[0]);
SaMatchVO[] sms = (SaMatchVO[]) this.getSmVO().toArray(new SaMatchVO[0]);
if (!MMValueCheck.isEmpty(sms)) {
VOUpdateTS<SaMatchVO> voQuery = new VOUpdateTS();
voQuery.update(sms);