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/service/md/item/MesMdItemTypeServiceImpl.java | 76 ++++++++++++++++++++++++++++++--------
1 files changed, 60 insertions(+), 16 deletions(-)
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/item/MesMdItemTypeServiceImpl.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/item/MesMdItemTypeServiceImpl.java
index dd1a2e6..ab5b7a2 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/item/MesMdItemTypeServiceImpl.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/item/MesMdItemTypeServiceImpl.java
@@ -2,7 +2,10 @@
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.mdm.api.category.MdmItemCategoryApi;
+import cn.iocoder.yudao.module.mdm.api.category.dto.MdmItemCategoryRespDTO;
import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.type.MesMdItemTypeListReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.type.MesMdItemTypeSaveReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemTypeDO;
@@ -20,17 +23,23 @@
/**
* MES 鐗╂枡浜у搧鍒嗙被 Service 瀹炵幇绫�
*
- * @author 鑺嬮亾婧愮爜
+ * 鍏煎灞傚疄鐜帮細鏁版嵁瀛樺偍鍦� mes_md_item_type 琛紝浣嗕紭鍏堜粠 MDM 鍒嗙被 API 鑾峰彇
+ * 瀹為檯鍒嗙被鏁版嵁宸茶縼绉诲埌 mdm_item_category 琛�
+ *
+ * @author 瓒呯骇绠$悊鍛�
*/
@Service
@Validated
public class MesMdItemTypeServiceImpl implements MesMdItemTypeService {
@Resource
+ private MdmItemCategoryApi mdmItemCategoryApi;
+
+ @Resource
private MesMdItemTypeMapper itemTypeMapper;
@Resource
- @Lazy // 寤惰繜鍔犺浇锛岄伩鍏嶅惊鐜緷璧�
+ @Lazy
private MesMdItemService itemService;
@Override
@@ -38,7 +47,7 @@
// 鏍¢獙鏁版嵁
validateItemTypeSaveData(createReqVO);
- // 鎻掑叆
+ // 鎻掑叆鍒版湰鍦拌〃锛堜繚鎸佸吋瀹癸級
MesMdItemTypeDO itemType = BeanUtils.toBean(createReqVO, MesMdItemTypeDO.class);
itemTypeMapper.insert(itemType);
return itemType.getId();
@@ -51,7 +60,7 @@
// 鏍¢獙鏁版嵁
validateItemTypeSaveData(updateReqVO);
- // 鏇存柊
+ // 鏇存柊鏈湴琛�
MesMdItemTypeDO updateObj = BeanUtils.toBean(updateReqVO, MesMdItemTypeDO.class);
itemTypeMapper.updateById(updateObj);
}
@@ -83,6 +92,12 @@
}
private void validateItemTypeExists(Long id) {
+ // 浼樺厛浠� MDM 鑾峰彇
+ CommonResult<MdmItemCategoryRespDTO> result = mdmItemCategoryApi.getItemCategory(id);
+ if (result.isSuccess() && result.getData() != null) {
+ return;
+ }
+ // 鍥為��鍒版湰鍦拌〃
if (itemTypeMapper.selectById(id) == null) {
throw exception(MD_ITEM_TYPE_NOT_EXISTS);
}
@@ -96,26 +111,36 @@
if (Objects.equals(id, parentId)) {
throw exception(MD_ITEM_TYPE_PARENT_ERROR);
}
- // 2. 鐖跺垎绫讳笉瀛樺湪
- MesMdItemTypeDO parentItemType = itemTypeMapper.selectById(parentId);
+ // 2. 鐖跺垎绫讳笉瀛樺湪 - 浼樺厛浠� MDM 鑾峰彇
+ CommonResult<MdmItemCategoryRespDTO> result = mdmItemCategoryApi.getItemCategory(parentId);
+ MesMdItemTypeDO parentItemType = null;
+ if (result.isSuccess() && result.getData() != null) {
+ parentItemType = convertToMesDO(result.getData());
+ } else {
+ parentItemType = itemTypeMapper.selectById(parentId);
+ }
if (parentItemType == null) {
throw exception(MD_ITEM_TYPE_PARENT_NOT_EXITS);
}
// 3. 閫掑綊鏍¢獙鐖跺垎绫伙紝濡傛灉鐖跺垎绫绘槸鑷繁鐨勫瓙鍒嗙被锛屽垯鎶ラ敊锛岄伩鍏嶅舰鎴愮幆璺�
- if (id == null) { // id 涓虹┖锛岃鏄庢柊澧烇紝涓嶉渶瑕佽�冭檻鐜矾
+ if (id == null) {
return;
}
for (int i = 0; i < Short.MAX_VALUE; i++) {
- // 3.1 鏍¢獙鐜矾
parentId = parentItemType.getParentId();
if (Objects.equals(id, parentId)) {
throw exception(MD_ITEM_TYPE_PARENT_IS_CHILD);
}
- // 3.2 缁х画閫掑綊涓嬩竴绾х埗鍒嗙被
if (parentId == null || MesMdItemTypeDO.PARENT_ID_ROOT.equals(parentId)) {
break;
}
- parentItemType = itemTypeMapper.selectById(parentId);
+ // 缁х画鏌ユ壘鐖剁骇
+ CommonResult<MdmItemCategoryRespDTO> parentResult = mdmItemCategoryApi.getItemCategory(parentId);
+ if (parentResult.isSuccess() && parentResult.getData() != null) {
+ parentItemType = convertToMesDO(parentResult.getData());
+ } else {
+ parentItemType = itemTypeMapper.selectById(parentId);
+ }
if (parentItemType == null) {
break;
}
@@ -144,16 +169,24 @@
@Override
public MesMdItemTypeDO getItemType(Long id) {
+ // 浼樺厛浠� MDM 鑾峰彇
+ CommonResult<MdmItemCategoryRespDTO> result = mdmItemCategoryApi.getItemCategory(id);
+ if (result.isSuccess() && result.getData() != null) {
+ return convertToMesDO(result.getData());
+ }
+ // 鍥為��鍒版湰鍦拌〃
return itemTypeMapper.selectById(id);
}
@Override
public MesMdItemTypeDO getItemTypeByCode(String code) {
+ // 浠庢湰鍦拌〃鏌�
return itemTypeMapper.selectByCode(code);
}
@Override
public List<MesMdItemTypeDO> getItemTypeList(MesMdItemTypeListReqVO listReqVO) {
+ // 浠庢湰鍦拌〃鏌�
return itemTypeMapper.selectList(listReqVO);
}
@@ -167,16 +200,12 @@
@Override
public List<MesMdItemTypeDO> getItemTypeChildrenList(Long parentId) {
- List<MesMdItemTypeDO> allList = itemTypeMapper.selectList(); // 鍒嗙被鎬婚噺灏忥紝鍏ㄩ噺鏌�
- // 閫掑綊鏀堕泦鎵�鏈夊瓙鍒嗙被
+ List<MesMdItemTypeDO> allList = itemTypeMapper.selectList();
List<MesMdItemTypeDO> result = new ArrayList<>();
collectItemTypeChildren(result, parentId, allList);
return result;
}
- /**
- * 閫掑綊鏀堕泦鎵�鏈夊瓙鍒嗙被
- */
private void collectItemTypeChildren(List<MesMdItemTypeDO> result, Long parentId, List<MesMdItemTypeDO> allList) {
for (MesMdItemTypeDO itemType : allList) {
if (Objects.equals(itemType.getParentId(), parentId)) {
@@ -186,4 +215,19 @@
}
}
-}
+ /**
+ * 杞崲 MDM 鍒嗙被 DTO 涓� MES DO
+ */
+ private MesMdItemTypeDO convertToMesDO(MdmItemCategoryRespDTO dto) {
+ MesMdItemTypeDO mesDO = new MesMdItemTypeDO();
+ mesDO.setId(dto.getId());
+ mesDO.setCode(dto.getCode());
+ mesDO.setName(dto.getName());
+ mesDO.setParentId(dto.getParentId());
+ mesDO.setItemOrProduct(dto.getItemOrProduct());
+ mesDO.setSort(dto.getSort());
+ mesDO.setStatus(dto.getStatus());
+ return mesDO;
+ }
+
+}
\ No newline at end of file
--
Gitblit v1.9.3