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/productsales/data.ts | 90 +++++++++++++++++++++++++++++++++-----------
1 files changed, 67 insertions(+), 23 deletions(-)
diff --git a/src/views/wls/productsales/data.ts b/src/views/wls/productsales/data.ts
index a99cee4..a4afe74 100644
--- a/src/views/wls/productsales/data.ts
+++ b/src/views/wls/productsales/data.ts
@@ -1,5 +1,6 @@
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { MdmItemApi } from '#/api/mdm/item';
import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock';
import type { MesWmProductSalesApi } from '#/api/mes/wm/productsales';
import type { MesWmProductSalesDetailApi } from '#/api/mes/wm/productsales/detail';
@@ -19,11 +20,16 @@
import { Button } from 'ant-design-vue';
import { z } from '#/adapter/form';
+import CrmCustomerSelect from '#/components/crm-customer-select.vue';
import { generateAutoCode } from '#/api/mes/md/autocode/record';
+import { ErpSaleOrderSelect } from '#/views/erp/sale/order/components';
import { getRangePickerDefaultProps } from '#/utils';
-import { MdClientSelect } from '#/views/mes/md/client/components';
-import { MdItemSelect } from '#/views/mes/md/item/components';
+import { MdmItemSelect } from '#/views/basicData/mdm/components';
import { WmMaterialStockSelect } from '#/views/wls/materialstock/components';
+import {
+ buildItemUnitSchema,
+ useLineUnitHandlers,
+} from '#/views/wls/utils/item-unit-convert';
import {
WmSalesNoticeLineSelect,
WmSalesNoticeSelect,
@@ -138,12 +144,38 @@
},
},
{
+ fieldName: 'saleOrderId',
+ label: '閿�鍞鍗曠紪鍙�',
+ component: markRaw(ErpSaleOrderSelect),
+ componentProps: {
+ disabled: isHeaderReadonly(formType),
+ placeholder: '璇烽�夋嫨閿�鍞鍗�',
+ onChange: (item: any) => {
+ if (formApi) {
+ formApi.setFieldValue('salesOrderCode', item?.no ?? '');
+ if (item?.customerId) {
+ formApi.setFieldValue('clientId', item.customerId);
+ }
+ }
+ },
+ },
+ rules: 'selectRequired',
+ dependencies: {
+ triggerFields: ['salesOrderCode'],
+ if: () => formType === 'create',
+ },
+ },
+ {
fieldName: 'salesOrderCode',
label: '閿�鍞鍗曠紪鍙�',
component: 'Input',
componentProps: {
- disabled: isHeaderReadonly(formType),
- placeholder: '璇疯緭鍏ラ攢鍞鍗曠紪鍙�',
+ disabled: true,
+ placeholder: '閿�鍞鍗曠紪鍙�',
+ },
+ dependencies: {
+ triggerFields: [''],
+ if: () => formType !== 'create',
},
},
{
@@ -155,14 +187,14 @@
disabled: isHeaderReadonly(formType),
format: 'YYYY-MM-DD',
placeholder: '璇烽�夋嫨鍑哄簱鏃ユ湡',
- valueFormat: 'x',
+ valueFormat: 'YYYY-MM-DD',
},
rules: 'required',
},
{
fieldName: 'clientId',
label: '瀹㈡埛',
- component: markRaw(MdClientSelect),
+ component: markRaw(CrmCustomerSelect),
componentProps: {
disabled: isHeaderReadonly(formType),
placeholder: '璇烽�夋嫨瀹㈡埛',
@@ -269,7 +301,7 @@
{
fieldName: 'clientId',
label: '瀹㈡埛',
- component: markRaw(MdClientSelect),
+ component: markRaw(CrmCustomerSelect),
componentProps: {
placeholder: '璇烽�夋嫨瀹㈡埛',
},
@@ -399,9 +431,24 @@
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',
@@ -445,6 +492,7 @@
hasNotice: boolean,
formApi?: VbenFormApi,
): VbenFormSchema[] {
+ const unitHandlers = useLineUnitHandlers(formApi);
return [
{
fieldName: 'noticeId',
@@ -461,6 +509,8 @@
componentProps: {
// 閫夋嫨鍙戣揣閫氱煡鍗曡鍚庯紝鑷姩鍥炲~鐗╂枡銆佹暟閲忋�佹壒娆°�佹槸鍚︽楠�
onChange: async (line?: MesWmSalesNoticeLineApi.SalesNoticeLine) => {
+ // 鍒囨崲閫氱煡琛岀瓑浜庡垏鎹骇鍝侊紝鍏堥噸缃瀷鍙蜂笌鍗曚綅鍙e緞锛堜細娓呯┖鏁伴噺锛夛紝鍐嶆寜閫氱煡琛屽洖濉�
+ await unitHandlers.handleItemChange(line?.itemId);
await formApi?.setValues({
batchCode: line?.batchCode,
itemId: line?.itemId,
@@ -480,9 +530,13 @@
{
fieldName: 'itemId',
label: '浜у搧',
- component: markRaw(MdItemSelect),
+ component: markRaw(MdmItemSelect),
componentProps: {
placeholder: '璇烽�夋嫨浜у搧',
+ // 鍒囨崲浜у搧鍚庯紝閲嶆柊璁板綍鐗╂枡涓诲崟浣嶅苟娓呯┖鍨嬪彿銆佸綍鍏ュ崟浣嶅彛寰�
+ onChange: async (item?: MdmItemApi.Item) => {
+ await unitHandlers.handleItemChange(item?.id);
+ },
},
rules: 'selectRequired',
dependencies: {
@@ -493,6 +547,8 @@
}),
},
},
+ // 鐗╂枡鍨嬪彿 / 褰曞叆鍗曚綅 / 褰曞叆鏁伴噺 / 鍑哄簱鏁伴噺锛堢墿鏂欎富鍗曚綅鍙e緞锛�
+ ...buildItemUnitSchema(formApi),
{
fieldName: 'batchCode',
label: '鎵规鍙�',
@@ -500,18 +556,6 @@
componentProps: {
placeholder: '璇疯緭鍏ユ壒娆″彿',
},
- },
- {
- fieldName: 'quantity',
- label: '鍑哄簱鏁伴噺',
- component: 'InputNumber',
- componentProps: {
- class: '!w-full',
- min: 0,
- placeholder: '璇疯緭鍏ュ嚭搴撴暟閲�',
- precision: 2,
- },
- rules: 'required',
},
{
fieldName: 'oqcCheckFlag',
@@ -597,7 +641,7 @@
{
fieldName: 'itemId',
label: '鐗╂枡',
- component: markRaw(MdItemSelect),
+ component: markRaw(MdmItemSelect),
componentProps: {
disabled: true,
},
--
Gitblit v1.9.3