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.ts |  161 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 149 insertions(+), 12 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 a3c71f8..82744a1 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-09-11 22:41:44
+ * @LastEditTime: 2024-10-23 20:48:14
  */
 
 import { Ref, h, ref, render, unref } from 'vue';
@@ -20,8 +20,9 @@
 import { CustModalParams, FunctionType } from '/@/api/tigerapi/model/systemModel';
 import { SaveMesBatchWo } from '/@/api/tigerapi/mes/wo';
 import { useForm } from '/@/components/Form/index';
-import { SP_MES_PROD2WO } from '/@/api/tigerapi/mes/router';
 import { cloneDeep } from 'lodash-es';
+import { useProdRouteStore } from '/@/store/modules/prodRoute';
+import { Tag, Tooltip } from 'ant-design-vue';
 
 const { t } = useI18n();
 const { createErrorModal } = useMessage();
@@ -43,10 +44,104 @@
      * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓�
      * @return {*}
      */
-    CreateAction: (type: string) => {
-      return {
-        action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�)
-      };
+    CreateAction: (type: string, fnName: string) => {
+      let action = {} as any;
+      switch (fnName) {
+        case 'ImportExcel':
+          action = {
+            action: 'importModal', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) | importModal(鎵撳紑瀵煎叆妯℃�佺獥鍙�) | ToPrint(鎵撳嵃鍔熻兘)
+            params: {
+              tmpHeader: ['宸ュ崟鍙�', '璁″垝鏃ユ湡', '璁″垝鏁伴噺'] /* 涓嬭浇妯℃澘鐨勬爣棰樺瓧娈� */,
+              filename: '宸ュ崟璁″垝妯℃澘.xlsx' /* 涓嬭浇妯℃澘鐨勬枃浠跺悕 */,
+              entityName: 'BIZ_MES_WO_BATCH' /* 瀵煎叆琛ㄧ殑琛ㄥ悕 */,
+              checkJson: ['ORDER_NO', 'PLAN_DATE', 'PLAN_QTY'] /* 瀵煎叆琛ㄩ渶瑕佹鏌ョ殑瀛楁鍒楄〃 */,
+              where: ['ORDER_NO'] /* 瀵煎叆琛ㄩ渶瑕佹煡璇㈢殑瀛楁鍒楄〃 */,
+              typeFullName:
+                'Tiger.IBusiness.MES.IImportWoPlan,Tiger.IBusiness.MES' /* 瀵煎叆鐨勬柟娉曞叏鍚嶏紝閫氱敤瀵煎叆鐢ㄨ繖涓細Tiger.IBusiness.ICommonImportExcel,Tiger.IBusiness */,
+              baseColumns: [
+                /* 瀵煎叆鏃剁晫闈㈡樉绀烘暟鎹殑瀛楁 */
+                {
+                  title: '宸ュ崟鍙�',
+                  dataIndex: 'ORDER_NO',
+                  ifShow: true,
+                  width: 180,
+                },
+                // {
+                //   title: '宸ュ崟鎵规鍙�',
+                //   dataIndex: 'BATCH_NO',
+                //   ifShow: true,
+                //   width: 180,
+                //   // customRender: ({ record }) => {
+                //   //   record.BATCH_NO = record.ORDER_NO+'-01'
+                //   //   return record.BATCH_NO
+                //   // },
+                // },
+                {
+                  title: '璁″垝鏃ユ湡',
+                  dataIndex: 'PLAN_DATE',
+                  ifShow: true,
+                  width: 180,
+                },
+                {
+                  title: '璁″垝鏁伴噺',
+                  dataIndex: 'PLAN_QTY',
+                  ifShow: true,
+                  width: 100,
+                },
+                {
+                  title: '澶勭悊鏂瑰紡',
+                  dataIndex: 'VALIDATION_TYPE',
+                  ifShow: true,
+                  width: 100,
+                  customRender: ({ record }) => {
+                    const status = record.VALIDATION_TYPE;
+                    var text = '';
+                    var color = 'green';
+                    if (status == '寮傚父') {
+                      color = 'red';
+                      text = status;
+                    } else if (status == '鏇存柊') {
+                      color = 'orange';
+                      text = status;
+                    } else {
+                      text = status;
+                    }
+                    return h(Tooltip, { title: text }, () => h(Tag, { color: color }, () => text));
+                  },
+                },
+                {
+                  title: '澶勭悊鎻愮ず',
+                  dataIndex: 'VALIDATION_RESULT',
+                  ifShow: true,
+                  width: 280,
+                  customRender: ({ record }) => {
+                    const status = record.VALIDATION_TYPE;
+                    var text = record.VALIDATION_RESULT;
+                    var color = 'green';
+                    if (status == '寮傚父') {
+                      color = 'red';
+                    } else if (status == '鏇存柊') {
+                      color = 'orange';
+                    }
+                    return h(Tooltip, { title: text }, () => h(Tag, { color: color }, () => text));
+                  },
+                },
+              ],
+            },
+          };
+          break;
+        case 'ToPrint':
+          action = {
+            action: 'ToPrint', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) | importModal(鎵撳紑瀵煎叆妯℃�佺獥鍙�) | ToPrint(鎵撳嵃鍔熻兘)
+          };
+        break;
+        default:
+          action = {
+            action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) | importModal(鎵撳紑瀵煎叆妯℃�佺獥鍙�) | ToPrint(鎵撳嵃鍔熻兘)
+          };
+          break;
+      }
+      return action;
     },
     /**
      * @description: 鎿嶄綔瀛楁鑷畾涔夋寜閽�
@@ -65,6 +160,9 @@
         if (x.name == 'handleRelease') {
           x.onClick = handleRelease.bind(null, args, params);
           x.tooltip = '涓嬪彂';
+        }
+        if (x.name == 'ToPrint') {
+          x.tooltip = '鎵撳嵃娴佺▼鍗�';
         }
       });
       return data;
@@ -88,6 +186,14 @@
           showActionButtonGroup: false,
         }),
         prodinfo: useForm({
+          labelWidth: 120,
+          schemas: prodCfgformSchema,
+          actionColOptions: {
+            span: 24,
+          },
+          showActionButtonGroup: false,
+        }),
+        tmpinfo: useForm({
           labelWidth: 120,
           schemas: prodCfgformSchema,
           actionColOptions: {
@@ -250,6 +356,16 @@
           break;
       }
     },
+    /**
+     * @description: 鑾峰彇鏍囬淇℃伅
+     * @param {string} type
+     * @return {*}
+     */
+    GetTitle: () => {
+      return {
+        importTitle: '宸ュ崟璁″垝瀵煎叆' /* 鎵撳紑妯℃�佺獥鍙f樉绀虹殑鏍囬 */,
+      };
+    },
   };
 
   /* 浠ヤ笅鏄唴閮ㄦ柟娉曪紝涓峞xport锛屼緵涓婇潰鐨勬柟娉曡皟鐢� */
