From e7dac9ecb16aa627f0603beec9930c75ee6aa3f7 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期四, 08 一月 2026 22:22:24 +0800
Subject: [PATCH] 盘点

---
 项目代码/WIDESEA_WMSClient/src/views/inbound/takeStockOrder.vue                                      |    8 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/MESOperation/FeedbackMesService.cs           |    4 
 项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/TakeStockSelect.vue                          |  288 ++++++++++++++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundPickingService.cs               |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs                          |    6 
 项目代码/WIDESEA_WMSClient/src/views/inbound/takeStockOrderDetail.vue                                |   18 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_TakeStockOrderDetail.cs           |    7 
 项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/OrderStockTake.vue                           |   83 +++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IInboundService/ITakeStockOrderService.cs                 |    9 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs                     |    3 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/WIDESEA_InboundService.csproj              |    1 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/TakeStockStatusEnum.cs                   |   28 
 项目代码/WIDESEA_WMSClient/src/extension/inbound/takeStockOrderDetail.js                             |  251 ++++++++++---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs                   |  301 +++++++++++++++-
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/TakeStockOrderController.cs |   31 +
 15 files changed, 926 insertions(+), 114 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/OrderStockTake.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/OrderStockTake.vue"
index aa90c8e..eb61cbc 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/OrderStockTake.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/OrderStockTake.vue"
@@ -61,6 +61,35 @@
             </el-input>
           </el-form-item>
 
+          <!-- 鏂板锛氱珯鍙伴�夋嫨涓嬫媺妗� -->
+          <el-form-item
+            label="鍥炲簱绔欏彴锛�"
+            name="station"
+            :rules="[
+              {
+                required: true,
+                message: '璇烽�夋嫨鍥炲簱绔欏彴',
+                trigger: 'blur',
+              },
+            ]"
+            class="form-item"
+          >
+            <el-select
+              v-model="selectedStation"
+              placeholder="璇烽�夋嫨鍥炲簱绔欏彴"
+              :disabled="!formData.boxNo.trim() || loading"
+              class="custom-input"
+              :class="{ 'has-value': selectedStation }"
+            >
+              <el-option
+                v-for="item in stations"
+                :key="item.key || item.value"
+                :label="item.label"
+                :value="item.value"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+
           <!-- 鏉$爜杈撳叆妗� -->
           <el-form-item
             label="鐩樼偣鏉$爜锛�"
@@ -147,7 +176,7 @@
             type="info"
             size="small"
             @click="handleBoxReturn"
-            :disabled="!formData.boxNo.trim() || loading"
+            :disabled="!formData.boxNo.trim() || !selectedStation || loading"
             class="return-btn"
           >
             <Return /> 鏂欑鍥炲簱
@@ -188,6 +217,8 @@
 
 import VolBox from "@/components/basic/VolBox.vue";
 import http from "@/api/http";
+// 鏂板锛氬紩鍏ョ珯鍙扮鐞嗗伐鍏凤紙鍜岀ず渚嬩唬鐮佷繚鎸佷竴鑷达級
+import { stationManager, STATION_STORAGE_KEY } from "@/../src/uitils/stationManager";
 
 // 鍝嶅簲寮忓彉閲� - 鍗曟嵁鍙�
 const orderNo = ref("");
@@ -205,6 +236,13 @@
 });
 const loading = ref(false);
 const formRef = ref(null);
+
+// 鏂板锛氱珯鍙扮浉鍏冲搷搴斿紡鏁版嵁锛堜豢鐓хず渚嬩唬鐮侊級
+const stations = ref([
+  { label: "绔欏彴2", value: "2-1" },
+  { label: "绔欏彴3", value: "3-1" },
+]);
+const selectedStation = ref(stationManager.getStation() || ""); // 榛樿閫変腑缂撳瓨鐨勭珯鍙�
 
 // 妯℃澘寮曠敤
 const boxNoInputRef = ref(null);
@@ -232,6 +270,8 @@
       formData.barcode = "";
       formData.stockQuantity = "";
       formData.actualQuantity = "";
+      // 鏂板锛氭枡绠卞彿娓呯┖鏃讹紝閲嶇疆绔欏彴閫夋嫨
+      selectedStation.value = stationManager.getStation() || "";
     }
   },
   { immediate: true }
@@ -257,6 +297,8 @@
   formData.barcode = "";
   formData.stockQuantity = "";
   formData.actualQuantity = "";
+  // 鏂板锛氭墦寮�寮圭獥鏃堕噸缃珯鍙伴�夋嫨锛堥粯璁ゅ彇缂撳瓨鐨勭珯鍙帮級
+  selectedStation.value = stationManager.getStation() || "";
   nextTick(() => {
     boxNoInputRef.value?.focus();
   });
@@ -468,16 +510,21 @@
   }
 };
 
