From 0b0899370f271793f7156144b4b912438aebdf73 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 24 十一月 2025 08:41:56 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockViewDTO.cs                                          |    6 
 项目代码/WIDESEA_WMSClient/src/extension/stock/stockView.js                                                   |  116 ++--
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs        |   11 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs                            |   12 
 项目代码/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue                                              |  164 +++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs                          |  647 ++++++++++++++++++----
 项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/outOrderDetail.vue                                   |   20 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundPickingService.cs                        |    2 
 项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/SelectedStock.vue                                     |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs                                |    4 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm      |    0 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm |    0 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs                      |   10 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockSelectViewDTO.cs                                    |    3 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs                                   |    2 
 项目代码/WIDESEA_WMSClient/src/views/stock/stockView.vue                                                      |  228 --------
 项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/StockSelect.vue                                       |   43 
 项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue                               |    9 
 项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue                                       |  380 +++++++++++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Outbound/OutboundOrderAddDTO.cs                                |    2 
 20 files changed, 1,213 insertions(+), 448 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/SelectedStock.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/SelectedStock.vue"
index acfbc12..d0ef793 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/SelectedStock.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/SelectedStock.vue"
@@ -5,7 +5,7 @@
       :lazy="true"
       width="75%"
       :padding="15"
-      title="鍑哄簱璇︽儏"
+      title="璋冩嫧鍑哄簱璇︽儏"
     >
       <div class="box-head">
         <el-alert :closable="false" style="width: 100%">
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/StockSelect.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/StockSelect.vue"
index 1b7e249..b525dbb 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/StockSelect.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/StockSelect.vue"
@@ -132,11 +132,11 @@
   data() {
     return {
       row: null,
-      showDetialBox: false,
+      showDetialBox: false, 
       tableData: [],
       tableColumns: [
         { prop: "materielCode", title: "鐗╂枡缂栧彿", type: "string", width: 150 },
-        { prop: "materielName", 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" },
@@ -201,30 +201,23 @@
         if (!valid) return;
 
 
-        // 鏋勯�犺姹傚弬鏁�
-        const keys = this.selection.map((item) => item.id);
-        const requestParams = {
-          taskIds: keys,
-          outboundPlatform: this.outboundForm.selectedPlatform,
-        };
-          console.log(this.selection)
-        // 璋冪敤鍑哄簱鎺ュ彛
-        this.http
-          .post("api/Task/GenerateOutboundTasks", requestParams, "鏁版嵁澶勭悊涓�")
-          .then((x) => {
-            if (!x.status) return ElMessage.error(x.message);
-
-            ElMessage.success("鎿嶄綔鎴愬姛");
-            this.showOutboundDialog = false;
-            this.showDetialBox = false;
-            this.$emit("parentCall", ($vue) => {
-              $vue.getData();
-            });
-          })
-          .catch((error) => {
-            console.error("鍑哄簱璇锋眰澶辫触:", error);
-            ElMessage.error("璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯");
+     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();
           });
+        });
+
       });
     },
 
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue"
index 148e7f4..f685705 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue"
@@ -1,9 +1,10 @@
 <template>
-  <div>
+  <div> 
     <vol-box
       v-model="showDetialBox"
       :lazy="true"
       width="75%"
+      height="80%"
       title="鍗曟嵁鏄庣粏淇℃伅"
     >
       <div class="box-head">
@@ -27,13 +28,13 @@
                 @click="handleOpenPicking"
                 >鎷i��</el-link>
                  
-              <el-link
+  <!--             <el-link
                 type="primary"
                 size="small"
                 style="float: right; height: 20px; margin-right: 10px"
                 @click="outbound"
                 >鐩存帴鍑哄簱</el-link
-              >
+              > -->
               <el-link
                 type="primary"
                 size="small"
