From 458dd6178b917a304d7539aa30e8103e4362588e Mon Sep 17 00:00:00 2001
From: quxin <592870522@qq.com>
Date: 星期五, 04 九月 2026 10:38:09 +0800
Subject: [PATCH] 修改BUG: 1.仓储物流--生产仓库--生产领料:新增领料出库单时报错,提示"请求参数不正确:生产任务ID不能为空",导致无法新增。 2.仓储物流--生产仓库--生产领料:对新增到领料出库单进行拣货时,提示"提示:库存记录与提交的物料、批次或库位信息不一致"导致无法进行拣货

---
 src/views/wls/productissue/data.ts |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/src/views/wls/productissue/data.ts b/src/views/wls/productissue/data.ts
index 2ee6dcc..896c624 100644
--- a/src/views/wls/productissue/data.ts
+++ b/src/views/wls/productissue/data.ts
@@ -1,5 +1,6 @@
 锘縤mport type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
 import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { MesProTaskApi } from '#/api/mes/pro/task';
 import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock';
 import type { MesWmProductIssueApi } from '#/api/mes/wm/productissue';
 import type { MesWmProductIssueDetailApi } from '#/api/mes/wm/productissue/detail';
@@ -20,6 +21,7 @@
 import { getRangePickerDefaultProps } from '#/utils';
 import { MdItemSelect } from '#/views/mes/md/item/components';
 import { MdWorkstationSelect } from '#/views/mes/md/workstation/components';
+import { ProTaskSelect } from '#/views/mes/pro/task/components';
 import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components';
 import { WmMaterialStockSelect } from '#/views/wls/materialstock/components';
 import {
@@ -110,7 +112,33 @@
       label: '鐢熶骇璁㈠崟',
       component: markRaw(ProWorkOrderSelect),
       componentProps: {
+        placeholder: '璇烽�夋嫨鐢熶骇璁㈠崟',
         status: MesProWorkOrderStatusEnum.CONFIRMED,
+        // 璁㈠崟鍙樻洿锛氭竻绌哄凡閫夌敓浜т换鍔★紝閬垮厤浠诲姟涓庤鍗曚笉涓�鑷�
+        onChange: async () => {
+          await formApi?.setFieldValue('taskId', undefined);
+        },
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'taskId',
+      label: '鐢熶骇浠诲姟',
+      component: markRaw(ProTaskSelect),
+      componentProps: {
+        placeholder: '璇烽�夋嫨鐢熶骇浠诲姟',
+        // 閫変腑浠诲姟鍚庤嚜鍔ㄥ甫鍑哄叾宸ヤ綔绔�
+        onChange: async (task?: MesProTaskApi.Task) => {
+          await formApi?.setFieldValue('workstationId', task?.workstationId);
+        },
+      },
+      dependencies: {
+        triggerFields: ['workOrderId'],
+        componentProps: (values) => ({
+          disabled: !values.workOrderId,
+          placeholder: values.workOrderId ? '璇烽�夋嫨鐢熶骇浠诲姟' : '璇峰厛閫夋嫨鐢熶骇璁㈠崟',
+          workOrderId: values.workOrderId,
+        }),
       },
       rules: 'selectRequired',
     },
@@ -198,6 +226,11 @@
     {
       field: 'workOrderCode',
       title: '鐢熶骇璁㈠崟',
+      minWidth: 140,
+    },
+    {
+      field: 'taskCode',
+      title: '鐢熶骇浠诲姟',
       minWidth: 140,
     },
     {
@@ -370,6 +403,14 @@
       },
     },
     {
+      fieldName: 'batchId',
+      component: 'Input',
+      dependencies: {
+        triggerFields: [''],
+        show: () => false,
+      },
+    },
+    {
       fieldName: 'itemId',
       label: '鐗╂枡',
       component: markRaw(MdItemSelect),
@@ -382,12 +423,13 @@
       label: '搴撳瓨璁板綍',
       component: markRaw(WmMaterialStockSelect),
       componentProps: {
-        // 閫夋嫨搴撳瓨璁板綍鍚庯紝鑷姩鍥炲~浠撳簱/搴撳尯/搴撲綅/鎵规/鏁伴噺
+        // 閫夋嫨搴撳瓨璁板綍鍚庯紝鑷姩鍥炲~鐗╂枡/浠撳簱/搴撳尯/搴撲綅/鎵规/鏁伴噺锛屽叏閮ㄤ互搴撳瓨璁板綍涓哄噯
         onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => {
           await formApi?.setValues({
             areaId: stock?.areaId,
             batchCode: stock?.batchCode,
             batchId: stock?.batchId,
+            itemId: stock?.itemId,
             locationId: stock?.locationId,
             quantity: stock?.quantity,
             quantityMax: stock?.quantity,
@@ -399,6 +441,7 @@
       dependencies: {
         triggerFields: ['itemId'],
         componentProps: (values) => ({
+          // 搴撳瓨閫夋嫨寮圭獥鍙瘑鍒� mdmItemId 鍏ュ弬锛屽苟鐢ㄥ畠浣滀负 itemId 杩囨护鏉′欢
           mdmItemId: values.itemId,
         }),
       },

--
Gitblit v1.9.3