From 227eff61120aaca63e068035d745d86452e6499a Mon Sep 17 00:00:00 2001
From: hsy <1029150275@qq.com>
Date: 星期一, 17 八月 2026 09:35:12 +0800
Subject: [PATCH] feat(mes): 优化生产订单与排产任务列表显示,新增启停工及校验逻辑 1. 生产订单列表展示优化 (WorkOrder) - 新增「生产状态」列,全局注册 `ORDER_PRODUCTION_STATUS` 常量并绑定系统动态字典。 - 彻底重构「工序生产进度」单元格显示:弃用臃肿的 Steps 组件,改为极简横向布局(彩色状态圆点 + 进度百分比),解决表格行高被强行撑开及内容截断问题,支持横向滚动。 - 优化「完成进度」列宽及展示样式,将百分比数值外置同行显示,更加直观。 2. 排产任务列表改造 (Task) - 顶部表头重构,由单一标题重构为「全部 / 未完成 / 已完成」的 Tabs 标签页切换结构。 - 重写数据过滤逻辑,剥离写死的 status 查询,改为使用 `scheduleStatus` 字段动态响应 Tabs 切换 (0: 未完成, 1: 已完成)。 3. 工单业务逻辑增强与状态流转 - 落实「工单查询逻辑设计方案」,优化底层的工单条件检索逻辑。 - 实现「添加工单启停功能」与「停工状态」,支持工单在执行过程中的暂停与恢复业务流转。 - 强化容错与防呆设计:操作「完成订单」时增加前置校验 `handleCheckFinish`,若生产状态为未完成,强制弹出二次确认 Modal,避免误操作。 # 相关讨论/参考方案 # - 添加工单启停功能 # - 停工状态功能设计方案 # - 工单查询逻辑设计方案 # - 工单完成进度显示优化
---
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/api/item/MesMdItemApiImpl.java | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 52 insertions(+), 7 deletions(-)
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/api/item/MesMdItemApiImpl.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/api/item/MesMdItemApiImpl.java
index 8be526a..3376239 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/api/item/MesMdItemApiImpl.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/api/item/MesMdItemApiImpl.java
@@ -7,6 +7,7 @@
import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemTypeDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO;
+import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdItemMapper;
import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemBatchConfigService;
import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService;
import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemTypeService;
@@ -15,6 +16,9 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
+
+import java.util.Collection;
+import java.util.Set;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
@@ -25,7 +29,7 @@
* 渚� MDM 绛夋ā鍧楀悓姝ョ墿鏂欎富鏁版嵁鍒� MES 浣跨敤銆�
* 鍗曚綅銆佸垎绫绘寜 code 鍦� MES 渚цВ鏋愪负瀵瑰簲 id銆�
*
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
*/
@Service
@Validated
@@ -35,6 +39,8 @@
@Resource
private MesMdItemService itemService;
@Resource
+ private MesMdItemMapper itemMapper;
+ @Resource
private MesMdItemTypeService itemTypeService;
@Resource
private MesMdUnitMeasureService unitMeasureService;
@@ -43,20 +49,36 @@
@Override
public Long createItem(MesMdItemSyncReqDTO syncReqDTO) {
- log.info("[createItem] 鍚屾鍒涘缓 MES 鐗╂枡浜у搧锛宑ode={}", syncReqDTO.getCode());
+ log.info("[createItem] 鍚屾鍒涘缓 MES 鐗╂枡浜у搧锛宑ode={}, mdmItemId={}", syncReqDTO.getCode(), syncReqDTO.getMdmItemId());
MesMdItemSaveReqVO saveReqVO = buildSaveReqVO(syncReqDTO);
+ // 浣跨敤 MDM 鐗╂枡 ID 浣滀负 MES 鐗╂枡 ID
+ if (syncReqDTO.getMdmItemId() != null) {
+ saveReqVO.setId(syncReqDTO.getMdmItemId());
+ }
Long itemId = itemService.createItem(saveReqVO);
// 鍚屾鎵规閰嶇疆
- saveBatchConfig(itemId, syncReqDTO);
+// saveBatchConfig(itemId, syncReqDTO);
return itemId;
}
@Override
public void updateItem(MesMdItemSyncReqDTO syncReqDTO) {
- log.info("[updateItem] 鍚屾鏇存柊 MES 鐗╂枡浜у搧锛宑ode={}", syncReqDTO.getCode());
+ log.info("[updateItem] 鍚屾鏇存柊 MES 鐗╂枡浜у搧锛宑ode={}, mdmItemId={}", syncReqDTO.getCode(), syncReqDTO.getMdmItemId());
MesMdItemSaveReqVO saveReqVO = buildSaveReqVO(syncReqDTO);
- // 鎸� code 鍖归厤锛氬瓨鍦ㄥ垯鏇存柊锛屼笉瀛樺湪鍒欏垱寤猴紙upsert锛�
- MesMdItemDO existItem = itemService.getItemByCode(syncReqDTO.getCode());
+ // 浣跨敤 MDM 鐗╂枡 ID 浣滀负 MES 鐗╂枡 ID
+ if (syncReqDTO.getMdmItemId() != null) {
+ saveReqVO.setId(syncReqDTO.getMdmItemId());
+ }
+ // 鎸� ID 鎴� code 鍖归厤锛氬瓨鍦ㄥ垯鏇存柊锛屼笉瀛樺湪鍒欏垱寤猴紙upsert锛�
+ MesMdItemDO existItem = null;
+ // 浼樺厛鎸� ID 鏌ユ壘
+ if (syncReqDTO.getMdmItemId() != null) {
+ existItem = itemService.getItem(syncReqDTO.getMdmItemId());
+ }
+ // 濡傛灉鎸� ID 鎵句笉鍒帮紝鍐嶆寜 code 鏌ユ壘
+ if (existItem == null) {
+ existItem = itemService.getItemByCode(syncReqDTO.getCode());
+ }
Long itemId;
if (existItem == null) {
itemId = itemService.createItem(saveReqVO);
@@ -66,7 +88,7 @@
itemId = existItem.getId();
}
// 鍚屾鎵规閰嶇疆
- saveBatchConfig(itemId, syncReqDTO);
+// saveBatchConfig(itemId, syncReqDTO);
}
/**
@@ -90,6 +112,29 @@
return saveReqVO;
}
+ @Override
+ public void deleteItem(Long mdmItemId) {
+ log.info("[deleteItem] 鍚屾鍒犻櫎 MES 鐗╂枡浜у搧锛宮dmItemId={}", mdmItemId);
+ MesMdItemDO existItem = itemService.getItemByMdmItemId(mdmItemId);
+ if (existItem != null) {
+ itemService.deleteItem(existItem.getId());
+ }
+ }
+
+ @Override
+ public void updateItemStatus(Long mdmItemId, Integer status) {
+ log.info("[updateItemStatus] 鍚屾鏇存柊 MES 鐗╂枡浜у搧鐘舵�侊紝mdmItemId={}, status={}", mdmItemId, status);
+ MesMdItemDO existItem = itemService.getItemByMdmItemId(mdmItemId);
+ if (existItem != null) {
+ itemService.updateItemStatus(existItem.getId(), status);
+ }
+ }
+
+ @Override
+ public Set<Long> getSyncedMdmItemIds(Collection<Long> mdmItemIds) {
+ return itemMapper.selectMdmItemIdsByMdmItemIds(mdmItemIds);
+ }
+
/**
* 淇濆瓨鎵规閰嶇疆
*/
--
Gitblit v1.9.3