From 7726b6cdab80596d2e2f7dd3fe1ec3dfbdeee155 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期五, 12 六月 2026 09:42:40 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro_河南鹤壁' into dev_pro_河南鹤壁

---
 src/views/productionManagement/productionOrder/components/MaterialDetailDialog.vue |  105 +++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 83 insertions(+), 22 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/components/MaterialDetailDialog.vue b/src/views/productionManagement/productionOrder/components/MaterialDetailDialog.vue
index a83ff6a..3373374 100644
--- a/src/views/productionManagement/productionOrder/components/MaterialDetailDialog.vue
+++ b/src/views/productionManagement/productionOrder/components/MaterialDetailDialog.vue
@@ -21,34 +21,56 @@
                          prop="batchNo"
                          min-width="150" />
         <el-table-column label="闇�姹傛暟閲�"
-                         prop="demandedQuantity"
-                         min-width="110" />
+                         min-width="110">
+          <template #default="{ row }">
+            {{ stripTrailingZeros(row.demandedQuantity) }}
+          </template>
+        </el-table-column>
         <el-table-column label="璁¢噺鍗曚綅"
                          prop="unit"
                          width="100" />
         <el-table-column label="棰嗙敤鏁伴噺"
-                         prop="pickQuantity"
-                         min-width="110" />
+                         min-width="110">
+          <template #default="{ row }">
+            {{ stripTrailingZeros(row.pickQuantity) }}
+          </template>
+        </el-table-column>
         <el-table-column label="琛ユ枡鏁伴噺"
                          min-width="120">
           <template #default="{ row }">
             <el-button type="primary"
                        link
                        @click="handleViewSupplementRecord(row)">
-              {{ row.supplementQty ?? 0 }}
+              {{ stripTrailingZeros(row.feedingQty) ?? 0 }}
             </el-button>
           </template>
         </el-table-column>
         <el-table-column label="閫�鏂欐暟閲�"
-                         prop="returnQty"
-                         min-width="110" />
+                         min-width="110">
+          <template #default="{ row }">
+            {{ stripTrailingZeros(row.returnQty) ?? 0 }}
+          </template>
+        </el-table-column>
         <el-table-column label="瀹為檯鏁伴噺"
-                         prop="actualQty"
-                         min-width="110" />
+                         min-width="140">
+          <template #default="{ row }">
+            <el-input-number v-model="row.actualQty"
+                             :min="0"
+                             :step="1"
+                             controls-position="right"
+                             placeholder="杈撳叆瀹為檯鏁伴噺"
+                             :formatter="value => stripTrailingZeros(value)"
+                             :parser="value => parseFloat(value) || 0"
+                             style="width: 100%;"
+                             :disabled="row.returned || orderRow?.end"
+                             @change="val => handleActualQtyChange(row, val)" />
+          </template>
+        </el-table-column>
       </el-table>
       <template #footer>
         <span class="dialog-footer">
-          <el-button type="warning"
+          <el-button v-if="!orderRow?.end"
+                     type="warning"
                      :loading="materialReturnConfirming"
                      :disabled="!canOpenReturnSummary"
                      @click="openReturnSummaryDialog">
@@ -66,7 +88,7 @@
                 border
                 row-key="id">
         <el-table-column label="琛ユ枡鏁伴噺"
-                         prop="supplementQty"
+                         prop="pickQuantity"
                          min-width="120" />
         <el-table-column label="琛ユ枡浜�"
                          prop="supplementUserName"
@@ -75,7 +97,7 @@
                          prop="supplementTime"
                          min-width="160" />
         <el-table-column label="琛ユ枡鍘熷洜"
-                         prop="supplementReason"
+                         prop="feedingReason"
                          min-width="200" />
       </el-table>
       <template #footer>
@@ -100,8 +122,11 @@
                          prop="unit"
                          min-width="100" />
         <el-table-column label="閫�鏂欐眹鎬绘暟閲�"
-                         prop="returnQtyTotal"
-                         min-width="140" />
+                         min-width="140">
+          <template #default="{ row }">
+            {{ stripTrailingZeros(row.returnQtyTotal) }}
+          </template>
+        </el-table-column>
       </el-table>
       <template #footer>
         <span class="dialog-footer">
@@ -121,8 +146,16 @@
   import {
     listMaterialPickingDetail,
     listMaterialSupplementRecord,
-    confirmMaterialReturn,
+    updateMaterialPickingLedger,
   } from "@/api/productionManagement/productionOrder.js";
+
+  const stripTrailingZeros = val => {
+    const str = String(val ?? "");
+    if (str.includes(".")) {
+      return parseFloat(str).toString();
+    }
+    return str;
+  };
 
   const props = defineProps({
     modelValue: { type: Boolean, default: false },
@@ -145,10 +178,12 @@
   const returnSummaryList = ref([]);
   const calcReturnQty = item =>
     Number(item.pickQuantity || 0) +
-    Number(item.supplementQty || 0) -
+    Number(item.feedingQty || 0) -
     Number(item.actualQty || 0);
   const canOpenReturnSummary = computed(() =>
-    materialDetailTableData.value.some(item => calcReturnQty(item) > 0)
+    materialDetailTableData.value.some(
+      item => item.returned !== true && calcReturnQty(item) > 0
+    )
   );
 
   const loadDetailList = async () => {
@@ -157,7 +192,13 @@
     materialDetailTableData.value = [];
     try {
       const res = await listMaterialPickingDetail(props.orderRow.id);
-      materialDetailTableData.value = res.data || [];
+      materialDetailTableData.value = (res.data || []).map(item => ({
+        ...item,
+        actualQty:
+          item.actualQty ??
+          Number(item.pickQuantity || 0) + Number(item.feedingQty || 0),
+        returnQty: item.returnQty ?? 0,
+      }));
     } finally {
       materialDetailLoading.value = false;
     }
@@ -176,6 +217,10 @@
     materialDetailTableData.value = [];
   };
 
+  const handleActualQtyChange = (row, val) => {
+    row.returnQty = calcReturnQty(row);
+  };
+
   const handleViewSupplementRecord = async row => {
     if (!row?.id) return;
     supplementRecordDialogVisible.value = true;
@@ -183,7 +228,8 @@
     supplementRecordTableData.value = [];
     try {
       const res = await listMaterialSupplementRecord({
-        materialDetailId: row.id,
+        pickId: row.id,
+        productionOrderId: props.orderRow.id,
       });
       supplementRecordTableData.value = res.data || [];
     } finally {
@@ -225,9 +271,24 @@
     if (!props.orderRow?.id) return;
     materialReturnConfirming.value = true;
     try {
-      await confirmMaterialReturn({
-        orderId: props.orderRow.id,
-        returnSummaryList: returnSummaryList.value,
+      await updateMaterialPickingLedger({
+        productionOrderId: props.orderRow.id,
+        productionOrderPickDto: materialDetailTableData.value.map(item => ({
+          id: item.id,
+          technologyOperationId: item.technologyOperationId,
+          operationName: item.operationName,
+          bom: item.bom === true,
+          productModelId: item.productModelId,
+          demandedQuantity: item.demandedQuantity,
+          unit: item.unit,
+          pickQuantity: item.pickQuantity,
+          batchNo: item.batchNo,
+          feedingQty: item.feedingQty,
+          returnQty: item.returnQty,
+          actualQty: item.actualQty,
+          feedingReason: item.feedingReason,
+          returned: true,
+        })),
       });
       returnSummaryDialogVisible.value = false;
       dialogVisible.value = false;

--
Gitblit v1.9.3