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