From 3d2c48733b86a03fc2e5a1f12ac3667ab0863b80 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期五, 08 十一月 2024 01:03:56 +0800
Subject: [PATCH] 标签模板,主页,默认工艺路线更新

---
 src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts |   95 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 60 insertions(+), 35 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts
index 732d685..e62eaf2 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts
@@ -4,14 +4,14 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-10-22 22:46:28
+ * @LastEditTime: 2024-10-23 23:55:56
  */
 
-import { Ref, h, ref, render, unref } from 'vue';
+import { Ref, unref } from 'vue';
 import {
   DeleteWoRoute,
   GetWoPTree,
-  SP_MES_PROD2WO,
+  ProdRouteToWo,
   SP_MES_WO2CUST,
 } from '/@/api/tigerapi/mes/router';
 import { GetEnum, SaveEntity, convertToTree, getEntity } from '/@/api/tigerapi/system';
@@ -119,6 +119,8 @@
           treeInfo: _treeData as unknown as MesRotTree[],
         });
       }
+      useProdRoute.setWo(wo);
+      useProdRoute.setname(wo);
       if (useProdRoute.curProdRotTree.some((q) => q.name == wo)) {
         data.treeData = useProdRoute.curProdRotTree.filter((q) => q.name == wo)[0].treeInfo;
       }
@@ -331,10 +333,9 @@
                 ? ents.Data.Items
                 : JSON.parse(res.Data.Items[0].OPTION_1);
               /* 濡傛灉OPTION_1瀛楁涓虹┖灏辨妸鍖呰淇℃伅杞琂SON瀛樺埌OPTION_1瀛楁 */
-              res.Data.Items[0].OPTION_1 = isNullOrEmpty(res.Data.Items[0].OPTION_1)
-                ? JSON.stringify(ents.Data.Items)
-                : res.Data.Items[0].OPTION_1;
-            } /* 濡傛灉鏄粍瑁呬笂鏂� */
+              res.Data.Items[0].OPTION_1 = JSON.stringify(result['BAS_PKG_DTL']);
+            }
+            /* 濡傛灉鏄粍瑁呬笂鏂� */
             if (res.Data.Items[0].ACT_TYPE == 2) {
               result['name'] = 'ItemCode';
               result['ItemCode'] = JSON.parse(res.Data.Items[0].OPTION_1);
@@ -352,7 +353,7 @@
               entityName: 'MES_WO_NODE',
               order: '',
             });
-            setFieldsValueNode({
+            const values = {
               ID: res.Data.Items[0].ID,
               OPER_CODE: res.Data.Items[0].OPER_CODE,
               ROT_ID: res.Data.Items[0].ROT_ID,
@@ -379,11 +380,18 @@
               ALLOW_DFT_IN: isNullOrEmpty(res.Data.Items[0].ALLOW_DFT_IN)
                 ? 'N'
                 : res.Data.Items[0].ALLOW_DFT_IN,
+              IF_DFT_OFFLINE: isNullOrEmpty(res.Data.Items[0].IF_DFT_OFFLINE)
+                ? 'N'
+                : res.Data.Items[0].IF_DFT_OFFLINE,
               REMARK: res.Data.Items[0].REMARK,
               WORK_ORDER: params['objParams'].value['CODE'],
               CUST_CODE: params['selectedNodes'][0].cust,
               PROD_CODE: params['selectedNodes'][0].prod,
-            });
+            };
+            setFieldsValueNode(values);
+            /* 榛樿淇濆瓨 */
+            SaveEntity(values, true, 'MES_WO_OPER');
+
             result['name'] = 'Node';
             result['isShow'] = {
               BAS_PKG_DTL: false,
@@ -551,33 +559,19 @@
             return;
           }
           /* 鏇存柊宸ュ崟鐘舵�佸苟鐢熸垚宸ュ崟鐨勫伐鑹鸿矾绾� */
-          UpdateWoStatus({
-            UserId: useUserStore().getUserInfo.userId as string,
-            WorkOrder: args[1]['CODE'],
-            Status: -1,
-            RouteStatus: 1,
-            WoBatch: '',
-            ActLine: '',
+          ProdRouteToWo({
+            rotId: d.values.id,
+            wo: args[1]['CODE'],
+            rotCode: '',
+            options: {
+              //鏍规嵁鎹偣鏌ヨ锛屽繀闇�甯﹁繖涓弬鏁�
+              UserId: useUserStore().getUserInfo.userId,
+              ByOrg: true,
+              CurOrg: useUserStore().getUserInfo.orgCode,
+            },
           }).then((action) => {
             if (action.IsSuccessed) {
-              SP_MES_PROD2WO({ rotId: d.values.id, wo: args[1]['CODE'] }).then((action) => {
-                if (action.IsSuccessed) {
-                  args[2]();
-                } else {
-                  UpdateWoStatus({
-                    UserId: useUserStore().getUserInfo.userId as string,
-                    WorkOrder: args[1]['CODE'],
-                    Status: -1,
-                    RouteStatus: 0,
-                    WoBatch: '',
-                    ActLine: '',
-                  });
-                  createErrorModal({
-                    title: t('sys.api.errorTip'),
-                    content: t(action.LocaleMsg),
-                  });
-                }
-              });
+              args[2]();
             } else {
               createErrorModal({
                 title: t('sys.api.errorTip'),
@@ -884,10 +878,18 @@
                 const webSocketStore = useWebSocketStore();
                 if (webSocketStore.GetSocketState == 1) {
                   webSocketStore.sendMessage(
-                    `wsGetNew ${param.values['LABEL_ID']}_#_${ param.values['WORK_ORDER']}`,
+                    `wsGetNew ${param.values['LABEL_ID']}_#_${param.values['WORK_ORDER']}`,
                   );
                 }
               }
+            case 'delete':
+              const webSocketStore = useWebSocketStore();
+              if (webSocketStore.GetSocketState == 1) {
+                webSocketStore.sendMessage(
+                  `wsGetNew ${param.values['LABEL_ID']}_#_${param.values['WORK_ORDER']}`,
+                );
+              }
+              break;
           }
           resolve('OK');
         } catch (e) {
@@ -1667,6 +1669,29 @@
       },
     },
     {
+      field: 'IF_DFT_OFFLINE',
+      label: '鍒ゆ柇涓嶈壇鍚庢槸鍚︿笅绾�',
+      required: true,
+      defaultValue: 'N',
+      component: 'Select',
+      colProps: { span: 12 },
+      componentProps: {
+        options: [
+          {
+            label: '鏄�',
+            value: 'Y',
+            key: 'Y',
+          },
+          {
+            label: '鍚�',
+            value: 'N',
+            key: 'N',
+          },
+        ],
+      },
+      ifShow: ({ values }) => values.OPER_CODE == 'TestNode',
+    },
+    {
       field: 'REMARK',
       label: '澶囨敞',
       component: 'Input',

--
Gitblit v1.9.3