From e4994fccfb49ebfb108ba62cbd82aea4e004f6d8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 15 十月 2026 10:02:46 +0800
Subject: [PATCH] fix(mes/qc): 不合格品处理单的不合格物料改查 MDM 物料

---
 src/views/wls/outsourceissue/data.ts |   57 ++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/src/views/wls/outsourceissue/data.ts b/src/views/wls/outsourceissue/data.ts
index 7cc6ae2..6e5e582 100644
--- a/src/views/wls/outsourceissue/data.ts
+++ b/src/views/wls/outsourceissue/data.ts
@@ -1,5 +1,6 @@
 锘縤mport type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
 import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { MdmItemApi } from '#/api/mdm/item';
 import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder';
 import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock';
 import type { MesWmOutsourceIssueApi } from '#/api/mes/wm/outsourceissue';
@@ -13,15 +14,19 @@
   MesAutoCodeRuleCode,
   MesProWorkOrderStatusEnum,
   MesProWorkOrderTypeEnum,
-} from '../../../packages/constants/src';
+} from '@vben/constants';
 
 import { Button } from 'ant-design-vue';
 
 import { generateAutoCode } from '#/api/mes/md/autocode/record';
 import { getRangePickerDefaultProps } from '#/utils';
-import { MdItemSelect } from '#/views/mes/md/item/components';
+import { MdmItemSelect } from '#/views/basicData/mdm/components';
 import { MdVendorSelect } from '#/views/mes/md/vendor/components';
 import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components';
+import {
+  buildItemUnitSchema,
+  useLineUnitHandlers,
+} from '#/views/wls/utils/item-unit-convert';
 import { WmMaterialStockSelect } from '#/views/wls/materialstock/components';
 import {
   WmWarehouseAreaSelect,
@@ -100,7 +105,7 @@
       componentProps: {
         format: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨鍙戞枡鏃ユ湡',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
       },
     },
     {
@@ -254,13 +259,28 @@
       minWidth: 120,
     },
     {
+      field: 'itemModel',
+      title: '鐗╂枡鍨嬪彿',
+      minWidth: 120,
+    },
+    {
       field: 'unitMeasureName',
-      title: '鍗曚綅',
-      width: 80,
+      title: '涓昏閲忓崟浣�',
+      width: 100,
+    },
+    {
+      field: 'enterUnitMeasureName',
+      title: '褰曞叆鍗曚綅',
+      width: 90,
+    },
+    {
+      field: 'enterQuantity',
+      title: '褰曞叆鏁伴噺',
+      width: 100,
     },
     {
       field: 'quantity',
-      title: '棰嗘枡鏁伴噺',
+      title: '鍙戞枡鏁伴噺',
       width: 100,
     },
     {
@@ -287,29 +307,24 @@
 }
 
 /** 鍙戞枡鍗曡鏂板/淇敼鐨勮〃鍗� */
-export function useLineFormSchema(): VbenFormSchema[] {
+export function useLineFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
+  const unitHandlers = useLineUnitHandlers(formApi);
   return [
     {
       fieldName: 'itemId',
       label: '鐗╂枡',
-      component: markRaw(MdItemSelect),
+      component: markRaw(MdmItemSelect),
       componentProps: {
         placeholder: '璇烽�夋嫨鐗╂枡',
+        // 鍒囨崲鐗╂枡鍚庯紝閲嶆柊璁板綍鐗╂枡涓诲崟浣嶅苟娓呯┖鍨嬪彿銆佸綍鍏ュ崟浣嶅彛寰�
+        onChange: async (item?: MdmItemApi.Item) => {
+          await unitHandlers.handleItemChange(item?.id);
+        },
       },
       rules: 'selectRequired',
     },
-    {
-      fieldName: 'quantity',
-      label: '鍙戞枡鏁伴噺',
-      component: 'InputNumber',
-      componentProps: {
-        class: '!w-full',
-        min: 0,
-        placeholder: '璇疯緭鍏ュ彂鏂欐暟閲�',
-        precision: 2,
-      },
-      rules: 'required',
-    },
+    // 鐗╂枡鍨嬪彿 / 褰曞叆鍗曚綅 / 褰曞叆鏁伴噺 / 鍙戞枡鏁伴噺锛堢墿鏂欎富鍗曚綅鍙e緞锛�
+    ...buildItemUnitSchema(formApi, { quantityLabel: '鍙戞枡鏁伴噺' }),
     {
       fieldName: 'batchCode',
       label: '鎵规鍙�',
@@ -409,7 +424,7 @@
     {
       fieldName: 'itemId',
       label: '鐗╂枡',
-      component: markRaw(MdItemSelect),
+      component: markRaw(MdmItemSelect),
       componentProps: {
         disabled: true,
       },

--
Gitblit v1.9.3