From ee7ac8df8bce38add1f75baf876b49de94b9e00a Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期五, 16 十月 2026 17:58:33 +0800
Subject: [PATCH] feat(mes): 赋码管理绑定托盘支持未录入批次的袋码

---
 src/views/wls/materialstock/data.ts |  126 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 119 insertions(+), 7 deletions(-)

diff --git a/src/views/wls/materialstock/data.ts b/src/views/wls/materialstock/data.ts
index c6f0ceb..aacee75 100644
--- a/src/views/wls/materialstock/data.ts
+++ b/src/views/wls/materialstock/data.ts
@@ -8,7 +8,6 @@
 import { DICT_TYPE } from '@vben/constants';
 
 import { MdItemSelect } from '#/views/mes/md/item/components';
-import { MdVendorSelect } from '#/views/mes/md/vendor/components';
 
 import {
   WmWarehouseAreaSelect,
@@ -63,6 +62,20 @@
       },
     },
     {
+      fieldName: 'stockState',
+      label: '搴撳瓨鐘舵��',
+      component: 'Select',
+      componentProps: {
+        allowClear: true,
+        options: [
+          { label: '鏆傚瓨搴擄紙寰呰川妫�锛�', value: 10 },
+          { label: '鍚堟牸搴擄紙姝e紡搴撳瓨锛�', value: 20 },
+          { label: '宸插嚭搴擄紙閿�鍞墸鍑忥級', value: 30 },
+        ],
+        placeholder: '璇烽�夋嫨搴撳瓨鐘舵��',
+      },
+    },
+    {
       fieldName: 'frozen',
       label: '鏄惁鍐荤粨',
       component: 'Select',
@@ -84,6 +97,7 @@
     newFrozen: boolean,
     row: MesWmMaterialStockApi.MaterialStock,
   ) => Promise<boolean | undefined>,
+  onMove?: (row: MesWmMaterialStockApi.MaterialStock) => void,
 ): VxeTableGridOptions<MesWmMaterialStockApi.MaterialStock>['columns'] {
   const { hasAccessByCodes } = useAccess();
   return [
@@ -103,9 +117,59 @@
       minWidth: 120,
     },
     {
+      field: 'stockState',
+      title: '搴撳瓨鐘舵��',
+      width: 150,
+      cellRender: {
+        name: 'CellTag',
+        props: {
+          options: [
+            { label: '鏆傚瓨搴�', value: 10, color: 'orange' },
+            { label: '鍚堟牸搴�', value: 20, color: 'green' },
+            { label: '宸插嚭搴�', value: 30, color: 'default' },
+          ],
+        },
+      },
+    },
+    {
       field: 'quantity',
       title: '鍦ㄥ簱鏁伴噺',
       width: 100,
+    },
+    {
+      field: 'frozenQuantity',
+      title: '鍐荤粨鏁伴噺',
+      width: 100,
+      formatter: ({ cellValue }: { cellValue: number }) =>
+        (cellValue || 0).toFixed(2),
+    },
+    {
+      field: 'reservedQuantity',
+      title: '鍗犵敤閲�',
+      width: 100,
+      formatter: ({ cellValue }: { cellValue: number }) =>
+        (cellValue || 0).toFixed(2),
+    },
+    {
+      field: 'inTransitQuantity',
+      title: '鍦ㄩ�旈噺',
+      width: 100,
+      formatter: ({ cellValue }: { cellValue: number }) =>
+        (cellValue || 0).toFixed(2),
+    },
+    {
+      field: 'availableQuantity',
+      title: '鍙敤閲�',
+      width: 100,
+      cellRender: {
+        name: 'CellText',
+        props: {
+          class: ({ row }: { row: MesWmMaterialStockApi.MaterialStock }) =>
+            (row.availableQuantity || 0) < 0 ? 'text-red-500 font-bold' : '',
+          formatter: ({ row }: { row: MesWmMaterialStockApi.MaterialStock }) =>
+            ((row.availableQuantity || 0) as number).toFixed(2),
+        },
+      },
     },
     {
       field: 'unitMeasureName',
@@ -117,6 +181,11 @@
       title: '鎵规鍙�',
       minWidth: 140,
       slots: { default: 'batchCode' },
+    },
+    {
+      field: 'bagCount',
+      title: '琚嬬爜鏁�',
+      width: 90,
     },
     {
       field: 'warehouseName',
@@ -155,6 +224,12 @@
         },
       },
     },
+    {
+      title: '鎿嶄綔',
+      width: onMove ? 150 : 90,
+      fixed: 'right' as const,
+      slots: { default: 'actions' } as const,
+    },
   ];
 }
 
@@ -162,19 +237,21 @@
 export function useSelectGridFormSchema(): VbenFormSchema[] {
   return [
     {
-      fieldName: 'itemId',
+      fieldName: 'itemName',
       label: '鐗╂枡',
-      component: markRaw(MdItemSelect),
+      component: 'Input',
       componentProps: {
-        placeholder: '璇烽�夋嫨鐗╂枡',
+        allowClear: true,
+        placeholder: '璇疯緭鍏ョ墿鏂欏悕绉�',
       },
     },
     {
-      fieldName: 'vendorId',
+      fieldName: 'vendorName',
       label: '渚涘簲鍟�',
-      component: markRaw(MdVendorSelect),
+      component: 'Input',
       componentProps: {
-        placeholder: '璇烽�夋嫨渚涘簲鍟�',
+        allowClear: true,
+        placeholder: '璇疯緭鍏ヤ緵搴斿晢鍚嶇О',
       },
     },
     {
@@ -288,6 +365,41 @@
       width: 100,
     },
     {
+      field: 'frozenQuantity',
+      title: '鍐荤粨鏁伴噺',
+      width: 100,
+      formatter: ({ cellValue }: { cellValue: number }) =>
+        (cellValue || 0).toFixed(2),
+    },
+    {
+      field: 'reservedQuantity',
+      title: '鍗犵敤閲�',
+      width: 100,
+      formatter: ({ cellValue }: { cellValue: number }) =>
+        (cellValue || 0).toFixed(2),
+    },
+    {
+      field: 'inTransitQuantity',
+      title: '鍦ㄩ�旈噺',
+      width: 100,
+      formatter: ({ cellValue }: { cellValue: number }) =>
+        (cellValue || 0).toFixed(2),
+    },
+    {
+      field: 'availableQuantity',
+      title: '鍙敤閲�',
+      width: 100,
+      cellRender: {
+        name: 'CellText',
+        props: {
+          class: ({ row }: { row: MesWmMaterialStockApi.MaterialStock }) =>
+            (row.availableQuantity || 0) < 0 ? 'text-red-500 font-bold' : '',
+          formatter: ({ row }: { row: MesWmMaterialStockApi.MaterialStock }) =>
+            ((row.availableQuantity || 0) as number).toFixed(2),
+        },
+      },
+    },
+    {
       field: 'receiptTime',
       title: '鍏ュ簱鏃ユ湡',
       width: 180,

--
Gitblit v1.9.3