@@ -362,7 +363,7 @@
         }
       }, {
         default: () => h(ElForm, {
-          model: formData,
+          model: formData00,
           rules: {
             selectedPlatform: [
               { required: true, message: '璇烽�夋嫨鍑哄簱绔欏彴', trigger: 'change' }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue"
new file mode 100644
index 0000000..252da58
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue"
@@ -0,0 +1,380 @@
+<template>
+  <div>
+    <vol-box
+      v-model="showDetailBox"
+      :lazy="true"
+      width="65%"
+      :padding="20"
+      title="鏃犲簱瀛樺嚭搴�"
+      class="custom-vol-box"
+    >
+      <div>
+        <!-- 涓婃柟杈撳叆妗� -->
+        <el-form :inline="true" :model="formData" ref="formData" style="margin-bottom: 20px; align-items: flex-end;">
+          <el-form-item
+            label="鎵弿鏉$爜:"
+            style="width: 80%"
+            prop="barcode"
+          >
+            <el-input
+              ref="barcodeInput"
+              v-model="formData.barcode"
+              placeholder="璇蜂娇鐢ㄦ壂鐮佹灙鎵弿鏉$爜锛屾垨鎵嬪姩杈撳叆"
+              @keyup.enter="handleScan"
+              autofocus
+              class="custom-input"
+            ></el-input>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" size="small" @click="handleScan" class="custom-button">
+              <i class="el-icon-search"></i> 纭鎵弿
+            </el-button>
+          </el-form-item>
+        </el-form>
+
+        <!-- 涓嬫柟鏄剧ず妗� -->
+        <div class="scan-list">
+          <el-card shadow="hover" style="margin-bottom: 10px; border: none;" class="custom-card">
+            <div class="card-header">
+              <span class="header-title">宸叉壂鎻忔潯鐮佸垪琛紙鍏眥{ scannedBarcodes.length }}鏉★級</span>
+              <el-button
+                class="clear-all-btn"
+                @click="clearAll"
+                :disabled="scannedBarcodes.length === 0"
+              >娓呯┖鎵�鏈�</el-button>
+            </div>
+            <div class="card-body">
+              <el-scrollbar height="400px" class="custom-scrollbar">
+                <!-- 浣跨敤 transition-group 鍖呰9浠ュ疄鐜板姩鐢� -->
+                <transition-group name="barcode-item-transition">
+                  <div class="barcode-item" v-for="(barcode, index) in scannedBarcodes" :key="barcode" :data-index="index">
+                    <span class="barcode-text">{{ index + 1 }}. {{ barcode }}</span>
+                    <el-button
+                      class="delete-btn"
+                      @click="removeItem(index)"
+                    >鍒犻櫎</el-button>
+                  </div>
+                </transition-group>
+                <div class="empty-tip" v-if="scannedBarcodes.length === 0">
+                  <i class="el-icon-information"></i>
+                  <span>鏆傛棤鎵弿璁板綍锛岃鎵弿鏉$爜</span>
+                </div>
+              </el-scrollbar>
+            </div>
+          </el-card>
+        </div>
+      </div>
+
+      <template #footer>
+        <div class="footer-actions">
+          <el-button type="primary" size="small" @click="submit" :disabled="scannedBarcodes.length === 0" class="submit-btn">
+            <i class="el-icon-check"></i> 鎻愪氦鍑哄簱
+          </el-button>
+          <el-button type="text" size="small" @click="showDetailBox = false" class="cancel-btn">
+            鍙栨秷
+          </el-button>
+        </div>
+      </template>
+    </vol-box>
+  </div>
+</template>
+
+<script>
+import VolBox from "@/components/basic/VolBox.vue";
+
+export default {
+  components: { VolBox },
+  data() {
+    return {
+      showDetailBox: false,
+      formData: {
+        barcode: "",
+      },
+      scannedBarcodes: [],
+    };
+  },
+  methods: {
+    open() {
+      this.showDetailBox = true;
+      this.scannedBarcodes = [];
+      this.formData.barcode = "";
+      this.$nextTick(() => {
+        this.$refs.barcodeInput.focus();
+      });
+    },
+
+    handleScan() {
+      const barcode = this.formData.barcode.trim();
+      if (!barcode) {
+        this.$refs.barcodeInput.focus();
+        return;
+      }
+      if (this.scannedBarcodes.includes(barcode)) {
+        this.$message.warning(`鏉$爜 ${barcode} 宸叉壂鎻忚繃锛岃鍕块噸澶嶆壂鎻廯);
+        this.formData.barcode = "";
+        this.$refs.barcodeInput.focus();
+        return;
+      }
+
+      this.scannedBarcodes.push(barcode);
+      this.formData.barcode = "";
+
+      this.$nextTick(() => {
+        this.$refs.barcodeInput.focus();
+      });
+    },
+
+    removeItem(index) {
+      this.scannedBarcodes.splice(index, 1);
+    },
+
+    clearAll() {
+      this.$confirm("纭畾瑕佹竻绌烘墍鏈夋壂鎻忚褰曞悧锛�", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      }).then(() => {
+        this.scannedBarcodes = [];
+      }).catch(() => {
+        this.$refs.barcodeInput.focus();
+      });
+    },
+
+    submit() {
+      if (this.scannedBarcodes.length === 0) {
+        this.$message.warning("璇峰厛鎵弿鑷冲皯涓�鏉℃潯鐮�");
+        this.$refs.barcodeInput.focus();
+        return;
+      }
+
+      const params = {
+        barcodes: this.scannedBarcodes,
+      };
+
+      this.http
+        .post("/api/OutboundOrder/NoStockOut", params, "鏁版嵁澶勭悊涓�...")
+        .then((res) => {
+          if (!res.status) {
+            this.$message.error(res.message);
+            this.$refs.barcodeInput.focus();
+            return;
+          }
+          this.$message.success("鍑哄簱鎴愬姛");
+          this.showDetailBox = false;
+          this.$emit("parentCall", ($vue) => {
+            $vue.refresh();
+          });
+        })
+        .catch((err) => {
+          this.$message.error(`璇锋眰澶辫触锛�${err.message || "鏈煡閿欒"}`);
+          this.$refs.barcodeInput.focus();
+        });
+    },
+  },
+};
+</script>
+
+<style scoped>
+/* 鍏抽敭锛氬畾涔夊垪琛ㄩ」鐨勮繃娓″姩鐢� */
+.barcode-item-transition-enter-active,
+.barcode-item-transition-leave-active {
+  transition: all 0.3s ease;
+}
+.barcode-item-transition-enter-from {
+  opacity: 0;
+  transform: translateY(10px);
+}
+.barcode-item-transition-leave-to {
+  opacity: 0;
+  transform: translateX(30px);
+}
+/* 纭繚鍒犻櫎鏃跺叾浠栧厓绱犲钩婊戜笂绉� */
+.barcode-item-transition-move {
+  transition: transform 1s ease;
+}
+
+.scan-list {
+  width: 100%;
+}
+
+.custom-card {
+  border-radius: 12px;
+  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
+  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
+}
+.custom-card:hover {
+  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
+}
+
+.card-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 15px;
+  padding-bottom: 10px;
+  border-bottom: 1px solid #f0f0f0;
+}
+.header-title {
+  font-weight: 600;
+  font-size: 15px;
+  color: #333;
+}
+.clear-all-btn {
+  color: #f56c6c;
+  font-size: 13px;
+  transition: color 0.2s;
+}
+.clear-all-btn:hover {
+  color: #e53e3e;
+  background: rgba(245, 108, 108, 0.1);
+}
+
+.card-body {
+  padding: 0;
+}
+
+/* 鑷畾涔夋粴鍔ㄦ潯 */
+.custom-scrollbar ::v-deep .el-scrollbar__thumb {
+  background: rgba(0, 0, 0, 0.2);
+  border-radius: 4px;
+  width: 4px;
+}
+.custom-scrollbar ::v-deep .el-scrollbar__bar:hover .el-scrollbar__thumb {
+  background: rgba(0, 0, 0, 0.3);
+  width: 6px;
+}
+.custom-scrollbar ::v-deep .el-scrollbar__wrap {
+  overflow-x: hidden;
+}
+
+.barcode-item {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 10px 15px;
+  border-bottom: 1px solid #f7f7f7;
+  transition: background-color 0.2s ease;
+}
+.barcode-item:hover {
+  background-color: #fafafa;
+}
+/* 涓哄鏁拌娣诲姞杞诲井鐨勮儗鏅壊锛屽寮哄彲璇绘�� */
+.barcode-item:nth-child(odd) {
+  background-color: #e1e1e1;
+}
+.barcode-text {
+  flex: 1;
+  font-size: 14px;
+  color: #666;
+  transition: color 0.2s;
+}
+.barcode-item:hover .barcode-text {
+  color: #409eff;
+}
+
+.delete-btn {
+  color: #ea1919;
+  font-size: 20px;
+  transition: all 0.2s;
+  transform: scale(0.8);
+}
+.barcode-item:hover .delete-btn {
+  opacity: 1;
+  transform: scale(1);
+}
+.delete-btn:hover {
+  color: #f56c6c !important; /* 浣跨敤 !important 瑕嗙洊 Element UI 榛樿鏍峰紡 */
+  background: rgba(245, 108, 108, 0.1);
+}
+
+.empty-tip {
+  text-align: center;
+  padding: 80px 0;
+  color: #999;
+  font-size: 14px;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+}
+.empty-tip i {
+  font-size: 40px;
+  margin-bottom: 15px;
+  color: #dcdfe6;
+}
+
+/* 鑷畾涔夎緭鍏ユ */
+.custom-input ::v-deep .el-input__inner {
+  border-radius: 6px;
+  border-color: #e4e7ed;
+  transition: all 0.3s;
+  height: 36px;
+  line-height: 36px;
+}
+.custom-input ::v-deep .el-input__inner:focus {
+  border-color: #409eff;
+  box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
+}
+
+/* 鑷畾涔夋寜閽� */
+.custom-button {
+  border-radius: 6px;
+  height: 36px;
+  line-height: 36px;
+  font-size: 13px;
+  font-weight: 500;
+  transition: all 0.2s;
+}
+.custom-button:hover {
+  transform: translateY(-1px);
+  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.2);
+}
+
+.footer-actions {
+  text-align: right;
+}
+.submit-btn {
+  border-radius: 6px;
+  font-weight: 500;
+  padding: 10px 20px;
+  transition: all 0.2s;
+}
+.submit-btn:hover {
+  transform: translateY(-1px);
+  box-shadow: 0 4px 12px rgba(46, 164, 79, 0.2);
+}
+.cancel-btn {
+  color: #666;
+  margin-right: 10px;
+  transition: color 0.2s;
+}
+.cancel-btn:hover {
+  color: #333;
+  background: #f5f5f5;
+}
+</style>
+
+<style>
+/* ... (鍏ㄥ眬鏍峰紡閮ㄥ垎淇濇寔涓嶅彉) ... */
+.text-button:hover {
+  background-color: #f0f9eb !important;
+}
+.el-table .warning-row {
+  background: oldlace;
+}
+.box-table .el-table tbody tr:hover > td {
+  background-color: #d8e0d4 !important;
+}
+.box-table .el-table tbody tr.current-row > td {
+  background-color: #f0f9eb !important;
+}
+.el-table .success-row {
+  background: #f0f9eb;
+}
+.box-table .el-table {
+  border: 1px solid #ebeef5;
+}
+.box-head .el-alert__content {
+  width: 100%;
+}
+</style>
\ No newline at end of file
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 890b066..b1630d8 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"
@@ -103,6 +103,7 @@
       ref="selectedStock"
       @parentCall="parentCall"
     ></selected-stock>
+    <NoStockOut ref="NoStockOut" @parentCall="parentCall"></NoStockOut>
   </div>
 </template>
 <script>
@@ -110,10 +111,12 @@
 import VolForm from "@/components/basic/VolForm.vue";
 import StockSelect from "./StockSelect.vue";
 import SelectedStock from "./SelectedStock.vue";
+import NoStockOut from "./NoStockOut.vue";
 import { h,createVNode, render,reactive  } from 'vue';
 import { ElDialog , ElForm, ElFormItem, ElSelect,ElOption, ElButton, ElMessage } from 'element-plus';
+import { th } from 'element-plus/es/locale';
 export default {
-  components: { VolBox, VolForm, StockSelect, SelectedStock },
+  components: { VolBox, VolForm, StockSelect, SelectedStock,NoStockOut},
   data() {
     return {
       row: null,
@@ -189,7 +192,7 @@
           prop: "orderDetailStatus",
           title: "璁㈠崟鏄庣粏鐘舵��",
           type: "tag",
-          width: 180,
+          width: 90,
           bindKey: "orderDetailStatusEnum",
         },
         {
@@ -198,6 +201,13 @@
           type: "icon",
           width: 90,
           icon: "el-icon-s-grid",
+        },
+        {
+          prop: "NoStockOut",
+          title: "鏃犲簱瀛樺嚭搴�",
+          type: "icon",
+          width: 100,
+          icon: "el-icon-setting",
         },
         {
           prop: "viewDetail",
@@ -304,8 +314,10 @@
     tableButtonClick(row, column) {
       if (column.prop == "assignStock") {
         this.$refs.child.open(row);
-      } else {
-        //鐐瑰嚮鎵撳紑鍑哄簱璇︽儏
+      } else if (column.prop == "NoStockOut") {
+        this.$refs.NoStockOut.open(row);
+      }else{
+          //鐐瑰嚮鎵撳紑鍑哄簱璇︽儏
         this.$refs.selectedStock.open(row);
       }
     },
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/stock/stockView.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/stock/stockView.js"
index 92ad623..047c354 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/stock/stockView.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/stock/stockView.js"
@@ -1,8 +1,4 @@
 
-//姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜
-
-import { el } from "element-plus/es/locales.mjs";
-
 let extension = {
   components: {
     //鏌ヨ鐣岄潰鎵╁睍缁勪欢
@@ -35,65 +31,65 @@
       //       });
       //   }
       // }
-      this.columns.forEach(column => {
-        if (column.field == 'materielCode') {
-          column.formatter = (row) => {
-            var str = '';
-            var list = row.materielCode.split(',');
-            for (let index = 0; index < list.length; index++) {
-              str += list[index] + '<br>';
-            }
-            return str = list[0] == "" ? "绌虹" : str;
-          }
-        }
-        if (column.field == 'batchNo') {
-          column.formatter = (row) => {
-            var str = '';
-            var list = row.batchNo.split(',');
-            for (let index = 0; index < list.length; index++) {
-              str += list[index] + '<br>';
-            }
-            return str = list[0] == "" ? "鏃�" : str;
-          }
-        }
-        if (column.field == 'materielInfo') {
-          const today = new Date()
-          column.formatter = (row) => {
-            if (row.details.length > 0) {
-              const today = new Date();
-              const closestDate = row.details
-                .map(x => {
-                  const date = new Date(x.effectiveDate);
-                  const diffInDays = Math.ceil(Math.abs((today - date) / (1000 * 60 * 60 * 24)));
-                  return { date, diffInDays };
-                })
-                .reduce((closest, current) => (current.diffInDays < closest.diffInDays ? current : closest))
-                .date;
+      // this.columns.forEach(column => {
+      //   if (column.field == 'materielCode') {
+      //     column.formatter = (row) => {
+      //       var str = '';
+      //       var list = row.materielCode.split(',');
+      //       for (let index = 0; index < list.length; index++) {
+      //         str += list[index] + '<br>';
+      //       }
+      //       return str = list[0] == "" ? "绌虹" : str;
+      //     }
+      //   }
+      //   if (column.field == 'batchNo') {
+      //     column.formatter = (row) => {
+      //       var str = '';
+      //       var list = row.batchNo.split(',');
+      //       for (let index = 0; index < list.length; index++) {
+      //         str += list[index] + '<br>';
+      //       }
+      //       return str = list[0] == "" ? "鏃�" : str;
+      //     }
+      //   }
+      //   if (column.field == 'materielInfo') {
+      //     const today = new Date()
+      //     column.formatter = (row) => {
+      //       if (row.details.length > 0) {
+      //         const today = new Date();
+      //         const closestDate = row.details
+      //           .map(x => {
+      //             const date = new Date(x.effectiveDate);
+      //             const diffInDays = Math.ceil(Math.abs((today - date) / (1000 * 60 * 60 * 24)));
+      //             return { date, diffInDays };
+      //           })
+      //           .reduce((closest, current) => (current.diffInDays < closest.diffInDays ? current : closest))
+      //           .date;
 
-              const daysSinceClosest = Math.ceil(Math.abs((today - closestDate) / (1000 * 60 * 60 * 24)));
-              return '<span style="color: #F56C6C">' + daysSinceClosest + "澶�" + '</span>';
-            } else {
-              return '<span style="color: #F56C6C">' + "鏃犱繚璐ㄦ湡" + '</span>';
-            }
+      //         const daysSinceClosest = Math.ceil(Math.abs((today - closestDate) / (1000 * 60 * 60 * 24)));
+      //         return '<span style="color: #F56C6C">' + daysSinceClosest + "澶�" + '</span>';
+      //       } else {
+      //         return '<span style="color: #F56C6C">' + "鏃犱繚璐ㄦ湡" + '</span>';
+      //       }
 
-          }
-        }
-        if (column.field == 'sumStock') {
-          column.formatter = (row) => {
-            if (row.details.length > 0) {
-              var sum = 0;
-              const closestDate = row.details
-                .map(x => {
-                  sum += (x.stockQuantity)
-                })
-              return '<span style="color: #F56C6C">' + sum + row.details[0].unit + '</span>';
-            } else {
-              return '<span style="color: #F56C6C">' + "1涓�" + '</span>';
-            }
+      //     }
+      //   }
+      //   if (column.field == 'sumStock') {
+      //     column.formatter = (row) => {
+      //       if (row.details.length > 0) {
+      //         var sum = 0;
+      //         const closestDate = row.details
+      //           .map(x => {
+      //             sum += (x.stockQuantity)
+      //           })
+      //         return '<span style="color: #F56C6C">' + sum + row.details[0].unit + '</span>';
+      //       } else {
+      //         return '<span style="color: #F56C6C">' + "1涓�" + '</span>';
+      //       }
 
-          }
-        }
-      })
+      //     }
+      //   }
+      // })
     },
     onInited() {
       //妗嗘灦鍒濆鍖栭厤缃悗
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue"
index b3adcc0..39ead12 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue"
@@ -28,7 +28,7 @@
           <el-button type="success" @click="confirmPicking">纭鎷i��</el-button>
      <!--      <el-button type="warning" @click="openSplitDialog">鎷嗗寘</el-button>
           <el-button type="info" @click="openRevertSplitDialog">鎾ら攢鎷嗗寘</el-button> -->
-      
+           <el-button type="info" @click="handleEmptyPallet">鍙栫┖绠�</el-button>
           <el-button type="primary" @click="openBatchReturnDialog">鍥炲簱</el-button>
           <!-- <el-button type="danger" @click="handleDirectOutbound">鐩存帴鍑哄簱</el-button>  -->
 
@@ -250,6 +250,49 @@
         </div>
       </div>
     </div>
+
+    <!-- 鍙栬蛋绌虹-->
+ <div v-if="showEmptyPalletDialog" class="custom-dialog-overlay">
+      <div class="custom-dialog-wrapper">
+        <div class="custom-dialog">
+          <div class="custom-dialog-header">
+            <h3>鍙栬蛋绌虹</h3>
+            <el-button 
+              type="text" 
+              @click="closeEmptyPalletDialog"
+              class="close-button">
+              脳
+            </el-button>
+          </div>
+          <div class="custom-dialog-body">
+            <el-form 
+              :model="emptypalletOutForm" 
+              :rules="emptypalletOutFormRules"
+              ref="emptypalletOutFormRef"
+              label-width="100px">
+              <el-form-item label="璁㈠崟缂栧彿">
+                <el-input v-model="emptypalletOutForm.orderNo" disabled></el-input>
+              </el-form-item>
+              <el-form-item label="鎵樼洏缂栧彿" prop="palletCode">
+                <el-input 
+                  v-model="emptypalletOutForm.palletCode" 
+                  placeholder="鎵弿鎵樼洏鐮�"
+                  @keyup.enter.native="onEmptyPalletScan"
+                  @change="onEmptyPalletScan"
+                  clearable>
+                </el-input>
+              </el-form-item>
+            </el-form>
+          </div>
+          <div class="custom-dialog-footer">
+            <el-button @click="closeEmptyPalletDialog">鍙栨秷</el-button>
+            <el-button type="primary" @click="handleEmptyPalletConfirm" :loading="emptypalletOutLoading">纭鍙栬蛋绌虹</el-button>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+
     <!-- 鐩存帴鍑哄簱寮圭獥 -->
     <div v-if="showDirectOutDialog" class="custom-dialog-overlay">
       <div class="custom-dialog-wrapper">
@@ -290,7 +333,7 @@
         </div>
       </div>
     </div>
-  </div>
+ 
   <print-view ref="childs" @parentcall="parentcall"></print-view>
 </template>
 
@@ -431,6 +474,20 @@
           { required: true, validator: validateDirectOutPalletCode, trigger: 'blur' }
         ]
       },
+
+      showEmptyPalletDialog: false, // 鍙栬蛋绌虹寮圭獥鏄剧ず鐘舵��
+      emptypalletOutLoading: false, // 鍙栬蛋绌虹鍔犺浇鐘舵��
+      emptypalletOutForm: {
+        orderNo: '',
+        palletCode: ''
+      },
+      emptypalletOutFormRules: {
+        palletCode: [
+          { required: true, validator: validateDirectOutPalletCode, trigger: 'blur' }
+        ]
+      },
+
+
       returnForm: {
         orderNo: '',
         palletCode: '',
@@ -708,6 +765,109 @@
     handleDirectOutbound() {
       this.openDirectOutDialog();
     },
+
+   // 鎵撳紑鍙栬蛋绌虹寮圭獥
+    openEmptyPalletDialog() {
+      console.log('鎵撳紑鍙栬蛋绌虹寮圭獥');
+      this.showEmptyPalletDialog = true;
+      
+      // 閲嶇疆琛ㄥ崟
+      this.resetEmptyPalletForm();
+      
+      // 璁剧疆璁㈠崟淇℃伅
+      this.emptypalletOutForm.orderNo = this.scanData.orderNo;
+      
+      // 娓呴櫎琛ㄥ崟楠岃瘉
+      this.$nextTick(() => {
+        if (this.$refs.emptyPalletFormRef) {
+          this.$refs.emptyPalletFormRef.clearValidate();
+        }
+      });
+    },
+
+    // 鍏抽棴鍙栬蛋绌虹寮圭獥
+    closeEmptyPalletDialog() {
+      this.showEmptyPalletDialog = false;
+      this.resetEmptyPalletForm();
+      
+      // 娓呴櫎琛ㄥ崟楠岃瘉
+      if (this.$refs.emptyPalletFormRef) {
+        this.$refs.emptyPalletFormRef.clearValidate();
+      }
+    },
+
+    // 鍙栬蛋绌虹鎵樼洏鐮佹壂鐮�
+    onEmptyPalletScan() {
+      if (!this.emptypalletOutForm.palletCode) return;
+      
+      this.emptypalletOutForm.palletCode = this.emptypalletOutForm.palletCode.replace(/\n/g, '').trim();
+      
+      // 娓呴櫎楠岃瘉鐘舵��
+      if (this.$refs.emptyPalletFormRef) {
+        this.$refs.emptyPalletFormRef.clearValidate(['palletCode']);
+      }
+    },
+
+    // 鍙栬蛋绌虹纭
+    async handleEmptyPalletConfirm() {
+      // 琛ㄥ崟楠岃瘉
+      if (this.$refs.emptyPalletFormRef) {
+        this.$refs.emptyPalletFormRef.validate((valid) => {
+          if (valid) {
+            this.submitEmptyPallet();
+          } else {
+            this.$message.warning('璇锋壂鎻忔墭鐩樼爜');
+            return false;
+          }
+        });
+      } else {
+        // 濡傛灉娌℃湁琛ㄥ崟寮曠敤锛屼娇鐢ㄥ師鏈夌殑楠岃瘉
+        if (!this.emptypalletOutForm.palletCode) {
+          this.$message.warning('璇锋壂鎻忔墭鐩樼爜');
+          return;
+        }
+        
+        this.submitEmptyPallet();
+      }
+    },
+    
+    // 鎻愪氦鍙栬蛋绌虹璇锋眰
+    async submitEmptyPallet() {
+      this.emptypalletOutLoading = true;
+      
+      try {
+        const res = await this.http.post('/api/OutboundPicking/remove-empty-pallet', {
+          orderNo: this.emptypalletOutForm.orderNo,
+          palletCode: this.emptypalletOutForm.palletCode
+        });
+        debugger;
+        if (res.status) {
+          this.$message.success('鍙栬蛋绌虹鎴愬姛');
+          this.showEmptyPalletDialog = false;
+          this.loadData();
+        } else {
+          this.$message.error(res.message || '鍙栬蛋绌虹澶辫触');
+        }
+      } catch (error) {
+        this.$message.error('鍙栬蛋绌虹澶辫触');
+      } finally {
+        this.emptypalletOutLoading = false;
+      }
+    },
+
+    // 閲嶇疆鍙栬蛋绌虹琛ㄥ崟
+    resetEmptyPalletForm() {
+      this.emptypalletOutForm.palletCode = '';
+    },
+
+    // 淇敼鍘熸湁鐨勫彇璧扮┖绠辨寜閽偣鍑讳簨浠� 
+    handleEmptyPallet() {
+      this.openEmptyPalletDialog();
+    },
+
+
+
+    
     async loadData() {
       if (!this.scanData.orderNo || !this.scanData.palletCode) {
         return;
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockView.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockView.vue"
index fc8b569..13ce26a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockView.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockView.vue"
@@ -27,18 +27,12 @@
       sortName: "stockId",
     });
     const editFormFields = ref({
-      palletCode: "",
-      locationCode: "",
-      locationName: "",
+    
     });
     const editFormOptions = ref([
       
     ]);
     const searchFormFields = ref({
-      palletCode: "",
-      // locationCode: "",
-      materielCode:"",
-      batchNo:""
     });
     const searchFormOptions = ref([
       [
@@ -69,7 +63,7 @@
         title: "鎵樼洏缂栧彿",
         type: "string",
         width: 150,
-        link: true,
+        // link: true,
         align: "left",
       },
       {
@@ -92,7 +86,6 @@
         type: "string",
         width: 80,
         align: "left",
-        bind: { key: "warehouses", data: [] },
       },
       {
         field: "roadwayNo",
@@ -110,90 +103,13 @@
         align: "left",
       },
       {
-        field: "batchNo",
-        title: "鎵�鍚墿鏂欐壒娆�",
-        type: "string",
-        width: 200,
-        align: "left"
-      },
-      {
-        field: "materielInfo",
-        title: "鎵�鍚墿鏂欐渶鏃╀复鏈�",
-        type: "string",
-        width: 140,
-        align: "left",
-      },
-      {
         field: "sumStock",
         title: "鎬诲簱瀛�",
         type: "string",
         width: 140,
         align: "left",
       },
-      {
-        field: "row",
-        title: "璐т綅琛�",
-        type: "string",
-        width: 90,
-        align: "left",
-        hidden: true,
-      },
-      {
-        field: "column",
-        title: "璐т綅鍒�",
-        type: "int",
-        width: 120,
-        align: "left",
-        hidden: true,
-      },
-      {
-        field: "layer",
-        title: "璐т綅灞�",
-        type: "string",
-        width: 200,
-        align: "left",
-        hidden: true,
-      },
-      {
-        field: "depth",
-        title: "璐т綅娣卞害",
-        type: "string",
-        width: 180,
-        align: "left",
-        hidden: true,
-      },
-      {
-        field: "stockStatus",
-        title: "搴撳瓨鐘舵��",
-        type: "string",
-        width: 200,
-        align: "left",
-        bind: { key: "stockStatusEmun", data: [] },
-      },
-      {
-        field: "locationType",
-        title: "璐т綅绫诲瀷",
-        type: "string",
-        width: 100,
-        align: "left",
-        bind:{key: "locationTypeEnum", data: []}
-      },
-      {
-        field: "locationStatus",
-        title: "璐т綅鐘舵��",
-        type: "string",
-        width: 120,
-        align: "left",
-        bind: { key: "locationStatusEnum", data: [] },
-      },
-      {
-        field: "enalbeStatus",
-        title: "绂佺敤鐘舵��",
-        type: "string",
-        width: 80,
-        align: "left",
-        bind: { key: "enableStatusEnum", data: [] },
-      },
+
       {
         field: "creater",
         title: "鍒涘缓浜�",
@@ -235,143 +151,7 @@
       cnName: "搴撳瓨鏄庣粏淇℃伅",
       table: "StockInfoDetail",
       columns: [
-        {
-          field: "id",
-          title: "Id",
-          type: "int",
-          width: 90,
-          hidden: true,
-          readonly: true,
-          require: true,
-          align: "left",
-        },
-        {
-          field: "stockId",
-          title: "搴撳瓨淇℃伅涓婚敭",
-          type: "string",
-          width: 90,
-          align: "left",
-          hidden: true
-        },
-        {
-          field: "materielCode",
-          title: "鐗╂枡缂栧彿",
-          type: "string",
-          width: 110,
-          align: "left",
-        },
-        {
-          field: "materielName",
-          title: "鐗╂枡鍚嶇О",
-          type: "string",
-          width: 130,
-          align: "left",
-        },
-        {
-          field: "orderNo",
-          title: "鍗曟嵁缂栧彿",
-          type: "decimal",
-          width: 130,
-          align: "left",
-        },
-        {
-          field: "batchNo",
-          title: "鎵规鍙�",
-          type: "string",
-          width: 180,
-          align: "left",
-        },
-        {
-          field: "serialNumber",
-          title: "搴忓垪鍙�",
-          type: "int",
-          width: 120,
-          align: "left",
-          hidden: true,
-        },
-        {
-          field: "stockQuantity",
-          title: "搴撳瓨鏁伴噺",
-          type: "string",
-          width: 80,
-          align: "left",
-        },
-        {
-          field: "outboundQuantity",
-          title: "鍑哄簱鏁伴噺",
-          type: "string",
-          width: 80,
-          align: "left",
-        },
-        {
-          field: "unit",
-          title: "鍗曚綅",
-          type: "string",
-          width: 50,
-          align: "left",
-        },
-        {
-          field: "productionDate",
-          title: "鐢熶骇鏃ユ湡",
-          type: "string",
-          width: 80,
-          align: "left",
-        },
-        {
-          field: "effectiveDate",
-          title: "鏈夋晥鏃ユ湡",
-          type: "string",
-          width: 80,
-          align: "left",
-        },
-        {
-          field: "status",
-          title: "搴撳瓨鏄庣粏鐘舵��",
-          type: "string",
-          width: 120,
-          align: "left",
-          bind: { key: "stockStatusEmun", data: [] }
-        },
-        {
-          field: "creater",
-          title: "鍒涘缓浜�",
-          type: "string",
-          width: 90,
-          align: "left",
-          hidden: true
-        },
-        {
-          field: "createDate",
-          title: "鍒涘缓鏃堕棿",
-          type: "datetime",
-          width: 160,
-          align: "left",
-          hidden: true
-        },
-        {
-          field: "modifier",
-          title: "淇敼浜�",
-          type: "string",
-          width: 100,
-          align: "left",
-          hidden: true
-        },
-        {
-          field: "modifyDate",
-          title: "淇敼鏃堕棿",
-          type: "datetime",
-          width: 160,
-          align: "left",
-          hidden: true
-        },
-        {
-          field: "remark",
-          title: "澶囨敞",
-          type: "string",
-          width: 100,
-          align: "left",
-          hidden: true
-        },
+
       ],
       sortName: "id",
       key: "id",
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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm" "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
index 281e03c..428e047 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
+++ "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
Binary files differ
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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm" "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
index 5c3038d..b6152d9 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
+++ "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
Binary files differ
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_BasicService/LocationInfoService.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_BasicService/LocationInfoService.cs"
index 48640ac..dc62c83 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_BasicService/LocationInfoService.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_BasicService/LocationInfoService.cs"
@@ -189,6 +189,10 @@
                 if (first != null)
                 {
                     locationCaches.Add(new LocationCache { LocationCode = first.LocationCode, DateTime = DateTime.Now });
+                    Db.Updateable<Dt_LocationInfo>().SetColumns(x => new Dt_LocationInfo
+                    {
+                        LocationStatus = (int)LocationStatusEnum.InStockLock,
+                    }).Where(x => x.Id == first.Id).ExecuteCommand();
                 }
 
                 return first;
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_DTO/Outbound/OutboundOrderAddDTO.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_DTO/Outbound/OutboundOrderAddDTO.cs"
index d764beb..43161d1 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_DTO/Outbound/OutboundOrderAddDTO.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_DTO/Outbound/OutboundOrderAddDTO.cs"
@@ -92,6 +92,8 @@
         /// </summary>
         public string orderNo { get; set; }
 
+        public string documentsNO { get; set; }
+
         public string business_type { get; set; }
 
         public int status { get; set; }
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_DTO/Stock/StockSelectViewDTO.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_DTO/Stock/StockSelectViewDTO.cs"
index 0ff3981..e529e33 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_DTO/Stock/StockSelectViewDTO.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_DTO/Stock/StockSelectViewDTO.cs"
@@ -19,6 +19,7 @@
 
         public string LocationCode { get; set; }
 
-        
+
+        public string Barcode { get; set; }
     }
 }
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_DTO/Stock/StockViewDTO.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_DTO/Stock/StockViewDTO.cs"
index 39e46e9..9ed7598 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_DTO/Stock/StockViewDTO.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_DTO/Stock/StockViewDTO.cs"
@@ -22,11 +22,13 @@
         /// <summary>
         /// 璐т綅缂栧彿
         /// </summary>
+        [SugarColumn(Length = 255, ColumnDescription = "璐т綅缂栧彿")]
         public string LocationCode { get; set; }
 
         /// <summary>
         /// 璐т綅鍚嶇О
         /// </summary>
+        [SugarColumn(Length = 255, ColumnDescription = "璐т綅鍚嶇О")]
         public string LocationName { get; set; }
 
         /// <summary>
@@ -62,6 +64,7 @@
         /// <summary>
         /// 宸烽亾缂栧彿
         /// </summary>
+        [SugarColumn(Length = 255, ColumnDescription = "宸烽亾缂栧彿")]
         public string RoadwayNo { get; set; }
 
         /// <summary>
@@ -77,6 +80,7 @@
         /// <summary>
         /// 鎵樼洏鍙�
         /// </summary>
+        [SugarColumn(Length = 255, ColumnDescription = "鎵樼洏鍙�")]
         public string PalletCode { get; set; }
 
         /// <summary>
@@ -87,11 +91,13 @@
         /// <summary>
         /// 鐗╂枡缂栫爜
         /// </summary>
+        [SugarColumn(Length = 255, ColumnDescription = "鐗╂枡缂栫爜")]
         public string MaterielCode { get; set; }
 
         /// <summary>
         /// 鐗╂枡鎵瑰彿
         /// </summary>
+        [SugarColumn(Length = 255, ColumnDescription = "鐗╂枡鎵瑰彿")]
         public string BatchNo { get; set; }
 
         /// <summary>
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_IOutboundService/IOutboundPickingService.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_IOutboundService/IOutboundPickingService.cs"
index 860e955..3f76b5e 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_IOutboundService/IOutboundPickingService.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_IOutboundService/IOutboundPickingService.cs"
@@ -24,5 +24,7 @@
         Task<WebResponseContent> CancelPicking(string orderNo, string palletCode, string barcode);
         Task<WebResponseContent> ConfirmPicking(string orderNo, string palletCode, string barcode);
         Task<WebResponseContent> ReturnRemaining(string orderNo, string palletCode, string reason);
+
+        Task<WebResponseContent> RemoveEmptyPallet(string orderNo, string palletCode);
     }
 }
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_OutboundService/OutboundOrderDetailService.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_OutboundService/OutboundOrderDetailService.cs"
index 954e8fc..14257d7 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_OutboundService/OutboundOrderDetailService.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_OutboundService/OutboundOrderDetailService.cs"
@@ -299,7 +299,7 @@
             if (!checkResult.Item1) throw new Exception(checkResult.Item2);
 
             Dt_OutboundOrder outboundOrder = _outboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId);
-            var originalNeedQuantity = outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity;
+            var originalNeedQuantity = outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity-outboundOrderDetail.MoveQty;
 
             var needQuantity = originalNeedQuantity;
 
@@ -352,10 +352,10 @@
             {
                 return (false, "璇ユ槑缁嗕笉鍙搷浣�");
             }
-            if (stockSelectViews.Sum(x => x.UseableQuantity) > outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity)
-            {
-                return (false, "閫夋嫨鏁伴噺瓒呭嚭鍗曟嵁鏁伴噺");
-            }
+            //if (stockSelectViews.Sum(x => x.UseableQuantity) > outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity - outboundOrderDetail.MoveQty)
+            //{
+            //    return (false, "閫夋嫨鏁伴噺瓒呭嚭鍗曟嵁鏁伴噺");
+            //}
             return (true, "鎴愬姛");
         }
 
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_OutboundService/OutboundPickingService.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_OutboundService/OutboundPickingService.cs"
index 02d76b3..8e030a2 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_OutboundService/OutboundPickingService.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_OutboundService/OutboundPickingService.cs"
@@ -10,6 +10,7 @@
 using System.Text;
 using System.Text.Json;
 using System.Threading.Tasks;
+using WIDESEA_Common.CommonEnum;
 using WIDESEA_Common.LocationEnum;
 using WIDESEA_Common.OrderEnum;
 using WIDESEA_Common.StockEnum;
@@ -17,6 +18,7 @@
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Enums;
 using WIDESEA_Core.Helper;
 using WIDESEA_DTO.Basic;
 using WIDESEA_DTO.Inbound;
@@ -86,6 +88,8 @@
             _dailySequenceService = dailySequenceService;
         }
 
+
+        #region 鏌ヨ鏂规硶
         // 鑾峰彇鏈嫞閫夊垪琛�
         public async Task<List<Dt_OutStockLockInfo>> GetUnpickedList(string orderNo, string palletCode)
         {
@@ -148,6 +152,8 @@
             return summary;
         }
 
+        #endregion
+
         #region 鏍稿績涓氬姟娴佺▼
         /// <summary>
         /// 鎷i��
@@ -161,7 +167,7 @@
             try
             {
                 _unitOfWorkManage.BeginTran();
-  
+
                 var validationResult = await ValidatePickingRequest(orderNo, palletCode, barcode);
                 if (!validationResult.IsValid)
                     return WebResponseContent.Instance.Error(validationResult.ErrorMessage);
@@ -252,11 +258,11 @@
             {
                 _unitOfWorkManage.BeginTran();
 
-                // 1. 鍩虹楠岃瘉
+
                 if (string.IsNullOrEmpty(orderNo) || string.IsNullOrEmpty(palletCode))
                     return WebResponseContent.Instance.Error("璁㈠崟鍙峰拰鎵樼洏鐮佷笉鑳戒负绌�");
 
-                // 2. 鑾峰彇搴撳瓨鍜屼换鍔′俊鎭�
+                //  鑾峰彇搴撳瓨鍜屼换鍔′俊鎭�
                 var stockInfo = await _stockInfoService.Db.Queryable<Dt_StockInfo>().FirstAsync(x => x.PalletCode == palletCode);
 
                 if (stockInfo == null)
@@ -266,23 +272,34 @@
                 if (task == null)
                     return WebResponseContent.Instance.Error("鏈壘鍒板搴旂殑浠诲姟淇℃伅");
 
-                // 3. 鍒嗘瀽闇�瑕佸洖搴撶殑璐х墿
-                var returnAnalysis = await AnalyzeReturnItems(orderNo, palletCode, stockInfo.Id);
-                if (!returnAnalysis.HasItemsToReturn)
-                    return await HandleNoReturnItems(orderNo, palletCode,task);
+                //鍒嗘瀽闇�瑕佸洖搴撶殑璐х墿
+                //var returnAnalysis = await AnalyzeReturnItems(orderNo, palletCode, stockInfo.Id);
+                //if (!returnAnalysis.HasItemsToReturn)
+                //    return await HandleNoReturnItems(orderNo, palletCode, task);
 
-                // 4. 鎵ц鍥炲簱鎿嶄綔
-                await ExecuteReturnOperations(orderNo, palletCode, stockInfo, task, returnAnalysis);
+                var statusAnalysis = await AnalyzePalletStatus(orderNo, palletCode, stockInfo.Id);
+                if (!statusAnalysis.HasItemsToReturn)
+                    return await HandleNoReturnItems(orderNo, palletCode, task, stockInfo.Id);
 
-                // 5. 鍒涘缓鍥炲簱浠诲姟
-                await CreateReturnTaskAndHandleESS(orderNo, palletCode, task, returnAnalysis);
+                // 4. 妫�鏌ユ槸鍚︽湁杩涜涓殑浠诲姟
+                if (statusAnalysis.HasActiveTasks)
+                {
+                    return WebResponseContent.Instance.Error($"鎵樼洏 {palletCode} 鏈夎繘琛屼腑鐨勪换鍔★紝涓嶈兘鎵ц鍥炲簱鎿嶄綔");
+                }
+
+                //鎵ц鍥炲簱鎿嶄綔
+                await ExecuteReturnOperations(orderNo, palletCode, stockInfo, task, statusAnalysis);
 
                 _unitOfWorkManage.CommitTran();
 
-                // 6. 鏇存柊璁㈠崟鐘舵�侊紙涓嶈Е鍙慚ES鍥炰紶锛�
+              
+                // 鍒涘缓鍥炲簱浠诲姟
+                await CreateReturnTaskAndHandleESS(orderNo, palletCode, task, TaskTypeEnum.InPick);
+
+                // 鏇存柊璁㈠崟鐘舵�侊紙涓嶈Е鍙慚ES鍥炰紶锛�
                 await UpdateOrderStatusForReturn(orderNo);
 
-                return WebResponseContent.Instance.OK($"鍥炲簱鎿嶄綔鎴愬姛锛屽叡鍥炲簱鏁伴噺锛歿returnAnalysis.TotalReturnQty}");
+                return WebResponseContent.Instance.OK($"鍥炲簱鎿嶄綔鎴愬姛锛屽叡鍥炲簱鏁伴噺锛歿statusAnalysis.TotalReturnQty}");
             }
             catch (Exception ex)
             {
@@ -292,6 +309,71 @@
             }
         }
 
+        /// <summary>
+        /// 绌烘墭鐩樺彇璧版帴鍙o紙甯﹁鍗曞彿锛�
+        /// 楠岃瘉鎵樼洏鏄惁鐪熺殑涓虹┖锛屾竻鐞嗘暟鎹紝鏇存柊璁㈠崟鐘舵�侊紝鍒涘缓鍙栨墭鐩樹换鍔�
+        /// </summary>
+        public async Task<WebResponseContent> RemoveEmptyPallet(string orderNo, string palletCode)
+        {
+            try
+            {
+                _unitOfWorkManage.BeginTran();
+
+                if (string.IsNullOrEmpty(orderNo) || string.IsNullOrEmpty(palletCode))
+                    return WebResponseContent.Instance.Error("璁㈠崟鍙峰拰鎵樼洏鐮佷笉鑳戒负绌�");
+
+                // 妫�鏌ヨ鍗曟槸鍚﹀瓨鍦�
+                var order = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>()
+                    .Where(x => x.OrderNo == orderNo)
+                    .FirstAsync();
+
+                if (order == null)
+                    return WebResponseContent.Instance.Error($"鏈壘鍒拌鍗� {orderNo}");
+
+                //妫�鏌ユ墭鐩樻槸鍚﹀瓨鍦ㄤ笖灞炰簬璇ヨ鍗�
+                var stockInfo = await _stockInfoService.Db.Queryable<Dt_StockInfo>()
+                    .Where(x => x.PalletCode == palletCode)
+                    .FirstAsync();
+
+                if (stockInfo == null)
+                    return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩� {palletCode} 瀵瑰簲鐨勫簱瀛樹俊鎭�");
+
+                var statusAnalysis = await AnalyzePalletStatus(orderNo, palletCode, stockInfo.Id);
+
+                if (!statusAnalysis.CanRemove)
+                {
+                    if (!statusAnalysis.IsEmptyPallet)
+                    {
+                        return WebResponseContent.Instance.Error($"鎵樼洏 {palletCode} 涓婅繕鏈夎揣鐗╋紝涓嶈兘鍙栬蛋");
+                    }
+                    if (statusAnalysis.HasActiveTasks)
+                    {
+                        return WebResponseContent.Instance.Error($"鎵樼洏 {palletCode} 杩樻湁杩涜涓殑浠诲姟锛屼笉鑳藉彇璧�");
+                    }
+                }
+                // 娓呯悊闆跺簱瀛樻暟鎹�
+                await CleanupZeroStockData(stockInfo.Id);
+
+                // 鍒犻櫎鎴栧彇娑堢浉鍏充换鍔�
+                await HandleTaskCleanup(orderNo, palletCode);
+
+                // 鏇存柊璁㈠崟鐩稿叧鏁版嵁
+                await UpdateOrderData(orderNo, palletCode);
+
+
+                _unitOfWorkManage.CommitTran();
+
+                _logger.LogInformation($"绌烘墭鐩樺彇璧版搷浣滄垚鍔� - 璁㈠崟: {orderNo}, 鎵樼洏: {palletCode}, 鎿嶄綔浜�: {App.User.UserName}");
+
+                return WebResponseContent.Instance.OK("绌烘墭鐩樺彇璧版搷浣滄垚鍔�");
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                _logger.LogError($"RemoveEmptyPallet澶辫触 - OrderNo: {orderNo}, PalletCode: {palletCode}, Error: {ex.Message}");
+                return WebResponseContent.Instance.Error($"绌烘墭鐩樺彇璧板け璐�: {ex.Message}");
+            }
+        }
         #endregion
 
         #region 鍒嗘嫞纭绉佹湁鏂规硶
@@ -367,7 +449,7 @@
             {
                 // 鏌ユ壘鍚屼竴璁㈠崟涓嬬殑璁板綍
                 lockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
-                    .Where(it => it.OrderNo == orderNo &&  it.CurrentBarcode == barcode && it.Status == (int)OutLockStockStatusEnum.鍑哄簱涓� && it.AssignQuantity > it.PickedQty).FirstAsync();
+                    .Where(it => it.OrderNo == orderNo && it.CurrentBarcode == barcode && it.Status == (int)OutLockStockStatusEnum.鍑哄簱涓� && it.AssignQuantity > it.PickedQty).FirstAsync();
 
                 if (lockInfo == null)
                 {
@@ -436,7 +518,7 @@
                 adjustedReason = adjustedReason != null
                     ? $"{adjustedReason}锛岄槻瓒呮嫞闄愬埗锛氭渶缁堣皟鏁翠负{actualQty}"
                     : $"闃茶秴鎷i檺鍒讹細浠巤plannedQty}璋冩暣涓簕actualQty}";
-            } 
+            }
 
             if (adjustedReason != null)
             {
@@ -501,30 +583,34 @@
         {
             decimal remainingStockQty = stockQuantity - actualQty;
 
-            // 1. 鏇存柊鍘熸潯鐮佸簱瀛�
+            // 鏇存柊鍘熸潯鐮佸簱瀛�
             stockDetail.StockQuantity = remainingStockQty;
             stockDetail.OutboundQuantity = remainingStockQty;
             await _stockInfoDetailService.Db.Updateable(stockDetail).ExecuteCommandAsync();
 
-            // 2. 鐢熸垚鏂版潯鐮�
+            //鐢熸垚鏂版潯鐮�
             string newBarcode = await GenerateNewBarcode();
 
-            // 3. 鍒涘缓鏂伴攣瀹氫俊鎭�
+            //鍒涘缓鏂伴攣瀹氫俊鎭�
             var newLockInfo = await CreateSplitLockInfo(lockInfo, actualQty, newBarcode);
 
-            // 4. 璁板綍鎷嗗寘鍘嗗彶
+            // 璁板綍鎷嗗寘鍘嗗彶
             await RecordSplitHistory(lockInfo, stockDetail, actualQty, remainingStockQty, newBarcode);
 
-            // 5. 鏇存柊鍘熼攣瀹氫俊鎭�
+            // 鏇存柊鍘熼攣瀹氫俊鎭�
             lockInfo.AssignQuantity = remainingStockQty;
             lockInfo.PickedQty = 0;
             lockInfo.Operator = App.User.UserName;
             await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync();
 
-            // 6. 璁剧疆缁撴灉
+            // 璁剧疆缁撴灉
             result.FinalLockInfo = newLockInfo;
             result.FinalBarcode = newBarcode;
             result.SplitResults.AddRange(CreateSplitResults(lockInfo, actualQty, remainingStockQty, newBarcode, stockDetail.Barcode));
+
+            await UpdateOrderRelatedData(lockInfo.OrderDetailId, actualQty, lockInfo.OrderNo);
+
+            _logger.LogInformation($"鎷嗗寘鍒嗘嫞鏇存柊璁㈠崟鏄庣粏 - OrderDetailId: {lockInfo.OrderDetailId}, 鍒嗘嫞鏁伴噺: {actualQty}");
         }
 
         private async Task HandleFullPicking(Dt_OutStockLockInfo lockInfo, Dt_StockInfoDetail stockDetail,
@@ -578,10 +664,10 @@
 
             if (newOverOutQuantity > currentOrderDetail.NeedOutQuantity)
             {
-                
+
                 _logger.LogError($"闃茶秴鎷f鏌ュけ璐� - OrderDetailId: {orderDetailId}, 宸插嚭搴�: {newOverOutQuantity}, 闇�姹�: {currentOrderDetail.NeedOutQuantity}, 鏈鍒嗘嫞: {pickedQty}");
 
-                 
+
                 decimal adjustedQty = currentOrderDetail.NeedOutQuantity - currentOrderDetail.OverOutQuantity;
 
                 if (adjustedQty > 0)
@@ -673,7 +759,7 @@
 
             if (lockInfo == null)
                 return ValidationResult<(Dt_PickingRecord, Dt_OutStockLockInfo, Dt_OutboundOrderDetail)>.Error("鏈壘鍒板搴旂殑鍑哄簱閿佸畾淇℃伅");
-          
+
             if (lockInfo.PickedQty < pickingRecord.PickQuantity)
             {
                 return ValidationResult<(Dt_PickingRecord, Dt_OutStockLockInfo, Dt_OutboundOrderDetail)>.Error(
@@ -715,8 +801,8 @@
                 {
                     return ValidationResult<(Dt_PickingRecord, Dt_OutStockLockInfo, Dt_OutboundOrderDetail)>.Error($"鏉$爜{barcode}宸茬粡鍥炲簱锛屼笉鑳藉彇娑堝垎鎷�");
                 }
-            }       
-            
+            }
+
             return ValidationResult<(Dt_PickingRecord, Dt_OutStockLockInfo, Dt_OutboundOrderDetail)>.Success((pickingRecord, lockInfo, orderDetail));
         }
         /// <summary>
@@ -846,6 +932,8 @@
             await _outStockLockInfoService.Db.Deleteable<Dt_OutStockLockInfo>()
                 .Where(x => x.Id == lockInfo.Id)
                 .ExecuteCommandAsync();
+
+            await UpdateOrderDetailOnCancel(pickingRecord.OrderDetailId, cancelQty);
         }
 
         private async Task HandleNormalBarcodeCancel(Dt_OutStockLockInfo lockInfo, Dt_PickingRecord pickingRecord, decimal cancelQty)
@@ -942,59 +1030,7 @@
 
             return task;
         }
-
-        private async Task<ReturnAnalysisResult> AnalyzeReturnItems(string orderNo, string palletCode, int stockId)
-        {
-            var result = new ReturnAnalysisResult();
-
-            // 鎯呭喌1锛氳幏鍙栨湭鍒嗘嫞鐨勫嚭搴撻攣瀹氳褰�
-            var remainingLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
-                .Where(it => it.OrderNo == orderNo &&
-                           it.PalletCode == palletCode &&
-                           it.Status == (int)OutLockStockStatusEnum.鍑哄簱涓�)
-                .ToListAsync();
-
-            if (remainingLocks.Any())
-            {
-                result.HasRemainingLocks = true;
-                result.RemainingLocks = remainingLocks;
-                result.RemainingLocksReturnQty = remainingLocks.Sum(x => x.AssignQuantity - x.PickedQty);
-            }
-
-            // 鎯呭喌2锛氭鏌ユ墭鐩樹笂鏄惁鏈夊叾浠栧簱瀛樿揣鐗�
-            var palletStockGoods = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
-                .Where(it => it.StockId == stockId &&
-                            (it.Status == StockStatusEmun.鍏ュ簱纭.ObjToInt() ||
-                             it.Status == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() ||
-                             it.Status == StockStatusEmun.鍑哄簱閿佸畾.ObjToInt()))
-                .Where(it => it.StockQuantity > 0)
-                .ToListAsync();
-
-            if (palletStockGoods.Any())
-            {
-                result.HasPalletStockGoods = true;
-                result.PalletStockGoods = palletStockGoods;
-                result.PalletStockReturnQty = palletStockGoods.Sum(x => x.StockQuantity);
-            }
-
-            // 鎯呭喌3锛氭鏌ユ媶鍖呰褰�
-            var splitRecords = await _splitPackageService.Db.Queryable<Dt_SplitPackageRecord>()
-                .Where(it => it.OrderNo == orderNo && it.PalletCode == palletCode && !it.IsReverted && it.Status != (int)SplitPackageStatusEnum.宸插洖搴�)
-                .ToListAsync();
-
-            if (splitRecords.Any())
-            {
-                result.HasSplitRecords = true;
-                result.SplitRecords = splitRecords;
-                result.SplitReturnQty = await CalculateSplitReturnQuantity(splitRecords, stockId);
-            }
-
-            result.TotalReturnQty = result.RemainingLocksReturnQty + result.PalletStockReturnQty + result.SplitReturnQty;
-            result.HasItemsToReturn = result.TotalReturnQty > 0;
-
-            return result;
-        }
-
+ 
         private async Task<decimal> CalculateSplitReturnQuantity(List<Dt_SplitPackageRecord> splitRecords, int stockId)
         {
             decimal totalQty = 0;
@@ -1034,40 +1070,74 @@
             return totalQty;
         }
 
-        private async Task<WebResponseContent> HandleNoReturnItems(string orderNo, string palletCode,Dt_Task originalTask)
+        private async Task<WebResponseContent> HandleNoReturnItems(string orderNo, string palletCode, Dt_Task originalTask, int stockInfoId)
         {
             // 妫�鏌ユ槸鍚︽墍鏈夎揣鐗╅兘宸叉嫞閫夊畬鎴�
-            var allPicked = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
-                .Where(it => it.OrderNo == orderNo && it.PalletCode == palletCode)
-                .AnyAsync(it => it.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴�);
+            //var allPicked = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+            //    .Where(it => it.OrderNo == orderNo && it.PalletCode == palletCode)
+            //    .AnyAsync(it => it.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴�);
 
-            if (allPicked)
+            //if (allPicked)
+            //{
+            //    // 鍒犻櫎鍘熷鍑哄簱浠诲姟 缁勭┖鐩�   绌虹洏鍥炲簱 
+            //    //await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
+            //    return WebResponseContent.Instance.OK("鎵�鏈夎揣鐗╁凡鎷i�夊畬鎴愶紝鎵樼洏涓虹┖");
+            //}
+            //else
+            //{
+            //    // 鍒犻櫎鍘熷鍑哄簱浠诲姟
+            //    //await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
+            //    return WebResponseContent.Instance.Error("娌℃湁闇�瑕佸洖搴撶殑鍓╀綑璐х墿");
+            //}
+            try
             {
-                // 鍒犻櫎鍘熷鍑哄簱浠诲姟
-                await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
-                return WebResponseContent.Instance.OK("鎵�鏈夎揣鐗╁凡鎷i�夊畬鎴愶紝鎵樼洏涓虹┖");
+                var locationtype = 0;
+                var stockInfo = await _stockInfoService.Db.Queryable<Dt_StockInfo>()
+                        .Where(x => x.PalletCode == palletCode)
+                        .FirstAsync();
+
+                if (stockInfo == null)
+                {
+                    var firstLocation = await _locationInfoService.Db.Queryable<Dt_LocationInfo>().FirstAsync(x => x.LocationCode == originalTask.SourceAddress);
+                    locationtype = firstLocation?.LocationType ?? 1;
+                }
+                else
+                {
+                    locationtype = stockInfo.LocationType;
+                }
+
+                var targetAddress = originalTask.TargetAddress;
+
+                await CleanupZeroStockData(stockInfoId);
+
+                var emptystockInfo = new Dt_StockInfo() { PalletType = PalletTypeEnum.Empty.ObjToInt(), StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(), PalletCode = palletCode, LocationType = locationtype };
+                emptystockInfo.Details = new List<Dt_StockInfoDetail>();
+                _stockInfoService.AddMaterielGroup(emptystockInfo);
+                //绌烘墭鐩樺浣曞鐞�  杩樻湁涓�涓嚭搴撲换鍔¤澶勭悊銆�
+                originalTask.PalletType = PalletTypeEnum.Empty.ObjToInt();
+
+                await CreateReturnTaskAndHandleESS(orderNo, palletCode, originalTask, TaskTypeEnum.InEmpty);
+
             }
-            else
+            catch (Exception ex)
             {
-                // 鍒犻櫎鍘熷鍑哄簱浠诲姟
-                await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
-                return WebResponseContent.Instance.Error("娌℃湁闇�瑕佸洖搴撶殑鍓╀綑璐х墿");
+                _logger.LogError($" HandleNoReturnItems  澶辫触: {ex.Message}");
+                return WebResponseContent.Instance.Error($" 鍥炲簱绌烘墭鐩樺け璐ワ紒");
             }
-            //绌烘墭鐩樺浣曞鐞�  杩樻湁涓�涓嚭搴撲换鍔¤澶勭悊銆�
-         
+            return WebResponseContent.Instance.OK("绌烘墭鐩樺洖搴撲换鍔″垱寤烘垚鍔�");
+
         }
 
         private async Task ExecuteReturnOperations(string orderNo, string palletCode, Dt_StockInfo stockInfo,
-            Dt_Task task, ReturnAnalysisResult analysis)
+            Dt_Task task, PalletStatusAnalysis analysis)
         {
             // 鎯呭喌1锛氬鐞嗘湭鍒嗘嫞鐨勫嚭搴撻攣瀹氳褰�
             if (analysis.HasRemainingLocks)
             {
                 await HandleRemainingLocksReturn(analysis.RemainingLocks, stockInfo.Id);
 
-                // 鍏抽敭锛氭洿鏂拌鍗曟槑缁嗙殑宸叉嫞閫夋暟閲�
-                await UpdateOrderDetailsOnReturn(analysis.RemainingLocks);
-            }
+               // await UpdateOrderDetailsOnReturn(analysis.RemainingLocks);
+            }                
 
             // 澶勭悊鎵樼洏涓婂叾浠栧簱瀛樿揣鐗�
             if (analysis.HasPalletStockGoods)
@@ -1177,9 +1247,9 @@
             foreach (var stockGood in palletStockGoods)
             {
                 _logger.LogInformation($"寰呭洖搴撹揣鐗� - 鏉$爜: {stockGood.Barcode}, 鏁伴噺: {stockGood.StockQuantity}, 褰撳墠鐘舵��: {stockGood.Status}");
-            
-            // 鎭㈠搴撳瓨鐘舵��
-            stockGood.OutboundQuantity = 0;
+
+                // 鎭㈠搴撳瓨鐘舵��
+                stockGood.OutboundQuantity = 0;
                 stockGood.Status = StockStatusEmun.鍏ュ簱纭.ObjToInt();
 
                 await _stockInfoDetailService.Db.Updateable(stockGood).ExecuteCommandAsync();
@@ -1213,7 +1283,7 @@
         /// <param name="originalTask"></param>
         /// <param name="analysis"></param>
         /// <returns></returns>
-        private async Task CreateReturnTaskAndHandleESS(string orderNo, string palletCode, Dt_Task originalTask, ReturnAnalysisResult analysis)
+        private async Task CreateReturnTaskAndHandleESS(string orderNo, string palletCode, Dt_Task originalTask, TaskTypeEnum taskTypeEnum)
         {
             var firstLocation = await _locationInfoService.Db.Queryable<Dt_LocationInfo>()
                 .FirstAsync(x => x.LocationCode == originalTask.SourceAddress);
@@ -1232,17 +1302,20 @@
                 SourceAddress = stations[originalTask.TargetAddress],
                 TargetAddress = newLocation.LocationCode,
                 TaskStatus = TaskStatusEnum.New.ObjToInt(),
-                TaskType = TaskTypeEnum.InPick.ObjToInt(),
+                TaskType = taskTypeEnum.ObjToInt(),
                 PalletType = originalTask.PalletType,
                 WarehouseId = originalTask.WarehouseId
 
             };
             // 淇濆瓨鍥炲簱浠诲姟
             await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync();
-            var targetAddress = originalTask.TargetAddress;        
-         
+            var targetAddress = originalTask.TargetAddress;
+
             // 鍒犻櫎鍘熷鍑哄簱浠诲姟
-            await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
+            _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.鑷姩瀹屾垚);
+            // await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
+
+
 
             // 缁� ESS 鍙戦�佹祦鍔ㄤ俊鍙峰拰鍒涘缓浠诲姟
             await SendESSCommands(palletCode, targetAddress, returnTask);
@@ -1274,10 +1347,7 @@
                         taskType = "putaway",
                         taskGroupCode = "",
                         groupPriority = 0,
-                        tasks = new List<TasksType>
-                    {
-                        new()
-                        {
+                        tasks = new List<TasksType>{  new() {
                             taskCode = returnTask.TaskNum.ToString(),
                             taskPriority = 0,
                             taskDescribe = new TaskDescribeType
@@ -1290,8 +1360,7 @@
                                 deadline = 0,
                                 storageTag = ""
                             }
-                        }
-                    }
+                        } }
                     };
 
                     var resultTask = await _eSSApiService.CreateTaskAsync(essTask);
@@ -1356,6 +1425,8 @@
             }
         }
 
+        
+
         private async Task UpdateOrderStatusForReturn(string orderNo)
         {
             try
@@ -1419,6 +1490,7 @@
                     operationType = 1,
                     Operator = App.User.UserName,
                     orderNo = outboundOrder.UpperOrderNo,
+                    documentsNO = outboundOrder.OrderNo,
                     status = outboundOrder.OrderStatus,
                     details = new List<FeedbackOutboundDetailsModel>()
                 };
@@ -1473,7 +1545,324 @@
 
         #endregion
 
+        #region 绌烘墭鐩�
+
+        /// <summary>
+        /// 娓呯悊闆跺簱瀛樻暟鎹�
+        /// </summary>
+        private async Task CleanupZeroStockData(int stockId)
+        {
+            try
+            {
+                // 1. 鍒犻櫎搴撳瓨鏁伴噺涓�0鐨勬槑缁嗚褰�
+                var deleteDetailCount = await _stockInfoDetailService.Db.Deleteable<Dt_StockInfoDetail>()
+                    .Where(x => x.StockId == stockId && x.StockQuantity == 0 && (x.Status == StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() || x.Status ==
+                                          StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()))
+                    .ExecuteCommandAsync();
+
+                await _stockInfoService.Db.Deleteable<Dt_StockInfo>()
+                   .Where(x => x.Id == stockId).ExecuteCommandAsync();
+
+                _logger.LogInformation($"娓呯悊闆跺簱瀛樻槑缁嗚褰� - StockId: {stockId}, 鍒犻櫎璁板綍鏁�: {deleteDetailCount}");
+
+
+
+            }
+            catch (Exception ex)
+            {
+                _logger.LogWarning($"娓呯悊闆跺簱瀛樻暟鎹け璐� - StockId: {stockId}, Error: {ex.Message}");
+                // 娉ㄦ剰锛氭竻鐞嗗け璐ヤ笉搴旇褰卞搷涓绘祦绋�
+            }
+        }
+        /// <summary>
+        /// 澶勭悊浠诲姟娓呯悊锛堟寜璁㈠崟鍜屾墭鐩橈級
+        /// </summary>
+        private async Task HandleTaskCleanup(string orderNo, string palletCode)
+        {
+            try
+            {
+                // 1. 鏌ユ壘鎵�鏈変笌璇ヨ鍗曞拰鎵樼洏鐩稿叧鐨勪换鍔�
+                var tasks = await _taskRepository.Db.Queryable<Dt_Task>().Where(x => x.OrderNo == orderNo && x.PalletCode == palletCode).ToListAsync();
+
+                if (tasks.Any())
+                {
+                    foreach (var task in tasks)
+                    {
+                        task.TaskStatus = (int)TaskStatusEnum.Finish;
+                    }
+                    // await _taskRepository.Db.Updateable(tasks).ExecuteCommandAsync();
+
+                    _taskRepository.DeleteAndMoveIntoHty(tasks, OperateTypeEnum.鑷姩瀹屾垚);
+                    _logger.LogInformation($"瀹屾垚{tasks.Count}涓墭鐩樹换鍔� - 璁㈠崟: {orderNo}, 鎵樼洏: {palletCode}");
+                }
+
+            }
+            catch (Exception ex)
+            {
+                _logger.LogWarning($"澶勭悊浠诲姟娓呯悊澶辫触 - OrderNo: {orderNo}, PalletCode: {palletCode}, Error: {ex.Message}");
+                throw new Exception($"浠诲姟娓呯悊澶辫触: {ex.Message}");
+            }
+        }
+        /// <summary>
+        /// 鏇存柊璁㈠崟鐩稿叧鏁版嵁
+        /// </summary>
+        private async Task UpdateOrderData(string orderNo, string palletCode)
+        {
+            try
+            {
+                // 妫�鏌ヨ鍗曟槸鍚﹁繕鏈夊叾浠栨墭鐩樺湪澶勭悊涓�
+                var otherActivePallets = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+                    .Where(x => x.OrderNo == orderNo &&
+                               x.PalletCode != palletCode &&
+                             (x.Status == (int)OutLockStockStatusEnum.鍑哄簱涓� || x.Status == (int)OutLockStockStatusEnum.鍥炲簱涓�))
+                    .AnyAsync();
+
+                var otherActiveTasks = await _taskRepository.Db.Queryable<Dt_Task>()
+                    .Where(x => x.OrderNo == orderNo &&
+                               x.PalletCode != palletCode
+                    // && x.TaskStatus.In((int)TaskStatusEnum.寰呮墽琛�, (int)TaskStatusEnum.鎵ц涓�)
+                     )
+                    .AnyAsync();
+
+                // 濡傛灉娌℃湁鍏朵粬鎵樼洏鍦ㄥ鐞嗭紝妫�鏌ヨ鍗曟槸鍚﹀簲璇ュ畬鎴�
+                if (!otherActivePallets && !otherActiveTasks)
+                {
+                    await CheckAndUpdateOrderCompletion(orderNo);
+                }
+                else
+                {
+                    _logger.LogInformation($"璁㈠崟 {orderNo} 杩樻湁鍏朵粬鎵樼洏鍦ㄥ鐞嗭紝涓嶆洿鏂拌鍗曠姸鎬�");
+                }
+
+                // 3. 鏇存柊鎷i�夎褰曠姸鎬侊紙鍙�夛級
+                await UpdatePickingRecordsStatus(orderNo, palletCode);
+
+            }
+            catch (Exception ex)
+            {
+                _logger.LogWarning($"鏇存柊璁㈠崟鏁版嵁澶辫触 - OrderNo: {orderNo}, PalletCode: {palletCode}, Error: {ex.Message}");
+                throw new Exception($"鏇存柊璁㈠崟鏁版嵁澶辫触: {ex.Message}");
+            }
+        }
+
+        /// <summary>
+        /// 妫�鏌ュ苟鏇存柊璁㈠崟瀹屾垚鐘舵��
+        /// </summary>
+        private async Task CheckAndUpdateOrderCompletion(string orderNo)
+        {
+            var orderDetails = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
+                .LeftJoin<Dt_OutboundOrder>((o, item) => o.OrderId == item.Id)
+                .Where((o, item) => item.OrderNo == orderNo)
+                .Select((o, item) => o)
+                .ToListAsync();
+
+            bool allCompleted = true;
+            foreach (var detail in orderDetails)
+            {
+                if (detail.OverOutQuantity < detail.NeedOutQuantity)
+                {
+                    allCompleted = false;
+                    break;
+                }
+            }
+
+            var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>()
+                .FirstAsync(x => x.OrderNo == orderNo);
+
+            if (outboundOrder != null && allCompleted && outboundOrder.OrderStatus != (int)OutOrderStatusEnum.鍑哄簱瀹屾垚)
+            {
+                outboundOrder.OrderStatus = (int)OutOrderStatusEnum.鍑哄簱瀹屾垚;
+                await _outboundOrderService.Db.Updateable(outboundOrder).ExecuteCommandAsync();
+
+                _logger.LogInformation($"璁㈠崟 {orderNo} 宸叉爣璁颁负鍑哄簱瀹屾垚");
+
+                // 鍚慚ES鍙嶉璁㈠崟瀹屾垚锛堝鏋滈渶瑕侊級
+                await HandleOrderCompletion(outboundOrder, orderNo);
+            }
+        }
+
+        /// <summary>
+        /// 鏇存柊鎷i�夎褰曠姸鎬�
+        /// </summary>
+        private async Task UpdatePickingRecordsStatus(string orderNo, string palletCode)
+        {
+            try
+            {
+                // 鍙互灏嗙浉鍏崇殑鎷i�夎褰曟爣璁颁负宸插畬鎴�
+                var pickingRecords = await Db.Queryable<Dt_PickingRecord>()
+                    .Where(x => x.OrderNo == orderNo && x.PalletCode == palletCode)
+                    .ToListAsync();
+
+                // 杩欓噷鍙互鏍规嵁闇�瑕佹洿鏂版嫞閫夎褰曠殑鐘舵�佸瓧娈�
+                // 渚嬪锛歱ickingRecord.Status = (int)PickingStatusEnum.宸插畬鎴�;
+
+                _logger.LogInformation($"鎵惧埌{pickingRecords.Count}鏉℃嫞閫夎褰� - 璁㈠崟: {orderNo}, 鎵樼洏: {palletCode}");
+
+            }
+            catch (Exception ex)
+            {
+                _logger.LogWarning($"鏇存柊鎷i�夎褰曠姸鎬佸け璐�: {ex.Message}");
+            }
+        }
+        #endregion
+
+
+
         #region 杈呭姪鏂规硶
+        /// <summary>
+        /// 缁熶竴鍒嗘瀽鎵樼洏鐘舵�� - 杩斿洖鎵樼洏鐨勫畬鏁寸姸鎬佷俊鎭�
+        /// </summary>
+        private async Task<PalletStatusAnalysis> AnalyzePalletStatus(string orderNo, string palletCode, int stockId)
+        {
+            var result = new PalletStatusAnalysis
+            {
+                OrderNo = orderNo,
+                PalletCode = palletCode,
+                StockId = stockId
+            };
+
+            // 1. 鍒嗘瀽鏈垎鎷g殑鍑哄簱閿佸畾璁板綍
+            var remainingLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+                .Where(it => it.OrderNo == orderNo &&
+                           it.PalletCode == palletCode &&
+                           it.Status == (int)OutLockStockStatusEnum.鍑哄簱涓�)
+                .ToListAsync();
+
+            if (remainingLocks.Any())
+            {
+                result.HasRemainingLocks = true;
+                result.RemainingLocks = remainingLocks;
+                result.RemainingLocksReturnQty = remainingLocks.Sum(x => x.AssignQuantity - x.PickedQty);
+            }
+
+            // 2. 鍒嗘瀽鎵樼洏涓婄殑搴撳瓨璐х墿
+            var palletStockGoods = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
+                .Where(it => it.StockId == stockId &&
+                     (it.Status == StockStatusEmun.鍏ュ簱纭.ObjToInt() ||
+                      it.Status == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() ||
+                      it.Status == StockStatusEmun.鍑哄簱閿佸畾.ObjToInt()))
+                .Where(it => it.StockQuantity > 0)
+                .ToListAsync();
+
+            if (palletStockGoods.Any())
+            {
+                result.HasPalletStockGoods = true;
+                result.PalletStockGoods = palletStockGoods;
+                result.PalletStockReturnQty = palletStockGoods.Sum(x => x.StockQuantity);
+            }
+
+            // 3. 鍒嗘瀽鎷嗗寘璁板綍
+            var splitRecords = await _splitPackageService.Db.Queryable<Dt_SplitPackageRecord>()
+                .Where(it => it.OrderNo == orderNo &&
+                           it.PalletCode == palletCode &&
+                           !it.IsReverted &&
+                           it.Status != (int)SplitPackageStatusEnum.宸插洖搴�)
+                .ToListAsync();
+
+            if (splitRecords.Any())
+            {
+                result.HasSplitRecords = true;
+                result.SplitRecords = splitRecords;
+                result.SplitReturnQty = await CalculateSplitReturnQuantity(splitRecords, stockId);
+            }
+
+            // 4. 璁$畻鎬诲洖搴撴暟閲忓拰绌烘墭鐩樼姸鎬�
+            result.TotalReturnQty = result.RemainingLocksReturnQty + result.PalletStockReturnQty + result.SplitReturnQty;
+            result.HasItemsToReturn = result.TotalReturnQty > 0;
+            result.IsEmptyPallet = !result.HasItemsToReturn;
+
+            // 5. 妫�鏌ユ槸鍚︽湁杩涜涓殑浠诲姟
+            result.HasActiveTasks = await _taskRepository.Db.Queryable<Dt_Task>()
+                .Where(x => x.OrderNo == orderNo && x.TaskType == TaskTypeEnum.InPick.ObjToInt() &&
+                           x.PalletCode == palletCode &&
+                           x.TaskStatus == (int)TaskStatusEnum.New)
+                .AnyAsync();
+
+            return result;
+        }
+
+        /// <summary>
+        /// 妫�鏌ユ墭鐩樻槸鍚︿负绌� 
+        /// </summary>
+        private async Task<bool> IsPalletEmpty(string orderNo, string palletCode)
+        {
+            try
+            {
+                // 鑾峰彇搴撳瓨淇℃伅
+                var stockInfo = await _stockInfoService.Db.Queryable<Dt_StockInfo>()
+                    .Where(x => x.PalletCode == palletCode)
+                    .FirstAsync();
+
+                if (stockInfo == null)
+                    return false;
+
+                // 浣跨敤缁熶竴鐨勭姸鎬佸垎鏋�
+                var statusAnalysis = await AnalyzePalletStatus(orderNo, palletCode, stockInfo.Id);
+                return statusAnalysis.IsEmptyPallet;
+            }
+            catch (Exception ex)
+            {
+                _logger.LogWarning($"妫�鏌ユ墭鐩樻槸鍚︿负绌哄け璐� - OrderNo: {orderNo}, PalletCode: {palletCode}, Error: {ex.Message}");
+                return false;
+            }
+        }
+        /// <summary>
+        /// 妫�鏌ュ苟澶勭悊绌烘墭鐩� 
+        /// </summary>
+        private async Task<bool> CheckAndHandleEmptyPallet(string orderNo, string palletCode)
+        {
+            try
+            {
+                // 1. 鑾峰彇搴撳瓨淇℃伅
+                var stockInfo = await _stockInfoService.Db.Queryable<Dt_StockInfo>()
+                    .Where(x => x.PalletCode == palletCode)
+                    .FirstAsync();
+
+                if (stockInfo == null)
+                {
+                    _logger.LogWarning($"鏈壘鍒版墭鐩� {palletCode} 鐨勫簱瀛樹俊鎭�");
+                    return false;
+                }
+
+                // 2. 浣跨敤缁熶竴鐨勭姸鎬佸垎鏋�
+                var statusAnalysis = await AnalyzePalletStatus(orderNo, palletCode, stockInfo.Id);
+
+                // 3. 妫�鏌ユ槸鍚︿负绌烘墭鐩樹笖娌℃湁杩涜涓殑浠诲姟
+                if (!statusAnalysis.IsEmptyPallet || statusAnalysis.HasActiveTasks)
+                {
+                    return false;
+                }
+
+                _logger.LogInformation($"妫�娴嬪埌绌烘墭鐩橈紝寮�濮嬭嚜鍔ㄥ鐞� - 璁㈠崟: {orderNo}, 鎵樼洏: {palletCode}");
+
+                //// 娓呯悊闆跺簱瀛樻暟鎹�
+                //await CleanupZeroStockData(stockInfo.Id);
+
+                //// 鏇存柊搴撳瓨涓昏〃鐘舵�佷负绌烘墭鐩�
+                //await UpdateStockInfoAsEmpty(stockInfo);
+
+                //// 澶勭悊鍑哄簱閿佸畾璁板綍
+                //await HandleOutStockLockRecords(orderNo, palletCode);
+
+                //// 澶勭悊浠诲姟鐘舵��
+                //await HandleTaskStatusForEmptyPallet(orderNo, palletCode);
+
+                //// 鏇存柊璁㈠崟鏁版嵁
+                //await UpdateOrderDataForEmptyPallet(orderNo, palletCode);
+
+                ////璁板綍鎿嶄綔鍘嗗彶
+                //await RecordAutoEmptyPalletOperation(orderNo, palletCode);
+
+                _logger.LogInformation($"绌烘墭鐩樿嚜鍔ㄥ鐞嗗畬鎴� - 璁㈠崟: {orderNo}, 鎵樼洏: {palletCode}");
+
+                return true;
+            }
+            catch (Exception ex)
+            {
+                _logger.LogError($"鑷姩澶勭悊绌烘墭鐩樺け璐� - OrderNo: {orderNo}, PalletCode: {palletCode}, Error: {ex.Message}");
+                return false;
+            }
+        }
 
         private async Task<string> GenerateNewBarcode()
         {
@@ -1506,10 +1895,10 @@
                 OriginalLockQuantity = quantity,
                 IsSplitted = 1,
                 ParentLockId = originalLock.Id,
-                Operator=  App.User.UserName,
-                FactoryArea=originalLock.FactoryArea,
-                lineNo=originalLock.lineNo,
-                WarehouseCode=originalLock.WarehouseCode,
+                Operator = App.User.UserName,
+                FactoryArea = originalLock.FactoryArea,
+                lineNo = originalLock.lineNo,
+                WarehouseCode = originalLock.WarehouseCode,
 
             };
 
@@ -1614,7 +2003,7 @@
             }
             return WebResponseContent.Instance.OK("鎷i�夌‘璁ゆ垚鍔�", new { SplitResults = new List<SplitResult>() });
         }
- 
+
         #endregion
     }
 
@@ -1668,6 +2057,32 @@
         public List<Dt_StockInfoDetail> PalletStockGoods { get; set; } = new List<Dt_StockInfoDetail>();
         public List<Dt_SplitPackageRecord> SplitRecords { get; set; } = new List<Dt_SplitPackageRecord>();
     }
+    public class PalletStatusAnalysis
+    {
+        public string OrderNo { get; set; }
+        public string PalletCode { get; set; }
+        public int StockId { get; set; }
 
+        // 鍥炲簱鐩稿叧灞炴��
+        public bool HasItemsToReturn { get; set; }
+        public bool HasRemainingLocks { get; set; }
+        public bool HasPalletStockGoods { get; set; }
+        public bool HasSplitRecords { get; set; }
+        public decimal RemainingLocksReturnQty { get; set; }
+        public decimal PalletStockReturnQty { get; set; }
+        public decimal SplitReturnQty { get; set; }
+        public decimal TotalReturnQty { get; set; }
+        public List<Dt_OutStockLockInfo> RemainingLocks { get; set; } = new List<Dt_OutStockLockInfo>();
+        public List<Dt_StockInfoDetail> PalletStockGoods { get; set; } = new List<Dt_StockInfoDetail>();
+        public List<Dt_SplitPackageRecord> SplitRecords { get; set; } = new List<Dt_SplitPackageRecord>();
+
+        // 绌烘墭鐩樼浉鍏冲睘鎬�
+        public bool IsEmptyPallet { get; set; }
+        public bool HasActiveTasks { get; set; }
+
+        // 渚垮埄鏂规硶
+        public bool CanReturn => HasItemsToReturn && !HasActiveTasks;
+        public bool CanRemove => IsEmptyPallet && !HasActiveTasks;
+    }
     #endregion
 }
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/StockInfoService.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/StockInfoService.cs"
index 5ff38f2..7303c19 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/StockInfoService.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/StockInfoService.cs"
@@ -254,6 +254,7 @@
                     LocationCode = a.LocationCode,
                     MaterielCode = b.MaterielCode,
                     MaterielName = b.MaterielName,
+                    Barcode=b.Barcode,
                     PalletCode = a.PalletCode,
                     UseableQuantity = b.StockQuantity - b.OutboundQuantity
                 }, a => locationCodes.Contains(a.LocationCode), b => b.StockQuantity > b.OutboundQuantity && b.MaterielCode == materielCode, x => true).GroupBy(x => x.PalletCode).Select(x => new StockSelectViewDTO
@@ -261,6 +262,7 @@
                     LocationCode = x.FirstOrDefault()?.LocationCode ?? "",
                     MaterielCode = x.FirstOrDefault()?.MaterielCode ?? "",
                     MaterielName = x.FirstOrDefault()?.MaterielName ?? "",
+                    Barcode=x.FirstOrDefault()?.Barcode??"",
                     PalletCode = x.Key,
                     UseableQuantity = x.Sum(x => x.UseableQuantity)
                 }).ToList();
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_TaskInfoService/TaskService_Outbound.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_TaskInfoService/TaskService_Outbound.cs"
index c2f08d2..8b0eb09 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_TaskInfoService/TaskService_Outbound.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_TaskInfoService/TaskService_Outbound.cs"
@@ -219,6 +219,7 @@
                         _outboundOrderService.Repository.UpdateData(outboundOrder);
                     }
                     outboundOrder.Operator = App.User.UserName;
+                    outboundOrder.OrderStatus = OutOrderStatusEnum.鍑哄簱涓�.ObjToInt();
                     _outboundOrderService.Repository.UpdateData(outboundOrder);
                     WebResponseContent content = _outboundOrderDetailService.LockOutboundStockDataUpdate(stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos, tasks: tasks);
 
@@ -239,6 +240,9 @@
                     {
                         _outboundOrderService.Repository.UpdateData(outboundOrder);
                     }
+                    outboundOrder.Operator = App.User.UserName;
+                    outboundOrder.OrderStatus = OutOrderStatusEnum.鍑哄簱涓�.ObjToInt();
+                    _outboundOrderService.Repository.UpdateData(outboundOrder);
                     _outboundOrderDetailService.Repository.UpdateData(outboundOrderDetails);
                 }
                 _unitOfWorkManage.CommitTran();
@@ -471,10 +475,10 @@
                 throw new Exception("鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅");
             }
 
-            if (stockSelectViews.Sum(x => x.UseableQuantity) > outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity)
-            {
-                throw new Exception("閫夋嫨鏁伴噺瓒呭嚭鍗曟嵁鏁伴噺");
-            }
+            //if (stockSelectViews.Sum(x => x.UseableQuantity) > outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity)
+            //{
+            //    throw new Exception("閫夋嫨鏁伴噺瓒呭嚭鍗曟嵁鏁伴噺");
+            //}
             List<Dt_StockInfo>? stockInfos = null;
             Dt_OutboundOrderDetail? orderDetail = null;
             List<Dt_OutStockLockInfo>? outStockLockInfos = null;
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_WMSServer/Controllers/Outbound/OutboundPickingController.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_WMSServer/Controllers/Outbound/OutboundPickingController.cs"
index dd51866..35c2dc3 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_WMSServer/Controllers/Outbound/OutboundPickingController.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_WMSServer/Controllers/Outbound/OutboundPickingController.cs"
@@ -91,13 +91,20 @@
             return await Service.ReturnRemaining(dto.OrderNo, dto.PalletCode, "");
         }
 
+        [HttpPost("remove-empty-pallet")]
+        public async Task<WebResponseContent> RemoveEmptyPallet ([FromBody] ConfirmPickingDto dto)
+        {
+            return await Service.RemoveEmptyPallet(dto.OrderNo, dto.PalletCode);
+        }
+
+
         //[HttpPost("direct-outbound")]
         //public async Task<WebResponseContent> DirectOutbound([FromBody] DirectOutboundRequest dto)
         //{
         //   return await Service.DirectOutbound(dto);
- 
+
         //} 
- 
+
         /// <summary>
         /// 鎾ら攢鎷i��
         /// </summary>

--
Gitblit v1.9.3