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-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java | 70 ++++++++++++++++++++++++++++-------
1 files changed, 56 insertions(+), 14 deletions(-)
diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
index b9fd295..d78cba5 100644
--- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
+++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
@@ -19,12 +19,14 @@
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractProductDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
-import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO;
+import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
+import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi;
+import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO;
import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService;
import cn.iocoder.yudao.module.crm.service.contact.CrmContactService;
import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
-import cn.iocoder.yudao.module.crm.service.product.CrmProductService;
+import cn.iocoder.yudao.module.crm.service.invoice.CrmInvoiceService;
import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableService;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
@@ -69,9 +71,12 @@
@Resource
private CrmBusinessService businessService;
@Resource
- private CrmProductService productService;
- @Resource
private CrmReceivableService receivableService;
+ @Resource
+ private CrmInvoiceService invoiceService;
+
+ @Resource
+ private MdmItemApi mdmItemApi;
@Resource
private AdminUserApi adminUserApi;
@@ -118,12 +123,12 @@
CrmContractRespVO contractVO = buildContractDetailList(singletonList(contract)).get(0);
// 鎷兼帴浜у搧椤�
List<CrmContractProductDO> businessProducts = contractService.getContractProductListByContractId(contractVO.getId());
- Map<Long, CrmProductDO> productMap = productService.getProductMap(
- convertSet(businessProducts, CrmContractProductDO::getProductId));
+ Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap(
+ convertSet(businessProducts, CrmContractProductDO::getItemId));
contractVO.setProducts(BeanUtils.toBean(businessProducts, CrmContractRespVO.Product.class, businessProductVO ->
- MapUtils.findAndThen(productMap, businessProductVO.getProductId(),
- product -> businessProductVO.setProductName(product.getName())
- .setProductNo(product.getNo()).setProductUnit(product.getUnit()))));
+ MapUtils.findAndThen(itemMap, businessProductVO.getItemId(),
+ item -> businessProductVO.setItemCode(item.getCode())
+ .setItemName(item.getName()).setItemBarCode(item.getBarCode()))));
return contractVO;
}
@@ -158,9 +163,18 @@
public void exportContractExcel(@Valid CrmContractPageReqVO exportReqVO,
HttpServletResponse response) throws IOException {
PageResult<CrmContractDO> pageResult = contractService.getContractPage(exportReqVO, getLoginUserId());
+ List<CrmContractRespVO> list = BeanUtils.toBean(pageResult.getList(), CrmContractRespVO.class);
+ // 璁$畻鏈洖娆鹃噾棰濄�佽浆鎹㈠鎵圭姸鎬佷负涓枃
+ list.forEach(vo -> {
+ if (vo.getTotalPrice() != null && vo.getTotalReceivablePrice() != null) {
+ vo.setUnReceivablePrice(vo.getTotalPrice().subtract(vo.getTotalReceivablePrice()));
+ }
+ if (vo.getAuditStatus() != null) {
+ vo.setAuditStatusName(CrmAuditStatusEnum.getNameByStatus(vo.getAuditStatus()));
+ }
+ });
// 瀵煎嚭 Excel
- ExcelUtils.write(response, "鍚堝悓.xls", "鏁版嵁", CrmContractRespVO.class,
- BeanUtils.toBean(pageResult.getList(), CrmContractRespVO.class));
+ ExcelUtils.write(response, "鍚堝悓.xls", "鏁版嵁", CrmContractRespVO.class, list);
}
@PutMapping("/transfer")
@@ -174,9 +188,17 @@
@PutMapping("/submit")
@Operation(summary = "鎻愪氦鍚堝悓瀹℃壒")
@PreAuthorize("@ss.hasPermission('crm:contract:update')")
- public CommonResult<Boolean> submitContract(@RequestParam("id") Long id) {
- contractService.submitContract(id, getLoginUserId());
+ public CommonResult<Boolean> submitContract(@RequestParam("id") Long id,
+ @RequestParam("processDefinitionKey") String processDefinitionKey) {
+ contractService.submitContract(id, processDefinitionKey, getLoginUserId());
return success(true);
+ }
+
+ @GetMapping("/approve-process-list")
+ @Operation(summary = "鑾峰彇鍚堝悓瀹℃壒娴佺▼鍒楄〃")
+ @PreAuthorize("@ss.hasPermission('crm:contract:query')")
+ public CommonResult<List<Map<String, Object>>> getContractApproveProcessList() {
+ return success(contractService.getContractApproveProcessDefinitionList());
}
private List<CrmContractRespVO> buildContractDetailList(List<CrmContractDO> contractList) {
@@ -199,6 +221,9 @@
// 1.5 鑾峰緱宸插洖娆鹃噾棰�
Map<Long, BigDecimal> receivablePriceMap = receivableService.getReceivablePriceMapByContractId(
convertSet(contractList, CrmContractDO::getId));
+ // 1.6 鑾峰緱宸插紑绁ㄩ噾棰濓紙瀹℃壒閫氳繃 + 瀹℃壒涓紝涓庡紑绁ㄩ槻瓒呮牎楠屽彛寰勪竴鑷达級
+ Map<Long, BigDecimal> invoicePriceMap = invoiceService.getInvoicePriceMapByContractId(
+ convertSet(contractList, CrmContractDO::getId));
// 2. 鎷兼帴鏁版嵁
return BeanUtils.toBean(contractList, CrmContractRespVO.class, contractVO -> {
// 2.1 璁剧疆瀹㈡埛淇℃伅
@@ -216,6 +241,12 @@
findAndThen(businessMap, contractVO.getBusinessId(), business -> contractVO.setBusinessName(business.getName()));
// 2.5 璁剧疆宸插洖娆鹃噾棰�
contractVO.setTotalReceivablePrice(receivablePriceMap.getOrDefault(contractVO.getId(), BigDecimal.ZERO));
+ // 2.6 璁剧疆宸插紑绁ㄩ噾棰�
+ contractVO.setTotalInvoicePrice(invoicePriceMap.getOrDefault(contractVO.getId(), BigDecimal.ZERO));
+ // 2.7 璁剧疆鏈紑绁ㄩ噾棰�
+ if (contractVO.getTotalPrice() != null && contractVO.getTotalInvoicePrice() != null) {
+ contractVO.setUnInvoicePrice(contractVO.getTotalPrice().subtract(contractVO.getTotalInvoicePrice()));
+ }
});
}
@@ -247,10 +278,21 @@
// 鎷兼帴鏁版嵁
Map<Long, BigDecimal> receivablePriceMap = receivableService.getReceivablePriceMapByContractId(
convertSet(pageResult.getList(), CrmContractDO::getId));
+ Map<Long, BigDecimal> invoicePriceMap = invoiceService.getInvoicePriceMapByContractId(
+ convertSet(pageResult.getList(), CrmContractDO::getId));
return success(convertList(pageResult.getList(), contract -> new CrmContractRespVO() // 鍙繑鍥� id銆乶ame 绛夌簿绠�瀛楁
.setId(contract.getId()).setName(contract.getName()).setAuditStatus(contract.getAuditStatus())
.setTotalPrice(contract.getTotalPrice())
- .setTotalReceivablePrice(receivablePriceMap.getOrDefault(contract.getId(), BigDecimal.ZERO))));
+ .setTotalReceivablePrice(receivablePriceMap.getOrDefault(contract.getId(), BigDecimal.ZERO))
+ .setTotalInvoicePrice(invoicePriceMap.getOrDefault(contract.getId(), BigDecimal.ZERO))));
+ }
+
+ @PostMapping("/generate-sale-order")
+ @Operation(summary = "鏍规嵁鍚堝悓鐢熸垚閿�鍞鍗�")
+ @Parameter(name = "id", description = "鍚堝悓缂栧彿", required = true)
+ @PreAuthorize("@ss.hasPermission('crm:contract:update')")
+ public CommonResult<Long> generateSaleOrder(@RequestParam("id") Long id) {
+ return success(contractService.generateSaleOrder(id, getLoginUserId()));
}
}
--
Gitblit v1.9.3