From 323e576c64129723df20fd18effb20d96d8d18b3 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期一, 22 七月 2024 10:27:50 +0800
Subject: [PATCH] 工单更新

---
 src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts |   67 +++++++++++++++++++++++----------
 1 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts
index 1f43d2f..432efb1 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts
@@ -4,7 +4,7 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-21 18:40:06
+ * @LastEditTime: 2024-07-22 02:58:01
  */
 
 import { Ref, h, ref, render, unref } from 'vue';
@@ -25,6 +25,7 @@
 import { uploadApi } from '/@/api/sys/upload';
 import { initRoute } from '../data';
 import { SP_MES_PROD2WO } from '/@/api/tigerapi/mes/router';
+import { cloneDeep } from 'lodash-es';
 
 const { t } = useI18n();
 const { createErrorModal } = useMessage();
@@ -39,7 +40,7 @@
   const isPrint = (type: number) => type === 5;
   const isPackage = (type: number) => type === 6;
   const ActionColumn: BasicColumn = {
-    width: 220,
+    width: 180,
     title: '鎿嶄綔',
     dataIndex: 'action',
     slots: { customRender: 'action' },
@@ -255,8 +256,21 @@
           });
           break;
         case 'set':
-        case 'setRot':
           openRvModal(true, { rotId: selectVals.value['ROUTE_CODE'], slotName: slotName });
+          break;
+        case 'setRot':
+          const id = {
+            ID: params['record'].ID,
+            Name: 'WoRouteBinding',
+            CODE: params['record'].ITEM_CODE,
+            Title: `宸ュ崟[${params['record'].ITEM_CODE}]宸ヨ壓缁戝畾`,
+            colSlots: [] /* 琛ㄦ牸鍐呯殑鏌ヨ琛ㄥ崟瀛楁鐨勬彃妲藉垪琛紝涓�鑸敤浜庡脊鍑洪�夋嫨妗嗘寜閽� */,
+            crudColSlots: [] /* 澧炲垹鏀硅〃鍗曞瓧娈电殑鎻掓Ы鍒楄〃锛屼竴鑸敤浜庡脊鍑洪�夋嫨妗嗘寜閽� */,
+            dense: true,
+            pageTitle: `宸ュ崟宸ヨ壓缁戝畾`,
+            pageContent: `杩欓噷鏄鐞嗗伐鍗曠殑宸ヨ壓缁戝畾锛屼竴涓伐鍗曞彲浠ョ粦瀹氬涓伐鑹鸿矾绾縛,
+          };
+          go(`/WoRouteBinding/CP/${encodeURI(JSON.stringify(id))}`);
           break;
       }
     },
@@ -280,12 +294,17 @@
         try {
           const form = param.values['prodinfo'];
           const wo = param.values['mValues'];
-          wo.ROUTE_STATUS = 1;
-          wo.ROUTE_CODE = form.ROUTE_CODE;
-          SaveEntity(wo, true, 'BIZ_MES_WO').then((action) => {
+          const _wo = cloneDeep(wo);
+          _wo.ROUTE_STATUS = 1;
+          _wo.ROUTE_CODE = form.ROUTE_CODE;
+          SaveEntity(_wo, true, 'BIZ_MES_WO').then((action) => {
             if (action.IsSuccessed) {
-              SP_MES_PROD2WO({ rotId: form.ROT_ID, wo: wo.ORDER_NO });
-              resolve(action);
+              SP_MES_PROD2WO({ rotId: form.ROT_ID, wo: wo.ORDER_NO }).then((res) => {
+                if (!res.IsSuccessed) {
+                  SaveEntity(wo, true, 'BIZ_MES_WO');
+                }
+                resolve(res);
+              });
             } else {
               reject(action);
             }
@@ -395,18 +414,26 @@
       edges: [],
     };
     initRoute(params['currlf'], params['record'].ROUTE_CODE, params['routeData'], params['currlf']);
-    params['selectVals'].value['ROUTE_CODE'] = params['record'].ROUTE_CODE;
-    openCustModal(true, {
-      isUpdate: true,
-      ctype: 'BIZ_MES_WO_Config',
-      title: '宸ヨ壓閰嶇疆',
-      width: '1200px',
-      formEl: params['useFormData'].value, //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы
-      formElName: ['woinfo', 'prodinfo', 'rotinfo'], //琛ㄥ崟鎻掓Ы鍚嶇О锛屾敮鎸佸涓〃鍗�
-      RowKey: '',
-      fnName: 'SaveCofig', //淇濆瓨鏂规硶鍚�
-      others: params['routeData'].value,
-      values: params['record'], //琛ㄥ崟璁板綍
+    getEntity({
+      sqlcmd: `ROT_CODE = '${params['record'].ROUTE_CODE}'`,
+      entityName: 'MES_ROUTE',
+      order: '',
+    }).then((rot) => {
+      params['selectVals'].value['ROUTE_CODE'] = params['record'].ROUTE_CODE;
+      params['selectVals'].value['ROT_ID'] =
+        !isNullOrEmpty(rot.Data) && !isNullOrEmpty(rot.Data.Items) ? rot.Data.Items[0].ID : '';
+      openCustModal(true, {
+        isUpdate: true,
+        ctype: 'BIZ_MES_WO_Config',
+        title: '宸ヨ壓閰嶇疆',
+        width: '1200px',
+        formEl: params['useFormData'].value, //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы
+        formElName: ['woinfo', 'prodinfo', 'rotinfo'], //琛ㄥ崟鎻掓Ы鍚嶇О锛屾敮鎸佸涓〃鍗�
+        RowKey: '',
+        fnName: 'SaveCofig', //淇濆瓨鏂规硶鍚�
+        others: params['routeData'].value,
+        values: { ...params['record'], ...params['selectVals'].value }, //琛ㄥ崟璁板綍
+      });
     });
   }
 

--
Gitblit v1.9.3