From 78caa769e452f63288743b8997f7b4c21bb06ce5 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 06 十一月 2026 19:00:38 +0800
Subject: [PATCH] feat(crm,mes): 扩展客户字段与重构批次号生成逻辑
---
src/views/wls/productsales/data.ts | 98 +++++++++++++++++++------------------------------
1 files changed, 38 insertions(+), 60 deletions(-)
diff --git a/src/views/wls/productsales/data.ts b/src/views/wls/productsales/data.ts
index afb2c12..279c0ea 100644
--- a/src/views/wls/productsales/data.ts
+++ b/src/views/wls/productsales/data.ts
@@ -28,11 +28,7 @@
WmSalesNoticeLineSelect,
WmSalesNoticeSelect,
} from '#/views/wls/salesnotice/components';
-import {
- WmWarehouseAreaSelect,
- WmWarehouseLocationSelect,
- WmWarehouseSelect,
-} from '#/views/wls/warehouse/components';
+import { WmWarehouseSelect } from '#/views/wls/warehouse/components';
/** 琛ㄥ崟绫诲瀷 */
export type FormType =
@@ -270,10 +266,7 @@
component: 'Select',
componentProps: {
allowClear: true,
- options: getDictOptions(
- DICT_TYPE.MES_WM_PRODUCT_SALES_STATUS,
- 'number',
- ),
+ options: [...getDictOptions(DICT_TYPE.MES_WM_PRODUCT_SALES_STATUS, 'number'), { label: '宸插叧闂�', value: 8 }],
placeholder: '璇烽�夋嫨鍗曟嵁鐘舵��',
},
},
@@ -334,10 +327,7 @@
field: 'status',
title: '鍗曟嵁鐘舵��',
minWidth: 100,
- cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.MES_WM_PRODUCT_SALES_STATUS },
- },
+ formatter: ({ cellValue, row }) => `${row.partiallyShipped ? '閮ㄥ垎鍙戣揣 / ' : ''}${({ 0: '鑽夌', 1: '寰呮娴�', 2: '寰呮嫞璐�', 3: '寰呮墽琛屽嚭搴�', 4: '宸插畬鎴�', 5: '宸插彇娑�', 8: '宸插叧闂�', 10: '寰呭~鍐欒繍鍗�' } as Record<number, string>)[cellValue] || '鏈煡鐘舵��'}`,
},
{
title: '鎿嶄綔',
@@ -384,6 +374,8 @@
title: '鍑哄簱鏁伴噺',
width: 100,
},
+ { field: 'shippedQuantity', title: '宸插嚭搴�', width: 100 },
+ { field: 'remainingQuantity', title: '鍓╀綑鏁伴噺', width: 100 },
{
field: 'batchCode',
title: '鎵规鍙�',
@@ -508,11 +500,16 @@
minWidth: 130,
},
{
+ field: 'shipmentId',
+ title: '鍙戣揣璁板綍',
+ minWidth: 120,
+ formatter: ({ row }) => row.shipmentId ? `鍙戣揣 #${row.shipmentId}` : '寰呭垎閰� / 鍘嗗彶鏄庣粏',
+ },
+ {
field: 'bagCodeId',
title: '鎵爜鏉ユ簮',
minWidth: 110,
- formatter: ({ row }) =>
- row.bagCodeId ? `琚嬬爜 #${row.bagCodeId}${row.palletCodeId ? ` / 鎵樼洏 #${row.palletCodeId}` : ''}` : row.palletCodeId ? `鎵樼洏鐮� #${row.palletCodeId}` : '鎵嬪伐鎷h揣',
+ slots: { default: 'scanSource' },
},
{
field: 'warehouseName',
@@ -520,21 +517,11 @@
minWidth: 100,
},
{
- field: 'locationName',
- title: '搴撳尯鍚嶇О',
- minWidth: 100,
- },
- {
- field: 'areaName',
- title: '搴撲綅鍚嶇О',
- minWidth: 100,
- },
- {
field: 'quantity',
title: '鏁伴噺',
width: 100,
},
- { field: 'remark', title: '琚嬬爜涓庢壂鐮佹潵婧�', minWidth: 240 },
+ { field: 'remark', title: '琚嬬爜涓庢壂鐮佹潵婧�', minWidth: 240, slots: { default: 'pickingRemark' } },
...(stockable
? [
{
@@ -548,8 +535,30 @@
];
}
+/** 鎵爜鏉ユ簮灞曠ず鏂囨 */
+export function formatScanSource(
+ row: MesWmProductSalesDetailApi.ProductSalesDetail,
+) {
+ if (row.bagCodeId) {
+ return `琚嬬爜 #${row.bagCodeId}${row.palletCodeId ? ` / 鎵樼洏 #${row.palletCodeId}` : ''}`;
+ }
+ return row.palletCodeId ? `鎵樼洏鐮� #${row.palletCodeId}` : '鎵嬪伐鎷h揣';
+}
+
+export function formatPickingRemark(value?: string) {
+ const names: Record<string, string> = { BAG: '琚嬬爜', PALLET: '鎵樼洏鐮�', BATCH: '鎵规鐮�' };
+ return (value || '')
+ .replace(/(鎵爜绫诲瀷\s+)(BAG|PALLET|BATCH)(\s*[锛�;]\s*)鏉ユ簮鐮�(?=\s)/g,
+ (_match, prefix: string, type: string, separator: string) => `${prefix}${type}${separator}鏉ユ簮${names[type]}`)
+ .replace(/鎵爜绫诲瀷\s+(BAG|PALLET|BATCH)(?=\s*[锛�;]|$)/g,
+ (_match, type: string) => `鎵爜绫诲瀷 ${names[type]}`);
+}
+
/** 鎷h揣鏄庣粏鏂板/淇敼鐨勮〃鍗� */
-export function useDetailFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
+export function useDetailFormSchema(
+ formApi?: VbenFormApi,
+ onStockChange?: (stock?: MesWmMaterialStockApi.MaterialStock) => void,
+): VbenFormSchema[] {
return [
{
fieldName: 'quantityMax',
@@ -582,17 +591,16 @@
componentProps: {
// 鍙粠鍚堟牸浠撳簱锛坱ype=20锛夐�夋嫨鍙嫞璐у簱瀛�
warehouseType: MesWmWarehouseTypeEnum.QUALIFIED,
- // 閫夋嫨搴撳瓨璁板綍鍚庯紝鑷姩鍥炲~浠撳簱/搴撳尯/搴撲綅/鎵规/鏁伴噺
+ // 閫夋嫨搴撳瓨璁板綍鍚庯紝鑷姩鍥炲~浠撳簱/鎵规/鏁伴噺
onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => {
await formApi?.setValues({
- areaId: stock?.areaId,
batchCode: stock?.batchCode,
batchId: stock?.batchId,
- locationId: stock?.locationId,
quantity: stock?.quantity,
quantityMax: stock?.quantity,
warehouseId: stock?.warehouseId,
});
+ onStockChange?.(stock);
},
},
rules: 'selectRequired',
@@ -632,36 +640,6 @@
component: markRaw(WmWarehouseSelect),
componentProps: {
disabled: true,
- },
- },
- {
- fieldName: 'locationId',
- label: '搴撳尯',
- component: markRaw(WmWarehouseLocationSelect),
- componentProps: {
- disabled: true,
- },
- dependencies: {
- triggerFields: ['warehouseId'],
- componentProps: (values) => ({
- disabled: true,
- warehouseId: values.warehouseId,
- }),
- },
- },
- {
- fieldName: 'areaId',
- label: '搴撲綅',
- component: markRaw(WmWarehouseAreaSelect),
- componentProps: {
- disabled: true,
- },
- dependencies: {
- triggerFields: ['locationId'],
- componentProps: (values) => ({
- disabled: true,
- locationId: values.locationId,
- }),
},
},
{
--
Gitblit v1.9.3