|
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -60,6 +61,8 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
|
|
|
put("ton", "吨");
|
|
|
}};
|
|
|
|
|
|
+ DecimalFormat df = new DecimalFormat("0.####");
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 更新工序的待加工批次号信息
|
|
@@ -153,7 +156,7 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
|
|
|
apsProcessOperationDo.setPreviousprocessid(processVo.get(0).getProcessId());
|
|
|
apsProcessOperationDo.setPreviousprocess(processVo.get(0).getProcessName());
|
|
|
apsProcessOperationDo.setPlaninputid(outMaterDo.getId());
|
|
|
- String meterInput = getMeterInfo(outMaterDo.getProducttype(), outMaterDo.getMetal(), outMaterDo.getMetalstate(), outMaterDo.getThickness(), outMaterDo.getProwidth(), outMaterDo.getProlength());
|
|
|
+ String meterInput = getInMeterInfo(outMaterDo.getProducttype(), outMaterDo.getMetal(), outMaterDo.getMetalstate(), outMaterDo.getThickness(), outMaterDo.getProwidth(), outMaterDo.getProlength());
|
|
|
// apsProcessOperationDo.setPlaninput(meterInput + outMaterDo.getSinglerollweight() + cxAdminFeginClient.getDictNameByValue("MATERIAL_UNIT", outMaterDo.getNumunit()));
|
|
|
apsProcessOperationDo.setPlaninput(meterInput + outMaterDo.getSinglerollweight() + UNIT_MAP.getOrDefault(outMaterDo.getNumunit(), ""));
|
|
|
apsProcessOperationDo.setProducttypeid(outMaterDo.getProducttypeid());
|
|
@@ -182,30 +185,51 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
|
|
|
ApsProcessOperationOutMaterDo apsProcessOperationOutMaterDo = BeanUtil.toBean(apsCraftRouteOutMaterRequestDo.get(0), ApsProcessOperationOutMaterDo.class);
|
|
|
apsProcessOperationOutMaterDo.setId(SecurityUtil.getUUID());
|
|
|
if (StringUtils.isBlank(apsProcessOperationOutMaterDo.getProducttypeid())) {
|
|
|
- apsProcessOperationOutMaterDo.setProducttypeid(blanckdata.getStr("PRODUCTTYPEID"));
|
|
|
+ apsProcessOperationOutMaterDo.setProducttypeid(outMaterDo.getProducttypeid());
|
|
|
}
|
|
|
- if (StringUtils.isBlank(apsProcessOperationOutMaterDo.getProducttype())) {
|
|
|
- apsProcessOperationOutMaterDo.setProducttype(blanckdata.getStr("PRODUCTTYPE"));
|
|
|
+ String outProducttype = apsProcessOperationOutMaterDo.getProducttype();
|
|
|
+ if (StringUtils.isBlank(outProducttype)) {
|
|
|
+ outProducttype = outMaterDo.getProducttype();
|
|
|
+ apsProcessOperationOutMaterDo.setProducttype(outMaterDo.getProducttype());
|
|
|
}
|
|
|
- if (StringUtils.isBlank(apsProcessOperationOutMaterDo.getMetal())) {
|
|
|
- apsProcessOperationOutMaterDo.setMetal(blanckdata.getStr("ALLOY"));
|
|
|
+ String outMeter = apsProcessOperationOutMaterDo.getMetal();
|
|
|
+ if (StringUtils.isBlank(outMeter)) {
|
|
|
+ outMeter = outMaterDo.getMetal();
|
|
|
+ apsProcessOperationOutMaterDo.setMetal(outMaterDo.getMetal());
|
|
|
}
|
|
|
- if (StringUtils.isBlank(apsProcessOperationOutMaterDo.getMetalstate())) {
|
|
|
- apsProcessOperationOutMaterDo.setMetalstate(blanckdata.getStr("ALLOYSTATUS"));
|
|
|
+ String outMetalstate = apsProcessOperationOutMaterDo.getMetalstate();
|
|
|
+ if (StringUtils.isBlank(outMetalstate)) {
|
|
|
+ outMetalstate = outMaterDo.getMetalstate();
|
|
|
+ apsProcessOperationOutMaterDo.setMetalstate(outMaterDo.getMetalstate());
|
|
|
}
|
|
|
- apsProcessOperationOutMaterDo.setThickness(changeSize(outMaterDo.getThickness(), apsProcessOperationOutMaterDo.getThickrule(), apsProcessOperationOutMaterDo.getThickchange()));
|
|
|
- apsProcessOperationOutMaterDo.setProwidth(changeSize(outMaterDo.getProwidth(), apsProcessOperationOutMaterDo.getWidthrule(), apsProcessOperationOutMaterDo.getWidthchange()));
|
|
|
- apsProcessOperationOutMaterDo.setProlength(changeSize(outMaterDo.getProlength(), apsProcessOperationOutMaterDo.getLengthrule(), apsProcessOperationOutMaterDo.getLengthchange()));
|
|
|
+ BigDecimal tval = changeSize(outMaterDo.getThickness(), apsProcessOperationOutMaterDo.getThickrule(), apsProcessOperationOutMaterDo.getThickchange());
|
|
|
+ apsProcessOperationOutMaterDo.setThickness(tval);
|
|
|
+ BigDecimal wval = changeSize(outMaterDo.getProwidth(), apsProcessOperationOutMaterDo.getWidthrule(), apsProcessOperationOutMaterDo.getWidthchange());
|
|
|
+ apsProcessOperationOutMaterDo.setProwidth(wval);
|
|
|
+ BigDecimal lval = changeSize(outMaterDo.getProlength(), apsProcessOperationOutMaterDo.getLengthrule(), apsProcessOperationOutMaterDo.getLengthchange());
|
|
|
+ apsProcessOperationOutMaterDo.setProlength(lval);
|
|
|
apsProcessOperationOutMaterDo.setRipcutnum(1);
|
|
|
apsProcessOperationOutMaterDo.setCrosscutnum(1);
|
|
|
apsProcessOperationOutMaterDo.setOutval(1);
|
|
|
apsProcessOperationOutMaterDo.setPlanrollnum(blanckdata.getInt("ROLLNUM"));
|
|
|
- apsProcessOperationOutMaterDo.setSinglerollweight(blanckdata.getBigDecimal("SINGLEROLLWEIGHT"));
|
|
|
+ //输入物料的输入单卷重*该输出物料的宽度/输入物料的宽度/该输出物料的单卷输出数量
|
|
|
+ String singlerollweight = df.format(outMaterDo.getSinglerollweight().multiply(wval).divide(outMaterDo.getProwidth(), 2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ apsProcessOperationOutMaterDo.setSinglerollweight(new BigDecimal(singlerollweight));
|
|
|
apsProcessOperationOutMaterDo.setNumunit(blanckdata.getStr("NUMBERUNIT"));
|
|
|
apsProcessOperationOutMaterDo.setPlanstockrollnum(0);
|
|
|
apsProcessOperationOutMaterDo.setPlanprodrollnum(0);
|
|
|
apsProcessOperationOutMaterDo.setMainid(processId);
|
|
|
apsProcessOperationOutMaterDo.setBlankid(blanckdata.getStr("ID"));
|
|
|
+ //输出物料
|
|
|
+ String outputMeter = getOutMeterInfo(outProducttype, outMeter, outMetalstate, tval, wval, lval, apsProcessOperationOutMaterDo.getThickoffset(), apsProcessOperationOutMaterDo.getWidthoffset(), apsProcessOperationOutMaterDo.getLengthoffset()) + singlerollweight + UNIT_MAP.getOrDefault(blanckdata.getStr("NUMBERUNIT"), "") + "*" + blanckdata.getInt("ROLLNUM") + "卷";
|
|
|
+ apsProcessOperationOutMaterDo.setOutputmaterial(outputMeter);
|
|
|
+ apsProcessOperationDo.setPlanoutput("[1]" + outputMeter);
|
|
|
+ //输出成品 没有后道工序作业,则自动填入=“{输出物料的输入物料描述} * {计划成品卷数}卷”
|
|
|
+ String outputfinishproduct = "";
|
|
|
+ if (StringUtils.isBlank(apsCraftRouteStepDo1.getNextstepid())) {
|
|
|
+ outputfinishproduct = getInMeterInfo(outProducttype, outMeter, outMetalstate, tval, wval, lval) + "*" + blanckdata.getInt("ROLLNUM") + "卷";
|
|
|
+ }
|
|
|
+ apsProcessOperationOutMaterDo.setOutputfinishproduct(outputfinishproduct);
|
|
|
previousProcessVo.setApsProcessOperationOutMaterDo(apsProcessOperationOutMaterDo);
|
|
|
|
|
|
|
|
@@ -258,7 +282,7 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
|
|
|
previousProcessVo = new PreviousProcessVo();
|
|
|
//首道工序
|
|
|
processId = SecurityUtil.getUUID();
|
|
|
- String meterInput = getMeterInfo(blanckdata.getStr("PRODUCTTYPE"), blanckdata.getStr("ALLOY"), blanckdata.getStr("ALLOYSTATUS"), blanckdata.getBigDecimal("THICKNESS"), blanckdata.getBigDecimal("PROWIDTH"), blanckdata.getBigDecimal("PROLENGTH"));
|
|
|
+ String meterInput = getInMeterInfo(blanckdata.getStr("PRODUCTTYPE"), blanckdata.getStr("ALLOY"), blanckdata.getStr("ALLOYSTATUS"), blanckdata.getBigDecimal("THICKNESS"), blanckdata.getBigDecimal("PROWIDTH"), blanckdata.getBigDecimal("PROLENGTH"));
|
|
|
apsProcessOperationDo = BeanUtil.toBean(apsCraftRouteStepDo, ApsProcessOperationDo.class);
|
|
|
apsProcessOperationDo.setId(processId);
|
|
|
apsProcessOperationDo.setPlaninput(meterInput + blanckdata.getStr("SINGLEROLLWEIGHT") + UNIT_MAP.getOrDefault(blanckdata.getStr("NUMBERUNIT"), ""));
|
|
@@ -288,28 +312,50 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
|
|
|
if (StringUtils.isBlank(apsProcessOperationOutMaterDo.getProducttypeid())) {
|
|
|
apsProcessOperationOutMaterDo.setProducttypeid(blanckdata.getStr("PRODUCTTYPEID"));
|
|
|
}
|
|
|
- if (StringUtils.isBlank(apsProcessOperationOutMaterDo.getProducttype())) {
|
|
|
+ String outProducttype = apsProcessOperationOutMaterDo.getProducttype();
|
|
|
+ if (StringUtils.isBlank(outProducttype)) {
|
|
|
+ outProducttype = blanckdata.getStr("PRODUCTTYPE");
|
|
|
apsProcessOperationOutMaterDo.setProducttype(blanckdata.getStr("PRODUCTTYPE"));
|
|
|
}
|
|
|
- if (StringUtils.isBlank(apsProcessOperationOutMaterDo.getMetal())) {
|
|
|
+ String outMeter = apsProcessOperationOutMaterDo.getMetal();
|
|
|
+ if (StringUtils.isBlank(outMeter)) {
|
|
|
+ outMeter = blanckdata.getStr("ALLOY");
|
|
|
apsProcessOperationOutMaterDo.setMetal(blanckdata.getStr("ALLOY"));
|
|
|
}
|
|
|
- if (StringUtils.isBlank(apsProcessOperationOutMaterDo.getMetalstate())) {
|
|
|
+ String outMetalstate = apsProcessOperationOutMaterDo.getMetalstate();
|
|
|
+ if (StringUtils.isBlank(outMetalstate)) {
|
|
|
+ outMetalstate = blanckdata.getStr("ALLOYSTATUS");
|
|
|
apsProcessOperationOutMaterDo.setMetalstate(blanckdata.getStr("ALLOYSTATUS"));
|
|
|
}
|
|
|
- apsProcessOperationOutMaterDo.setThickness(changeSize(blanckdata.getBigDecimal("THICKNESS"), apsProcessOperationOutMaterDo.getThickrule(), apsProcessOperationOutMaterDo.getThickchange()));
|
|
|
- apsProcessOperationOutMaterDo.setProwidth(changeSize(blanckdata.getBigDecimal("PROWIDTH"), apsProcessOperationOutMaterDo.getWidthrule(), apsProcessOperationOutMaterDo.getWidthchange()));
|
|
|
- apsProcessOperationOutMaterDo.setProlength(changeSize(blanckdata.getBigDecimal("PROLENGTH"), apsProcessOperationOutMaterDo.getLengthrule(), apsProcessOperationOutMaterDo.getLengthchange()));
|
|
|
+ BigDecimal tval = changeSize(blanckdata.getBigDecimal("THICKNESS"), apsProcessOperationOutMaterDo.getThickrule(), apsProcessOperationOutMaterDo.getThickchange());
|
|
|
+ apsProcessOperationOutMaterDo.setThickness(tval);
|
|
|
+ BigDecimal wval = changeSize(blanckdata.getBigDecimal("PROWIDTH"), apsProcessOperationOutMaterDo.getWidthrule(), apsProcessOperationOutMaterDo.getWidthchange());
|
|
|
+ apsProcessOperationOutMaterDo.setProwidth(wval);
|
|
|
+ BigDecimal lval = changeSize(blanckdata.getBigDecimal("PROLENGTH"), apsProcessOperationOutMaterDo.getLengthrule(), apsProcessOperationOutMaterDo.getLengthchange());
|
|
|
+ apsProcessOperationOutMaterDo.setProlength(lval);
|
|
|
apsProcessOperationOutMaterDo.setRipcutnum(1);
|
|
|
apsProcessOperationOutMaterDo.setCrosscutnum(1);
|
|
|
apsProcessOperationOutMaterDo.setOutval(1);
|
|
|
apsProcessOperationOutMaterDo.setPlanrollnum(blanckdata.getInt("ROLLNUM"));
|
|
|
- apsProcessOperationOutMaterDo.setSinglerollweight(blanckdata.getBigDecimal("SINGLEROLLWEIGHT"));
|
|
|
+ //输入物料的输入单卷重*该输出物料的宽度/输入物料的宽度/该输出物料的单卷输出数量
|
|
|
+ String singlerollweight = df.format(blanckdata.getBigDecimal("SINGLEROLLWEIGHT").multiply(wval).divide(blanckdata.getBigDecimal("PROWIDTH"), 2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ apsProcessOperationOutMaterDo.setSinglerollweight(new BigDecimal(singlerollweight));
|
|
|
apsProcessOperationOutMaterDo.setNumunit(blanckdata.getStr("NUMBERUNIT"));
|
|
|
apsProcessOperationOutMaterDo.setPlanstockrollnum(0);
|
|
|
apsProcessOperationOutMaterDo.setPlanprodrollnum(0);
|
|
|
apsProcessOperationOutMaterDo.setMainid(processId);
|
|
|
apsProcessOperationOutMaterDo.setBlankid(blanckdata.getStr("ID"));
|
|
|
+ //输出物料
|
|
|
+ String outputMeter = getOutMeterInfo(outProducttype, outMeter, outMetalstate, tval, wval, lval, apsProcessOperationOutMaterDo.getThickoffset(), apsProcessOperationOutMaterDo.getWidthoffset(), apsProcessOperationOutMaterDo.getLengthoffset()) + singlerollweight + UNIT_MAP.getOrDefault(blanckdata.getStr("NUMBERUNIT"), "") + "*" + blanckdata.getInt("ROLLNUM") + "卷";
|
|
|
+ apsProcessOperationOutMaterDo.setOutputmaterial(outputMeter);
|
|
|
+ apsProcessOperationDo.setPlanoutput("[1]" + outputMeter);
|
|
|
+ //输出成品 没有后道工序作业,则自动填入=“{输出物料的输入物料描述} * {计划成品卷数}卷”
|
|
|
+ String outputfinishproduct = "";
|
|
|
+ if (StringUtils.isBlank(apsCraftRouteStepDo.getNextstepid())) {
|
|
|
+ outputfinishproduct = getInMeterInfo(outProducttype, outMeter, outMetalstate, tval, wval, lval) + "*" + blanckdata.getInt("ROLLNUM") + "卷";
|
|
|
+ }
|
|
|
+ apsProcessOperationOutMaterDo.setOutputfinishproduct(outputfinishproduct);
|
|
|
+
|
|
|
previousProcessVo.setApsProcessOperationOutMaterDo(apsProcessOperationOutMaterDo);
|
|
|
|
|
|
//本道工序的可选设备
|
|
@@ -395,8 +441,10 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
|
|
|
apsProcessOperationDao.updateSysMindMapping(blankid);
|
|
|
}
|
|
|
|
|
|
- //工艺步骤管理/物料输出规则
|
|
|
- private String getMeterInfo(String producttype, String metal, String metalstate, BigDecimal thickness, BigDecimal prowidth, BigDecimal prolength) {
|
|
|
+ /*
|
|
|
+ 工艺步骤管理/输入物料描述
|
|
|
+ */
|
|
|
+ private String getInMeterInfo(String producttype, String metal, String metalstate, BigDecimal thickness, BigDecimal prowidth, BigDecimal prolength) {
|
|
|
String res = "";
|
|
|
StringBuilder resStr = new StringBuilder();
|
|
|
StringBuilder resSizeStr = new StringBuilder();
|
|
@@ -410,13 +458,13 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
|
|
|
resStr.append(producttype);
|
|
|
}
|
|
|
if (thickness != null) {
|
|
|
- resSizeStr.append("厚" + thickness + "*");
|
|
|
+ resSizeStr.append("厚" + df.format(thickness) + "*");
|
|
|
}
|
|
|
if (prowidth != null) {
|
|
|
- resSizeStr.append("宽" + prowidth + "*");
|
|
|
+ resSizeStr.append("宽" + df.format(prowidth) + "*");
|
|
|
}
|
|
|
if (prolength != null) {
|
|
|
- resSizeStr.append("长" + prolength + "*");
|
|
|
+ resSizeStr.append("长" + df.format(prolength) + "*");
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isBlank(resSizeStr.toString())) {
|
|
@@ -425,10 +473,47 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
|
|
|
res = (StringUtils.isBlank(resStr.toString()) ? "" : (resStr.toString() + " ")) + resSizeStr.toString().substring(0, resSizeStr.toString().length() - 1) + "mm";
|
|
|
}
|
|
|
|
|
|
- return res;
|
|
|
+ return res + " ";
|
|
|
}
|
|
|
|
|
|
- //长宽高的计算规则
|
|
|
+ /*
|
|
|
+ 工艺步骤管理/输出物料描述
|
|
|
+ */
|
|
|
+ private String getOutMeterInfo(String producttype, String metal, String metalstate, BigDecimal thickness, BigDecimal prowidth, BigDecimal prolength, String thickoffset, String widthoffset, String lengthoffset) {
|
|
|
+ String res = "";
|
|
|
+ StringBuilder resStr = new StringBuilder();
|
|
|
+ StringBuilder resSizeStr = new StringBuilder();
|
|
|
+ if (StringUtils.isNotBlank(metal)) {
|
|
|
+ resStr.append(metal);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(metalstate)) {
|
|
|
+ resStr.append(metalstate);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(producttype)) {
|
|
|
+ resStr.append(producttype);
|
|
|
+ }
|
|
|
+ if (thickness != null) {
|
|
|
+ resSizeStr.append("厚" + df.format(thickness) + (thickoffset == null ? "" : thickoffset) + "*");
|
|
|
+ }
|
|
|
+ if (prowidth != null) {
|
|
|
+ resSizeStr.append("宽" + df.format(prowidth) + (widthoffset == null ? "" : widthoffset) + "*");
|
|
|
+ }
|
|
|
+ if (prolength != null) {
|
|
|
+ resSizeStr.append("长" + df.format(prolength) + (lengthoffset == null ? "" : lengthoffset) + "*");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(resSizeStr.toString())) {
|
|
|
+ res = resStr.toString();
|
|
|
+ } else {
|
|
|
+ res = (StringUtils.isBlank(resStr.toString()) ? "" : (resStr.toString() + " ")) + resSizeStr.toString().substring(0, resSizeStr.toString().length() - 1) + "mm";
|
|
|
+ }
|
|
|
+
|
|
|
+ return res + " ";
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ 长宽高的计算规则
|
|
|
+ */
|
|
|
private BigDecimal changeSize(BigDecimal oldVal, String countRule, BigDecimal changeVal) {
|
|
|
BigDecimal newVal = null;
|
|
|
if (!countRule.equals("自定义") && oldVal != null) {
|
|
@@ -445,7 +530,9 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
|
|
|
return newVal;
|
|
|
}
|
|
|
|
|
|
- //获取可选设备IDS
|
|
|
+ /*
|
|
|
+ 获取可选设备IDS
|
|
|
+ */
|
|
|
private String getChooseequids(List<String> equIds, List<String> equGroupIds) {
|
|
|
//资源组下所有的设备IDS
|
|
|
if (equGroupIds.size() > 0) {
|