-// 鏂欑鍥炲簱鍔熻兘
+// 鏂欑鍥炲簱鍔熻兘锛堟牳蹇冧慨鏀癸細澧炲姞绔欏彴楠岃瘉 + 浼犲叆sourceAddress鍙傛暟锛�
 const handleBoxReturn = async () => {
   const boxNo = formData.boxNo.trim();
+  // 鏂板锛氶獙璇佺珯鍙版槸鍚﹂�夋嫨
   if (!boxNo) {
     ElMessage.warning("璇峰厛杈撳叆鎴栨壂鎻忔枡绠卞彿");
     return;
   }
+  if (!selectedStation.value) {
+    ElMessage.warning("璇烽�夋嫨鍥炲簱绔欏彴");
+    return;
+  }
 
   try {
-    await ElMessageBox.confirm(`纭畾灏嗘枡绠便��${boxNo}銆戝洖搴撳悧锛焋, "鍥炲簱纭", {
+    await ElMessageBox.confirm(`纭畾灏嗘枡绠便��${boxNo}銆戝洖搴撹嚦銆�${selectedStation.value}銆戠珯鍙板悧锛焋, "鍥炲簱纭", {
       confirmButtonText: "纭畾",
       cancelButtonText: "鍙栨秷",
       type: "info",
@@ -488,19 +535,21 @@
 
     loading.value = true;
 
+    // 鏂板锛氭嫾鎺ourceAddress鍙傛暟锛堢珯鍙版暟鎹級鍒版帴鍙h姹備腑
     const res = await http.post(
       `/api/TakeStockOrder/ReturnBox?boxNo=${encodeURIComponent(boxNo)}&orderNo=${encodeURIComponent(
         orderNo.value
-      )}`,
+      )}&sourceAddress=${encodeURIComponent(selectedStation.value)}`, // 鏂板sourceAddress鍙傛暟
       "鏂欑鍥炲簱涓�..."
     );
 
     if (res.status) {
-      ElMessage.success(`鏂欑銆�${boxNo}銆戝洖搴撴垚鍔燂紒`);
+      ElMessage.success(`鏂欑銆�${boxNo}銆戝洖搴撹嚦銆�${selectedStation.value}銆戠珯鍙版垚鍔燂紒`);
       formData.boxNo = "";
       formData.barcode = "";
       formData.stockQuantity = "";
       formData.actualQuantity = "";
+      selectedStation.value = stationManager.getStation() || ""; // 閲嶇疆绔欏彴閫夋嫨
       nextTick(() => {
         boxNoInputRef.value?.focus();
       });
@@ -588,13 +637,15 @@
 }
 
 /* 鏈夊�兼椂闅愯棌鍗犱綅绗� + 浼樺寲杈规 */
-.custom-input.has-value :deep(.el-input__inner) {
+.custom-input.has-value :deep(.el-input__inner),
+.custom-input.has-value :deep(.el-select__wrapper) {
   --el-input-placeholder-color: transparent; /* 闅愯棌鍗犱綅绗� */
   border-color: #8cc5ff; /* 娴呰摑杈规锛屽尯鍒嗘棤鍊肩姸鎬� */
   background-color: #ffffff;
 }
 
-.custom-input :deep(.el-input__inner) {
+.custom-input :deep(.el-input__inner),
+.custom-input :deep(.el-select__wrapper) {
   border-radius: 8px;
   border-color: #e5f0fa;
   transition: all 0.2s ease;
@@ -606,7 +657,8 @@
 }
 
 /* 鑱氱劍鏍峰紡浼樺寲 */
-.custom-input :deep(.el-input__inner:focus) {
+.custom-input :deep(.el-input__inner:focus),
+.custom-input :deep(.el-select__wrapper:focus) {
   border-color: #409eff;
   box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
   background-color: #ffffff;
@@ -666,7 +718,8 @@
 }
 
 /* 鏈夊�兼椂鍗充娇楠岃瘉澶辫触锛屼篃涓嶆樉绀洪敊璇竟妗� */
-.custom-input.has-value :deep(.el-input__inner.el-input__inner--error) {
+.custom-input.has-value :deep(.el-input__inner.el-input__inner--error),
+.custom-input.has-value :deep(.el-select__wrapper.el-select__wrapper--error) {
   border-color: #8cc5ff;
   box-shadow: none;
 }
@@ -807,22 +860,26 @@
 }
 
 /* 鍗犱綅绗︽牱寮� - 缁熶竴棰滆壊 */
-.el-input__inner::-webkit-input-placeholder {
+.el-input__inner::-webkit-input-placeholder,
+.el-select__placeholder {
   color: #b3d8ff;
   font-size: 13px;
 }
 
-.el-input__inner::-moz-placeholder {
+.el-input__inner::-moz-placeholder,
+.el-select__placeholder {
   color: #b3d8ff;
   font-size: 13px;
 }
 
-.el-input__inner:-ms-input-placeholder {
+.el-input__inner:-ms-input-placeholder,
+.el-select__placeholder {
   color: #b3d8ff;
   font-size: 13px;
 }
 
-.el-input__inner::placeholder {
+.el-input__inner::placeholder,
+.el-select__placeholder {
   color: #b3d8ff;
   font-size: 13px;
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/TakeStockSelect.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/TakeStockSelect.vue"
new file mode 100644
index 0000000..3607f6e
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/TakeStockSelect.vue"
@@ -0,0 +1,288 @@
+<template>
+  <el-dialog
+    v-model="dialogVisible"
+    title="鏉傛敹鏉傚彂骞宠处"
+    width="1000px"
+    :close-on-click-modal="false"
+    :destroy-on-close="true"
+    @closed="handleDialogClosed"
+  >
+    <div class="reconciliation-container">
+      <!-- 鍗曟嵁鍩烘湰淇℃伅 -->
+      <div class="order-info">
+        <div class="info-row">
+          <span class="label">鍗曟嵁ID锛�</span>
+          <span class="value">{{ currentRow.id || '-' }}</span>
+        </div>
+        <div class="info-row" v-if="selectedItem">
+          <span class="label">宸查�夎鍗曪細</span>
+          <span class="value selected-order">{{ selectedItem.orderId }}</span>
+        </div>
+      </div>
+
+      <!-- 鏁版嵁鍒楄〃灞曠ず -->
+      <el-scrollbar height="400px" class="custom-scrollbar">
+        <transition-group name="data-item-transition">
+          <div class="data-item" v-for="(item, index) in displayData" :key="`${item.orderId}-${index}`">
+            <div class="radio-container">
+              <el-radio 
+                v-model="selectedItem" 
+                :label="item"
+                :value="item"
+                @change="handleRadioChange(item)"
+              >
+                <!-- 鍗曢�夋寜閽殑鍐呭鐣欑┖锛屽彧鏄剧ず鍗曢�夋寜閽� -->
+              </el-radio>
+            </div>
+            <div class="data-detail">
+              <div class="detail-row">
+                <span class="label">璁㈠崟ID锛�</span>
+                <span class="value">{{ item.orderId || '-' }}</span>
+              </div>
+              <div class="detail-row">
+                <span class="label">鐗╂枡缂栫爜锛�</span>
+                <span class="value">{{ item.materielCode || '-' }}</span>
+              </div>
+              <div class="detail-row">
+                <span class="label">鐗╂枡鍚嶇О锛�</span>
+                <span class="value">{{ item.materielName || '-' }}</span>
+              </div>
+              <div class="detail-row">
+                <span class="label">鎵规鍙凤細</span>
+                <span class="value">{{ item.batchNo || '-' }}</span>
+              </div>
+              <div class="detail-row">
+                <span class="label">璁㈠崟鏁伴噺锛�</span>
+                <span class="value">{{ item.orderQuantity || 0 }}</span>
+              </div>
+              <div class="detail-row">
+                <span class="label">鍗曚綅锛�</span>
+                <span class="value">{{ item.unit || '-' }}</span>
+              </div>
+              <div class="detail-row">
+                <span class="label">渚涘簲鍟嗙紪鐮侊細</span>
+                <span class="value">{{ item.supplyCode || '-' }}</span>
+              </div>
+              <div class="detail-row">
+                <span class="label">浠撳簱缂栫爜锛�</span>
+                <span class="value">{{ item.warehouseCode || '-' }}</span>
+              </div>
+            </div>
+          </div>
+        </transition-group>
+        <div class="empty-tip" v-if="displayData.length === 0">
+          <span>鏆傛棤鐩稿叧鏁版嵁</span>
+        </div>
+      </el-scrollbar>
+    </div>
+
+    <template #footer>
+      <el-button @click="dialogVisible = false">鍏抽棴</el-button>
+      <el-button 
+        type="primary" 
+        @click="handleConfirm"
+        :disabled="!selectedItem"
+        :loading="loading"
+      >
+        {{ loading ? '骞宠处涓�...' : '纭骞宠处' }}
+      </el-button>
+    </template>
+  </el-dialog>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+import { ElMessage, ElMessageBox } from 'element-plus';
+// 鏍规嵁鎮ㄧ殑瀹為檯椤圭洰寮曞叆璇锋眰鏂规硶锛岃繖閲屼娇鐢╝xios浣滀负绀轰緥
+import axios from 'axios';
+
+// 寮圭獥鏄剧ず鐘舵��
+const dialogVisible = ref(false);
+// 褰撳墠閫変腑鐨勮鏁版嵁
+const currentRow = ref({});
+// 瑕佸睍绀虹殑鏁版嵁鍒楄〃
+const displayData = ref([]);
+// 閫変腑鐨勬暟鎹」
+const selectedItem = ref(null);
+// 鍔犺浇鐘舵��
+const loading = ref(false);
+
+// 鎵撳紑寮圭獥鏂规硶锛堜緵鐖剁粍浠惰皟鐢級
+const open = (row, data) => {
+  currentRow.value = row;
+  displayData.value = data;
+  selectedItem.value = null; // 閲嶇疆閫夋嫨
+  dialogVisible.value = true;
+};
+
+// 澶勭悊鍗曢�夋寜閽彉鍖�
+const handleRadioChange = (item) => {
+  selectedItem.value = item;
+};
+
+// 寮圭獥鍏抽棴鏃剁殑澶勭悊
+const handleDialogClosed = () => {
+  selectedItem.value = null;
+  loading.value = false;
+};
+
+// 纭骞宠处鎿嶄綔
+const handleConfirm = async () => {
+  if (!selectedItem.value) {
+    ElMessage.warning('璇烽�夋嫨涓�鏉℃暟鎹繘琛屽钩璐﹀鐞�');
+    return;
+  }
+
+  try {
+    // 纭鎻愮ず
+    await ElMessageBox.confirm(
+      `纭畾瑕佸璁㈠崟 ${selectedItem.value.orderId} 杩涜骞宠处澶勭悊鍚楋紵`,
+      '骞宠处纭',
+      {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning',
+      }
+    );
+
+    loading.value = true;
+    
+    // 璋冪敤骞宠处鎺ュ彛
+    const params = {
+      id: currentRow.value.id, // 琛孖D
+      orderId: selectedItem.value.orderId // 閫夋嫨鐨勫崟鎹畂rderId
+    };
+
+    // 鏍规嵁鎮ㄧ殑鎺ュ彛瀹為檯鎯呭喌璋冩暣璇锋眰鏂瑰紡
+    const response = await axios.get('/api/TakeStockOrder/DocumentReconciliation', {
+      params: params // GET璇锋眰浼犲弬
+      // 濡傛灉鏄疨OST璇锋眰锛屽彲浠ヨ繖鏍峰啓锛�
+      // data: params
+    });
+
+    if (response.status) {
+      ElMessage.success('骞宠处鎿嶄綔鎴愬姛');
+      dialogVisible.value = false;
+      
+      // 鍙互閫氳繃emit閫氱煡鐖剁粍浠跺埛鏂拌〃鏍�
+      // emit('refresh-table');
+    } else {
+    }
+  } catch (error) {
+    // 濡傛灉鏄敤鎴峰彇娑堟搷浣滐紝涓嶆樉绀洪敊璇俊鎭�
+    if (error === 'cancel' || error === 'close') {
+      return;
+    }
+    
+    ElMessage.error('骞宠处鎿嶄綔澶辫触锛岃绋嶅悗閲嶈瘯');
+  } finally {
+    loading.value = false;
+  }
+};
+
+// 鏆撮湶鏂规硶缁欑埗缁勪欢
+defineExpose({
+  open
+});
+</script>
+
+<style scoped>
+.reconciliation-container {
+  padding: 10px 0;
+}
+
+.order-info {
+  margin-bottom: 20px;
+  padding: 10px;
+  background: #f5f7fa;
+  border-radius: 4px;
+  display: flex;
+  flex-wrap: wrap;
+  gap: 20px;
+}
+
+.info-row {
+  display: flex;
+  align-items: center;
+}
+
+.label {
+  font-weight: 600;
+  color: #606266;
+  margin-right: 5px;
+  min-width: 80px;
+  text-align: right;
+}
+
+.value {
+  color: #303133;
+}
+
+.selected-order {
+  color: #409EFF;
+  font-weight: 600;
+}
+
+.custom-scrollbar {
+  border: 1px solid #e4e7ed;
+  border-radius: 4px;
+}
+
+.data-item {
+  display: flex;
+  align-items: flex-start;
+  padding: 15px;
+  margin: 10px;
+  background: #fff;
+  border: 1px solid #e4e7ed;
+  border-radius: 4px;
+  transition: all 0.3s;
+}
+
+.data-item:hover {
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+}
+
+.data-item.selected {
+  border-color: #409EFF;
+  background-color: #f0f7ff;
+}
+
+.radio-container {
+  margin-right: 12px;
+  margin-top: 4px;
+}
+
+.data-detail {
+  display: grid;
+  grid-template-columns: repeat(2, 1fr);
+  gap: 10px;
+  flex: 1;
+}
+
+.detail-row {
+  display: flex;
+  align-items: center;
+}
+
+.empty-tip {
+  text-align: center;
+  padding: 50px 0;
+  color: #909399;
+}
+
+.data-item-transition-enter-from,
+.data-item-transition-leave-to {
+  opacity: 0;
+  transform: translateY(10px);
+}
+
+.data-item-transition-enter-active,
+.data-item-transition-leave-active {
+  transition: all 0.3s ease;
+}
+
+:deep(.el-radio__label) {
+  display: none;
+}
+</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/inbound/takeStockOrderDetail.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/takeStockOrderDetail.js"
index 24e1d94..1bfba85 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/takeStockOrderDetail.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/takeStockOrderDetail.js"
@@ -1,58 +1,201 @@
-
-//姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜
+// 鑷畾涔夋墿灞曚笟鍔′唬鐮�
+import gridBody from "./extend/OrderStockTake.vue";
+// 寮曞叆鏉傛敹鏉傚彂骞宠处寮圭獥缁勪欢
+import gridHeader from "./extend/TakeStockSelect.vue";
+import { ElMessageBox, ElLoading, ElMessage } from "element-plus";
 
 let extension = {
-    components: {
-      //鏌ヨ鐣岄潰鎵╁睍缁勪欢
-      gridHeader: '',
-      gridBody: '',
-      gridFooter: '',
-      //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢
-      modelHeader: '',
-      modelBody: '',
-      modelFooter: ''
-    },
-    tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓)
-    buttons: { view: [], box: [], detail: [] }, //鎵╁睍鐨勬寜閽�
-    methods: {
-       //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄�
-      onInit() {  
-      },
-      onInited() {
-        //妗嗘灦鍒濆鍖栭厤缃悗
-        //濡傛灉瑕侀厤缃槑缁嗚〃,鍦ㄦ鏂规硶鎿嶄綔
-        //this.detailOptions.columns.forEach(column=>{ });
-      },
-      searchBefore(param) {
-        //鐣岄潰鏌ヨ鍓�,鍙互缁檖aram.wheres娣诲姞鏌ヨ鍙傛暟
-        //杩斿洖false锛屽垯涓嶄細鎵ц鏌ヨ
-        return true;
-      },
-      searchAfter(result) {
-        //鏌ヨ鍚庯紝result杩斿洖鐨勬煡璇㈡暟鎹�,鍙互鍦ㄦ樉绀哄埌琛ㄦ牸鍓嶅鐞嗚〃鏍肩殑鍊�
-        return true;
-      },
-      addBefore(formData) {
-        //鏂板缓淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛紝鍙互缁欑粰琛ㄥ崟璁剧疆鍊硷紝鑷繁杈撳嚭鐪媐ormData鐨勫��
-        return true;
-      },
-      updateBefore(formData) {
-        //缂栬緫淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛ㄣ�佸垹闄よ鐨処d
-        return true;
-      },
-      rowClick({ row, column, event }) {
-        //鏌ヨ鐣岄潰鐐瑰嚮琛屼簨浠�
-        this.$refs.table.$refs.table.toggleRowSelection(row); //鍗曞嚮琛屾椂閫変腑褰撳墠琛�;
-      },
-      modelOpenAfter(row) {
-        //鐐瑰嚮缂栬緫銆佹柊寤烘寜閽脊鍑烘鍚庯紝鍙互鍦ㄦ澶勫啓閫昏緫锛屽锛屼粠鍚庡彴鑾峰彇鏁版嵁
-        //(1)鍒ゆ柇鏄紪杈戣繕鏄柊寤烘搷浣滐細 this.currentAction=='Add';
-        //(2)缁欏脊鍑烘璁剧疆榛樿鍊�
-        //(3)this.editFormFields.瀛楁='xxx';
-        //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊�
-        //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions)
+  components: {
+    // 鏌ヨ鐣岄潰鎵╁睍缁勪欢
+    gridHeader: gridHeader,
+    gridBody: gridBody, // 鍘熸湁鐩樼偣寮圭獥缁勪欢
+    gridFooter: '',
+    modelHeader: '',
+    modelBody: '',
+    modelFooter: ''
+  },
+  tableAction: '', // 鏃犻渶鎸囧畾琛ㄥ悕
+  buttons: { view: [], box: [], detail: [] }, // 鎵╁睍鎸夐挳
+  methods: {
+    onInit() {
+      // 鍘熸湁鐩樼偣鎸夐挳閫昏緫淇濈暀
+      let OrderStockTakeBtn = this.buttons.find(x => x.value === 'OrderStockTake');
+      if (OrderStockTakeBtn) {
+        OrderStockTakeBtn.onClick = function () {
+          let rows = this.$refs.table.getSelected();
+          if (rows.length === 0) return this.$error("璇烽�夋嫨涓�鏉$洏鐐瑰崟鎹暟鎹紒");
+          if (rows.length > 1) return this.$error("鍙兘閫夋嫨涓�鏉$洏鐐瑰崟鎹暟鎹紒");
+          
+          const selectedReceiptNo = rows[0].orderNo;
+          if (!selectedReceiptNo) return this.$error("閫変腑鐨勫崟鎹己灏戞湁鏁堢殑鍗曟嵁鍙凤紒");
+          this.$refs.gridBody.open(selectedReceiptNo);
+        };
       }
+
+      // 鐩戝惉鍘熸湁寮圭獥浜嬩欢锛堜繚鐣欙級
+      this.$nextTick(() => {
+        const stockTakeComp = this.$refs.gridBody;
+        if (stockTakeComp) {
+          stockTakeComp.$on('refresh', () => {
+            this.$refs.table.reload();
+          });
+          stockTakeComp.$on('box-returned', (boxNo) => {
+            this.$success(`鏂欑銆�${boxNo}銆戝洖搴撴垚鍔燂紝琛ㄦ牸灏嗗埛鏂帮紒`);
+            this.$refs.table.reload();
+          });
+        }
+        
+      });
+
+      // ========== 鏂板鎿嶄綔鍒楋細浜哄伐骞宠处 + 鏉傛敹鏉傚彂骞宠处 ==========
+      this.columns.push({
+        field: 'operation',
+        title: '鎿嶄綔',
+        width: 200,
+        fixed: 'right',
+        align: 'center',
+        formatter: (row) => {
+          return `
+            <span style="cursor: pointer;color: #2d8cf0;margin-right: 10px;" class="manual-reconciliation">
+              <i class="el-icon-check"></i>浜哄伐骞宠处
+            </span>
+            <span style="cursor: pointer;color: #1989fa;" class="misc-reconciliation">
+              <i class="el-icon-edit"></i>鏉傛敹鏉傚彂骞宠处
+            </span>
+          `;
+        },
+        click: (row, column, event) => {
+          const target = event.target;
+          // 鍖哄垎鐐瑰嚮鐨勬槸浜哄伐骞宠处杩樻槸鏉傛敹鏉傚彂骞宠处
+          if (target.closest('.manual-reconciliation')) {
+            this.handleManualReconciliation(row); // 浜哄伐骞宠处閫昏緫
+          } else if (target.closest('.misc-reconciliation')) {
+            this.handleMiscReconciliation(row); // 鏉傛敹鏉傚彂骞宠处閫昏緫
+          }
+        }
+      });
+    },
+
+    // ========== 浜哄伐骞宠处鏍稿績閫昏緫 ==========
+    handleManualReconciliation(row) {
+      // 寮瑰嚭纭妗�
+      ElMessageBox.confirm(
+        '纭瑕佹墽琛屼汉宸ュ钩璐︽搷浣滃悧锛�',
+        '鎿嶄綔纭',
+        {
+          confirmButtonText: '纭',
+          cancelButtonText: '鍙栨秷',
+          type: 'warning'
+        }
+      ).then(async () => {
+        // 娣诲姞閬僵灞傞槻姝㈤噸澶嶇偣鍑�
+        const loading = ElLoading.service({
+          lock: true,
+          text: '澶勭悊涓紝璇风◢鍊�...',
+          background: 'rgba(0, 0, 0, 0.7)'
+        });
+
+        try {
+          // 璋冪敤浜哄伐骞宠处鎺ュ彛
+          const response = await this.http.get(`/api/TakeStockOrder/ManualReconciliation?id=${row.id}`);
+          if (response.status) {
+            ElMessage.success('浜哄伐骞宠处鎿嶄綔鎴愬姛锛�');
+            this.$refs.table.reload(); // 鍒锋柊琛ㄦ牸
+          } else {
+            ElMessage.error(`鎿嶄綔澶辫触锛�${response.message || '鏈煡閿欒'}`);
+          }
+        } catch (error) {
+        } finally {
+          // 鍏抽棴閬僵灞�
+          loading.close();
+        }
+      }).catch(() => {
+        ElMessage.info('宸插彇娑堜汉宸ュ钩璐︽搷浣�');
+      });
+    },
+
+    // ========== 鏉傛敹鏉傚彂骞宠处鏍稿績閫昏緫锛堜慨鏀瑰悗锛� ==========
+    handleMiscReconciliation(row) {
+      // 閫変腑褰撳墠琛�
+      const table = this.$refs.table.$refs.table;
+      if (table) {
+        table.clearSelection();
+        table.toggleRowSelection(row, true);
+      }
+
+      // 璋冪敤鎺ュ彛鑾峰彇鏉傛敹鏉傚彂骞宠处鏁版嵁
+      const fetchMiscData = async () => {
+        const loading = ElLoading.service({
+          lock: true,
+          text: '鍔犺浇鏁版嵁涓�...',
+          background: 'rgba(0, 0, 0, 0.7)'
+        });
+
+        try {
+          // 璋冪敤鎺ュ彛锛屼紶閫抮ow涓殑remark鍜宨d鍙傛暟
+          const response = await this.http.get(`/api/TakeStockOrder/SelectOrder?remark=${row.remark || ''}&id=${row.id}`);
+          loading.close();
+          
+          if (response.status) {
+            if (!Array.isArray(response.data) || response.data.length === 0) {
+              ElMessage.warning("鏈煡璇㈠埌鐩稿叧鏁版嵁");
+              // 鎵撳紑绌烘暟鎹殑寮圭獥
+              this.$refs.gridHeader.open(row, []);
+              return;
+            }
+
+            // 鎻愬彇闇�瑕佸睍绀虹殑瀛楁
+            const displayData = response.data.map(item => ({
+              orderId: item.orderId || '',
+              materielCode: item.materielCode || '',
+              materielName: item.materielName || '',
+              batchNo: item.batchNo || '',
+              orderQuantity: item.orderQuantity || 0,
+              unit: item.unit || '',
+              supplyCode: item.supplyCode || '',
+              warehouseCode: item.warehouseCode || ''
+            }));
+
+            // 鎵撳紑寮圭獥骞朵紶閫掑鐞嗗悗鐨勬暟鎹�
+            this.$refs.gridHeader.open(row, displayData);
+          } else {
+            ElMessage.error(`鏌ヨ澶辫触锛�${response.message || '鏈煡閿欒'}`);
+          }
+        } catch (error) {
+          loading.close();
+          ElMessage.error(`缃戠粶寮傚父锛�${error.message || '鎺ュ彛璋冪敤澶辫触'}`);
+        }
+      };
+
+      // 鎵ц鏁版嵁鏌ヨ骞舵墦寮�寮圭獥
+      fetchMiscData();
+    },
+
+    onInited() {
+      // 妗嗘灦鍒濆鍖栧畬鎴愬悗鎵ц
+    },
+    searchBefore(param) {
+      // 鏌ヨ鍓嶆嫤鎴�
+      return true;
+    },
+    searchAfter(result) {
+      // 鏌ヨ鍚庢暟鎹鐞�
+      return true;
+    },
+    addBefore(formData) {
+      return true;
+    },
+    updateBefore(formData) {
+      return true;
+    },
+    rowClick({ row, column, event }) {
+      // 鍗曞嚮琛岄�変腑褰撳墠琛�
+      this.$refs.table.$refs.table.toggleRowSelection(row);
+    },
+    modelOpenAfter(row) {
+      // 鏂板缓/缂栬緫寮圭獥鎵撳紑鍚庡鐞�
     }
-  };
-  export default extension;
-  
\ No newline at end of file
+  }
+};
+
+export default extension;
\ No newline at end of file
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/takeStockOrder.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/takeStockOrder.vue"
index 88f8af2..b40ecb1 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/takeStockOrder.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/takeStockOrder.vue"
@@ -40,7 +40,15 @@
       });
       const searchFormOptions = ref([
         [
+        { title: "鎵�鍚洏鐐规墭鐩�", field: "allPalletCode", type: "like" },
         { title: "鍗曟嵁缂栧彿", field: "orderNo", type: "like" },
+        {
+          field: "takeStockStatus",
+          title: "鐩樼偣鐘舵��",
+          type: "select",
+          dataKey: "takeStockStatusEnum", 
+          data: [] ,
+        },
         ]
       ]);
   
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/takeStockOrderDetail.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/takeStockOrderDetail.vue"
index 28acfed..995ced3 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/takeStockOrderDetail.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/takeStockOrderDetail.vue"
@@ -50,9 +50,16 @@
         { title: "鏉$爜", field: "barcode", type: "like" },
         { title: "浠撳簱", field: "warehouseCode", type: "like" },
         { title: "鍘傚尯", field: "factoryArea", type: "like" },
-        { title: "渚涘簲鍟嗙紪鍙�", field: "supplyCode", type: "like" },
+        {
+          field: "takeDetalStatus",
+          title: "鐩樼偣鏄庣粏鐘舵��",
+          type: "select",
+          dataKey: "takeStockDetailStatusEnum", 
+          data: [] ,
+        },
         ],
         [
+        { title: "渚涘簲鍟嗙紪鍙�", field: "supplyCode", type: "like" },
         { title: "鍒涘缓浜�", field: "creater", type: "like" },
         { title: "鍒涘缓鏃堕棿", field: "createDate", type: "datetime" },
         ]
@@ -172,6 +179,15 @@
             edit: { type: "decimal" }
           },
           {
+            field: "differenceQty",
+            title: "寰呭钩璐︽暟閲�",
+            type: "decimal",
+            width: 90,
+            align: "left",
+            required: true,
+            edit: { type: "decimal" }
+          },
+          {
             field: "unit",
             title: "鍗曚綅",
             type: "string",
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/MESOperation/FeedbackMesService.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/MESOperation/FeedbackMesService.cs"
index bc18e9c..fc049c4 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/MESOperation/FeedbackMesService.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/MESOperation/FeedbackMesService.cs"
@@ -98,7 +98,7 @@
 
                     if (returnDTO.Details.Count <= 0)
                     {
-                        return webResponse = WebResponseContent.Instance.Error($"璇ュ崟鎹棤鏄庣粏鍙洖浼�");
+                        return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x=>x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
                     }
 
                     string apiUrl = AppSettings.GetValue("MaterialOutboundFeedbackUrl");
@@ -129,7 +129,7 @@
 
                     if (returnDTO.Details.Count <= 0)
                     {
-                        return webResponse = WebResponseContent.Instance.Error($"璇ュ崟鎹棤鏄庣粏鍙洖浼�");
+                        return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
                     }
 
                     string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl"); ;
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_Common/OrderEnum/TakeStockStatusEnum.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_Common/OrderEnum/TakeStockStatusEnum.cs"
index cf918d8..bcca560 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_Common/OrderEnum/TakeStockStatusEnum.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_Common/OrderEnum/TakeStockStatusEnum.cs"
@@ -33,8 +33,8 @@
         /// <summary>
         /// 鐩樼偣鍏抽棴
         /// </summary>
-        [Description("鐩樼偣鍏抽棴")]
-        鐩樼偣鍏抽棴 = 3,
+        //[Description("鐩樼偣鍏抽棴")]
+        //鐩樼偣鍏抽棴 = 3,
     }
     /// <summary>
     /// 鐩樼偣鏄庣粏鐘舵��
@@ -42,27 +42,27 @@
     public enum TakeStockDetailStatusEnum
     {
         /// <summary>
-        /// 鏈洏鐐�
+        /// 鏈繘琛屽钩璐﹀鐞�
         /// </summary>
-        [Description("鏈洏鐐�")]
-        鏈洏鐐� = 0,
+        [Description("鏈繘琛屽钩璐﹀鐞�")]
+        鏈繘琛屽钩璐﹀鐞� = 0,
 
         /// <summary>
-        /// 鐩樼偣涓�
+        /// 宸茶繘琛屽钩璐﹀鐞�
         /// </summary>
-        [Description("鐩樼偣鍑哄簱涓�")]
-        鐩樼偣鍑哄簱涓� = 1,
+        [Description("浜哄伐骞宠处澶勭悊")]
+        宸茶繘琛屽钩璐﹀鐞� = 1,
 
         /// <summary>
-        /// 鐩樼偣鍑哄簱瀹屾垚
+        /// 鏉傛敹鏉傚彂骞宠处澶勭悊
         /// </summary>
-        [Description("鐩樼偣鍑哄簱瀹屾垚")]
-        鐩樼偣鍑哄簱瀹屾垚 = 2,
+        [Description("鏉傛敹鏉傚彂骞宠处澶勭悊")]
+        鏉傛敹鏉傚彂骞宠处澶勭悊 = 2,
 
         /// <summary>
-        /// 鐩樼偣瀹屾垚
+        /// 鏉傛敹鏉傚彂骞宠处澶勭悊涓�
         /// </summary>
-        [Description("鐩樼偣瀹屾垚")]
-        鐩樼偣瀹屾垚 = 3
+        [Description("鏉傛敹鏉傚彂骞宠处澶勭悊涓�")]
+        鏉傛敹鏉傚彂骞宠处澶勭悊涓� = 3
     }
 }
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_IInboundService/ITakeStockOrderService.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_IInboundService/ITakeStockOrderService.cs"
index 74387b8..f29a703 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_IInboundService/ITakeStockOrderService.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_IInboundService/ITakeStockOrderService.cs"
@@ -19,6 +19,13 @@
 
         WebResponseContent CompleteStockTake([FromBody] CompleteStockTakeDTO completeStockTakeDTO);
 
-        WebResponseContent ReturnBox(string orderNo, string boxNo);
+        WebResponseContent ReturnBox(string orderNo, string boxNo, string sourceAddress);
+
+        WebResponseContent ManualReconciliation(int id);
+
+        WebResponseContent SelectOrder(string remark, int id);
+
+        WebResponseContent DocumentReconciliation(int orderId, int 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/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 5a97c5b..e4e0e7e 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"
@@ -58,5 +58,7 @@
         /// <param name="barcode"></param>
         /// <returns></returns>
         public WebResponseContent GetPurchaseOrderByBarcode(string barcode);
+
+        public WebResponseContent NoStockOutBatchInOrderFeedbackToMes(int id, List<string> barCodeList);
     }
 }
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_InboundService/InboundOrderService.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_InboundService/InboundOrderService.cs"
index b905ce3..babba31 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_InboundService/InboundOrderService.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_InboundService/InboundOrderService.cs"
@@ -106,9 +106,10 @@
 
                     foreach (var item in model.Details)
                     {
+                        Dt_MaterielInfo materielInfo = materielInfos.First(x => x.MaterielCode == item.MaterielCode);
                         //var purchaseToStockResult = await _materialUnitService.ConvertPurchaseToStockAsync(item.MaterielCode, item.BarcodeQty);
 
-                        UnitConvertResultDTO totalResult = _basicService.UnitQuantityConvert(item.MaterielCode, item.Unit, item.BarcodeUnit, item.OrderQuantity);
+                        UnitConvertResultDTO totalResult = _basicService.UnitQuantityConvert(item.MaterielCode, item.Unit, materielInfo.inventoryUOM, item.OrderQuantity);
                         item.Unit = totalResult.ToUnit;
                         item.OrderQuantity = totalResult.ToQuantity;
                         if (materielInfos.Any())
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_InboundService/InboundService.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_InboundService/InboundService.cs"
index 5d5dd37..f9bdcc5 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_InboundService/InboundService.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_InboundService/InboundService.cs"
@@ -10,6 +10,7 @@
 using System.Collections.Generic;
 using System.Data;
 using System.Linq;
+using System.Net;
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_Common.AllocateEnum;
@@ -23,6 +24,7 @@
 using WIDESEA_Core.Utilities;
 using WIDESEA_DTO.Allocate;
 using WIDESEA_DTO.Inbound;
+using WIDESEA_DTO.Mes;
 using WIDESEA_DTO.ReturnMES;
 using WIDESEA_IBasicService;
 using WIDESEA_IInboundService;
@@ -439,7 +441,7 @@
 
                     if (allocatefeedmodel.Details.Count <= 0)
                     {
-                        throw new Exception("鏈壘鍒伴渶瑕佸洖浼犵殑鏁版嵁");
+                        return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
                     }
 
                     var response = responseModel(inboundOrder, 3, null, allocatefeedmodel);
@@ -473,7 +475,7 @@
 
                     if (feedmodel.details.Count<=0)
                     {
-                        throw new Exception("鏈壘鍒伴渶瑕佸洖浼犵殑鏁版嵁");
+                        return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
                     }
                     var response = responseModel(inboundOrder, 3, feedmodel);
 
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_InboundService/TakeStockOrderService.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_InboundService/TakeStockOrderService.cs"
index d98ba61..554d1c2 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_InboundService/TakeStockOrderService.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_InboundService/TakeStockOrderService.cs"
@@ -22,6 +22,11 @@
 using WIDESEA_Common.CommonEnum;
 using WIDESEA_Common.TaskEnum;
 using WIDESEA_IBasicService;
+using static HslCommunication.Profinet.Knx.KnxCode;
+using System.Collections;
+using WIDESEA_Common.AllocateEnum;
+using WIDESEA_Model.Models.Basic;
+using WIDESEA_IOutboundService;
 
 namespace WIDESEA_InboundService
 {
@@ -34,7 +39,12 @@
         private readonly IRepository<Dt_TakeStockOrderDetail> _takeStockOrderDetail;
         private readonly IRepository<Dt_Task> _taskRepository;
         private readonly ILocationInfoService _locationInfoService;
-        public TakeStockOrderService(IRepository<Dt_TakeStockOrder> BaseDal, IUnitOfWorkManage unitOfWorkManage,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfo> stockInfoRepository,IRepository<Dt_TakeStockOrderDetail> takeStockOrderDetail,IRepository<Dt_Task> taskRepository,ILocationInfoService locationInfoService) : base(BaseDal)
+        private readonly IRepository<Dt_InboundOrder> _inboundOrderRepository;
+        private readonly IRepository<Dt_OutboundOrder> _outboundOrderRepository;
+        private readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository;
+        private readonly IRepository<Dt_OutboundOrderDetail> _outboundOrderDetailRepository;
+        private readonly IOutboundPickingService _outboundPickingService;
+        public TakeStockOrderService(IRepository<Dt_TakeStockOrder> BaseDal, IUnitOfWorkManage unitOfWorkManage,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfo> stockInfoRepository,IRepository<Dt_TakeStockOrderDetail> takeStockOrderDetail,IRepository<Dt_Task> taskRepository,ILocationInfoService locationInfoService, IRepository<Dt_InboundOrder> inboundOrderRepository,IRepository<Dt_OutboundOrder> outboundOrderRepository,IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository, IOutboundPickingService outboundPickingService) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _takeStockOrder = takeStockOrder;
@@ -42,6 +52,11 @@
             _takeStockOrderDetail = takeStockOrderDetail;
             _taskRepository = taskRepository;
             _locationInfoService = locationInfoService;
+            _inboundOrderRepository = inboundOrderRepository;
+            _outboundOrderRepository = outboundOrderRepository;
+            _inboundOrderDetailRepository = inboundOrderDetailRepository;
+            _outboundOrderDetailRepository = outboundOrderDetailRepository;
+            _outboundPickingService = outboundPickingService;
         }
 
         public WebResponseContent ValidateBoxNo(string orderNo, string boxNo)
@@ -52,7 +67,7 @@
                 if (stockInfo == null) {
                     return WebResponseContent.Instance.Error("鏈壘鍒拌鎵樼洏搴撳瓨");
                 }
-                if(stockInfo.StockStatus != StockStatusEmun.鐩樼偣鍑哄簱瀹屾垚.ObjToInt())
+                if(stockInfo.StockStatus != StockStatusEmun.鐩樼偣鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鐩樼偣搴撳瓨瀹屾垚.ObjToInt())
                 {
                     return WebResponseContent.Instance.Error("璇ユ墭鐩樺浜庨潪鐩樼偣鐘舵�侊紝璇锋鏌ョ洏鐐逛换鍔�");
                 }
@@ -76,15 +91,7 @@
                     bool isMatch = remarkValues.Any(val => val.Equals(boxNo, StringComparison.OrdinalIgnoreCase));
                     if (!isMatch)
                     {
-                        return WebResponseContent.Instance.Error($"绠卞彿銆恵boxNo}銆戞湭鍦ㄧ洏鐐瑰崟绠卞彿銆恵takeStockOrder.Remark}銆戜腑鎵惧埌鍖归厤椤�");
-                    }
-                }
-                else
-                {
-                    bool isMatch = takeStockOrder.Remark.Trim().Equals(boxNo, StringComparison.OrdinalIgnoreCase);
-                    if (!isMatch)
-                    {
-                        return WebResponseContent.Instance.Error($"绠卞彿銆恵boxNo}銆戜笌鐩樼偣鍗曠鍙枫�恵takeStockOrder.Remark}銆戜笉鍖归厤");
+                        return WebResponseContent.Instance.Error($"绠卞彿銆恵boxNo}銆戞湭鍦ㄧ洏鐐瑰崟绠卞彿銆恵takeStockOrder.AllPalletCode}銆戜腑鎵惧埌鍖归厤椤�");
                     }
                 }
 
@@ -132,6 +139,10 @@
         {
             try
             {
+                if(completeStockTakeDTO.actualQuantity == completeStockTakeDTO.stockQuantity)
+                {
+                    return WebResponseContent.Instance.OK("璇ユ潯鐮佷负骞宠处锛屾棤闇�璁板綍宸紓");
+                }
                 Dt_TakeStockOrder takeStockOrder = _takeStockOrder.QueryFirst(x=>x.OrderNo == completeStockTakeDTO.orderNo);
                 if (takeStockOrder == null)
                 {
@@ -147,38 +158,58 @@
                 {
                     return WebResponseContent.Instance.Error("鏉$爜搴撳瓨鏁版嵁鏈壘鍒板尮閰嶆暟鎹�");
                 }
+                List<Dt_AllocateMaterialInfo> allocateMaterialInfos = new List<Dt_AllocateMaterialInfo>();
                 Dt_TakeStockOrderDetail takeStockOrderDetail = new Dt_TakeStockOrderDetail()
                 {
                     TakeStockId = takeStockOrder.Id,
                     MaterielCode = stockInfoDetail.MaterielCode,
-                    MaterielName = stockInfoDetail.MaterielName??"",
+                    MaterielName = stockInfoDetail.MaterielName ?? "",
                     BatchNo = stockInfoDetail.BatchNo,
                     TakePalletCode = completeStockTakeDTO.boxNo,
-                    TakeDetalStatus = TakeStockDetailStatusEnum.鐩樼偣瀹屾垚.ObjToInt(),
+                    TakeDetalStatus = TakeStockDetailStatusEnum.鏈繘琛屽钩璐﹀鐞�.ObjToInt(),
                     Unit = stockInfoDetail.Unit,
                     SysQty = completeStockTakeDTO.stockQuantity,
-                    Qty =completeStockTakeDTO.actualQuantity,
-                    Remark = completeStockTakeDTO.stockQuantity-completeStockTakeDTO.actualQuantity>=0 ?"鐩樹簭":"鐩樼泩",
+                    Qty = completeStockTakeDTO.actualQuantity,
+                    Remark = completeStockTakeDTO.stockQuantity - completeStockTakeDTO.actualQuantity >= 0 ? "鐩樹簭" : "鐩樼泩",
                     barcode = completeStockTakeDTO.barcode,
-                    WarehouseCode = stockInfoDetail.WarehouseCode??"",
+                    WarehouseCode = stockInfoDetail.WarehouseCode ?? "",
                     FactoryArea = stockInfoDetail.FactoryArea,
-                    SupplyCode = stockInfoDetail.SupplyCode??"",
+                    SupplyCode = stockInfoDetail.SupplyCode ?? "",
                     TakeStockNo = takeStockOrder.OrderNo,
+                    DifferenceQty = completeStockTakeDTO.stockQuantity - completeStockTakeDTO.actualQuantity
 
                 };
+                foreach (var item in stockInfo.Details)
+                {
+                    Dt_AllocateMaterialInfo allocateMaterialInfo = new Dt_AllocateMaterialInfo()
+                    {
+                        Barcode = item.Barcode,
+                        BatchNo = item.BatchNo,
+                        FactoryArea = item.FactoryArea,
+                        MaterialCode = item.MaterielCode,
+                        MaterialName = item.MaterielName,
+                        OrderId = takeStockOrder.Id,
+                        OrderNo = takeStockOrder.OrderNo,
+                        Quantity = item.StockQuantity,
+                        SupplyCode = item.SupplyCode,
+                        Unit = item.Unit
+                    };
+                }
+                stockInfo.StockStatus = StockStatusEmun.鐩樼偣搴撳瓨瀹屾垚.ObjToInt();
                 _unitOfWorkManage.BeginTran();
                 _takeStockOrderDetail.AddData(takeStockOrderDetail);
+                _stockInfoRepository.UpdateData(stockInfo);
                 _unitOfWorkManage.CommitTran();
-                return WebResponseContent.Instance.OK();
-            } 
-            catch (Exception ex) 
+                return WebResponseContent.Instance.OK("鐩樼偣瀹屾垚锛岃鍙栬蛋璇ュ紓甯告枡绠辫繘琛屽钩璐﹀鐞嗭紒");
+            }
+            catch (Exception ex)
             {
                 _unitOfWorkManage.RollbackTran();
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
 
-        public WebResponseContent ReturnBox(string orderNo, string boxNo)
+        public WebResponseContent ReturnBox(string orderNo, string boxNo, string sourceAddress)
         {
             WebResponseContent content = new WebResponseContent();
             try
@@ -202,13 +233,33 @@
                 {
                     return content.Error($"鎵樼洏{boxNo}瀛樺湪浠诲姟鍥炲簱澶辫触!");
                 }
-                if(stock.StockStatus != StockStatusEmun.鐩樼偣鍑哄簱瀹屾垚.ObjToInt())
+                if(stock.StockStatus != StockStatusEmun.鐩樼偣鍑哄簱瀹屾垚.ObjToInt() && stock.StockStatus != StockStatusEmun.鐩樼偣搴撳瓨瀹屾垚.ObjToInt())
                 {
                     return content.Error("璇ユ墭鐩樼姸鎬佷笉瀵�,涓嶅厑璁哥洏鐐瑰叆搴�");
                 }
                 stock.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
 
-                takeStockOrder.TakeStockStatus = TakeStockStatusEnum.鐩樼偣瀹屾垚.ObjToInt();
+                var palletCodes = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
+                if (!string.IsNullOrEmpty(takeStockOrder.AllPalletCode))
+                {
+                    palletCodes = takeStockOrder.AllPalletCode
+                        .Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries)
+                        .Select(p => p.Trim())
+                        .ToHashSet(StringComparer.OrdinalIgnoreCase);
+                }
+                Dt_TakeStockOrderDetail isReturn = _takeStockOrderDetail.QueryFirst(x => x.TakePalletCode == boxNo && (x.TakeDetalStatus == TakeStockDetailStatusEnum.鏈繘琛屽钩璐﹀鐞�.ObjToInt() || x.TakeDetalStatus == TakeStockDetailStatusEnum.鏉傛敹鏉傚彂骞宠处澶勭悊涓�.ObjToInt()));
+                if(isReturn != null)
+                {
+                    return WebResponseContent.Instance.Error("璇ユ墭鐩樿繕鏈夋潯鐮佸緟骞宠处锛岃鍏堝鐞嗗啀鍥炲簱");
+                }
+                bool hasRelatedTasks = _taskRepository.QueryData(x => palletCodes.Contains(x.PalletCode)).Any();
+                bool hasRelatedDetails = _takeStockOrderDetail.QueryData(x => palletCodes.Contains(x.TakePalletCode)).Any();
+
+                if (!hasRelatedTasks && !hasRelatedDetails)
+                {
+                    takeStockOrder.TakeStockStatus = (int)TakeStockStatusEnum.鐩樼偣瀹屾垚;
+                }
+
                 // 鍒嗛厤鏂拌揣浣�
                 var newLocation = _locationInfoService.AssignLocation(stock.LocationType);
 
@@ -220,7 +271,7 @@
                     NextAddress = "",
                     OrderNo = takeStockOrder.OrderNo,
                     Roadway = newLocation.RoadwayNo,
-                    SourceAddress = takeStockOrder.Remark,
+                    SourceAddress = sourceAddress,
                     TargetAddress = newLocation.LocationCode,
                     TaskStatus = (int)TaskStatusEnum.New,
                     TaskType = TaskTypeEnum.InInventory.ObjToInt(),
@@ -247,6 +298,208 @@
                 return content.Error(ex.Message);
             }
         }
+
+        public WebResponseContent ManualReconciliation(int id)
+        {
+            try
+            {
+                Dt_TakeStockOrderDetail takeStockOrderDetail = _takeStockOrderDetail.QueryFirst(x=>x.Id == id);
+                if(takeStockOrderDetail == null)
+                {
+                    return WebResponseContent.Instance.Error("鏈壘鍒拌鐩樼偣宸紓璁板綍");
+                }
+                else
+                {
+                    if(takeStockOrderDetail.TakeDetalStatus != TakeStockDetailStatusEnum.鏈繘琛屽钩璐﹀鐞�.ObjToInt())
+                    {
+                        return WebResponseContent.Instance.Error("璇ヨ褰曞凡缁忚繘琛屼簡骞宠处鎿嶄綔");
+                    }
+                    takeStockOrderDetail.DifferenceQty = 0;
+                    takeStockOrderDetail.TakeDetalStatus = TakeStockDetailStatusEnum.宸茶繘琛屽钩璐﹀鐞�.ObjToInt();
+                }
+                _takeStockOrderDetail.UpdateData(takeStockOrderDetail);
+                return WebResponseContent.Instance.OK();
+            }
+            catch(Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
+
+        public WebResponseContent SelectOrder(string remark, int id)
+        {
+            try
+            {
+                Dt_TakeStockOrderDetail takeStockOrderDetail = _takeStockOrderDetail.QueryFirst(x => x.Id == id);
+                if (takeStockOrderDetail == null)
+                {
+                    return WebResponseContent.Instance.Error("鏈壘鍒拌鐩樼偣宸紓璁板綍");
+                }
+                else
+                {
+                    //鏌ユ潅鏀跺崟
+                    if (takeStockOrderDetail.Remark == "鐩樼泩")
+                    {
+                        List<Dt_InboundOrderDetail> inboundOrderDetails = new List<Dt_InboundOrderDetail>();
+                        List<Dt_InboundOrder> inboundOrders = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.BusinessType == "12" && x.OrderStatus != InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()).Includes(x => x.Details).ToList();
+                        foreach (var inboundOrder in inboundOrders)
+                        {
+
+                            var matchedDetails = inboundOrder.Details
+
+                                .Where(detail => !string.IsNullOrEmpty(detail.MaterielCode)
+                                              && detail.MaterielCode == takeStockOrderDetail.MaterielCode && detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt())
+
+                                .WhereIF(!string.IsNullOrEmpty(takeStockOrderDetail.FactoryArea),
+                                         detail => !string.IsNullOrEmpty(inboundOrder.FactoryArea)
+                                              && inboundOrder.FactoryArea == takeStockOrderDetail.FactoryArea)
+                                .WhereIF(!string.IsNullOrEmpty(takeStockOrderDetail.WarehouseCode),
+                                         detail => !string.IsNullOrEmpty(detail.WarehouseCode)
+                                         && detail.WarehouseCode == takeStockOrderDetail.WarehouseCode)
+                                .ToList();
+
+                            // 灏嗗尮閰嶇殑鏄庣粏娣诲姞鍒版�诲垪琛�
+                            if (matchedDetails.Any())
+                            {
+                                inboundOrderDetails.AddRange(matchedDetails);
+                            }
+                        }
+                        return WebResponseContent.Instance.OK("鎴愬姛",data: inboundOrderDetails);
+                    }
+                    else
+                    {
+                        List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
+                        List<Dt_OutboundOrder> outboundOrders = _outboundOrderRepository.Db.Queryable<Dt_OutboundOrder>().Where(x => x.BusinessType == "23" && x.OrderStatus != OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt()).Includes(x => x.Details).ToList();
+                        foreach (var outboundOrder in outboundOrders)
+                        {
+                            var matchedDetails = outboundOrder.Details
+                                .Where(detail => !string.IsNullOrWhiteSpace(detail.MaterielCode)
+                                              && detail.MaterielCode == takeStockOrderDetail.MaterielCode)
+                                .WhereIF(!string.IsNullOrWhiteSpace(takeStockOrderDetail.FactoryArea),
+                                         detail => !string.IsNullOrWhiteSpace(outboundOrder.FactoryArea)
+                                              && outboundOrder.FactoryArea == takeStockOrderDetail.FactoryArea)
+                                .WhereIF(!string.IsNullOrWhiteSpace(takeStockOrderDetail.WarehouseCode),
+                                         detail => !string.IsNullOrWhiteSpace(detail.WarehouseCode)
+                                              && detail.WarehouseCode == takeStockOrderDetail.WarehouseCode)
+                                .Where(detail => string.IsNullOrWhiteSpace(detail.BatchNo)||
+                                         detail.BatchNo == takeStockOrderDetail.BatchNo)
+
+                                .Where(detail => string.IsNullOrWhiteSpace(detail.SupplyCode) ||
+                                         detail.SupplyCode == takeStockOrderDetail.SupplyCode)
+                                .ToList();
+
+                            if (matchedDetails.Any())
+                            {
+                                outboundOrderDetails.AddRange(matchedDetails);
+                            }
+                        }
+                        return WebResponseContent.Instance.OK("鎴愬姛", data: outboundOrderDetails);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
+
+        public WebResponseContent DocumentReconciliation(int orderId, int id)
+        {
+            try
+            {
+                Dt_TakeStockOrderDetail takeStockOrderDetail = _takeStockOrderDetail.QueryFirst(x => x.Id == id);
+                if(takeStockOrderDetail== null)
+                {
+                    return WebResponseContent.Instance.Error("鏈壘鍒拌鐩樼偣宸紓鏁版嵁");
+                }
+                if(takeStockOrderDetail.Remark == "鐩樼泩")
+                {
+                    Dt_InboundOrderDetail inboundOrderDetail = _inboundOrderDetailRepository.QueryFirst(x => x.OrderId == orderId);
+                    if(inboundOrderDetail == null)
+                    {
+                        return WebResponseContent.Instance.Error("鏈壘鍒伴�夋嫨鐨勬潅鏀跺钩璐﹀崟鎹�");
+                    }
+                    Dt_InboundOrder inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x=>x.Id == orderId).Includes(x=>x.Details).First();
+                    Dt_StockInfo  stockInfo = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x=>x.PalletCode == takeStockOrderDetail.TakePalletCode && x.StockStatus == StockStatusEmun.鐩樼偣搴撳瓨瀹屾垚.ObjToInt()).Includes(x=>x.Details).First();
+                    if(stockInfo== null)
+                    {
+                        return WebResponseContent.Instance.Error($"鐩樼偣鎵樼洏{takeStockOrderDetail.TakePalletCode}鐨勫簱瀛樹俊鎭湭鎵惧埌锛屾垨鎵樼洏鐘舵�佷笉姝g‘");
+                    }
+                    var datevaliDate = _inboundOrderRepository.Db.Queryable<Dt_MaterialExpirationDate>().Where(x => x.MaterialCode.Contains(inboundOrderDetail.MaterielCode.Substring(0, 6))).First();
+                    var newStockDetail = new Dt_StockInfoDetail
+                    {
+                        StockId = stockInfo == null ? 0 : stockInfo.Id,
+                        Barcode = inboundOrderDetail.Barcode,
+                        MaterielCode = inboundOrderDetail.MaterielCode,
+                        MaterielName = inboundOrderDetail.MaterielName,
+                        BatchNo = inboundOrderDetail.BatchNo,
+                        Unit = inboundOrderDetail.Unit,
+                        InboundOrderRowNo = inboundOrderDetail.lineNo,
+                        SupplyCode = inboundOrderDetail.SupplyCode,
+                        WarehouseCode = inboundOrderDetail.WarehouseCode,
+                        StockQuantity = inboundOrderDetail.OrderQuantity,
+                        BarcodeQty = inboundOrderDetail.BarcodeQty,
+                        BarcodeUnit = inboundOrderDetail.BarcodeUnit,
+                        FactoryArea = inboundOrder.FactoryArea,
+                        Status = 0,
+                        OrderNo = inboundOrder.InboundOrderNo,
+                        BusinessType = inboundOrder.BusinessType,
+                        ValidDate = inboundOrder.BusinessType == BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠�.ToString() ? inboundOrderDetail.ValidDate : datevaliDate == null ? null : Convert.ToDateTime(DateTime.Now).AddDays(Convert.ToDouble(datevaliDate.ValidityDays)),
+                    };
+                    stockInfo.Details.Add(newStockDetail);
+
+                    inboundOrderDetail.ReceiptQuantity = inboundOrderDetail.OrderQuantity;
+                    inboundOrderDetail.OverInQuantity = inboundOrderDetail.OrderQuantity;
+                    inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+                    int overCount = 1;
+                    int moreOverCount = inboundOrder.Details.Count(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
+                    if (inboundOrder.Details.Count() == overCount + moreOverCount)
+                    {
+                        inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
+                    }
+                    else
+                    {
+                        inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱涓�.ObjToInt();
+                    }
+                    takeStockOrderDetail.DifferenceQty += inboundOrderDetail.OrderQuantity;
+                    if(takeStockOrderDetail.DifferenceQty > 0)
+                    {
+                        return WebResponseContent.Instance.Error("璇ユ潅鏀跺崟鎹槑缁嗘潯鐮佹暟閲忓ぇ浜庡緟骞宠处鏁伴噺锛岃鍙﹂�夊叾浠栧崟鎹钩璐�");
+                    }
+                    else if (takeStockOrderDetail.DifferenceQty == 0)
+                    {
+                        takeStockOrderDetail.TakeDetalStatus = TakeStockDetailStatusEnum.鏉傛敹鏉傚彂骞宠处澶勭悊.ObjToInt();
+                    }
+                    else
+                    {
+                        takeStockOrderDetail.TakeDetalStatus = TakeStockDetailStatusEnum.鏉傛敹鏉傚彂骞宠处澶勭悊涓�.ObjToInt();
+                    }
+                    
+                    _unitOfWorkManage.BeginTran();
+                    _inboundOrderRepository.UpdateData(inboundOrder);
+                    _inboundOrderDetailRepository.UpdateData(inboundOrderDetail);
+                    _takeStockOrderDetail.UpdateData(takeStockOrderDetail);
+                    BaseDal.Db.Insertable(newStockDetail).ExecuteCommand();
+                    _unitOfWorkManage.CommitTran();
+                    List<string> barcodes = new List<string>();
+                    barcodes.Add(inboundOrderDetail.Barcode);
+                    _outboundPickingService.NoStockOutBatchInOrderFeedbackToMes(orderId, barcodes);
+
+
+                }
+                else
+                {
+
+                }
+                return WebResponseContent.Instance.OK();
+            }
+            catch(Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                return WebResponseContent.Instance.Error(ex.Message);
+
+            }
+        }
     }
     
 }
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_InboundService/WIDESEA_InboundService.csproj" "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_InboundService/WIDESEA_InboundService.csproj"
index 2796822..0153cdd 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_InboundService/WIDESEA_InboundService.csproj"
+++ "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_InboundService/WIDESEA_InboundService.csproj"
@@ -9,6 +9,7 @@
   <ItemGroup>
     <ProjectReference Include="..\WIDESEA_IBasicService\WIDESEA_IBasicService.csproj" />
     <ProjectReference Include="..\WIDESEA_IInboundService\WIDESEA_IInboundService.csproj" />
+    <ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" />
     <ProjectReference Include="..\WIDESEA_IRecordService\WIDESEA_IRecordService.csproj" />
     <ProjectReference Include="..\WIDESEA_IStockService\WIDESEA_IStockService.csproj" />
     <ProjectReference Include="..\WIDESEA_ITaskInfoService\WIDESEA_ITaskInfoService.csproj" />
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_Model/Models/Inbound/Dt_TakeStockOrderDetail.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_Model/Models/Inbound/Dt_TakeStockOrderDetail.cs"
index 487b615..e8ebf96 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_Model/Models/Inbound/Dt_TakeStockOrderDetail.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_Model/Models/Inbound/Dt_TakeStockOrderDetail.cs"
@@ -140,5 +140,12 @@
         [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鐩樼偣鍗曞崟鎹�")]
         [ExporterHeader(DisplayName = "鐩樼偣鍗曞崟鎹�")]
         public string TakeStockNo { get; set; }
+
+        /// <summary>
+        /// 宸紓鏁伴噺
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDescription = "宸紓鏁伴噺")]
+        [ExporterHeader(DisplayName = "宸紓鏁伴噺")]
+        public decimal DifferenceQty { 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_WMSServer/Controllers/Inbound/TakeStockOrderController.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/Inbound/TakeStockOrderController.cs"
index 3db09d1..72d9d17 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/Inbound/TakeStockOrderController.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/Inbound/TakeStockOrderController.cs"
@@ -49,9 +49,36 @@
         /// 鐩樼偣鏂欑鍥炲簱
         /// </summary>
         [HttpPost, HttpGet, Route("ReturnBox"), AllowAnonymous]
-        public WebResponseContent ReturnBox(string orderNo, string boxNo)
+        public WebResponseContent ReturnBox(string orderNo, string boxNo, string sourceAddress)
         {
-            return Service.ReturnBox(orderNo, boxNo);
+            return Service.ReturnBox(orderNo, boxNo,sourceAddress);
+        }
+
+        /// <summary>
+        /// 浜哄伐骞宠处澶勭悊
+        /// </summary>
+        [HttpPost, HttpGet, Route("ManualReconciliation"), AllowAnonymous]
+        public WebResponseContent ManualReconciliation(int id)
+        {
+            return Service.ManualReconciliation(id);
+        }
+
+        /// <summary>
+        /// 鏉傛敹鏉傚彂鍗曟嵁鏌ヨ
+        /// </summary>
+        [HttpPost, HttpGet, Route("SelectOrder"), AllowAnonymous]
+        public WebResponseContent SelectOrder(string remark,int id)
+        {
+            return Service.SelectOrder(remark,id);
+        }
+
+        /// <summary>
+        /// 鏉傚彂鏉傛敹鍗曞鐞�
+        /// </summary>
+        [HttpPost, HttpGet, Route("DocumentReconciliation"), AllowAnonymous]
+        public WebResponseContent DocumentReconciliation(int orderId, int id)
+        {
+            return Service.DocumentReconciliation(orderId, id);
         }
     }
 }

--
Gitblit v1.9.3