From 04aac2eda9b5d9473eb96d12b32cb76fb45135c6 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期日, 21 七月 2024 19:52:31 +0800
Subject: [PATCH] 工单更新

---
 src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue               |    6 +
 src/api/tigerapi/mes/router.ts                                      |   20 ++++++
 src/views/tigerprojects/mes/prod/biz_mes_wo/biz_mes_wo.data.ts      |   18 ------
 src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts |    7 +-
 src/api/tigerapi/mes/mesApi.ts                                      |    3 
 src/views/tigerprojects/system/lowcode/composition/index.vue        |    6 +
 src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts       |   43 +++++++++----
 src/views/tigerprojects/system/lowcode/high/index.vue               |    6 +
 src/views/tigerprojects/system/lowcode/normal/mainTable.vue         |    6 +
 src/views/tigerprojects/system/lowcode/detail/index.vue             |    6 +
 src/views/components/Step2.vue                                      |    2 
 11 files changed, 74 insertions(+), 49 deletions(-)

diff --git a/src/api/tigerapi/mes/mesApi.ts b/src/api/tigerapi/mes/mesApi.ts
index b33a973..82d1432 100644
--- a/src/api/tigerapi/mes/mesApi.ts
+++ b/src/api/tigerapi/mes/mesApi.ts
@@ -4,7 +4,7 @@
  * @version: 
  * @Date: 2024-04-27 15:54:50
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-16 09:53:13
+ * @LastEditTime: 2024-07-21 17:19:54
  */
 export enum mesApi {
   GetRoute = '/MES/GetRoute',
@@ -21,4 +21,5 @@
   RouteToProd = '/MES/RouteToProd',
   RouteToCust = '/MES/RouteToCust',
   SaveMesBatchWo = '/MES/SaveMesBatchWo',
+  SP_MES_PROD2WO = '/MES/SP_MES_PROD2WO',
 }
diff --git a/src/api/tigerapi/mes/router.ts b/src/api/tigerapi/mes/router.ts
index 9cc0478..416f7f1 100644
--- a/src/api/tigerapi/mes/router.ts
+++ b/src/api/tigerapi/mes/router.ts
@@ -127,11 +127,11 @@
  * @param {string} params
  * @return {*}
  */
-export async function GetRoutePTree(params?: string) {
+export async function GetRoutePTree(params: {}) {
   const data = await defHttp.get<V_MES_ROUTE_PTREE[]>(
     {
       url: mesApi.GetRoutePTree,
-      params: { param: params },
+      params: params,
     },
     {
       errorMessageMode: 'none',
@@ -172,3 +172,19 @@
   );
   return data;
 };
+
+/**
+ * @description: 娣诲姞宸ヨ壓绾垮埌宸ュ崟
+ * @param {*} params
+ * @return {*}
+ */
+export const SP_MES_PROD2WO = async (params: {}) => {
+  const data = await defHttp.get(
+    { url: mesApi.SP_MES_PROD2WO, params: params },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false,
+    },
+  );
+  return data;
+};
diff --git a/src/views/components/Step2.vue b/src/views/components/Step2.vue
index 58cb3bd..a6ea76b 100644
--- a/src/views/components/Step2.vue
+++ b/src/views/components/Step2.vue
@@ -107,7 +107,7 @@
       ],
       tableName: 'MES_ROUTE',
       rowKey: 'ROT_CODE',
-      returnFieldName: 'ROUTE_CODE', //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О
+      returnFieldName: ['ROUTE_CODE'], //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О
       searchInfo: { TABLE_NAME: 'MES_ROUTE' },
       which: '',
     });
diff --git a/src/views/tigerprojects/mes/prod/biz_mes_wo/biz_mes_wo.data.ts b/src/views/tigerprojects/mes/prod/biz_mes_wo/biz_mes_wo.data.ts
index 7b5cdaf..f4bb103 100644
--- a/src/views/tigerprojects/mes/prod/biz_mes_wo/biz_mes_wo.data.ts
+++ b/src/views/tigerprojects/mes/prod/biz_mes_wo/biz_mes_wo.data.ts
@@ -357,10 +357,6 @@
       resultField: 'Data',
       labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name',
       valueField: 'Value',
-      // onChange: (e, v) => {
-      //   alert(e)
-      //   console.log('ApiSelect====>:', e, v);
-      // },
     },
   },
   {
@@ -426,20 +422,6 @@
     component: 'Input',
     colProps: { span: 24 },
   },
