From 3c506974e141024ed26a0c348d896c70ea42891b Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期五, 12 十二月 2025 13:59:32 +0800
Subject: [PATCH] 1

---
 项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue          |  480 ++++++++++++++++++--------
 项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/outOrderDetail.vue       |  464 +++++++++++++++----------
 项目代码/WIDESEA_WMSClient/src/views/taskinfo/task.vue                            |   16 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs |   90 ++--
 4 files changed, 651 insertions(+), 399 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue"
index 55145a5..8e14b29 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue"
@@ -15,22 +15,11 @@
               <el-divider direction="vertical"></el-divider>
               <span class="less-style">鐗╂枡缂栧彿锛� {{ row.materielCode }} </span>
               <el-divider direction="vertical"></el-divider>
-              <span class="less-style"
-                >闇�姹傛暟閲忥細 {{ row.orderQuantity }}
-              </span>
+              <span class="less-style">闇�姹傛暟閲忥細 {{ row.qty }} </span>
               <el-divider direction="vertical"></el-divider>
-              <span :class="selectionClass"
-                >宸查�夋暟閲忥細 {{ selectionSum }}
-              </span>
+              <span :class="selectionClass">宸查�夋暟閲忥細 {{ selectionSum }} </span>
             </el-col>
             <el-col :span="8">
-             <!--  <el-link
-                type="primary"
-                size="small"
-                style="float: right; height: 20px"
-                @click="getData(false)"
-                >{{ kcname }}</el-link
-              > -->
               <el-link
                 type="primary"
                 size="small"
@@ -38,17 +27,64 @@
                 @click="getData"
                 >鍒锋柊</el-link
               >
-      <!--         <el-link
+              <el-link
                 type="primary"
                 size="small"
                 style="float: right; height: 20px; margin-right: 10px"
-                @click="revokeAssign"
-                >鎾ら攢鍒嗛厤</el-link
-              > -->
+                @click="openOutboundDialog"
+                >鐩存帴鍑哄簱</el-link
+              >
             </el-col>
           </el-row>
         </el-alert>
       </div>
+
+      <!-- 鏂板绛涢�夊尯鍩� -->
+      <div class="filter-area" style="margin: 10px 0; padding: 10px; background: #f8f9fa; border-radius: 4px;">
+        <el-form :model="filterForm" inline @submit.prevent>
+          <el-form-item label="鐗╂枡缂栧彿锛�">
+            <el-input
+              v-model="filterForm.materielCode"
+              placeholder="妯$硦绛涢�夌墿鏂欑紪鍙�"
+              clearable
+              style="width: 180px"
+              @input="filterTable"
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="鐗╂枡鏉$爜锛�">
+            <el-input
+              v-model="filterForm.barcode"
+              placeholder="妯$硦绛涢�夌墿鏂欐潯鐮�"
+              clearable
+              style="width: 180px"
+              @input="filterTable"
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="鎵樼洏缂栧彿锛�">
+            <el-input
+              v-model="filterForm.palletCode"
+              placeholder="妯$硦绛涢�夋墭鐩樼紪鍙�"
+              clearable
+              style="width: 180px"
+              @input="filterTable"
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="璐т綅缂栧彿锛�">
+            <el-input
+              v-model="filterForm.locationCode"
+              placeholder="妯$硦绛涢�夎揣浣嶇紪鍙�"
+              clearable
+              style="width: 180px"
+              @input="filterTable"
+            ></el-input>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="filterTable">鎼滅储</el-button>
+            <el-button @click="resetFilter">閲嶇疆</el-button>
+          </el-form-item>
+        </el-form>
+      </div>
+
       <div class="box-table" style="margin-top: 1%">
         <el-table
           ref="singleTable"
@@ -59,7 +95,6 @@
           height="500px"
           @selection-change="handleSelectionChange"
         >
-          >
           <el-table-column type="selection" width="55"> </el-table-column>
           <el-table-column
             label="搴忓彿"
@@ -92,185 +127,334 @@
         </el-table>
       </div>
       <template #footer>
-       <!--  <el-button type="primary" size="small" @click="outbound"
-          >鐩存帴鍑哄簱</el-button
-        >
-        <el-button type="primary" size="small" @click="lockStock"
-          >閿佸畾搴撳瓨</el-button
-        > -->
+        <!-- 鍘绘帀閿佸畾搴撳瓨鎸夐挳锛屽彧淇濈暀鍏抽棴鎸夐挳 -->
         <el-button type="danger" size="small" @click="showDetialBox = false"
           >鍏抽棴</el-button
         >
       </template>
     </vol-box>
+
+    <!-- 鍑哄簱绔欏彴閫夋嫨寮圭獥锛堥潤鎬佹ā鏉垮疄鐜帮級 -->
+    <el-dialog
+      v-model="showOutboundDialog"
+      title="鍑哄簱鎿嶄綔 - 閫夋嫨鍑哄簱绔欏彴"
+      width="500px"
+      :append-to-body="true"
+    >
+      <el-form
+        :model="outboundForm"
+        :rules="outboundRules"
+        ref="outboundFormRef"
+        label-width="100px"
+        style="padding: 0 20px"
+      >
+        <el-form-item label="鍑哄簱绔欏彴" prop="selectedPlatform" style="margin-bottom: 24px">
+          <el-select
+            v-model="outboundForm.selectedPlatform"
+            placeholder="璇烽�夋嫨鍑哄簱绔欏彴锛�3-12锛�"
+            style="width: 100%; height: 40px"
+          >
+            <el-option
+              v-for="platform in platformOptions"
+              :key="platform.value"
+              :label="platform.label"
+              :value="platform.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="showOutboundDialog = false" style="margin-right: 8px">鍙栨秷</el-button>
+        <el-button type="primary" @click="confirmOutbound">纭畾鍑哄簱</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
+
 <script>
 import VolBox from "@/components/basic/VolBox.vue";
