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/wm/batch/MesWmBatchServiceImpl.java | 168 ++++++++++++++++++++++++++-----------------------------
1 files changed, 79 insertions(+), 89 deletions(-)
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/batch/MesWmBatchServiceImpl.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/batch/MesWmBatchServiceImpl.java
index 151f178..d218f8c 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/batch/MesWmBatchServiceImpl.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/batch/MesWmBatchServiceImpl.java
@@ -14,6 +14,7 @@
import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService;
import cn.iocoder.yudao.module.mes.service.mdm.MesMdmItemService;
import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService;
+import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi;
import cn.iocoder.yudao.module.mdm.api.item.MdmItemBatchConfigApi;
import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemBatchConfigRespDTO;
import jakarta.annotation.Resource;
@@ -33,7 +34,7 @@
/**
* 鎵规绠$悊 Service 瀹炵幇绫�
*
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
*/
@Service
@Validated
@@ -56,10 +57,14 @@
private MesMdAutoCodeRecordService autoCodeRecordService;
@Resource
private MesWmBarcodeService barcodeService;
+ @Resource
+ private CrmCustomerApi customerApi;
@Override
public PageResult<MesWmBatchDO> getBatchPage(MesWmBatchPageReqVO pageReqVO) {
- return batchMapper.selectPage(pageReqVO);
+ // 鑾峰彇鐢ㄦ埛鏈夋潈闄愮殑瀹㈡埛 ID 鍒楄〃
+ List<Long> permittedClientIds = customerApi.getPermittedCustomerIds();
+ return batchMapper.selectPage(pageReqVO, permittedClientIds);
}
@Override
@@ -92,122 +97,107 @@
// 2. 鏍规嵁閰嶇疆鏍¢獙蹇呭~鍙傛暟骞舵竻绌轰笉闇�瑕佺殑鍙傛暟
MesWmBatchDO batch = MesWmBatchDO.builder().itemId(reqVO.getItemId()).build();
if (config != null) {
+ // ========== 蹇呭~鏍¢獙锛坒lag=true 琛ㄧず璇ュ瓧娈典负蹇呭~锛� ==========
// 鐢熶骇鏃ユ湡
- if (Boolean.TRUE.equals(config.getProduceDateFlag())) {
- if (ObjUtil.isNull(reqVO.getProduceDate())) {
- throw exception(WM_BATCH_PRODUCE_DATE_REQUIRED);
- }
- batch.setProduceDate(reqVO.getProduceDate());
+ if (Boolean.TRUE.equals(config.getProduceDateFlag()) && ObjUtil.isNull(reqVO.getProduceDate())) {
+ throw exception(WM_BATCH_PRODUCE_DATE_REQUIRED);
}
// 鍏ュ簱鏃ユ湡
- if (Boolean.TRUE.equals(config.getReceiptDateFlag())) {
- if (ObjUtil.isNull(reqVO.getReceiptDate())) {
- throw exception(WM_BATCH_RECEIPT_DATE_REQUIRED);
- }
- batch.setReceiptDate(reqVO.getReceiptDate());
+ if (Boolean.TRUE.equals(config.getReceiptDateFlag()) && ObjUtil.isNull(reqVO.getReceiptDate())) {
+ throw exception(WM_BATCH_RECEIPT_DATE_REQUIRED);
}
// 鏈夋晥鏈�
- if (Boolean.TRUE.equals(config.getExpireDateFlag())) {
- if (ObjUtil.isNull(reqVO.getExpireDate())) {
- throw exception(WM_BATCH_EXPIRE_DATE_REQUIRED);
- }
- batch.setExpireDate(reqVO.getExpireDate());
+ if (Boolean.TRUE.equals(config.getExpireDateFlag()) && ObjUtil.isNull(reqVO.getExpireDate())) {
+ throw exception(WM_BATCH_EXPIRE_DATE_REQUIRED);
}
// 渚涘簲鍟�
- if (Boolean.TRUE.equals(config.getVendorFlag())) {
- if (ObjUtil.isNull(reqVO.getVendorId())) {
- throw exception(WM_BATCH_VENDOR_REQUIRED);
- }
- batch.setVendorId(reqVO.getVendorId());
+ if (Boolean.TRUE.equals(config.getVendorFlag()) && ObjUtil.isNull(reqVO.getVendorId())) {
+ throw exception(WM_BATCH_VENDOR_REQUIRED);
}
// 瀹㈡埛
- if (Boolean.TRUE.equals(config.getClientFlag())) {
- if (ObjUtil.isNull(reqVO.getClientId())) {
- throw exception(WM_BATCH_CLIENT_REQUIRED);
- }
- batch.setClientId(reqVO.getClientId());
+ if (Boolean.TRUE.equals(config.getClientFlag()) && ObjUtil.isNull(reqVO.getClientId())) {
+ throw exception(WM_BATCH_CLIENT_REQUIRED);
}
// 閲囪喘璁㈠崟缂栧彿
- if (Boolean.TRUE.equals(config.getPurchaseOrderCodeFlag())) {
- if (ObjUtil.isNull(reqVO.getPurchaseOrderCode())) {
- throw exception(WM_BATCH_PURCHASE_ORDER_CODE_REQUIRED);
- }
- batch.setPurchaseOrderCode(reqVO.getPurchaseOrderCode());
+ if (Boolean.TRUE.equals(config.getPurchaseOrderCodeFlag()) && ObjUtil.isNull(reqVO.getPurchaseOrderCode())) {
+ throw exception(WM_BATCH_PURCHASE_ORDER_CODE_REQUIRED);
}
// 閿�鍞鍗曠紪鍙�
- if (Boolean.TRUE.equals(config.getSalesOrderCodeFlag())) {
- if (ObjUtil.isNull(reqVO.getSalesOrderCode())) {
- throw exception(WM_BATCH_CUSTOMER_ORDER_CODE_REQUIRED);
- }
- batch.setSalesOrderCode(reqVO.getSalesOrderCode());
+ if (Boolean.TRUE.equals(config.getSalesOrderCodeFlag()) && ObjUtil.isNull(reqVO.getSalesOrderCode())) {
+ throw exception(WM_BATCH_CUSTOMER_ORDER_CODE_REQUIRED);
}
// 鐢熶骇宸ュ崟
- if (Boolean.TRUE.equals(config.getWorkOrderFlag())) {
- if (ObjUtil.isNull(reqVO.getWorkOrderId())) {
- throw exception(WM_BATCH_WORK_ORDER_REQUIRED);
- }
- batch.setWorkOrderId(reqVO.getWorkOrderId());
+ if (Boolean.TRUE.equals(config.getWorkOrderFlag()) && ObjUtil.isNull(reqVO.getWorkOrderId())) {
+ throw exception(WM_BATCH_WORK_ORDER_REQUIRED);
}
// 鐢熶骇浠诲姟
- if (Boolean.TRUE.equals(config.getTaskFlag())) {
- if (ObjUtil.isNull(reqVO.getTaskId())) {
- throw exception(WM_BATCH_TASK_REQUIRED);
- }
- batch.setTaskId(reqVO.getTaskId());
+ if (Boolean.TRUE.equals(config.getTaskFlag()) && ObjUtil.isNull(reqVO.getTaskId())) {
+ throw exception(WM_BATCH_TASK_REQUIRED);
}
// 宸ヤ綔绔�
- if (Boolean.TRUE.equals(config.getWorkstationFlag())) {
- if (ObjUtil.isNull(reqVO.getWorkstationId())) {
- throw exception(WM_BATCH_WORKSTATION_REQUIRED);
- }
- batch.setWorkstationId(reqVO.getWorkstationId());
+ if (Boolean.TRUE.equals(config.getWorkstationFlag()) && ObjUtil.isNull(reqVO.getWorkstationId())) {
+ throw exception(WM_BATCH_WORKSTATION_REQUIRED);
}
// 宸ュ叿
- if (Boolean.TRUE.equals(config.getToolFlag())) {
- if (ObjUtil.isNull(reqVO.getToolId())) {
- throw exception(WM_BATCH_TOOL_REQUIRED);
- }
- batch.setToolId(reqVO.getToolId());
+ if (Boolean.TRUE.equals(config.getToolFlag()) && ObjUtil.isNull(reqVO.getToolId())) {
+ throw exception(WM_BATCH_TOOL_REQUIRED);
}
// 妯″叿
- if (Boolean.TRUE.equals(config.getMoldFlag())) {
- if (ObjUtil.isNull(reqVO.getMoldId())) {
- throw exception(WM_BATCH_MOLD_REQUIRED);
- }
- batch.setMoldId(reqVO.getMoldId());
+ if (Boolean.TRUE.equals(config.getMoldFlag()) && ObjUtil.isNull(reqVO.getMoldId())) {
+ throw exception(WM_BATCH_MOLD_REQUIRED);
}
// 鐢熶骇鎵瑰彿
- if (Boolean.TRUE.equals(config.getLotNumberFlag())) {
- if (ObjUtil.isNull(reqVO.getLotNumber())) {
- throw exception(WM_BATCH_LOT_NUMBER_REQUIRED);
- }
- batch.setLotNumber(reqVO.getLotNumber());
+ if (Boolean.TRUE.equals(config.getLotNumberFlag()) && ObjUtil.isNull(reqVO.getLotNumber())) {
+ throw exception(WM_BATCH_LOT_NUMBER_REQUIRED);
}
// 璐ㄩ噺鐘舵��
- if (Boolean.TRUE.equals(config.getQualityStatusFlag())) {
- if (ObjUtil.isNull(reqVO.getQualityStatus())) {
- throw exception(WM_BATCH_QUALITY_STATUS_REQUIRED);
- }
- batch.setQualityStatus(reqVO.getQualityStatus());
+ if (Boolean.TRUE.equals(config.getQualityStatusFlag()) && ObjUtil.isNull(reqVO.getQualityStatus())) {
+ throw exception(WM_BATCH_QUALITY_STATUS_REQUIRED);
}
}
- // 鏃犳壒娆¢厤缃椂锛屼娇鐢ㄤ紶鍏ョ殑鍙傛暟锛堝鏉炬ā寮忥紝閫傜敤浜庤嚜瀹氫箟鍏ュ簱绛夊満鏅級
- else {
- if (reqVO.getProduceDate() != null) {
- batch.setProduceDate(reqVO.getProduceDate());
- }
- if (reqVO.getReceiptDate() != null) {
- batch.setReceiptDate(reqVO.getReceiptDate());
- }
- if (reqVO.getExpireDate() != null) {
- batch.setExpireDate(reqVO.getExpireDate());
- }
- if (reqVO.getVendorId() != null) {
- batch.setVendorId(reqVO.getVendorId());
- }
- if (reqVO.getClientId() != null) {
- batch.setClientId(reqVO.getClientId());
- }
+
+ // ========== 淇濆瓨瀛楁锛堟棤璁烘湁鏃犻厤缃紝鍙璋冪敤鏂逛紶浜嗗氨淇濆瓨锛� ==========
+ if (reqVO.getProduceDate() != null) {
+ batch.setProduceDate(reqVO.getProduceDate());
+ }
+ if (reqVO.getReceiptDate() != null) {
+ batch.setReceiptDate(reqVO.getReceiptDate());
+ }
+ if (reqVO.getExpireDate() != null) {
+ batch.setExpireDate(reqVO.getExpireDate());
+ }
+ if (reqVO.getVendorId() != null) {
+ batch.setVendorId(reqVO.getVendorId());
+ }
+ if (reqVO.getClientId() != null) {
+ batch.setClientId(reqVO.getClientId());
+ }
+ if (reqVO.getPurchaseOrderCode() != null) {
+ batch.setPurchaseOrderCode(reqVO.getPurchaseOrderCode());
+ }
+ if (reqVO.getSalesOrderCode() != null) {
+ batch.setSalesOrderCode(reqVO.getSalesOrderCode());
+ }
+ if (reqVO.getWorkOrderId() != null) {
+ batch.setWorkOrderId(reqVO.getWorkOrderId());
+ }
+ if (reqVO.getTaskId() != null) {
+ batch.setTaskId(reqVO.getTaskId());
+ }
+ if (reqVO.getWorkstationId() != null) {
+ batch.setWorkstationId(reqVO.getWorkstationId());
+ }
+ if (reqVO.getToolId() != null) {
+ batch.setToolId(reqVO.getToolId());
+ }
+ if (reqVO.getMoldId() != null) {
+ batch.setMoldId(reqVO.getMoldId());
+ }
+ if (reqVO.getLotNumber() != null) {
+ batch.setLotNumber(reqVO.getLotNumber());
+ }
+ if (reqVO.getQualityStatus() != null) {
+ batch.setQualityStatus(reqVO.getQualityStatus());
}
// 3.1 鎯呭喌涓�锛氫紶鍏ヤ簡 batchCode锛屾煡璇㈡槸鍚﹀瓨鍦ㄨ鎵规鍙�
--
Gitblit v1.9.3