-  // {
-  //   field: 'FACTORY',
-  //   label: '宸ュ巶',
-  //   required: true,
-  //   component: 'ApiSelect',
-  //   colProps: { span: 12 },
-  //   componentProps: {
-  //     api: getEntity,
-  //     params: { entityName: 'MES_FACTORY', sqlcmd: ' 1=1 ' },
-  //     resultField: 'Data.Items',
-  //     labelField: 'FTY_NAME',
-  //     valueField: 'FTY_CODE',
-  //   },
-  // },
   {
     field: 'PLAN_LINE',
     label: '璁″垝绾夸綋',
diff --git a/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue b/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
index 73c72cc..b252f3c 100644
--- a/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
+++ b/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
@@ -4,7 +4,7 @@
  * @version: 
  * @Date: 2024-05-25 00:27:00
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-20 03:51:31
+ * @LastEditTime: 2024-07-21 18:07:27
 -->
 <template>
   <div>
@@ -463,7 +463,9 @@
     var values = GetSelectSuccess(d, u, cType.value);
     selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋�
     let _val = {};
-    _val[d.returnFieldName] = values[d.returnFieldName];
+    d.returnFieldName.map((x) => {
+          _val[x] = values[x];
+        });
     useFormData.value[item][1].setFieldsValue(_val);
     if (d.returnFieldName == 'ROUTE_CODE' && cType.value == 'BIZ_MES_WO_Config') {
       routeData.value = {
diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue
index 2068333..1b49c52 100644
--- a/src/views/tigerprojects/system/lowcode/composition/index.vue
+++ b/src/views/tigerprojects/system/lowcode/composition/index.vue
@@ -4,7 +4,7 @@
  * @version: 
  * @Date: 2024-06-18 23:30:30
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-15 22:22:58
+ * @LastEditTime: 2024-07-21 18:03:22
 -->
 <template>
   <PageWrapper
@@ -215,7 +215,9 @@
         var values = GetSelectSuccess(d, u);
         selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋�
         let _val = {};
-        _val[d.returnFieldName] = values[d.returnFieldName];
+        d.returnFieldName.map((x) => {
+          _val[x] = values[x];
+        });
         useFormData.value[item][1].setFieldsValue(_val);
       });
     } catch (e) {}
diff --git a/src/views/tigerprojects/system/lowcode/detail/index.vue b/src/views/tigerprojects/system/lowcode/detail/index.vue
index be7bed3..c7375b0 100644
--- a/src/views/tigerprojects/system/lowcode/detail/index.vue
+++ b/src/views/tigerprojects/system/lowcode/detail/index.vue
@@ -4,7 +4,7 @@
  * @version: 
  * @Date: 2024-05-30 13:28:20
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-20 21:54:58
+ * @LastEditTime: 2024-07-21 18:02:52
 -->
 <template>
   <PageWrapper :title="pageTitle" :content="contentStr" contentBackground @back="goBack">
@@ -173,7 +173,9 @@
         var values = GetSelectSuccess(d, u);
         selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋�
         let _val = {};
-        _val[d.returnFieldName] = values[d.returnFieldName];
+        d.returnFieldName.map((x) => {
+          _val[x] = values[x];
+        });
         useFormData.value[item][1].setFieldsValue(_val);
       });
     } catch (e) {}
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 4917931..1f43d2f 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts
@@ -4,11 +4,10 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-20 22:18:28
+ * @LastEditTime: 2024-07-21 18:40:06
  */
 
 import { Ref, h, ref, render, unref } from 'vue';
-import { GetRoutePTree, RouteToCust, RouteToProd } from '/@/api/tigerapi/mes/router';
 import { GetEnum, SaveEntity, convertToTree, getEntity } from '/@/api/tigerapi/system';
 import { useLocale } from '/@/locales/useLocale';
 import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
@@ -25,6 +24,7 @@
 import { useForm } from '/@/components/Form/index';
 import { uploadApi } from '/@/api/sys/upload';
 import { initRoute } from '../data';
+import { SP_MES_PROD2WO } from '/@/api/tigerapi/mes/router';
 
 const { t } = useI18n();
 const { createErrorModal } = useMessage();
