mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、webcad拆单部件状态设置修正;2、装配设置详情页状态过滤修改;
This commit is contained in:
+10
@@ -44,6 +44,16 @@ public interface OrderComponentMapper extends BaseMapperX<OrderComponentDO> {
|
|||||||
*/
|
*/
|
||||||
List<OrderComponentDO> getOrderTopComponentList(@Param("orderIds")List<Long> orderIds, @Param("name") String name);
|
List<OrderComponentDO> getOrderTopComponentList(@Param("orderIds")List<Long> orderIds, @Param("name") String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单顶级部件,关联order_item,如果被移除了就不展示了
|
||||||
|
*
|
||||||
|
* @param orderIds
|
||||||
|
* @param processStatus
|
||||||
|
* @param name
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<OrderComponentDO> getOrderTopComponentListByAssemblyStatus(@Param("orderIds") List<Long> orderIds, @Param("assemblyStatusList") List<Integer> processStatus, @Param("name") String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询订单topid下的所有大于level层级的部件列表
|
* 查询订单topid下的所有大于level层级的部件列表
|
||||||
* @param orderId
|
* @param orderId
|
||||||
|
|||||||
+17
-34
@@ -98,21 +98,20 @@ public class AssemblyListServiceImpl implements AssemblyListService {
|
|||||||
.map(OrderComponentDO::getTopId)
|
.map(OrderComponentDO::getTopId)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
// 根据部件的topid查询树上所有已加工节点
|
// 查询所有top节点下的子节点
|
||||||
List<OrderComponentDO> topUnProcessedComponentList = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
|
List<OrderComponentDO> allNodesOnTopIds = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
|
||||||
.in(OrderComponentDO::getTopId, topIds)
|
.in(OrderComponentDO::getTopId, topIds)
|
||||||
.in(OrderComponentDO::getOrderId, orderIds)
|
.in(OrderComponentDO::getOrderId, orderIds)
|
||||||
.select(OrderComponentDO::getId, OrderComponentDO::getPid, OrderComponentDO::getName, OrderComponentDO::getProcessStatus));
|
.select(OrderComponentDO::getId, OrderComponentDO::getPid, OrderComponentDO::getName, OrderComponentDO::getProcessStatus, OrderComponentDO::getExtraProcessStatus));
|
||||||
|
|
||||||
// 计算部件状态
|
// 遍历处理状态
|
||||||
List<OrderComponentTreeCompareVO> treeCompareVOS = calculateProcessingStatusAccordingToAssemblyConfig(topUnProcessedComponentList);
|
for (OrderComponentDO orderComponent : allNodesOnTopIds) {
|
||||||
|
// extraProcessStatus不为空时替代processStatus
|
||||||
List<OrderComponentRespVO> result = new ArrayList<>();
|
if (ObjectUtil.isNotEmpty(orderComponent.getExtraProcessStatus())) {
|
||||||
// 树形扁平化
|
orderComponent.setProcessStatus(orderComponent.getExtraProcessStatus());
|
||||||
for (OrderComponentTreeCompareVO vo : treeCompareVOS) {
|
}
|
||||||
flatTree(vo, result);
|
|
||||||
}
|
}
|
||||||
return result;
|
return BeanUtil.copyToList(allNodesOnTopIds, OrderComponentRespVO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -386,8 +385,8 @@ public class AssemblyListServiceImpl implements AssemblyListService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 不加工不可操作
|
// 不加工不可操作
|
||||||
AssertUtils.notEquals(
|
AssertUtils.equals(
|
||||||
componentDO.getProcessStatus(),
|
componentDO.getExtraProcessStatus(),
|
||||||
OrderComponentProcessStatusEnum.NOT_PROCESS.getStatus(),
|
OrderComponentProcessStatusEnum.NOT_PROCESS.getStatus(),
|
||||||
ORDER_COMPONENT_NOT_PROCESS
|
ORDER_COMPONENT_NOT_PROCESS
|
||||||
);
|
);
|
||||||
@@ -415,7 +414,7 @@ public class AssemblyListServiceImpl implements AssemblyListService {
|
|||||||
|
|
||||||
AssertUtils.equals(
|
AssertUtils.equals(
|
||||||
componentDO.getProcessStatus(),
|
componentDO.getProcessStatus(),
|
||||||
OrderComponentProcessStatusEnum.UNPROCESSED.getStatus(),
|
OrderComponentProcessStatusEnum.PROCESSED.getStatus(),
|
||||||
ORDER_COMPONENT_PROCESSED_REPEAT
|
ORDER_COMPONENT_PROCESSED_REPEAT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -425,7 +424,7 @@ public class AssemblyListServiceImpl implements AssemblyListService {
|
|||||||
|
|
||||||
AssertUtils.equals(
|
AssertUtils.equals(
|
||||||
componentDO.getProcessStatus(),
|
componentDO.getProcessStatus(),
|
||||||
OrderComponentProcessStatusEnum.PROCESSED.getStatus(),
|
OrderComponentProcessStatusEnum.UNPROCESSED.getStatus(),
|
||||||
ORDER_COMPONENT_RESTORE_REPEAT
|
ORDER_COMPONENT_RESTORE_REPEAT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -783,24 +782,8 @@ public class AssemblyListServiceImpl implements AssemblyListService {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TopComponentState> states = buildTopComponentStates(reqVO);
|
// 查询顶级部件
|
||||||
|
List<OrderComponentDO> result = orderComponentMapper.getOrderTopComponentListByAssemblyStatus(reqVO.getOrderIds(), reqVO.getProcessStatus(), reqVO.getName());
|
||||||
if (CollUtil.isEmpty(states)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<OrderComponentProcessStatusEnum> statusSet =
|
|
||||||
Optional.ofNullable(reqVO.getProcessStatus())
|
|
||||||
.orElse(Collections.emptyList())
|
|
||||||
.stream()
|
|
||||||
.map(OrderComponentProcessStatusEnum::fromValue)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
|
|
||||||
List<OrderComponentTreeCompareVO> result = states.stream()
|
|
||||||
.filter(state -> matchAnyStatus(state, statusSet))
|
|
||||||
.map(state -> state.node)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
return BeanUtil.copyToList(result, OrderComponentRespVO.class);
|
return BeanUtil.copyToList(result, OrderComponentRespVO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -812,7 +795,7 @@ public class AssemblyListServiceImpl implements AssemblyListService {
|
|||||||
*/
|
*/
|
||||||
private List<TopComponentState> buildTopComponentStates(OrdersTopComponentListReqVO reqVO) {
|
private List<TopComponentState> buildTopComponentStates(OrdersTopComponentListReqVO reqVO) {
|
||||||
// 查询顶级部件
|
// 查询顶级部件
|
||||||
List<OrderComponentDO> topComponents = orderComponentMapper.getOrderTopComponentList(reqVO.getOrderIds(), reqVO.getName());
|
List<OrderComponentDO> topComponents = orderComponentMapper.getOrderTopComponentListByAssemblyStatus(reqVO.getOrderIds(), reqVO.getProcessStatus(), reqVO.getName());
|
||||||
|
|
||||||
if (CollUtil.isEmpty(topComponents)) {
|
if (CollUtil.isEmpty(topComponents)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|||||||
+52
@@ -57,6 +57,58 @@
|
|||||||
);
|
);
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getOrderTopComponentListByAssemblyStatus"
|
||||||
|
resultType="com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentDO">
|
||||||
|
SELECT * FROM (
|
||||||
|
SELECT
|
||||||
|
top.id,
|
||||||
|
top.name,
|
||||||
|
top.pid,
|
||||||
|
top.cad_view_file_id,
|
||||||
|
CASE
|
||||||
|
<!-- 1. 不加工:extra_process_status = 0 -->
|
||||||
|
WHEN top.pid = 0 AND top.extra_process_status = 0 THEN 0
|
||||||
|
|
||||||
|
<!-- 2. 部分加工:extra_process_status = 3 -->
|
||||||
|
WHEN top.pid = 0 AND top.extra_process_status = 3 THEN 3
|
||||||
|
|
||||||
|
<!-- 3. 已加工:process_status = 2 -->
|
||||||
|
WHEN top.pid = 0 AND top.process_status = 2 THEN 2
|
||||||
|
|
||||||
|
<!-- 4. 未加工:process_status = 1 且 extra_process_status IS NULL -->
|
||||||
|
WHEN top.pid = 0 AND top.process_status = 1 AND (top.extra_process_status IS NULL OR top.extra_process_status != 0) THEN 1
|
||||||
|
|
||||||
|
ELSE -1
|
||||||
|
END AS processStatus
|
||||||
|
FROM order_component top
|
||||||
|
WHERE top.pid = 0
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
AND top.name LIKE CONCAT('%', #{name}, '%')
|
||||||
|
</if>
|
||||||
|
AND top.order_id IN
|
||||||
|
<foreach item="orderId" collection="orderIds" open="(" separator="," close=")">
|
||||||
|
#{orderId}
|
||||||
|
</foreach>
|
||||||
|
AND EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM order_component oc
|
||||||
|
JOIN order_item oi
|
||||||
|
ON oi.comp_id = oc.id
|
||||||
|
AND oi.order_id = oc.order_id
|
||||||
|
AND oi.organ_id = oc.organ_id
|
||||||
|
WHERE oc.top_id = top.id
|
||||||
|
AND oc.order_id = top.order_id
|
||||||
|
AND oc.organ_id = top.organ_id
|
||||||
|
)
|
||||||
|
) t
|
||||||
|
<if test="assemblyStatusList != null and assemblyStatusList.size() > 0">
|
||||||
|
WHERE t.processStatus IN
|
||||||
|
<foreach item="status" collection="assemblyStatusList" open="(" separator="," close=")">
|
||||||
|
#{status}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getComponentListOnTopLevel"
|
<select id="getComponentListOnTopLevel"
|
||||||
resultType="com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentDO">
|
resultType="com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentDO">
|
||||||
select * from order_component oc
|
select * from order_component oc
|
||||||
|
|||||||
+45
-5
@@ -1801,7 +1801,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
|
|
||||||
// 3. hash计算
|
// 3. hash计算
|
||||||
for (OrderComponentTreeCompareVO root : roots) {
|
for (OrderComponentTreeCompareVO root : roots) {
|
||||||
computeHashRecursively(root);
|
buildAndSetRootHash(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 状态刷新
|
// 4. 状态刷新
|
||||||
@@ -1945,7 +1945,6 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
node.setId(groupId == null ? null : groupId);
|
node.setId(groupId == null ? null : groupId);
|
||||||
node.setName(name);
|
node.setName(name);
|
||||||
node.setChildren(children);
|
node.setChildren(children);
|
||||||
node.setProcessStatus(OrderComponentProcessStatusEnum.UNPROCESSED.getStatus());
|
|
||||||
|
|
||||||
if (boxSize != null) {
|
if (boxSize != null) {
|
||||||
node.setWidth(boxSize.getWidth());
|
node.setWidth(boxSize.getWidth());
|
||||||
@@ -1979,13 +1978,50 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buildAndSetRootHash(
|
||||||
|
OrderComponentTreeCompareVO root) {
|
||||||
|
|
||||||
private String buildStructureString(OrderComponentTreeCompareVO node) {
|
sortRecursively(root);
|
||||||
|
|
||||||
|
String structureStr =
|
||||||
|
buildStructureString(root);
|
||||||
|
|
||||||
|
root.setStructureHash(
|
||||||
|
DigestUtil.sha256Hex(structureStr)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sortRecursively(
|
||||||
|
OrderComponentTreeCompareVO node) {
|
||||||
|
|
||||||
|
List<OrderComponentTreeCompareVO> children =
|
||||||
|
node.getChildren();
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(children)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
children.sort(
|
||||||
|
Comparator.comparing(
|
||||||
|
OrderComponentTreeCompareVO::getName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
for (OrderComponentTreeCompareVO child : children) {
|
||||||
|
sortRecursively(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String buildStructureString(
|
||||||
|
OrderComponentTreeCompareVO node) {
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append(node.getName());
|
sb.append(node.getName());
|
||||||
|
|
||||||
List<OrderComponentTreeCompareVO> children = node.getChildren();
|
List<OrderComponentTreeCompareVO> children =
|
||||||
|
node.getChildren();
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(children)) {
|
if (CollUtil.isNotEmpty(children)) {
|
||||||
|
|
||||||
@@ -1997,7 +2033,11 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
sb.append(",");
|
sb.append(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append(buildStructureString(children.get(i)));
|
sb.append(
|
||||||
|
buildStructureString(
|
||||||
|
children.get(i)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append(")");
|
sb.append(")");
|
||||||
|
|||||||
-5
@@ -589,11 +589,6 @@ public class WebCadOrderImportFactory {
|
|||||||
vo.setDepth(node.getBoxSize().getDepth());
|
vo.setDepth(node.getBoxSize().getDepth());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认未加工
|
|
||||||
vo.setProcessStatus(
|
|
||||||
OrderComponentProcessStatusEnum.UNPROCESSED.getStatus()
|
|
||||||
);
|
|
||||||
|
|
||||||
List<OrderComponentTreeCompareVO> children =
|
List<OrderComponentTreeCompareVO> children =
|
||||||
new ArrayList<>();
|
new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
+53
-18
@@ -178,7 +178,7 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
|
|||||||
|
|
||||||
// 3、递归排序 + 生成 hash
|
// 3、递归排序 + 生成 hash
|
||||||
for (AssemblyConfigStructureVO root : roots) {
|
for (AssemblyConfigStructureVO root : roots) {
|
||||||
computeHashRecursively(root);
|
buildAndSetRootHash(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
return roots;
|
return roots;
|
||||||
@@ -187,23 +187,43 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
|
|||||||
/**
|
/**
|
||||||
* 递归排序 children + 生成结构 hash
|
* 递归排序 children + 生成结构 hash
|
||||||
*
|
*
|
||||||
|
* @param root
|
||||||
|
*/
|
||||||
|
private void buildAndSetRootHash(AssemblyConfigStructureVO root) {
|
||||||
|
|
||||||
|
sortRecursively(root);
|
||||||
|
|
||||||
|
String structureStr = buildStructureString(root);
|
||||||
|
|
||||||
|
root.setStructureHash(
|
||||||
|
DigestUtil.sha256Hex(structureStr)
|
||||||
|
);
|
||||||
|
|
||||||
|
root.setProcess(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递归排序
|
||||||
|
*
|
||||||
* @param node
|
* @param node
|
||||||
*/
|
*/
|
||||||
private void computeHashRecursively(AssemblyConfigStructureVO node) {
|
private void sortRecursively(AssemblyConfigStructureVO node) {
|
||||||
|
|
||||||
List<AssemblyConfigStructureVO> children = node.getChildren();
|
List<AssemblyConfigStructureVO> children = node.getChildren();
|
||||||
if (children != null && !children.isEmpty()) {
|
|
||||||
// 按 name 排序保证 hash 稳定
|
if (children == null || children.isEmpty()) {
|
||||||
children.sort(Comparator.comparing(AssemblyConfigStructureVO::getName));
|
return;
|
||||||
// 递归处理
|
}
|
||||||
for (AssemblyConfigStructureVO child : children) {
|
|
||||||
computeHashRecursively(child);
|
children.sort(
|
||||||
}
|
Comparator.comparing(
|
||||||
|
AssemblyConfigStructureVO::getName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
for (AssemblyConfigStructureVO child : children) {
|
||||||
|
sortRecursively(child);
|
||||||
}
|
}
|
||||||
// 生成结构字符串并 hash
|
|
||||||
String structureStr = buildStructureString(node);
|
|
||||||
node.setStructureHash(DigestUtil.sha256Hex(structureStr));
|
|
||||||
// 默认是加工的
|
|
||||||
node.setProcess(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -212,18 +232,33 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
|
|||||||
* @param node
|
* @param node
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String buildStructureString(AssemblyConfigStructureVO node) {
|
private String buildStructureString(
|
||||||
|
AssemblyConfigStructureVO node) {
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append(node.getName());
|
sb.append(node.getName());
|
||||||
|
|
||||||
List<AssemblyConfigStructureVO> children = node.getChildren();
|
List<AssemblyConfigStructureVO> children = node.getChildren();
|
||||||
|
|
||||||
if (children != null && !children.isEmpty()) {
|
if (children != null && !children.isEmpty()) {
|
||||||
|
|
||||||
sb.append("(");
|
sb.append("(");
|
||||||
for (AssemblyConfigStructureVO child : children) {
|
|
||||||
sb.append(buildStructureString(child));
|
for (int i = 0; i < children.size(); i++) {
|
||||||
|
|
||||||
|
if (i > 0) {
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(
|
||||||
|
buildStructureString(children.get(i))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append(")");
|
sb.append(")");
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +390,7 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
|
|||||||
String newJson = JsonUtils.zipString(JsonUtils.toJsonString(structureVO));
|
String newJson = JsonUtils.zipString(JsonUtils.toJsonString(structureVO));
|
||||||
|
|
||||||
// 重算hash
|
// 重算hash
|
||||||
computeHashRecursively(structureVO);
|
buildAndSetRootHash(structureVO);
|
||||||
String newHash = structureVO.getStructureHash();
|
String newHash = structureVO.getStructureHash();
|
||||||
|
|
||||||
// 更新状态和名称
|
// 更新状态和名称
|
||||||
|
|||||||
Reference in New Issue
Block a user