-import { fa } from "element-plus/es/locales.mjs";
+import { ElMessage } from "element-plus";
+
 export default {
   components: { VolBox },
   data() {
     return {
-      row: null,
-      kcname: "",
-      pkcx: false,
+      row: null, // 鎺ユ敹鐖剁粍浠朵紶閫掔殑瀹屾暣鏁版嵁锛堝寘鍚槑缁咺D闆嗗悎锛�
       showDetialBox: false,
       tableData: [],
+      originalTableData: [], // 瀛樺偍鍘熷鏁版嵁锛岀敤浜庣瓫閫�
       tableColumns: [
-        {
-          prop: "materielCode",
-          title: "鐗╂枡缂栧彿",
-          type: "string",
-          width: 150,
-        },
-        {
-          prop: "materielName",
-          title: "鐗╂枡鍚嶇О",
-          type: "string",
-          width: 150,
-        },
-        {
-          prop: "palletCode",
-          title: "鎵樼洏缂栧彿",
-          type: "string",
-          width: 150,
-        },
-        {
-          prop: "locationCode",
-          title: "璐т綅缂栧彿",
-          type: "string",
-          width: 180,
-        },
-        {
-          prop: "useableQuantity",
-          title: "鍙敤鏁伴噺",
-          type: "string",
-        },
+        { prop: "materielCode", title: "鐗╂枡缂栧彿", type: "string", width: 150 },
+        { prop: "barcode", title: "鐗╂枡鏉$爜", type: "string", width: 150 },
+        { prop: "palletCode", title: "鎵樼洏缂栧彿", type: "string", width: 150 },
+        { prop: "locationCode", title: "璐т綅缂栧彿", type: "string", width: 180 },
+        { prop: "useableQuantity", title: "鍙敤鏁伴噺", type: "string" },
       ],
-      selection: [],
-      selectionSum: 0,
+      selection: [], // 閫変腑鐨勫簱瀛樻暟鎹�
+      selectionSum: 0, // 宸查�夋暟閲忔�诲拰
       selectionClass: "less-style",
       originalQuantity: 0,
+
+      // 绛涢�夎〃鍗曟暟鎹�
+      filterForm: {
+        materielCode: "",
+        barcode: "",
+        palletCode: "",
+        locationCode: ""
+      },
+
+      // 鍑哄簱寮圭獥鐩稿叧鏁版嵁
+      showOutboundDialog: false,
+      outboundForm: { selectedPlatform: "" }, // 琛ㄥ崟缁戝畾鏁版嵁
+      outboundRules: {
+        selectedPlatform: [
+          { required: true, message: "璇烽�夋嫨鍑哄簱绔欏彴", trigger: "change" },
+        ],
+      },
+      platformOptions: [
+        { label: "绔欏彴2", value: "2-1" },
+        { label: "绔欏彴3", value: "3-1" },
+      ],
+      pkcx: false, // 鏂板锛氶粯璁alse锛堝鏋滈渶瑕佸彲浠庣埗缁勪欢浼犻�掞級
     };
   },
   methods: {
-    open(row) {
-      console.log(row);
-      this.row = row;
+    // 鎺ユ敹鐖剁粍浠朵紶閫掔殑鏁版嵁锛堝寘鍚槑缁咺D闆嗗悎鍜岀墿鏂欎俊鎭級
+    open(data) {
+      this.row = data; // data缁撴瀯锛歿materielCode, materielName, qty, orderNo, detailIds, mainOrderId, groupRow}
       this.showDetialBox = true;
-      this.originalQuantity = this.row.lockQuantity;
-      this.selectionSum = this.row.lockQuantity;
-      this.getData();
-      if (this.selectionSum == this.row.orderQuantity) {
-        this.selectionClass = "equle-style";
-      } else if (this.selectionSum < this.row.orderQuantity) {
-        this.selectionClass = "less-style";
-      } else {
-        this.selectionClass = "more-style";
-      }
+      this.getData(); // 鍔犺浇搴撳瓨鏁版嵁
+      this.updateSelectionClass(); // 鍒濆鍖栧凡閫夋暟閲忔牱寮�
+      console.log("鎺ユ敹鐨勫垎缁勬槑缁咺D闆嗗悎锛�", this.row.detailIds);
+      console.log("鏌ヨ搴撳瓨鐨勭墿鏂欑紪鐮侊細", this.row.materielCode);
     },
-    lockStock() {
+
+    // 鎵撳紑鍑哄簱寮圭獥
+    openOutboundDialog() {
+      if (this.selection.length === 0) {
+        return ElMessage.error("璇烽�夋嫨搴撳瓨鏁版嵁");
+      }
+      // 鏍¢獙鏄庣粏ID闆嗗悎
+      if (!this.row?.detailIds || this.row.detailIds.length === 0) {
+        return ElMessage.error("娌℃湁鑾峰彇鍒板崟鎹槑缁咺D锛屾棤娉曞嚭搴�");
+      }
+      // 閲嶇疆琛ㄥ崟閬垮厤娈嬬暀鍊�
+      this.outboundForm.selectedPlatform = "";
+      this.showOutboundDialog = true;
+    },
+
+    // 鏍稿績淇敼锛歎RL鎷兼帴浼犻�抜nt[] orderDetailId锛堥噸澶嶅弬鏁板悕锛夊拰station锛岃姹備綋浼犲簱瀛樻暟鎹�
+    confirmOutbound() {
+      this.$refs.outboundFormRef.validate((valid) => {
+        if (!valid) return;
+
+        // 鏍¢獙閫変腑搴撳瓨鍜屾槑缁咺D
+        if (this.selection.length <= 0) {
+          return this.$message.error("璇峰嬀閫夊簱瀛樻暟鎹�");
+        }
+        if (!this.row?.detailIds || this.row.detailIds.length === 0) {
+          return this.$message.error("娌℃湁鑾峰彇鍒板崟鎹槑缁咺D锛屾棤娉曞嚭搴�");
+        }
+
+        try {
+          // 1. 杞崲ID涓烘暣鏁版暟缁勶紙纭繚鍚庣鑳借瘑鍒负int[]锛�
+          const orderDetailId = this.row.detailIds.map(id => {
+            const num = Number(id);
+            if (isNaN(num) || !Number.isInteger(num)) {
+              throw new Error(`ID ${id} 涓嶆槸鏈夋晥鐨勬暣鏁癭);
+            }
+            return num;
+          });
+
+          // 2. 鎷兼帴URL锛歩nt[] 鐢ㄩ噸澶嶅弬鏁板悕鏍煎紡锛�?orderDetailId=1&orderDetailId=2&...锛�
+          let url = "api/Task/GenerateOutboundTask";
+          // 鎷兼帴ID鏁扮粍鍙傛暟
+          const idParams = orderDetailId.map(id => `orderDetailId=${id}`).join("&");
+          // 鎷兼帴绔欏彴鍙傛暟
+          const stationParam = `station=${encodeURIComponent(this.outboundForm.selectedPlatform)}`;
+          // 瀹屾暣URL锛堝鐞嗗弬鏁版嫾鎺ラ�昏緫锛�
+          const fullUrl = idParams 
+            ? `${url}?${idParams}&${stationParam}` 
+            : `${url}?${stationParam}`;
+
+          console.log("鍑哄簱璇锋眰URL锛�", fullUrl);
+
+          // 3. 鍙戦�佽姹傦細URL鎷兼帴ID鍜岀珯鍙帮紝璇锋眰浣撲紶搴撳瓨鏁版嵁锛堥�傞厤FromBody锛�
+          this.http
+            .post(fullUrl, this.selection, "鏁版嵁澶勭悊涓�")
+            .then((x) => {
+              if (!x.status) return this.$message.error(x.message);
+              this.$message.success("鎿嶄綔鎴愬姛");
+              this.showDetialBox = false;
+              this.$emit("parentCall", ($vue) => {
+                $vue.getData(); // 鍒锋柊鐖剁粍浠舵暟鎹�
+              });
+            })
+            .catch((err) => {
+              console.error("鍑哄簱澶辫触锛�", err);
+              this.$message.error(`鍑哄簱澶辫触锛�${err.message || '璇风◢鍚庨噸璇�'}`);
+            });
+        } catch (err) {
+          this.$message.error(err.message);
+        }
+      });
+    },
+
+    // 鎸夌涓�涓墿鏂欑紪鐮佹煡璇㈠簱瀛樻暟鎹�
+    getData() {
+      const url = "api/StockInfo/GetSelectViewDTOs?materielCode=";
+      // 浣跨敤鐖剁粍浠朵紶閫掔殑鐗╂枡缂栫爜锛堢涓�涓槑缁嗙殑缂栫爜锛�
       this.http
         .post(
-          "api/OutboundOrderDetail/LockOutboundStock?id=" + this.row.id,
-          this.selection,
-          "鏁版嵁澶勭悊涓�"
-        )
-        .then((x) => {
-          if (!x.status) return this.$message.error(x.message);
-          this.$message.success("鎿嶄綔鎴愬姛");
-          this.showDetialBox = false;
-          this.$emit("parentCall", ($vue) => {
-            $vue.getData();
-          });
-        });
-    },
-    outbound() {
-      if (this.selection.length <= 0) {
-        return this.$message.error("璇峰嬀閫�");
-      }
-      let url = this.pkcx
-        ? "api/Task/GenerateOutboundTask?orderDetailId="
-        : "api/Task/GenerateOutboundTask?orderDetailId=";
-      this.http
-        .post(url + this.row.id, this.selection, "鏁版嵁澶勭悊涓�")
-        .then((x) => {
-          if (!x.status) return this.$message.error(x.message);
-          this.$message.success("鎿嶄綔鎴愬姛");
-          this.showDetialBox = false;
-          this.$emit("parentCall", ($vue) => {
-            $vue.getData();
-          });
-        });
-    },
-    getData(a) {
-      if (!a) this.pkcx = !this.pkcx;
-      let url = this.pkcx
-        ? "api/StockInfo/GetStockSelectViews?materielCode="
-        : "api/StockInfo/GetStockSelectViews?materielCode=";
-      this.kcname = this.pkcx ? "绔嬪簱搴撳瓨" : "骞冲簱搴撳瓨";
-      this.http
-        .post(
-          url + this.row.materielCode + "&orderId=" + this.row.orderId,
+          url + this.row.materielCode + "&orderNo=" + (this.row.upperOrderNo || this.row.orderNo),
           null,
           "鏌ヨ涓�"
         )
         .then((x) => {
-          this.tableData = x;
+          this.tableData = x || [];
+          this.originalTableData = [...this.tableData]; // 淇濆瓨鍘熷鏁版嵁
+          // 鍒锋柊鍚庢竻绌轰箣鍓嶇殑閫夋嫨鍜岃鏁�
+          this.clearSelection();
+          this.selectionSum = 0;
+          this.originalQuantity = 0;
+          this.updateSelectionClass();
+          // 鍒锋柊鍚庨噸缃瓫閫夋潯浠�
+          this.resetFilter();
+        })
+        .catch((err) => {
+          console.error("搴撳瓨鏌ヨ澶辫触锛�", err);
+          ElMessage.error("搴撳瓨鏌ヨ澶辫触锛岃绋嶅悗閲嶈瘯");
+          this.tableData = [];
+          this.originalTableData = [];
         });
     },
+
+    // 鎾ら攢鎸囧畾搴撳瓨锛堝鏋滈渶瑕侊級
     revokeAssign() {
-      console.log(this.row);
-      this.http
-        .post(
-          "api/OutboundOrderDetail/RevokeLockOutboundStock?id=" + this.row.id,
-          null,
-          "鏁版嵁澶勭悊涓�"
-        )
-        .then((x) => {
-          if (!x.status) return this.$message.error(x.message);
-          this.$message.success("鎿嶄綔鎴愬姛");
-          this.showDetialBox = false;
-          this.$emit("parentCall", ($vue) => {
-            $vue.getData();
+      if (!this.row?.detailIds || this.row.detailIds.length === 0) {
+        return ElMessage.error("娌℃湁鑾峰彇鍒板崟鎹槑缁咺D锛屾棤娉曟挙閿�");
+      }
+
+      try {
+        // ID杞负鏁存暟鏁扮粍锛屾嫾鎺RL
+        const detailIds = this.row.detailIds.map(id => Number(id));
+        const idParams = detailIds.map(id => `detailIds=${id}`).join("&");
+        const url = `api/OutboundOrderDetail/RevokeLockOutboundStock?id=${this.row.mainOrderId}&${idParams}`;
+        
+        this.http
+          .post(url, null, "鏁版嵁澶勭悊涓�")
+          .then((x) => {
+            if (!x.status) return ElMessage.error(x.message);
+            ElMessage.success("鎾ら攢鎴愬姛");
+            this.showDetialBox = false;
+            this.$emit("parentCall", ($vue) => {
+              $vue.getData();
+            });
           });
-        });
+      } catch (err) {
+        this.$message.error(`鎾ら攢澶辫触锛�${err.message}`);
+      }
     },
+
+    // 澶勭悊琛ㄦ牸閫夋嫨鍙樺寲锛堣绠楀凡閫夋暟閲忥級
     handleSelectionChange(val) {
       this.selection = val;
-      this.selectionSum =
-        val.reduce(
-          (accumulator, currentValue) =>
-            accumulator + currentValue["useableQuantity"],
-          0
-        ) + this.originalQuantity;
-      if (this.selectionSum == this.row.orderQuantity) {
+      // 璁$畻宸查�夋暟閲忥紙杞暟瀛楅伩鍏嶅瓧绗︿覆鎷兼帴锛�
+      this.selectionSum = val.reduce(
+        (acc, curr) => acc + Number(curr.useableQuantity || 0),
+        0
+      ) + this.originalQuantity;
+      this.updateSelectionClass();
+    },
+
+    // 鏇存柊宸查�夋暟閲忔牱寮忥紙瀵规瘮鍒嗙粍鎬婚渶姹傛暟閲忥級
+    updateSelectionClass() {
+      if (!this.row) return;
+      if (this.selectionSum === this.row.qty) {
         this.selectionClass = "equle-style";
-      } else if (this.selectionSum < this.row.orderQuantity) {
+      } else if (this.selectionSum < this.row.qty) {
         this.selectionClass = "less-style";
       } else {
         this.selectionClass = "more-style";
       }
     },
+
+    // 鍒囨崲琛ㄦ牸閫夋嫨
     toggleSelection(rows) {
-      if (rows) {
-        rows.forEach((row) => {
-          this.$refs.singleTable.toggleRowSelection(row);
-        });
-      } else {
+      rows 
+        ? rows.forEach((row) => this.$refs.singleTable.toggleRowSelection(row)) 
+        : this.clearSelection();
+    },
+
+    // 娓呯┖閫夋嫨
+    clearSelection() {
+      if (this.$refs.singleTable) {
         this.$refs.singleTable.clearSelection();
       }
     },
-    clearSelection() {
-      this.$refs.singleTable.clearSelection();
-    },
+
+    // 琛岀偣鍑讳簨浠�
     handleRowClick(row) {
       this.$refs.singleTable.toggleRowSelection(row);
     },
+
+    // 鍥炬爣鎸夐挳鐐瑰嚮鍗犱綅鏂规硶锛堝彲鏍规嵁闇�姹傛墿灞曪級
+    tableButtonClick(row, item) {
+      console.log("鍥炬爣鎸夐挳鐐瑰嚮锛�", item.title, row);
+    },
+
+    // 绛涢�夎〃鏍兼暟鎹�
+    filterTable() {
+      if (!this.originalTableData.length) return;
+      
+      // 瑙f瀯绛涢�夋潯浠跺苟杞负灏忓啓锛堝拷鐣ュぇ灏忓啓锛�
+      const { materielCode, barcode, palletCode, locationCode } = this.filterForm;
+      const mc = materielCode.toLowerCase().trim();
+      const bc = barcode.toLowerCase().trim();
+      const pc = palletCode.toLowerCase().trim();
+      const lc = locationCode.toLowerCase().trim();
+
+      // 妯$硦绛涢�夐�昏緫
+      this.tableData = this.originalTableData.filter(item => {
+        // 姣忎釜瀛楁閮藉仛绌哄�煎鐞嗗拰灏忓啓杞崲锛屾敮鎸佹ā绯婂尮閰�
+        const itemMc = (item.materielCode || "").toLowerCase();
+        const itemBc = (item.barcode || "").toLowerCase();
+        const itemPc = (item.palletCode || "").toLowerCase();
+        const itemLc = (item.locationCode || "").toLowerCase();
+
+        return (
+          itemMc.includes(mc) &&
+          itemBc.includes(bc) &&
+          itemPc.includes(pc) &&
+          itemLc.includes(lc)
+        );
+      });
+
+      // 绛涢�夊悗娓呯┖閫夋嫨鐘舵��
+      this.clearSelection();
+      this.selectionSum = 0;
+      this.updateSelectionClass();
+    },
+
+    // 閲嶇疆绛涢�夋潯浠�
+    resetFilter() {
+      this.filterForm = {
+        materielCode: "",
+        barcode: "",
+        palletCode: "",
+        locationCode: ""
+      };
+      // 鎭㈠鍘熷鏁版嵁
+      this.tableData = [...this.originalTableData];
+      // 閲嶇疆閫夋嫨鐘舵��
+      this.clearSelection();
+      this.selectionSum = 0;
+      this.updateSelectionClass();
+    }
   },
 };
 </script>
+
 <style scoped>
 .less-style {
   color: black;
@@ -282,6 +466,12 @@
 
 .more-style {
   color: red;
+}
+
+/* 绛涢�夊尯鍩熸牱寮忎紭鍖� */
+.filter-area :deep(.el-form-item) {
+  margin-bottom: 0;
+  margin-right: 10px;
 }
 </style>
 
@@ -296,12 +486,10 @@
 
 .box-table .el-table tbody tr:hover > td {
   background-color: #d8e0d4 !important;
-  /* color: #ffffff; */
 }
 
 .box-table .el-table tbody tr.current-row > td {
   background-color: #f0f9eb !important;
-  /* color: #ffffff; */
 }
 
 .el-table .success-row {
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/outOrderDetail.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/outOrderDetail.vue"
index cc9b8be..1dd121e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/outOrderDetail.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/outOrderDetail.vue"
@@ -60,7 +60,7 @@
       <div class="box-table" style="margin-top: 1%">
         <el-table
           ref="singleTable"
-          :data="tableData"
+          :data="groupedTableData"
           style="width: 100%; height: 100%"
           highlight-current-row
           @current-change="handleCurrentChange"
@@ -77,38 +77,127 @@
             align="center"
           ></el-table-column>
           <el-table-column
-            v-for="(item, index) in tableColumns.filter((x) => !x.hidden)"
-            :key="index"
-            :prop="item.prop"
-            :label="item.title"
-            :width="item.width"
+            prop="materielCode"
+            label="鐗╂枡缂栧彿"
+            width="120"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="materielName"
+            label="鐗╂枡鍚嶇О"
+            width="150"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="batchNo"
+            label="鎵规鍙�"
+            width="90"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="supplyCode"
+            label="渚涘簲鍟嗙紪鍙�"
+            width="90"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="orderQuantity"
+            label="鍗曟嵁鏁伴噺"
+            width="90"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="lockQuantity"
+            label="閿佸畾鏁伴噺"
+            width="90"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="overOutQuantity"
+            label="宸插嚭鏁伴噺"
+            width="90"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="moveQty"
+            label="鎸枡鏁伴噺"
+            width="90"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="unit"
+            label="鍗曚綅"
+            width="80"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="orderDetailStatus"
+            label="璁㈠崟鏄庣粏鐘舵��"
+            width="90"
             align="center"
           >
             <template #default="scoped">
-              <div v-if="item.type == 'icon'">
-                <el-tooltip
-                  class="item"
-                  effect="dark"
-                  :content="item.title"
-                  placement="bottom"
+              <el-tag size="small">
+                {{ getDictionaryForGroup(scoped.row) }}
+              </el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="assignStock"
+            label="鎸囧畾搴撳瓨"
+            width="90"
+            align="center"
+            :hidden="mainBusinessType !== '22'"
+          >
+            <template #default="scoped">
+              <el-tooltip
+                class="item"
+                effect="dark"
+                content="鎸囧畾搴撳瓨"
+                placement="bottom"
+              >
+                <el-link
+                  type="primary"
+                  :disabled="getButtonEnable('assignStock', scoped.row)"
+                  @click="handleAssignStock(scoped.row)"
                 >
-                  <el-link
-                    type="primary"
-                    :disabled="getButtonEnable(item.prop, scoped.row)"
-                    @click="tableButtonClick(scoped.row, item)"
-                  >
-                    <i :class="item.icon" style="font-size: 22px"></i>
-                  </el-link>
-                </el-tooltip>
-              </div>
-              <div v-else-if="item.type == 'tag'">
-                <el-tag size="small">
-                  {{ getDictionary(scoped.row, item) }}
-                </el-tag>
-              </div>
-              <div v-else>
-                {{ scoped.row[item.prop] }}
-              </div>
+                  <i class="el-icon-s-grid" style="font-size: 22px"></i>
+                </el-link>
+              </el-tooltip>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="viewDetail"
+            label="鍑哄簱璇︾粏"
+            width="90"
+            align="center"
+          >
+            <template #default="scoped">
+              <el-tooltip
+                class="item"
+                effect="dark"
+                content="鏌ョ湅鍑哄簱璇︾粏"
+                placement="bottom"
+              >
+                <el-link
+                  type="primary"
+                  @click="handleViewDetail(scoped.row)"
+                >
+                  <i class="el-icon-s-operation" style="font-size: 22px"></i>
+                </el-link>
+              </el-tooltip>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="detailCount"
+            label="鏄庣粏鏁伴噺"
+            width="80"
+            align="center"
+          >
+            <template #default="scoped">
+              <el-tag type="info" size="small">
+                {{ scoped.row.detailCount }}
+              </el-tag>
             </template>
           </el-table-column>
         </el-table>
@@ -151,129 +240,9 @@
       flag: false,
       currentRow: null,
       selection: [],
-      tableData: [],
-      mainBusinessType: null, // 鏂板锛氬瓨鍌ㄤ富鍗曟嵁鐨刡usinessType
-      tableColumns: [
-        {
-          prop: "id",
-          title: "Id",
-          type: "int",
-          width: 90,
-          hidden: true,
-        },
-        {
-          prop: "orderId",
-          title: "鍑哄簱鍗曚富閿�",
-          type: "string",
-          width: 90,
-          hidden: true,
-        },
-        {
-          prop: "materielCode",
-          title: "鐗╂枡缂栧彿",
-          type: "string",
-          width: 120,
-        },
-        {
-          prop: "materielName",
-          title: "鐗╂枡鍚嶇О",
-          type: "string",
-          width: 150,
-        },
-        {
-          prop: "batchNo",
-          title: "鎵规鍙�",
-          type: "string",
-          width: 90,
-        },
-        {
-          prop: "supplyCode",
-          title: "渚涘簲鍟嗙紪鍙�",
-          type: "string",
-          width: 90,
-        },
-        {
-          prop: "orderQuantity",
-          title: "鍗曟嵁鏁伴噺",
-          type: "string",
-          width: 90,
-        },
-        {
-          prop: "lockQuantity",
-          title: "閿佸畾鏁伴噺",
-          type: "int",
-          width: 90,
-        },
-        {
-          prop: "overOutQuantity",
-          title: "宸插嚭鏁伴噺",
-          type: "string",
-          width: 90,
-        },
-        {
-          prop: "moveQty",
-          title: "鎸枡鏁伴噺",
-          type: "string",
-          width: 90,
-        },
-        {
-          prop: "unit",
-          title: "鍗曚綅",
-          type: "string",
-          width: 80,
-        },
-        {
-          prop: "orderDetailStatus",
-          title: "璁㈠崟鏄庣粏鐘舵��",
-          type: "tag",
-          width: 90,
-          bindKey: "orderDetailStatusEnum",
-        },
-        {
-          prop: "assignStock",
-          title: "鎸囧畾搴撳瓨",
-          type: "icon",
-          width: 90,
-          hidden: true, // 榛樿闅愯棌
-          icon: "el-icon-s-grid",
-        },
-        {
-          prop: "viewDetail",
-          title: "鍑哄簱璇︾粏",
-          type: "icon",
-          width: 90,
-          icon: "el-icon-s-operation",
-        },
-        {
-          prop: "creater",
-          title: "鍒涘缓浜�",
-          type: "string",
-          width: 90,
-        },
-        {
-          prop: "createDate",
-          title: "鍒涘缓鏃堕棿",
-          type: "datetime",
-          width: 160,
-        },
-        {
-          prop: "modifier",
-          title: "淇敼浜�",
-          type: "string",
-          width: 100,
-        },
-        {
-          prop: "modifyDate",
-          title: "淇敼鏃堕棿",
-          type: "datetime",
-          width: 160,
-        },
-        {
-          prop: "remark",
-          title: "澶囨敞",
-          type: "string",
-        },
-      ],
+      tableData: [], // 鍘熷鏁版嵁
+      groupedTableData: [], // 鍒嗙粍鍚庣殑鏁版嵁
+      mainBusinessType: null, // 瀛樺偍涓诲崟鎹殑businessType
       paginations: {
         sort: "id",
         order: "desc",
@@ -317,15 +286,50 @@
     };
   },
   methods: {
-    toggleAssignStockColumn() {
-      const assignStockColumn = this.tableColumns.find(
-        (item) => item.prop === "assignStock"
-      );
-      if (assignStockColumn) {
-        // businessType涓�22鏃舵樉绀猴紝鍚﹀垯闅愯棌
-        assignStockColumn.hidden = this.mainBusinessType !=='22';
-      }
+    // 鏍规嵁鐗╂枡缂栧彿銆佹壒娆°�佷緵搴斿晢鍒嗙粍鏁版嵁
+    groupDataByMaterial() {
+      const groups = {};
+      
+      this.tableData.forEach(item => {
+        // 鏋勫缓鍒嗙粍閿紝鎵规鍜屼緵搴斿晢鍙互涓虹┖
+        const groupKey = `${item.materielCode}_${item.batchNo || ''}_${item.supplyCode || ''}`;
+        
+        if (!groups[groupKey]) {
+          // 鍒涘缓鏂板垎缁�
+          groups[groupKey] = {
+            materielCode: item.materielCode,
+            materielName: item.materielName,
+            batchNo: item.batchNo || '-',
+            supplyCode: item.supplyCode || '-',
+            orderQuantity: 0,
+            lockQuantity: 0,
+            overOutQuantity: 0,
+            moveQty: 0,
+            unit: item.unit,
+            orderDetailStatus: item.orderDetailStatus,
+            detailCount: 0,
+            originalDetails: [] // 淇濆瓨鍘熷鏄庣粏鏁版嵁
+          };
+        }
+        
+        // 绱姞鏁伴噺
+        groups[groupKey].orderQuantity += item.orderQuantity || 0;
+        groups[groupKey].lockQuantity += item.lockQuantity || 0;
+        groups[groupKey].overOutQuantity += item.overOutQuantity || 0;
+        groups[groupKey].moveQty += item.moveQty || 0;
+        groups[groupKey].detailCount += 1;
+        groups[groupKey].originalDetails.push(item);
+        
+        // 濡傛灉鐘舵�佷笉鍚岋紝鍙互鐢ㄧ涓�涓姸鎬佹垨鐗规畩澶勭悊
+        // 杩欓噷浣跨敤绗竴涓槑缁嗙殑鐘舵��
+      });
+      
+      // 杞崲涓烘暟缁�
+      this.groupedTableData = Object.values(groups);
+      
+      console.log('鍒嗙粍鍚庣殑鏁版嵁:', this.groupedTableData);
     },
+    
     open(row) {
       this.row = row;
       this.showDetialBox = true;
@@ -334,8 +338,8 @@
       this.mainBusinessType = row.businessType;
       this.getDictionaryData();
       this.getData();
-      this.toggleAssignStockColumn();
     },
+    
     getData() {
       var wheres = [{ name: "orderId", value: this.row.id }];
       var param = {
@@ -349,25 +353,66 @@
         .post("api/OutboundOrderDetail/GetPageData", param, "鏌ヨ涓�")
         .then((x) => {
           this.tableData = x.rows;
-          this.toggleAssignStockColumn(); // 鏁版嵁鍔犺浇鍚庨噸鏂扮‘璁ゅ垪鏄鹃殣
+          // 鍒嗙粍鏁版嵁
+          this.groupDataByMaterial();
         });
     },
-    tableButtonClick(row, column) {
-      if (column.prop == "assignStock") {
-        this.$refs.child.open(row);
-      } else if (column.prop == "NoStockOut") {
-        this.$refs.NoStockOut.open(row);
+    
+    // 閲嶇偣淇敼锛氬鐞嗘寚瀹氬簱瀛樼偣鍑讳簨浠� - 浼犻�掑畬鏁寸殑鍒嗙粍鏄庣粏淇℃伅
+    handleAssignStock(row) {
+      // 浼犻�掑畬鏁寸殑鍒嗙粍鏄庣粏鏁版嵁锛堝寘鍚墍鏈夊師濮嬫槑缁咺D鍜岀墿鏂欎俊鎭級
+      if (row.originalDetails && row.originalDetails.length > 0) {
+        this.$refs.child.open({
+          // 鐗╂枡鍩烘湰淇℃伅锛堝彇绗竴涓槑缁嗙殑淇℃伅锛�
+          materielCode: row.originalDetails[0].materielCode,
+          materielName: row.originalDetails[0].materielName,
+          // 鍒嗙粍鍚庣殑鎬婚渶姹傛暟閲�
+          qty: row.orderQuantity,
+          // 涓诲崟鎹紪鍙�
+          upperOrderNo: this.row.upperOrderNo,
+          // 鍏抽敭锛氬綋鍓嶅垎缁勭殑鎵�鏈夋槑缁咺D闆嗗悎
+          detailIds: row.originalDetails.map(detail => detail.id),
+          // 涓诲崟鎹甀D
+          mainOrderId: this.row.id,
+          // 瀹屾暣鍒嗙粍琛屼俊鎭紙澶囩敤锛�
+          groupRow: row
+        });
       } else {
-        this.$refs.selectedStock.open(row);
+        ElMessage.warning("璇ュ垎缁勬病鏈夋槑缁嗘暟鎹紝鏃犳硶鎸囧畾搴撳瓨");
       }
     },
+    
+    handleViewDetail(row) {
+      // 鏌ョ湅鍒嗙粍鏄庣粏鐨勮缁嗕俊鎭�
+      if (row.originalDetails && row.originalDetails.length > 0) {
+        // 杩欓噷鍙互鎵撳紑涓�涓柊鐨勫脊绐楁樉绀烘墍鏈夋槑缁嗭紝鎴栬�呬娇鐢ㄧ涓�涓槑缁�
+        this.$refs.selectedStock.open(row.originalDetails[0]);
+      }
+    },
+    
     lockstocks() {
       if (this.selection.length === 0) {
         return this.$message.error("璇烽�夋嫨鍗曟嵁鏄庣粏");
       }
-      var keys = this.selection.map((item) => item.id);
+      
+      // 鑾峰彇鎵�鏈夐�変腑鍒嗙粍鐨勫師濮嬫槑缁咺D
+      const detailIds = [];
+      this.selection.forEach(group => {
+        if (group.originalDetails && group.originalDetails.length > 0) {
+          group.originalDetails.forEach(detail => {
+            if (detail.id) {
+              detailIds.push(detail.id);
+            }
+          });
+        }
+      });
+      
+      if (detailIds.length === 0) {
+        return this.$message.error("娌℃湁鎵惧埌鍙攣瀹氱殑鏄庣粏");
+      }
+      
       this.http
-        .post("api/OutboundOrderDetail/LockOutboundStocks", keys, "鏁版嵁澶勭悊涓�")
+        .post("api/OutboundOrderDetail/LockOutboundStocks", detailIds, "鏁版嵁澶勭悊涓�")
         .then((x) => {
           if (!x.status) return this.$message.error(x.message);
           this.$message.success("鎿嶄綔鎴愬姛");
@@ -377,22 +422,42 @@
           });
         });
     },
+    
     handleOpenPicking() {
       this.$router.push({
         path: "/outbound/picking",
         query: { orderId: this.row.id, orderNo: this.row.orderNo },
       });
     },
+    
     handleOpenBatchPicking() {
       this.$router.push({
         path: "/outbound/batchpicking",
         query: { orderId: this.row.id, orderNo: this.row.orderNo },
       });
     },
+    
     outbound() {
       if (this.selection.length === 0) {
         return this.$message.error("璇烽�夋嫨鍗曟嵁鏄庣粏");
       }
+      
+      // 鑾峰彇鎵�鏈夐�変腑鍒嗙粍鐨勫師濮嬫槑缁咺D
+      const detailIds = [];
+      this.selection.forEach(group => {
+        if (group.originalDetails && group.originalDetails.length > 0) {
+          group.originalDetails.forEach(detail => {
+            if (detail.id) {
+              detailIds.push(detail.id);
+            }
+          });
+        }
+      });
+      
+      if (detailIds.length === 0) {
+        return this.$message.error("娌℃湁鎵惧埌鍙嚭搴撶殑鏄庣粏");
+      }
+      
       const platformOptions = [
         { label: "绔欏彴2", value: "2-1" },
         { label: "绔欏彴3", value: "3-1" },
@@ -448,7 +513,7 @@
                   },
                 }, [
                   h(ElSelect, {
-                    placeholder: "璇烽�夋嫨鍑哄簱绔欏彴锛�3-12锛�",
+                    placeholder: "璇烽�夋嫨鍑哄簱绔欏彴",
                     modelValue: formData.selectedPlatform,
                     "onUpdate:modelValue": (val) => {
                       formData.selectedPlatform = val;
@@ -492,9 +557,8 @@
                         return;
                       }
 
-                      const keys = this.selection.map((item) => item.id);
                       const requestParams = {
-                        taskIds: keys,
+                        taskIds: detailIds,
                         outboundPlatform: formData.selectedPlatform,
                       };
 
@@ -531,6 +595,7 @@
       vnode.appContext = this.$.appContext;
       render(vnode, mountNode);
     },
+    
     outboundbatch() {
       if (this.selection.length === 0) {
         return this.$message.error("璇烽�夋嫨鍗曟嵁鏄庣粏");
@@ -538,6 +603,16 @@
       if (this.selection.length > 1) {
         return this.$message.error("鍙兘閫夋嫨涓�鏉″崟鎹槑缁嗚繘琛屽垎鎵瑰嚭搴�");
       }
+      
+      const selectedGroup = this.selection[0];
+      if (!selectedGroup.originalDetails || selectedGroup.originalDetails.length === 0) {
+        return this.$message.error("娌℃湁鎵惧埌鏄庣粏鏁版嵁");
+      }
+      
+      // 鍒嗘壒鍑哄簱閫氬父閽堝鍗曚釜鏄庣粏
+      // 杩欓噷浣跨敤绗竴涓槑缁�
+      const selectedDetail = selectedGroup.originalDetails[0];
+      
       const platformOptions = [
         { label: "绔欏彴2", value: "2-1" },
         { label: "绔欏彴3", value: "3-1" },
@@ -608,7 +683,7 @@
                   },
                 }, [
                   h(ElSelect, {
-                    placeholder: "璇烽�夋嫨鍑哄簱绔欏彴锛�3-12锛�",
+                    placeholder: "璇烽�夋嫨鍑哄簱绔欏彴",
                     modelValue: formData.selectedPlatform,
                     "onUpdate:modelValue": (val) => {
                       formData.selectedPlatform = val;
@@ -646,6 +721,7 @@
                     step: "0.01",
                     precision: 2,
                     min: 0.01,
+                    max: selectedDetail.orderQuantity - selectedDetail.overOutQuantity - selectedDetail.lockQuantity - selectedDetail.moveQty,
                   }),
                 ]),
                 h("div", {
@@ -677,9 +753,8 @@
                         return;
                       }
 
-                      const keys = this.selection.map((item) => item.id);
                       const requestParams = {
-                        orderDetailId: keys[0],
+                        orderDetailId: selectedDetail.id,
                         outboundPlatform: formData.selectedPlatform,
                         batchQuantity: formData.outboundDecimal,
                       };
@@ -714,52 +789,52 @@
         }
       );
 
-      vnode.appContext = this.$.appContext;
+      vnode.appContext = this.$appContext;
       render(vnode, mountNode);
     },
+    
     setCurrent(row) {
       this.$refs.singleTable.setCurrentRow(row);
     },
+    
     handleCurrentChange(val) {
       this.currentRow = val;
     },
+    
     getButtonEnable(propName, row) {
       if (propName == "assignStock") {
         if (
           row.orderDetailStatus !== 0 &&
-          row.orderDetailStatus !== 60 &&
-          row.orderDetailStatus !== 70 &&
-          row.orderDetailStatus !== 80
+          row.orderDetailStatus !== 70 
         ) {
-          return true;
-        } else {
           return false;
+        } else {
+          return true;
         }
       }
       return false;
     },
+    
     parentCall(fun) {
       if (typeof fun != "function") {
         return console.log("鎵╁睍缁勪欢闇�瑕佷紶鍏ヤ竴涓洖璋冩柟娉曟墠鑳借幏鍙栫埗绾ue瀵硅薄");
       }
       fun(this);
     },
+    
     handleRowClick(row) {
       this.$refs.singleTable.toggleRowSelection(row);
     },
+    
     handleSelectionChange(val) {
       this.selection = val;
     },
+    
     getDictionaryData() {
       if (this.dictionaryList) {
         return;
       }
-      var param = [];
-      this.tableColumns.forEach((x) => {
-        if (x.type == "tag" && x.bindKey != "") {
-          param.push(x.bindKey);
-        }
-      });
+      var param = ["orderDetailStatusEnum"];
       this.http
         .post("api/Sys_Dictionary/GetVueDictionary", param, "鏌ヨ涓�")
         .then((x) => {
@@ -768,21 +843,22 @@
           }
         });
     },
-    getDictionary(row, column) {
+    
+    getDictionaryForGroup(row) {
       if (this.dictionaryList) {
-        var item = this.dictionaryList.find((x) => x.dicNo == column.bindKey);
+        var item = this.dictionaryList.find((x) => x.dicNo == "orderDetailStatusEnum");
         if (item) {
-          var dicItem = item.data.find((x) => x.key == row[column.prop]);
+          var dicItem = item.data.find((x) => x.key == row.orderDetailStatus);
           if (dicItem) {
             return dicItem.value;
           } else {
-            return row[column.prop];
+            return row.orderDetailStatus;
           }
         } else {
-          return row[column.prop];
+          return row.orderDetailStatus;
         }
       }
-      return row[column.prop];
+      return row.orderDetailStatus;
     },
   },
 };
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/taskinfo/task.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/taskinfo/task.vue"
index a246cdf..e69ad6d 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/taskinfo/task.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/taskinfo/task.vue"
@@ -90,14 +90,14 @@
         width: 120,
         align: "left",
       },
-      // {
-      //   field: "taskType",
-      //   title: "浠诲姟绫诲瀷",
-      //   type: "int",
-      //   width: 120,
-      //   align: "left",
-      //   bind: { key: "taskType", data: [] },
-      // },
+      {
+        field: "taskType",
+        title: "浠诲姟绫诲瀷",
+        type: "int",
+        width: 120,
+        align: "left",
+        bind: { key: "taskType", data: [] },
+      },
       {
         field: "taskStatus",
         title: "浠诲姟鐘舵��",
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs"
index 704f65d..89d3890 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs"
@@ -1,10 +1,12 @@
 锘縰sing SqlSugar;
+using System.Collections.Generic;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
 using WIDESEA_Core.Enums;
 using WIDESEA_Core.Helper;
 using WIDESEA_Core.HttpContextUser;
+using WIDESEA_Core.Utilities;
 using WIDESEA_DTO.Stock;
 using WIDESEA_IStockService;
 using WIDESEA_Model.Models;
@@ -34,8 +36,8 @@
         public PageGridData<StockInfoDetailWithPalletDto> GetPageData2(PageDataOptions options)
         {
             // 1. 鑾峰彇鍩虹鍒嗛〉鏁版嵁
-            PageGridData<Dt_StockInfoDetail> pageData = base.GetPageData(options);
-            List<Dt_StockInfoDetail> filteredDetails = pageData.Rows.ToList(); // 鍏堟嫹璐濆師濮嬫暟鎹�
+            ISugarQueryable<Dt_StockInfoDetail> sugarQueryable1 = BaseDal.Db.Queryable<Dt_StockInfoDetail>();
+            ISugarQueryable<Dt_StockInfo> sugarQueryable = BaseDal.Db.Queryable<Dt_StockInfo>();
 
             if (!string.IsNullOrEmpty(options.Wheres))
             {
@@ -46,24 +48,17 @@
                     {
                         foreach (var param in searchParametersList)
                         {
-                            // 鍖归厤鎵樼洏缂栧彿鏌ヨ鏉′欢锛堝皬鍐欏瓧娈靛悕锛�
                             if (param.Name.Equals(nameof(Dt_StockInfo.PalletCode).FirstLetterToLower(), StringComparison.OrdinalIgnoreCase)
                                 && !string.IsNullOrEmpty(param.Value?.ToString()))
                             {
-                                // 浼樺寲锛氭壒閲忔煡璇紙濡傛灉鏈夊涓墭鐩樼爜锛岃繖閲屼篃鍙互鎵╁睍锛�
                                 string palletCode = param.Value.ToString().Trim();
                                 var targetStock = _stockinfoRepository.QueryFirst(x => x.PalletCode == palletCode);
 
-                                // 绌哄�兼牎楠岋細鏈壘鍒板搴旀墭鐩樼殑搴撳瓨锛岀洿鎺ヨ繃婊や负绌�
                                 if (targetStock != null)
                                 {
-                                    filteredDetails = filteredDetails.Where(x => x.StockId == targetStock.Id).ToList();
+                                    sugarQueryable1 = sugarQueryable1.Where(x => x.StockId == targetStock.Id);
                                 }
-                                else
-                                {
-                                    filteredDetails = new List<Dt_StockInfoDetail>();
-                                }
-                                break; // 鍗曚釜鎵樼洏鐮佹煡璇紝鍖归厤鍚庨��鍑哄惊鐜�
+                                break;
                             }
                         }
                     }
@@ -72,47 +67,40 @@
                 {
                 }
             }
-
-            List<int> stockIds = filteredDetails.Select(detail => detail.StockId).Distinct().ToList();
-            var stockDict = _stockinfoRepository.QueryData(x => stockIds.Contains(x.Id))
-                                                .ToDictionary(x => x.Id, x => x.PalletCode ?? "鏃犳墭鐩樼紪鍙�"); 
-
-            List<StockInfoDetailWithPalletDto> dtoList = filteredDetails
-                .Select(detail => new StockInfoDetailWithPalletDto
-                {
-                    Id = detail.Id,
-                    StockId = detail.StockId,
-                    MaterielCode = detail.MaterielCode,
-                    MaterielName = detail.MaterielName,
-                    OrderNo = detail.OrderNo,
-                    BatchNo = detail.BatchNo,
-                    ProductionDate = detail.ProductionDate,
-                    EffectiveDate = detail.EffectiveDate,
-                    SerialNumber = detail.SerialNumber,
-                    StockQuantity = detail.StockQuantity,
-                    OutboundQuantity = detail.OutboundQuantity,
-                    Status = detail.Status,
-                    Unit = detail.Unit,
-                    InboundOrderRowNo = detail.InboundOrderRowNo,
-                    SupplyCode = detail.SupplyCode,
-                    WarehouseCode = detail.WarehouseCode,
-                    Barcode = detail.Barcode,
-                    BusinessType = detail.BusinessType,
-                    Remark = detail.Remark,
-                    Creater = detail.Creater,
-                    CreateDate = detail.CreateDate,
-                    Modifier = detail.Modifier,
-                    ModifyDate = detail.ModifyDate,
-                    PalletCode = stockDict.TryGetValue(detail.StockId, out var palletCode) ? palletCode : "鏃犳墭鐩樼紪鍙�"
-                })
-                .ToList();
-
-            return new PageGridData<StockInfoDetailWithPalletDto>
+            EntityProperties.ValidatePageOptions(options, ref sugarQueryable1);
+            ISugarQueryable<StockInfoDetailWithPalletDto> list = sugarQueryable1.InnerJoin(sugarQueryable, (b, a) => a.Id == b.StockId).Select((b, a) => new StockInfoDetailWithPalletDto
             {
-                Rows = dtoList.Where(x=>x.PalletCode != "鏃犳墭鐩樼紪鍙�").ToList(),
-                Total = pageData.Total,
-                Summary = pageData.Summary
-            };
+                    Id = b.Id,
+                    StockId = b.StockId,
+                    MaterielCode = b.MaterielCode,
+                    MaterielName = b.MaterielName,
+                    OrderNo = b.OrderNo,
+                    BatchNo = b.BatchNo,
+                    ProductionDate = b.ProductionDate,
+                    EffectiveDate = b.EffectiveDate,
+                    SerialNumber = b.SerialNumber,
+                    StockQuantity = b.StockQuantity,
+                    OutboundQuantity = b.OutboundQuantity,
+                    Status = b.Status,
+                    Unit = b.Unit,
+                    InboundOrderRowNo = b.InboundOrderRowNo,
+                    SupplyCode = b.SupplyCode,
+                    WarehouseCode = b.WarehouseCode,
+                    Barcode = b.Barcode,
+                    BusinessType = b.BusinessType,
+                    Remark = b.Remark,
+                    Creater = b.Creater,
+                    CreateDate = b.CreateDate,
+                    Modifier = b.Modifier,
+                    ModifyDate = b.ModifyDate,
+                    PalletCode = a.PalletCode??"鏃犳墭鐩樼紪鍙�"
+                });
+
+
+            int totalCount = 0;
+            var stockViewDTOs = list.ToPageList(options.Page, options.Rows, ref totalCount);
+            return new PageGridData<StockInfoDetailWithPalletDto>(totalCount, stockViewDTOs);
+            
         }
 
     }

--
Gitblit v1.9.3