@@ -203,7 +203,8 @@
     GetSelectSuccess: (d, u) => {
       return {
         ROUTE_CODE: d.values['val'],
-        ID: d.values['id'],
+        // ID: d.values['id'],
+        ROT_ID: d.values['id'],
       };
     },
     /**
@@ -249,7 +250,7 @@
             ],
             tableName: 'MES_ROUTE',
             rowKey: 'ROT_CODE',
-            returnFieldName: 'ROUTE_CODE', //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О
+            returnFieldName: ['ROUTE_CODE', 'ROT_ID'], //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О
             searchInfo: { TABLE_NAME: 'MES_ROUTE' },
           });
           break;
@@ -280,8 +281,10 @@
           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) => {
             if (action.IsSuccessed) {
+              SP_MES_PROD2WO({ rotId: form.ROT_ID, wo: wo.ORDER_NO });
               resolve(action);
             } else {
               reject(action);
@@ -313,7 +316,7 @@
               UPDATE_TIME: new Date(),
               UPDATE_USER: useUserStore().getUserInfo.userId as string,
               GHOST_ROW: false,
-              AUTH_ORG: '',
+              AUTH_ORG: useUserStore().getUserInfo.orgCode,
               AUTH_PROD: useUserStore().getUserInfo.prodCode as string,
               AUTH_WH: '',
               ORDER_NO: wo.ORDER_NO,
@@ -436,6 +439,9 @@
       required: true,
       colProps: {
         span: 24,
+      },
+      dynamicDisabled: ({ values }) => {
+        return true;
       },
     },
     {
@@ -594,18 +600,27 @@
       },
     },
     {
-      field: 'fieldsc',
-      component: 'Upload',
-      label: '鎵撳嵃妯℃澘',
+      label: '宸ヨ壓璺嚎',
+      field: 'ROT_ID',
+      component: 'Input',
+      show: false,
       colProps: {
-        span: 10,
-      },
-      rules: [{ required: true, message: '璇烽�夋嫨涓婁紶鏂囦欢' }],
-      componentProps: {
-        api: uploadApi,
-        multiple: false,
+        span: 12,
       },
     },
+    // {
+    //   field: 'fieldsc',
+    //   component: 'Upload',
+    //   label: '鎵撳嵃妯℃澘',
+    //   colProps: {
+    //     span: 10,
+    //   },
+    //   rules: [{ required: true, message: '璇烽�夋嫨涓婁紶鏂囦欢' }],
+    //   componentProps: {
+    //     api: uploadApi,
+    //     multiple: false,
+    //   },
+    // },
   ];
 
   return [methods, ActionColumn];
diff --git a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
index 03c5f65..e4f26ae 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
@@ -4,7 +4,7 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-15 22:05:16
+ * @LastEditTime: 2024-07-21 18:26:07
  */
 
 import { Ref, h, ref, render, unref } from 'vue';
@@ -19,6 +19,7 @@
 import { FormSchema } from '/@/components/Table';
 import { initRoute } from '../data';
 import { CustModalParams } from '/@/api/tigerapi/model/systemModel';
+import { useUserStore } from '/@/store/modules/user';
 
 const { t } = useI18n();
 const { createErrorModal } = useMessage();
@@ -77,7 +78,7 @@
      */
     fetchTreeData: async (type: string, itemCode: string) => {
       let data = { title: '', treeData: [] as any[], fieldNames: {} };
-      let prodTreeData = await GetRoutePTree(itemCode);
+      let prodTreeData = await GetRoutePTree({prodCode: itemCode, orgCode: useUserStore().getUserInfo.orgCode});
       // let uniqueArr = prodTreeData.reduce((acc, current) => {
       //   if (!acc.some((x) => x.pid == current.pid && x.id == current.id && x.seq == current.seq && x.type == current.type)) {
       //     acc.push(current);
@@ -420,7 +421,7 @@
             ],
             tableName: 'MES_ROUTE',
             rowKey: 'ROT_CODE',
-            returnFieldName: 'ROUTE_CODE', //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О
+            returnFieldName: ['ROUTE_CODE'], //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О
             searchInfo: { TABLE_NAME: 'MES_ROUTE' },
             which: action,
           });
diff --git a/src/views/tigerprojects/system/lowcode/high/index.vue b/src/views/tigerprojects/system/lowcode/high/index.vue
index 689ef07..2abbdca 100644
--- a/src/views/tigerprojects/system/lowcode/high/index.vue
+++ b/src/views/tigerprojects/system/lowcode/high/index.vue
@@ -4,7 +4,7 @@
  * @version: 
  * @Date: 2024-06-18 15:09:48
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-15 22:23:12
+ * @LastEditTime: 2024-07-21 18:04:06
 -->
 <!--
  *                        _oo0oo_
@@ -326,7 +326,9 @@
         var values = GetSelectSuccess(d, u);
         selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋�
         let _val = {};
-        _val[d.returnFieldName] = values[d.returnFieldName];
+        d.returnFieldName.map((x) => {
+          _val[x] = values[x];
+        });
         useFormData.value[item][1].setFieldsValue(_val);
       });
     } catch (e) {}
diff --git a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue
index 4f4a1b9..f076804 100644
--- a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue
+++ b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue
@@ -422,10 +422,12 @@
       var values = GetSelectSuccess(d, u);
       selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋�
       let _val = {};
-      _val[d.returnFieldName] = values[d.returnFieldName];
+      d.returnFieldName.map((x) => {
+          _val[x] = values[x];
+        });
       useFormData.value[item][1].setFieldsValue(_val);
       /* 閽堝宸ュ崟鐨勬柟娉� */
-      if (d.returnFieldName == 'ROUTE_CODE') {
+      if (d.returnFieldName.filter((x) => x == 'ROUTE_CODE') && item == 'prodinfo' ) {
         routeData.value = {
           nodes: [],
           edges: [],

--
Gitblit v1.9.3