From abbc201b41a1a25a19ccf7cff8df633dadcf5d88 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 05 三月 2025 16:52:39 +0800
Subject: [PATCH] 优化

---
 src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts |   95 +++++++++++++++++++++++++++++++----------------
 1 files changed, 62 insertions(+), 33 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts
index fb85766..1bac099 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts
@@ -4,21 +4,22 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-08-28 08:53:22
+ * @LastEditTime: 2024-09-29 21:28:37
  */
 
 import { Tag, Tooltip } from 'ant-design-vue';
 import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table';
 import { useI18n } from '/@/hooks/web/useI18n';
-import { h, unref } from 'vue';
-import { getEntity, GetEnum, SaveEntity } from '/@/api/tigerapi/system';
+import { h } from 'vue';
+import { getEntity, SaveEntity } from '/@/api/tigerapi/system';
 import { useLocale } from '/@/locales/useLocale';
 import { useModal } from '/@/components/Modal';
 import { CustModalParams, FunctionType } from '/@/api/tigerapi/model/systemModel';
 import { useForm } from '/@/components/Form';
 import { useMessage } from '/@/hooks/web/useMessage';
-import { UpdateWoStatus } from '/@/api/tigerapi/mes/wo';
+import { UpdateWoBatchStatus } from '/@/api/tigerapi/mes/wo';
 import { useUserStore } from '/@/store/modules/user';
+import { formatToDateTime } from '/@/utils/dateUtil';
 
 const { getLocale } = useLocale();
 const { createMessage, createErrorModal } = useMessage();
@@ -26,7 +27,7 @@
 
 function _default() {
   const ActionColumn: BasicColumn = {
-    width: 160,
+    width: 180,
     title: '鎿嶄綔',
     dataIndex: 'action',
     slots: { customRender: 'action' },
@@ -55,7 +56,7 @@
       data.map((x) => {
         if (x.name == 'handlePause') {
           x.onClick = handlePause.bind(null, args, params);
-          x.color = 'error'
+          x.color = 'error';
           x.tooltip = '鏆傚仠';
         }
         if (x.name == 'handleStart') {
@@ -161,6 +162,13 @@
         {
           dataIndex: 'ACT_LINE',
           title: '瀹為檯绾夸綋',
+          ifShow: true,
+          sorter: true,
+          resizable: true,
+        },
+        {
+          dataIndex: 'PLAN_DATE',
+          title: '璁″垝鏃ユ湡',
           ifShow: true,
           sorter: true,
           resizable: true,
@@ -346,14 +354,16 @@
       return new Promise((resolve, reject) => {
         try {
           const wo = param.values['mValues'];
-          wo.STATUS = 2;
-          wo.ACT_LINE = param.values['forminfo'].ACT_LINE;
-          SaveEntity(wo, true, 'BIZ_MES_WO_BATCH').then((action) => {
-            if (action.IsSuccessed) {
-              resolve(action);
-            } else {
-              reject(action);
-            }
+          /* 鏇存柊宸ュ崟鎵规鐘舵�� */
+         return  UpdateWoBatchStatus({
+            UserId: useUserStore().getUserInfo.userId as string,
+            WorkOrder: wo.ORDER_NO,
+            WoBatch: wo.BATCH_NO,
+            ActLine: param.values['forminfo'].ACT_LINE,
+            Status: 2,
+            RouteStatus: 0,
+          }).then((action) => {
+            resolve(action);
           });
         } catch {
           reject(false);
@@ -378,20 +388,21 @@
       });
       return;
     }
-    // params['record'].STATUS = 4;
-    // SaveEntity(params['record'], true, 'BIZ_MES_WO_BATCH').then((action) => {
-    //   if (action.IsSuccessed) {
-    //     createMessage.success(t('宸叉殏鍋�'));
-    //     reload();
-    //   } else {
-    //     createMessage.success(t('鏆傚仠鎿嶄綔澶辫触'));
-    //   }
-    // });
-    UpdateWoStatus({
+    /* 鏇存柊宸ュ崟鎵规鐘舵�� */
+    UpdateWoBatchStatus({
       UserId: useUserStore().getUserInfo.userId as string,
       WorkOrder: params['record'].ORDER_NO,
-      Status: -1,
+      WoBatch: params['record'].BATCH_NO,
+      Status: 4,
       RouteStatus: 0,
+      ActLine: ''
+    }).then((action) => {
+      if (action.IsSuccessed) {
+        createMessage.success(t('宸叉殏鍋�'));
+        reload();
+      } else {
+        createMessage.success(t(action.Message));
+      }
     });
   }
 
@@ -411,10 +422,17 @@
       });
       return;
     }
-    params['record'].STATUS = 3;
-    SaveEntity(params['record'], true, 'BIZ_MES_WO_BATCH').then((action) => {
+     /* 鏇存柊宸ュ崟鎵规鐘舵�� */
+     UpdateWoBatchStatus({
+       UserId: useUserStore().getUserInfo.userId as string,
+       WorkOrder: params['record'].ORDER_NO,
+       WoBatch: params['record'].BATCH_NO,
+       Status: 3,
+       RouteStatus: 0,
+       ActLine: ''
+     }).then((action) => {
       if (action.IsSuccessed) {
-        createMessage.success(t('宸插彇娑堟殏鍋�'));
+        createMessage.success(t('鏆傚仠宸插彇娑�'));
         reload();
       } else {
         createMessage.success(t('鍙栨秷鏆傚仠鎿嶄綔澶辫触'));
@@ -467,14 +485,25 @@
         getContainer: () => document.body,
       });
       return;
-    } 
-    params['record'].STATUS = 0;
-    SaveEntity(params['record'], true, 'BIZ_MES_WO_BATCH').then((action) => {
+    }
+    /* 鏇存柊宸ュ崟鎵规鐘舵�� */
+    UpdateWoBatchStatus({
+      UserId: useUserStore().getUserInfo.userId as string,
+      WorkOrder: params['record'].ORDER_NO,
+      WoBatch: params['record'].BATCH_NO,
+      Status: 0, //鍙栨秷涓嬪彂鐘舵��
+      RouteStatus: 0,
+      ActLine: ''
+    }).then((action) => {
       if (action.IsSuccessed) {
-        createMessage.success(t('宸插彇娑�'));
+        createMessage.success(t('涓嬪彂宸插彇娑�'));
         reload();
       } else {
-        createMessage.success(t('鍙栨秷鎿嶄綔澶辫触'));
+        createErrorModal({
+          title: t('璀﹀憡'),
+          content: t(action.Message),
+          getContainer: () => document.body,
+        });
       }
     });
   }

--
Gitblit v1.9.3