@@ -300,7 +416,7 @@
         try {
           const form = param.values['forminfo'];
           const wo = param.values['mValues'];
-          wo.STATUS = wo.STATUS == 3?wo.STATUS: 2;
+          wo.STATUS = wo.STATUS == 3 ? wo.STATUS : 2;
           let input: SaveWoBatchInput = {
             Wo: wo,
             WoBatch: {
@@ -336,6 +452,7 @@
               ACT_END_TIME: wo.ACT_END_TIME,
               BATCH_NO: '',
             },
+            IfToCust: form.IfToCust,
           };
           SaveMesBatchWo(input).then((action) => {
             resolve(action);
@@ -389,19 +506,30 @@
       Name: 'WoRouteBinding',
       CODE: params['record'].ORDER_NO,
       Title: `宸ュ崟[${params['record'].ORDER_NO}]宸ヨ壓缁戝畾`,
-      colSlots: params['colSlots'].value, /* 琛ㄦ牸鍐呯殑鏌ヨ琛ㄥ崟瀛楁鐨勬彃妲藉垪琛紝涓�鑸敤浜庡脊鍑洪�夋嫨妗嗘寜閽� */
-      crudColSlots: {BAS_PKG_DTL:['BAS_LABEL_TEMP1add'], ItemCode: ['BAS_CODE_RULE1add']} /* 澧炲垹鏀硅〃鍗曞瓧娈电殑鎻掓Ы鍒楄〃锛屼竴鑸敤浜庡脊鍑洪�夋嫨妗嗘寜閽� */,
-      OtherTableName: ['BAS_PKG_DTL', 'ItemCode'], /* 鑷畾涔夋樉绀哄垪琛ㄧ殑琛ㄥ悕锛岃窡涓婇潰澧炲垹鏀圭殑琛ㄥ悕涓�鑷达紝鏈夊涓氨鏀惧垪琛ㄤ腑 */
+      colSlots:
+        params['colSlots'].value /* 琛ㄦ牸鍐呯殑鏌ヨ琛ㄥ崟瀛楁鐨勬彃妲藉垪琛紝涓�鑸敤浜庡脊鍑洪�夋嫨妗嗘寜閽� */,
+      crudColSlots: {
+        BAS_PKG_DTL: ['BAS_LABEL_TEMP1add'],
+        ItemCode: ['BAS_CODE_RULE1add'],
+      } /* 澧炲垹鏀硅〃鍗曞瓧娈电殑鎻掓Ы鍒楄〃锛屼竴鑸敤浜庡脊鍑洪�夋嫨妗嗘寜閽� */,
+      OtherTableName: [
+        'BAS_PKG_DTL',
+        'ItemCode',
+      ] /* 鑷畾涔夋樉绀哄垪琛ㄧ殑琛ㄥ悕锛岃窡涓婇潰澧炲垹鏀圭殑琛ㄥ悕涓�鑷达紝鏈夊涓氨鏀惧垪琛ㄤ腑 */,
+      record: params['record'],
       dense: true,
       pageTitle: `宸ュ崟宸ヨ壓缁戝畾`,
       pageContent: `杩欓噷鏄鐞嗗伐鍗曠殑宸ヨ壓缁戝畾锛屼竴涓伐鍗曞彲浠ョ粦瀹氫竴涓伐鑹鸿矾绾匡紝骞跺彲浠ヤ繚瀛樹负瀹㈡埛涓撶敤鐨勫伐鑹鸿矾绾縛,
       SessionName: 'WoRouteBinding_update',
       ifSave: false,
-      rotType: 'Wo'
+      rotType: 'Wo',
     };
     // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage
     sessionStorage.removeItem(`${id.SessionName}_params`);
     sessionStorage.setItem(`${id.SessionName}_params`, encodeURI(JSON.stringify(id)));
+    /* 璁剧疆鏍囧織锛屼互鏍规嵁缂撳瓨鏁版嵁鍙栨暟鎹� */
+    const useProdRoute = useProdRouteStore();
+    useProdRoute.setChangeToCPPage(true);
     go(`/WoRouteBinding/CP/${encodeURI(JSON.stringify({ sName: id.SessionName, Name: id.Name }))}`);
   }
 
@@ -426,7 +554,6 @@
     });
   }
 
-  /* 涓嬪彂鐣岄潰涓殑琛ㄥ崟鍒楄〃 */
   const woformSchema: FormSchema[] = [
     {
       field: 'PLAN_QTY',
@@ -465,6 +592,16 @@
         valueField: 'LINE_CODE',
       },
     },
+    {
+      field: 'IfToCust',
+      component: 'Switch',
+      label: '鏄惁淇濆瓨宸ヨ壓璺嚎鍒板鎴�',
+      defaultValue: true,
+      colProps: {
+        span: 8,
+      },
+      labelWidth: 200,
+    },
     // {
     //   label: '宸ヨ壓璺嚎',
     //   field: 'ROUTE_CODE',

--
Gitblit v1.9.3