From 14817696a26eb142ccae03fa7c43050840e057f5 Mon Sep 17 00:00:00 2001
From: hsy <1029150275@qq.com>
Date: 星期一, 17 八月 2026 09:35:03 +0800
Subject: [PATCH] feat(mes): 优化生产订单与排产任务列表显示,新增启停工及校验逻辑 1. 生产订单列表展示优化 (WorkOrder)   - 新增「生产状态」列,全局注册 `ORDER_PRODUCTION_STATUS` 常量并绑定系统动态字典。   - 彻底重构「工序生产进度」单元格显示:弃用臃肿的 Steps 组件,改为极简横向布局(彩色状态圆点 + 进度百分比),解决表格行高被强行撑开及内容截断问题,支持横向滚动。   - 优化「完成进度」列宽及展示样式,将百分比数值外置同行显示,更加直观。 2. 排产任务列表改造 (Task)   - 顶部表头重构,由单一标题重构为「全部 / 未完成 / 已完成」的 Tabs 标签页切换结构。   - 重写数据过滤逻辑,剥离写死的 status 查询,改为使用 `scheduleStatus` 字段动态响应 Tabs 切换 (0: 未完成, 1: 已完成)。 3. 工单业务逻辑增强与状态流转   - 落实「工单查询逻辑设计方案」,优化底层的工单条件检索逻辑。   - 实现「添加工单启停功能」与「停工状态」,支持工单在执行过程中的暂停与恢复业务流转。   - 强化容错与防呆设计:操作「完成订单」时增加前置校验 `handleCheckFinish`,若生产状态为未完成,强制弹出二次确认 Modal,避免误操作。 # 相关讨论/参考方案 # - 添加工单启停功能 # - 停工状态功能设计方案 # - 工单查询逻辑设计方案 # - 工单完成进度显示优化

---
 src/views/wls/salesnotice/data.ts |   67 ++++++++++++++++++++++++++-------
 1 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/src/views/wls/salesnotice/data.ts b/src/views/wls/salesnotice/data.ts
index f9a1931..6818446 100644
--- a/src/views/wls/salesnotice/data.ts
+++ b/src/views/wls/salesnotice/data.ts
@@ -5,21 +5,25 @@
 
 import { h, markRaw } from 'vue';
 
-import { DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants';
+import {
+  DICT_TYPE,
+  MesAutoCodeRuleCode,
+} from '@vben/constants';
 
 import { Button } from 'ant-design-vue';
 
 import { z } from '#/adapter/form';
 import { generateAutoCode } from '#/api/mes/md/autocode/record';
-import { MdClientSelect } from '#/views/mes/md/client/components';
+import CrmCustomerSelect from '#/components/crm-customer-select.vue';
+import { ErpSaleOrderSelect } from '#/views/erp/sale/order/components';
 import { MdItemSelect } from '#/views/mes/md/item/components';
 
 /** 琛ㄥ崟绫诲瀷 */
-export type FormType = 'create' | 'detail' | 'finish' | 'update';
+export type FormType = 'create' | 'detail' | 'update';
 
-/** 琛ㄥ崟澶撮儴鏄惁鍙锛堣鎯呫�佹墽琛屽嚭搴撴�侊級 */
+/** 琛ㄥ崟澶撮儴鏄惁鍙锛堣鎯呮�侊級 */
 function isHeaderReadonly(formType: FormType): boolean {
-  return formType === 'detail' || formType === 'finish';
+  return formType === 'detail';
 }
 
 /** 鏂板/淇敼鐨勮〃鍗� */
@@ -79,19 +83,26 @@
       rules: 'required',
     },
     {
-      fieldName: 'salesOrderCode',
-      label: '閿�鍞鍗曠紪鍙�',
-      component: 'Input',
+      fieldName: 'saleOrderId',
+      label: '閿�鍞鍗�',
+      component: markRaw(ErpSaleOrderSelect),
       componentProps: {
-        placeholder: '璇疯緭鍏ラ攢鍞鍗曠紪鍙�',
+        placeholder: '璇烽�夋嫨閿�鍞鍗�',
+        // 閫夋嫨閿�鍞鍗曞悗锛岃嚜鍔ㄥ洖濉鎴蜂俊鎭�
+        onChange: (item: any) => {
+          if (item?.customerId && formApi) {
+            formApi.setFieldValue('clientId', item.customerId);
+          }
+        },
       },
     },
     {
       fieldName: 'clientId',
       label: '瀹㈡埛',
-      component: markRaw(MdClientSelect),
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
         placeholder: '璇烽�夋嫨瀹㈡埛',
+        disabled: true,
       },
       rules: 'selectRequired',
     },
@@ -103,7 +114,7 @@
         class: '!w-full',
         format: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨鍙戣揣鏃ユ湡',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
       },
       rules: 'required',
     },
@@ -166,7 +177,7 @@
       },
     },
     {
-      fieldName: 'salesOrderCode',
+      fieldName: 'saleOrderCode',
       label: '閿�鍞鍗曠紪鍙�',
       component: 'Input',
       componentProps: {
@@ -177,7 +188,7 @@
     {
       fieldName: 'clientId',
       label: '瀹㈡埛',
-      component: markRaw(MdClientSelect),
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
         placeholder: '璇烽�夋嫨瀹㈡埛',
       },
@@ -200,7 +211,7 @@
       minWidth: 150,
     },
     {
-      field: 'salesOrderCode',
+      field: 'saleOrderCode',
       title: '閿�鍞鍗曠紪鍙�',
       minWidth: 140,
     },
@@ -240,6 +251,12 @@
       },
     },
     {
+      field: 'outStatus',
+      title: '鍑哄簱鐘舵��',
+      minWidth: 100,
+      slots: { default: 'outStatus' },
+    },
+    {
       title: '鎿嶄綔',
       width: 200,
       fixed: 'right',
@@ -279,6 +296,28 @@
       width: 100,
     },
     {
+      field: 'outCount',
+      title: '宸插嚭搴撴暟閲�',
+      width: 100,
+      formatter: ({ cellValue }: { cellValue: number }) => (cellValue || 0).toFixed(2),
+    },
+    {
+      field: 'outProgress',
+      title: '鍑哄簱杩涘害',
+      width: 120,
+      cellRender: {
+        name: 'CellText',
+        props: {
+          formatter: ({ row }: { row: MesWmSalesNoticeLineApi.SalesNoticeLine }) => {
+            const quantity = row.quantity || 0;
+            const outCount = row.outCount || 0;
+            const percent = quantity > 0 ? Math.round((outCount / quantity) * 100) : 0;
+            return `${outCount.toFixed(2)} / ${quantity.toFixed(2)} (${percent}%)`;
+          },
+        },
+      },
+    },
+    {
       field: 'batchCode',
       title: '鎵规鍙�',
       minWidth: 120,

--
Gitblit v1.9.3