mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 12:52:07 +08:00
1、fastjson升级导致的无法解析自定义板编号配置中的下划线格式异常修复;2、组件订单数据拉取:配件颜色/材质取值修复、配件备注未记录修复;
This commit is contained in:
+5
-2
@@ -3,6 +3,7 @@ package com.cf.imes.module.plan.service.customplateno;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONReader;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
@@ -165,7 +166,8 @@ public class CustomPlateNoGenerateServiceImpl implements CustomPlateNoGenerateSe
|
||||
if (orgCustomPlateNoConfigResult.isSuccess()) {
|
||||
orgCustomPlateNoConfig = orgCustomPlateNoConfigResult.getData();
|
||||
customPlateNoRuleVOS = Optional.ofNullable(orgCustomPlateNoConfig)
|
||||
.map(config -> JSON.parseArray(config.getSetting(), CustomPlateNoRuleVO.class))
|
||||
.map(config -> JSON.parseArray(config.getSetting(), CustomPlateNoRuleVO.class,
|
||||
JSONReader.Feature.SupportSmartMatch))
|
||||
.orElse(List.of());
|
||||
customPlateNoGenerateConfigVO.setOrgCustomPlateNoConfigId(Optional.ofNullable(orgCustomPlateNoConfig).map(SystemConfigRespDTO::getId).orElse(null));
|
||||
}
|
||||
@@ -178,7 +180,8 @@ public class CustomPlateNoGenerateServiceImpl implements CustomPlateNoGenerateSe
|
||||
if (ObjectUtil.isNotNull(orderCustomPlatenoConfigId) && ObjectUtil.notEqual(orgCustomPlateNoConfig.getId(), orderCustomPlatenoConfigId)) {
|
||||
CommonResult<SystemConfigRespDTO> previousCustomPlateNoConfig = systemConfigApi.getById(orderCustomPlatenoConfigId);
|
||||
if (previousCustomPlateNoConfig.isSuccess()) {
|
||||
customPlateNoRuleVOS = JSON.parseArray(previousCustomPlateNoConfig.getData().getSetting(), CustomPlateNoRuleVO.class);
|
||||
customPlateNoRuleVOS = JSON.parseArray(previousCustomPlateNoConfig.getData().getSetting(),
|
||||
CustomPlateNoRuleVO.class, JSONReader.Feature.SupportSmartMatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-3
@@ -2013,9 +2013,13 @@ public class ProducingOrderImportFactory {
|
||||
String thickness = part.getThickness();
|
||||
String unit = part.getUnit();
|
||||
String brand = part.getBrand();
|
||||
String partMaterial = part.getMaterial();
|
||||
String partColor = part.getColor();
|
||||
|
||||
// 分类配件的键组合
|
||||
String groupKey = composite + partType + factory + model + spec + scale3(height) + scale3(width) + scale3(thickness) + unit + brand;
|
||||
String groupKey = composite + partType + factory + model + spec
|
||||
+ scale3(height) + scale3(width) + scale3(thickness)
|
||||
+ unit + brand + partMaterial + partColor;
|
||||
|
||||
Long orderPartId = orderPartMap.get(groupKey);
|
||||
if (ObjectUtil.isNull(orderPartId)) {
|
||||
@@ -2033,8 +2037,10 @@ public class ProducingOrderImportFactory {
|
||||
spec = part.getSpec();
|
||||
} else {
|
||||
spec = getFieldFromSpec(part.getSpec(), 0);
|
||||
material = getFieldFromSpec(part.getSpec(), 1);
|
||||
color = getFieldFromSpec(part.getSpec(), 2);
|
||||
material = StringUtils.isNotEmpty(partMaterial)
|
||||
? partMaterial : getFieldFromSpec(part.getSpec(), 1);
|
||||
color = StringUtils.isNotEmpty(partColor)
|
||||
? partColor : getFieldFromSpec(part.getSpec(), 2);
|
||||
}
|
||||
|
||||
String type = changePartType(partType, part.getIsComposite());
|
||||
|
||||
+76
-10
@@ -13,6 +13,7 @@ import com.cf.imes.module.plan.service.orderImport.producing.dto.ProducingImport
|
||||
import com.cf.imes.module.plan.dal.dataobject.plate.PlateGoodDO;
|
||||
import com.cf.imes.module.plan.dal.mysql.plate.PlateGoodMapper;
|
||||
import com.cf.imes.module.plan.service.orderImport.producing.dto.ProducingOrderResponse;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -914,7 +915,7 @@ public class ProducingOrderConverter {
|
||||
for (ProducingOrderResponse.ShapeOffset source : safe(shape.getOffsetList())) {
|
||||
ProducingImportBlock.PointInfoDTO.ModelDetailDTO.OffSetListDTO target =
|
||||
new ProducingImportBlock.PointInfoDTO.ModelDetailDTO.OffSetListDTO();
|
||||
target.setId(source.getToolPath());
|
||||
target.setId(shapeOffsetToolPathId(source.getToolPath()));
|
||||
target.setAngle(zero(source.getAngle()));
|
||||
target.setDeep(zero(source.getDepth()));
|
||||
target.setName(source.getKnifeName());
|
||||
@@ -925,6 +926,19 @@ public class ProducingOrderConverter {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从新旧两种偏移刀路结构中提取刀路 ID。
|
||||
*
|
||||
* <p>新结构使用 {@code toolPath.id},旧结构则直接以字符串或数字返回 ID。</p>
|
||||
*/
|
||||
private String shapeOffsetToolPathId(JsonNode toolPath) {
|
||||
if (toolPath == null || toolPath.isNull()) {
|
||||
return null;
|
||||
}
|
||||
JsonNode id = toolPath.isObject() ? toolPath.get("id") : toolPath;
|
||||
return id == null || id.isNull() ? null : id.asText();
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并 partsItems 与 partsList,并按柜体 ID 汇总待入库配件。
|
||||
*/
|
||||
@@ -946,23 +960,21 @@ public class ProducingOrderConverter {
|
||||
? SEAL_PART_GROUP : part.getGroup());
|
||||
target.setModel(empty(material.getModel()));
|
||||
boolean sealPart = SEAL_PART_GROUP.equals(part.getGroup());
|
||||
target.setSpec(sealPart
|
||||
? empty(material.getSpec())
|
||||
: String.join("|", empty(material.getSpec()),
|
||||
empty(material.getMaterial()), empty(material.getColor())));
|
||||
target.setSpec(empty(material.getSpec()));
|
||||
// 对方 width/length/height 对应原导入结构的宽/长/厚。
|
||||
target.setWidth(partDimension(part.getWidth()));
|
||||
target.setHeight(partDimension(part.getLength()));
|
||||
target.setThickness(partDimension(part.getHeight()));
|
||||
target.setMaterial(empty(material.getMaterial()));
|
||||
target.setMaterial(partMaterial(material));
|
||||
target.setColor(partColor(material));
|
||||
target.setBrand(empty(material.getBrand()));
|
||||
target.setFactory(empty(material.getFactory()));
|
||||
target.setUnit("0");
|
||||
target.setNum(part.getQuantity() == null ? 1D : part.getQuantity());
|
||||
int partType = defaultPartType(part.getType());
|
||||
target.setIsComposite(partType == 1 || partType == 2);
|
||||
// 配件备注与板件一致,只取实例级 partsItems.remarks。
|
||||
target.setRemark(remarksText(item.getRemarks()));
|
||||
// 实例级备注优先;对方暂未在 partsItems 返回 remarks 时,兼容读取配件定义备注。
|
||||
target.setRemark(remarksText(effectivePartRemarks(item, part)));
|
||||
target.setObjectId(partCadViewId(context, part.getId()));
|
||||
target.setGroupIds(parseIds(item.getProcessGroupIds(), "process group"));
|
||||
target.setComponentIds(isNoComponent(item.getComponentGroupId())
|
||||
@@ -974,8 +986,8 @@ public class ProducingOrderConverter {
|
||||
new ProducingImportPart.GroupData();
|
||||
groupData.setSize(0);
|
||||
groupData.setThickness(0);
|
||||
groupData.setMaterial(empty(material.getMaterial()));
|
||||
groupData.setColor(empty(material.getColor()));
|
||||
groupData.setMaterial(target.getMaterial());
|
||||
groupData.setColor(sealPartColor(material));
|
||||
groupData.setBoardName(material.getName());
|
||||
target.setGroupData(groupData);
|
||||
}
|
||||
@@ -1048,6 +1060,60 @@ public class ProducingOrderConverter {
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配件业务备注:优先使用物理项备注,物理项未返回时兼容配件定义备注。
|
||||
*/
|
||||
private Map<String, Object> effectivePartRemarks(
|
||||
ProducingOrderResponse.Item item, ProducingOrderResponse.Part part) {
|
||||
Map<String, Object> itemRemarks = item.getRemarks();
|
||||
return itemRemarks == null || itemRemarks.isEmpty()
|
||||
? part.getRemarks() : itemRemarks;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配件材质:优先使用物料独立字段,字段为空时从“规格|材质|颜色”中补齐。
|
||||
*/
|
||||
private String partMaterial(ProducingOrderResponse.Material material) {
|
||||
return preferredPartField(material.getMaterial(), material.getSpec(), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配件颜色:优先使用物料独立字段,字段为空时从“规格|材质|颜色”中补齐。
|
||||
*/
|
||||
private String partColor(ProducingOrderResponse.Material material) {
|
||||
return preferredPartField(material.getColor(), material.getSpec(), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按配件物料独立字段优先、组合规格兜底的顺序读取属性。
|
||||
*/
|
||||
private String preferredPartField(String directValue, String spec, int index) {
|
||||
if (StringUtils.hasText(directValue)) {
|
||||
return directValue;
|
||||
}
|
||||
if (!StringUtils.hasText(spec)) {
|
||||
return "";
|
||||
}
|
||||
String[] fields = spec.split("\\|", -1);
|
||||
return fields.length > index ? fields[index].trim() : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取封边条颜色:遵循配件颜色优先级,并兼容当前封边条连字符规格。
|
||||
*/
|
||||
private String sealPartColor(ProducingOrderResponse.Material material) {
|
||||
String color = partColor(material);
|
||||
if (StringUtils.hasText(color)) {
|
||||
return color;
|
||||
}
|
||||
String spec = material.getSpec();
|
||||
if (!StringUtils.hasText(spec)) {
|
||||
return "";
|
||||
}
|
||||
String[] fields = spec.split("-", 3);
|
||||
return fields.length == 3 ? fields[2].trim() : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 优先读取 blockList 的显式字段;字段缺失时兼容旧报文 remarks 中的同名派生标记。
|
||||
*/
|
||||
|
||||
+5
@@ -34,6 +34,11 @@ public class ProducingImportPart {
|
||||
|
||||
private String material;
|
||||
|
||||
/**
|
||||
* 对方独立颜色字段优先,缺失时由转换层从组合规格中补齐。
|
||||
*/
|
||||
private String color;
|
||||
|
||||
private String brand;
|
||||
|
||||
private String factory;
|
||||
|
||||
+12
-2
@@ -2,6 +2,7 @@ package com.cf.imes.module.plan.service.orderImport.producing.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -149,7 +150,7 @@ public class ProducingOrderResponse {
|
||||
private List<String> processGroupIds = Collections.emptyList();
|
||||
private String componentGroupId;
|
||||
/**
|
||||
* 物理板件/配件实例的业务备注,导入备注只取本字段。
|
||||
* 物理板件/配件实例的业务备注;配件实例未返回时兼容定义级业务备注。
|
||||
*/
|
||||
private Map<String, Object> remarks = Collections.emptyMap();
|
||||
}
|
||||
@@ -170,6 +171,9 @@ public class ProducingOrderResponse {
|
||||
private Double length;
|
||||
private Double width;
|
||||
private Double height;
|
||||
/**
|
||||
* 配件定义级业务备注,仅在 partsItems.remarks 缺失时作为兼容兜底。
|
||||
*/
|
||||
private Map<String, Object> remarks = Collections.emptyMap();
|
||||
}
|
||||
|
||||
@@ -257,6 +261,12 @@ public class ProducingOrderResponse {
|
||||
private String knifeName;
|
||||
private Double radius;
|
||||
private Double value;
|
||||
private String toolPath;
|
||||
/**
|
||||
* 偏移刀路。
|
||||
*
|
||||
* <p>新报文返回包含 {@code id/pts/buls/depths} 的对象,旧报文可能直接返回刀路 ID,
|
||||
* 因此保留为 JSON 节点并由转换层统一提取 ID。</p>
|
||||
*/
|
||||
private JsonNode toolPath;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user