|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.rongwei.bscommon.sys.dao.*;
|
|
|
import com.rongwei.bscommon.sys.service.*;
|
|
|
import com.rongwei.bscommon.sys.utils.ApsUtils;
|
|
@@ -1042,7 +1043,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
|
|
|
|
|
|
//更新生产状态为“待发布”(20)
|
|
|
List<ApsBlankOrderVo> toupstatus = apsBlankOrders.stream().filter(v ->
|
|
|
- blankids.contains(v.getId()) && (StringUtils.isBlank(v.getIfcp()) || "N".equals(v.getIfcp())))
|
|
|
+ blankids.contains(v.getId()) && (StringUtils.isBlank(v.getIfcp()) || "N".equals(v.getIfcp())))
|
|
|
.collect(Collectors.toList());
|
|
|
updateProductStatusByOrderIds(toupstatus);
|
|
|
// 自动加锁坯料计划下的工序作业
|
|
@@ -5488,4 +5489,140 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R initProcessDesc() {
|
|
|
+ List<ApsProcessOutputProductDo> apsProcessOutputProductDoList = apsProcessOutputProductService.list();
|
|
|
+ Map<String, List<ApsProcessOutputProductDo>> blankIdAndOutputMap = apsProcessOutputProductDoList.stream().collect(Collectors.groupingBy(ApsProcessOutputProductDo::getBlankid));
|
|
|
+
|
|
|
+ Set<String> blankIds = blankIdAndOutputMap.keySet();
|
|
|
+ List<ApsBlankOrderDo> apsBlankOrderDoList = new ArrayList<>(this.listByIds(blankIds));
|
|
|
+ List<String> orderIdList = apsBlankOrderDoList.stream().map(ApsBlankOrderDo::getProductionorderid).distinct().collect(Collectors.toList());
|
|
|
+ List<ApsProductionOrderDo> apsProductionOrderDoList = new ArrayList<>(apsProductionOrderService.listByIds(orderIdList));
|
|
|
+
|
|
|
+ Collator collator = Collator.getInstance(Locale.US);
|
|
|
+ List<ApsProcessOutputProductDo> neeUpdateAll = new LinkedList<>();
|
|
|
+ List<ApsBlankOrderDo> neeUpdateAll2 = new LinkedList<>();
|
|
|
+ for (String blankId : blankIdAndOutputMap.keySet()) {
|
|
|
+ try {
|
|
|
+ List<ApsProcessOutputProductDo> value = blankIdAndOutputMap.getOrDefault(blankId, null);
|
|
|
+ if (value == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ApsBlankOrderDo apsBlankOrderDo = apsBlankOrderDoList.stream().filter(item -> item.getId().equals(blankId)).findFirst().orElse(null);
|
|
|
+ if (apsBlankOrderDo == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ApsProductionOrderDo apsProductionOrderDo = apsProductionOrderDoList.stream().filter(item -> item.getId().equals(apsBlankOrderDo.getProductionorderid())).findFirst().orElse(null);
|
|
|
+ if (apsProductionOrderDo == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //输出成品拼接字段:输出工艺描述
|
|
|
+ List<ApsProcessOutputProductDo> needUpdateOutputList = new LinkedList<>();
|
|
|
+ boolean idmatureprocess = true;//是否成熟工艺
|
|
|
+ for (ApsProcessOutputProductDo apsProcessOutputProductDo : value) {
|
|
|
+ //合金、合金状态、产品类型及其替代
|
|
|
+ String alloy = StringUtils.isNotBlank(apsProcessOutputProductDo.getAlloy()) ? apsProcessOutputProductDo.getAlloy() : "";
|
|
|
+ String alloystatus = StringUtils.isNotBlank(apsProcessOutputProductDo.getAlloystatus()) ? apsProcessOutputProductDo.getAlloystatus() : "";
|
|
|
+ String producttype = StringUtils.isNotBlank(apsProcessOutputProductDo.getProducttype()) ? apsProcessOutputProductDo.getProducttype() : "";
|
|
|
+ String changealloy = StringUtils.isNotBlank(apsProcessOutputProductDo.getChangealloy()) ? apsProcessOutputProductDo.getChangealloy() : "";
|
|
|
+ String changealloystatus = StringUtils.isNotBlank(apsProcessOutputProductDo.getChangealloystatus()) ? apsProcessOutputProductDo.getChangealloystatus() : "";
|
|
|
+ String changeproducttype = StringUtils.isNotBlank(apsProcessOutputProductDo.getChangeproducttype()) ? apsProcessOutputProductDo.getChangeproducttype() : "";
|
|
|
+ if (StringUtils.isNotBlank(changealloy)) {
|
|
|
+ alloy = changealloy;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(changealloystatus)) {
|
|
|
+ alloystatus = changealloystatus;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(changeproducttype)) {
|
|
|
+ producttype = changeproducttype;
|
|
|
+ }
|
|
|
+
|
|
|
+ //厚宽长
|
|
|
+ String thickness = apsProcessOutputProductDo.getThickness() != null ? CXCommonUtils.removeExtraZerosAndDecimal(apsProcessOutputProductDo.getThickness()) : "";
|
|
|
+ String prowidth = apsProcessOutputProductDo.getProwidth() != null ? CXCommonUtils.removeExtraZerosAndDecimal(apsProcessOutputProductDo.getProwidth()) : "";
|
|
|
+ String prolength = apsProcessOutputProductDo.getProlength() != null ? CXCommonUtils.removeExtraZerosAndDecimal(apsProcessOutputProductDo.getProlength()) : "";
|
|
|
+ //厚查、宽差、长差
|
|
|
+ String thicknesstolerance = StringUtils.isNotBlank(apsProcessOutputProductDo.getThicknesstolerance()) ? apsProcessOutputProductDo.getThicknesstolerance() : "";
|
|
|
+ String widthtolerance = StringUtils.isNotBlank(apsProcessOutputProductDo.getWidthtolerance()) ? apsProcessOutputProductDo.getWidthtolerance() : "";
|
|
|
+ String lengthtolerance = StringUtils.isNotBlank(apsProcessOutputProductDo.getLengthtolerance()) ? apsProcessOutputProductDo.getLengthtolerance() : "";
|
|
|
+
|
|
|
+ //管内芯直径、管芯材质、抗拉强度、延伸率、是否清洗线
|
|
|
+ String innercorediameter = apsProcessOutputProductDo.getInnercorediameter() != null ? CXCommonUtils.removeExtraZerosAndDecimal(apsProcessOutputProductDo.getInnercorediameter()) : "";
|
|
|
+ String corematerial = StringUtils.isNotBlank(apsProcessOutputProductDo.getCorematerial()) ? apsProcessOutputProductDo.getCorematerial() : "";
|
|
|
+ String tensilestrength = StringUtils.isNotBlank(apsProcessOutputProductDo.getTensilestrength()) ? apsProcessOutputProductDo.getTensilestrength() : "";
|
|
|
+ String elongationrate = StringUtils.isNotBlank(apsProcessOutputProductDo.getElongationrate()) ? apsProcessOutputProductDo.getElongationrate() : "";
|
|
|
+ String isclean = StringUtils.isNotBlank(apsProcessOutputProductDo.getIsclean()) ? apsProcessOutputProductDo.getIsclean() : "";
|
|
|
+
|
|
|
+ //拼接字段
|
|
|
+ String outputprocessdes = alloy + alloystatus + producttype
|
|
|
+ + " " + thickness + "(" + thicknesstolerance + ")*" + prowidth + "(" + widthtolerance + ")";
|
|
|
+ if (StringUtils.isNotBlank(prolength)) {
|
|
|
+ outputprocessdes = outputprocessdes + "*" + prolength + "(" + lengthtolerance + ")";
|
|
|
+ }
|
|
|
+ outputprocessdes = outputprocessdes + "," + String.join(",", Arrays.asList(innercorediameter, corematerial, tensilestrength, elongationrate, isclean));
|
|
|
+
|
|
|
+ ApsProcessOutputProductDo needUpdate = new ApsProcessOutputProductDo();
|
|
|
+ needUpdate.setId(apsProcessOutputProductDo.getId());
|
|
|
+ needUpdate.setOutputprocessdes(outputprocessdes);
|
|
|
+ needUpdateOutputList.add(needUpdate);
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(apsProcessOutputProductDo.getIdmatureprocess()) || apsProcessOutputProductDo.getIdmatureprocess().equals("否")) {
|
|
|
+ idmatureprocess = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //坯料计划拼接字段:工艺描述
|
|
|
+ List<String> outputProcessDescList = needUpdateOutputList.stream().map(ApsProcessOutputProductDo::getOutputprocessdes).collect(Collectors.toList());
|
|
|
+ outputProcessDescList.sort(collator);
|
|
|
+ String processDesc = "";
|
|
|
+ for (int i = 0; i < outputProcessDescList.size(); i++) {
|
|
|
+ processDesc += "[" + (i + 1) + "]" + outputProcessDescList.get(i);
|
|
|
+ if (i < outputProcessDescList.size() - 1) {
|
|
|
+ processDesc += ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //订单的客户ID
|
|
|
+ String customid = StringUtils.isNotBlank(apsProductionOrderDo.getCustomid()) ? apsProductionOrderDo.getCustomid() : "";
|
|
|
+ //是否新料
|
|
|
+ String isNewBlank = "否";
|
|
|
+ if ("新料".equals(apsBlankOrderDo.getBlankcomefrom())) {
|
|
|
+ isNewBlank = "是";
|
|
|
+ }
|
|
|
+ //排产车间
|
|
|
+ String plannedproductionworkshop = StringUtils.isNotBlank(apsBlankOrderDo.getPlannedproductionworkshop()) ? apsBlankOrderDo.getPlannedproductionworkshop() : "";
|
|
|
+ //工艺路线标签
|
|
|
+ String routetag = StringUtils.isNotBlank(apsBlankOrderDo.getRoutetag()) ? apsBlankOrderDo.getRoutetag() : "";
|
|
|
+ //坯料类型、产品类型、合金、厚度、宽度
|
|
|
+ String blanktype = StringUtils.isNotBlank(apsBlankOrderDo.getBlanktype()) ? apsBlankOrderDo.getBlanktype() : "";
|
|
|
+ String producttype = StringUtils.isNotBlank(apsBlankOrderDo.getProducttype()) ? apsBlankOrderDo.getProducttype() : "";
|
|
|
+ String alloy = StringUtils.isNotBlank(apsBlankOrderDo.getAlloy()) ? apsBlankOrderDo.getAlloy() : "";
|
|
|
+ String alloystatus = StringUtils.isNotBlank(apsBlankOrderDo.getAlloystatus()) ? apsBlankOrderDo.getAlloystatus() : "";
|
|
|
+ String thickness = apsBlankOrderDo.getThickness() != null ? CXCommonUtils.removeExtraZerosAndDecimal(apsBlankOrderDo.getThickness()) : "";
|
|
|
+ String prowidth = apsBlankOrderDo.getProwidth() != null ? CXCommonUtils.removeExtraZerosAndDecimal(apsBlankOrderDo.getProwidth()) : "";
|
|
|
+
|
|
|
+ //坯料计划工艺描述
|
|
|
+ String endProcessDesc = String.join(",", Arrays.asList(customid, isNewBlank, plannedproductionworkshop, routetag, blanktype, producttype, alloy, alloystatus, thickness + "*" + prowidth, processDesc));
|
|
|
+ ApsBlankOrderDo needUpdate = new ApsBlankOrderDo();
|
|
|
+ needUpdate.setId(apsBlankOrderDo.getId());
|
|
|
+ needUpdate.setProcessdesc(endProcessDesc);
|
|
|
+
|
|
|
+ neeUpdateAll.addAll(needUpdateOutputList);
|
|
|
+ neeUpdateAll2.add(needUpdate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!neeUpdateAll.isEmpty()) {
|
|
|
+ Lists.partition(neeUpdateAll, 1000).forEach(item -> {
|
|
|
+ this.baseMapper.updateProcessOutputBatchById(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (!neeUpdateAll2.isEmpty()) {
|
|
|
+ Lists.partition(neeUpdateAll2, 1000).forEach(item -> {
|
|
|
+ this.baseMapper.updateBlankBatchById(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
}
|