From c95029139c278f0d2980e6d67cab42f5331e8d06 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期五, 05 十二月 2025 08:35:04 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs |   19 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITask_HtyService.cs                    |    1 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs               |  106 +++--
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs                     |   19 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/Task_HtyService.cs                      |   60 +++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundBatchPickingService.cs          |   34 +
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskStatusEnum.cs                       |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Filter/CustomProfile.cs                       |    5 
 项目代码/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue                              |  609 +++++++++++++++++++++++++++++++++--
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/ErpApiService.cs                           |    3 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/NoStockOutModel.cs                |    6 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs                        |    3 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs                          |   73 +++-
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ESSController.cs                  |   15 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs                        |   50 ++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/WIDESEA_OutboundService.csproj          |    1 
 16 files changed, 855 insertions(+), 151 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
index 1b7dafd..48d960a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
@@ -586,62 +586,430 @@
     },
 
    openSplitDialog() {
-      console.log('寮�濮嬫墦寮�鎷嗗寘寮圭獥');
-      
-      if (this.isOpeningDialog) {
-        console.log('姝e湪鎵撳紑寮圭獥锛岃烦杩�');
-        return;
-      }
+      console.log('绱ф�ヤ慨澶嶇増锛氭墦寮�鎷嗗寘寮圭獥');
       
       if (!this.scanData.palletCode) {
         this.$message.warning('璇峰厛鎵弿鎵樼洏鐮�');
         return;
       }
       
-      this.isOpeningDialog = true;
+      // 1. 鍏抽棴鎵�鏈塚ue寮圭獥
+      this.closeAllDialogs();
+      
+      // 2. 寮哄埗浠嶥OM涓Щ闄ゆ墍鏈夊脊绐�
+      setTimeout(() => {
+        const dialogs = document.querySelectorAll('.custom-dialog-overlay');
+        dialogs.forEach(dialog => {
+          if (dialog.parentNode) {
+            dialog.parentNode.removeChild(dialog);
+          }
+        });
+        
+        // 濡傛灉宸茬粡瀛樺湪鎵嬪姩寮圭獥锛屽厛绉婚櫎
+        if (this.manualDialog && this.manualDialog.parentNode) {
+          this.manualDialog.parentNode.removeChild(this.manualDialog);
+        }
+        
+        // 3. 绛夊緟涓�甯�
+        requestAnimationFrame(() => {
+          // 4. 鐩存帴鍒涘缓鏂板脊绐楋紝涓嶄緷璧朧ue鐨勫搷搴斿紡绯荤粺
+          this.createManualSplitDialog();
+        });
+      }, 10);
+    },
+    
+    // 鍒涘缓鎵嬪姩鎷嗗寘寮圭獥
+    createManualSplitDialog() {
+      const newDialog = document.createElement('div');
+      newDialog.className = 'custom-dialog-overlay emergency-fix';
+      
+      // 鐢熸垚闅忔満ID鐢ㄤ簬浜嬩欢缁戝畾
+      const dialogId = 'manual-dialog-' + Date.now();
+      newDialog.id = dialogId;
+      
+      // 瀛樺偍寮曠敤
+      this.manualDialog = newDialog;
+      
+      // 寮圭獥鍐呭
+      newDialog.innerHTML = `
+        <div class="custom-dialog-wrapper">
+          <div class="custom-dialog" style="width: 500px;">
+            <div class="custom-dialog-header">
+              <h3 style="margin: 0; color: #303133;">鎷嗗寘鎿嶄綔</h3>
+              <button class="close-button" onclick="document.getElementById('${dialogId}').remove()" style="
+                font-size: 18px;
+                color: #909399;
+                padding: 0;
+                width: 24px;
+                height: 24px;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                background: none;
+                border: none;
+                cursor: pointer;
+              ">脳</button>
+            </div>
+            <div class="custom-dialog-body" style="padding: 20px;">
+              <div style="margin-bottom: 15px;">
+                <div style="display: flex; align-items: center; margin-bottom: 5px;">
+                  <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">璁㈠崟缂栧彿:</span>
+                  <input type="text" value="${this.scanData.orderNo}" disabled style="
+                    flex: 1;
+                    padding: 8px 12px;
+                    border: 1px solid #dcdfe6;
+                    border-radius: 4px;
+                    background-color: #f5f7fa;
+                    color: #909399;
+                  ">
+                </div>
+              </div>
+              
+              <div style="margin-bottom: 15px;">
+                <div style="display: flex; align-items: center; margin-bottom: 5px;">
+                  <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鎵樼洏缂栧彿:</span>
+                  <input type="text" value="${this.scanData.palletCode}" disabled style="
+                    flex: 1;
+                    padding: 8px 12px;
+                    border: 1px solid #dcdfe6;
+                    border-radius: 4px;
+                    background-color: #f5f7fa;
+                    color: #909399;
+                  ">
+                </div>
+              </div>
+              
+              <div style="margin-bottom: 15px;">
+                <div style="display: flex; align-items: center; margin-bottom: 5px;">
+                  <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鍘熸潯鐮�:</span>
+                  <div style="flex: 1; display: flex; align-items: center; gap: 10px;">
+                    <input type="text" id="${dialogId}-barcode" placeholder="鎵弿鍘熸潯鐮�" style="
+                      flex: 1;
+                      padding: 8px 12px;
+                      border: 1px solid #dcdfe6;
+                      border-radius: 4px;
+                    ">
+                    <button id="${dialogId}-viewChain" style="
+                      padding: 8px 16px;
+                      background: #409eff;
+                      color: white;
+                      border: none;
+                      border-radius: 4px;
+                      cursor: pointer;
+                      white-space: nowrap;
+                    ">鏌ョ湅鎷嗗寘閾�</button>
+                  </div>
+                </div>
+              </div>
+              
+              <div style="margin-bottom: 15px;">
+                <div style="display: flex; align-items: center; margin-bottom: 5px;">
+                  <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鐗╂枡缂栫爜:</span>
+                  <input type="text" id="${dialogId}-materiel" disabled style="
+                    flex: 1;
+                    padding: 8px 12px;
+                    border: 1px solid #dcdfe6;
+                    border-radius: 4px;
+                    background-color: #f5f7fa;
+                    color: #909399;
+                  ">
+                </div>
+              </div>
+              
+              <div style="margin-bottom: 15px;">
+                <div style="display: flex; align-items: center; margin-bottom: 5px;">
+                  <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鍓╀綑鏁伴噺:</span>
+                  <input type="text" id="${dialogId}-remain" disabled style="
+                    flex: 1;
+                    padding: 8px 12px;
+                    border: 1px solid #dcdfe6;
+                    border-radius: 4px;
+                    background-color: #f5f7fa;
+                    color: #909399;
+                  ">
+                </div>
+              </div>
+              
+              <div style="margin-bottom: 15px;">
+                <div style="display: flex; align-items: center; margin-bottom: 5px;">
+                  <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鎷嗗寘鏁伴噺:</span>
+                  <div style="flex: 1;">
+                    <input type="number" id="${dialogId}-splitQty" value="1" min="0.01" step="0.01" style="
+                      width: 100%;
+                      padding: 8px 12px;
+                      border: 1px solid #dcdfe6;
+                      border-radius: 4px;
+                    ">
+                  </div>
+                </div>
+              </div>
+            </div>
+            
+            <div class="custom-dialog-footer" style="
+              padding: 10px 20px 20px;
+              text-align: right;
+              border-top: 1px solid #ebeef5;
+            ">
+              <button id="${dialogId}-cancel" style="
+                padding: 9px 15px;
+                background: white;
+                color: #606266;
+                border: 1px solid #dcdfe6;
+                border-radius: 4px;
+                cursor: pointer;
+                margin-right: 10px;
+              ">鍙栨秷</button>
+              <button id="${dialogId}-confirm" style="
+                padding: 9px 15px;
+                background: #409eff;
+                color: white;
+                border: none;
+                border-radius: 4px;
+                cursor: pointer;
+              ">纭鎷嗗寘</button>
+            </div>
+          </div>
+        </div>
+      `;
+      
+      // 娣诲姞鏍峰紡
+      newDialog.style.cssText = `
+        position: fixed;
+        top: 0;
+        left: 0;
+        right: 0;
+        bottom: 0;
+        background: rgba(0,0,0,0.5);
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        z-index: 999999;
+      `;
+      
+      // 寮圭獥瀹瑰櫒鏍峰紡
+      const wrapper = newDialog.querySelector('.custom-dialog-wrapper');
+      if (wrapper) {
+        wrapper.style.position = 'relative';
+        wrapper.style.zIndex = '1000000';
+      }
+      
+      // 寮圭獥鍐呭鏍峰紡
+      const dialog = newDialog.querySelector('.custom-dialog');
+      if (dialog) {
+        dialog.style.background = 'white';
+        dialog.style.borderRadius = '4px';
+        dialog.style.maxWidth = '90vw';
+        dialog.style.maxHeight = '90vh';
+        dialog.style.boxShadow = '0 2px 12px 0 rgba(0, 0, 0, 0.1)';
+        dialog.style.overflow = 'auto';
+      }
+      
+      // 寮圭獥澶撮儴鏍峰紡
+      const header = newDialog.querySelector('.custom-dialog-header');
+      if (header) {
+        header.style.display = 'flex';
+        header.style.justifyContent = 'space-between';
+        header.style.alignItems = 'center';
+        header.style.padding = '20px 20px 10px';
+        header.style.borderBottom = '1px solid #ebeef5';
+      }
+      
+      document.body.appendChild(newDialog);
+      console.log('绱ф�ュ脊绐楀凡鍒涘缓');
+      
+      // 缁戝畾浜嬩欢
+      this.bindManualDialogEvents(dialogId);
+      
+      // 鑷姩鑱氱劍鍒版潯鐮佽緭鍏ユ
+      setTimeout(() => {
+        const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+        if (barcodeInput) {
+          barcodeInput.focus();
+          // 娣诲姞鍥炶溅閿洃鍚�
+          barcodeInput.addEventListener('keyup', (event) => {
+            if (event.key === 'Enter') {
+              this.onManualSplitBarcodeScan(dialogId);
+            }
+          });
+        }
+      }, 100);
+    },
+    
+    // 缁戝畾鎵嬪姩寮圭獥浜嬩欢
+    bindManualDialogEvents(dialogId) {
+      const vm = this; // 淇濆瓨Vue瀹炰緥寮曠敤
+      
+      // 鏌ョ湅鎷嗗寘閾炬寜閽�
+      const viewChainBtn = document.getElementById(`${dialogId}-viewChain`);
+      if (viewChainBtn) {
+        viewChainBtn.onclick = () => {
+          const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+          if (barcodeInput && barcodeInput.value.trim()) {
+            vm.viewSplitChainFromManualDialog(barcodeInput.value.trim(), dialogId);
+          } else {
+            ElMessage.warning('璇峰厛杈撳叆鏉$爜');
+          }
+        };
+      }
+      
+      // 鍙栨秷鎸夐挳
+      const cancelBtn = document.getElementById(`${dialogId}-cancel`);
+      if (cancelBtn) {
+        cancelBtn.onclick = () => {
+          const dialog = document.getElementById(dialogId);
+          if (dialog && dialog.parentNode) {
+            dialog.parentNode.removeChild(dialog);
+          }
+        };
+      }
+      
+      // 纭鎷嗗寘鎸夐挳
+      const confirmBtn = document.getElementById(`${dialogId}-confirm`);
+      if (confirmBtn) {
+        confirmBtn.onclick = () => {
+          vm.handleManualSplitPackage(dialogId);
+        };
+      }
+      
+      // 鏉$爜杈撳叆妗嗗彉鍖栦簨浠�
+      const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+      if (barcodeInput) {
+        // 闃叉姈澶勭悊
+        let timeout;
+        barcodeInput.addEventListener('input', () => {
+          clearTimeout(timeout);
+          timeout = setTimeout(() => {
+            if (barcodeInput.value.trim()) {
+              vm.onManualSplitBarcodeScan(dialogId);
+            }
+          }, 500);
+        });
+      }
+    },
+    
+    // 鎵嬪姩寮圭獥鐨勬潯鐮佹壂鎻忓鐞�
+    async onManualSplitBarcodeScan(dialogId) {
+      const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+      if (!barcodeInput || !barcodeInput.value.trim()) return;
+      
+      const barcode = barcodeInput.value.trim();
       
       try {
-        // 鏂规硶1: 浣跨敤 setTimeout 纭繚寮傛鎵ц
-        setTimeout(() => {
-          console.log('鎵ц寮圭獥鎵撳紑閫昏緫');
+        const res = await http.post('/api/OutboundBatchPicking/split-package-info', {
+          orderNo: this.scanData.orderNo,
+          palletCode: this.scanData.palletCode,
+          barcode: barcode
+        });
+
+        if (res.status) {
+          // 鏇存柊鐗╂枡缂栫爜
+          const materielInput = document.getElementById(`${dialogId}-materiel`);
+          if (materielInput) {
+            materielInput.value = res.data.materielCode || '';
+          }
           
-          // 鍏堝叧闂墍鏈夊脊绐�
-          this.closeAllDialogsImmediately();
+          // 鏇存柊鍓╀綑鏁伴噺
+          const remainInput = document.getElementById(`${dialogId}-remain`);
+          if (remainInput) {
+            remainInput.value = res.data.remainQuantity || 0;
+          }
           
-          // 浣跨敤 requestAnimationFrame 纭繚鍦ㄤ笅涓�甯ф墦寮�
-          requestAnimationFrame(() => {
-            console.log('璁剧疆寮圭獥鐘舵�佷负 true');
-            
-            // 閲嶇疆琛ㄥ崟
-            this.resetSplitForm();
-            this.splitForm.orderNo = this.scanData.orderNo;
-            this.splitForm.palletCode = this.scanData.palletCode;
-            
-            // 鍏抽敭锛氱洿鎺ヨ缃脊绐楃姸鎬�
-            this.showCustomSplitDialog = true;
-            
-            console.log('寮圭獥鐘舵�佸凡璁剧疆锛岀瓑寰匘OM鏇存柊');
-            
-            // 浣跨敤 nextTick 纭繚DOM鏇存柊瀹屾垚
-            this.$nextTick(() => {
-              console.log('DOM鏇存柊瀹屾垚锛屽脊绐楀簲璇ユ樉绀轰簡');
-              this.isOpeningDialog = false;
-              
-              // 灏濊瘯鑱氱劍鍒拌緭鍏ユ
-              setTimeout(() => {
-                const input = this.$refs.splitFormRef?.$el?.querySelector('input');
-                if (input) {
-                  input.focus();
-                  console.log('杈撳叆妗嗗凡鑱氱劍');
-                }
-              }, 100);
-            });
-          });
-        }, 0);
-        
+          // 鏇存柊鎷嗗寘鏁伴噺锛堥粯璁や负1锛屼笉瓒呰繃鍓╀綑鏁伴噺锛�
+          const splitQtyInput = document.getElementById(`${dialogId}-splitQty`);
+          if (splitQtyInput) {
+            const maxQty = res.data.remainQuantity || 0;
+            splitQtyInput.max = maxQty;
+            const currentVal = parseFloat(splitQtyInput.value) || 1;
+            if (currentVal > maxQty) {
+              splitQtyInput.value = Math.min(1, maxQty);
+            }
+          }
+        } else {
+          ElMessage.error(res.message || '鑾峰彇鎷嗗寘淇℃伅澶辫触');
+        }
       } catch (error) {
-        console.error('鎵撳紑鎷嗗寘寮圭獥鍑洪敊:', error);
-        this.isOpeningDialog = false;
+        console.error('鑾峰彇鎷嗗寘淇℃伅澶辫触:', error);
+        ElMessage.error('鑾峰彇鎷嗗寘淇℃伅澶辫触');
+      }
+    },
+    
+    // 浠庢墜鍔ㄥ脊绐楁煡鐪嬫媶鍖呴摼
+    viewSplitChainFromManualDialog(barcode, dialogId) {
+      // 鍏堝叧闂墜鍔ㄥ脊绐�
+      const dialog = document.getElementById(dialogId);
+      if (dialog && dialog.parentNode) {
+        dialog.parentNode.removeChild(dialog);
+      }
+      
+      // 寤惰繜涓�涓嬶紝鐒跺悗鎵撳紑Vue鐨勬媶鍖呴摼寮圭獥
+      setTimeout(() => {
+        this.viewSplitChain(barcode);
+      }, 50);
+    },
+    
+    // 澶勭悊鎵嬪姩寮圭獥鐨勬媶鍖呮搷浣�
+    async handleManualSplitPackage(dialogId) {
+      const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+      const splitQtyInput = document.getElementById(`${dialogId}-splitQty`);
+      
+      if (!barcodeInput || !barcodeInput.value.trim()) {
+        ElMessage.warning('璇疯緭鍏ュ師鏉$爜');
+        return;
+      }
+      
+      if (!splitQtyInput || !splitQtyInput.value || parseFloat(splitQtyInput.value) <= 0) {
+        ElMessage.warning('璇疯緭鍏ユ湁鏁堢殑鎷嗗寘鏁伴噺');
+        return;
+      }
+      
+      const originalBarcode = barcodeInput.value.trim();
+      const splitQuantity = parseFloat(splitQtyInput.value);
+      
+      try {
+        // 鏄剧ず鍔犺浇鐘舵��
+        const confirmBtn = document.getElementById(`${dialogId}-confirm`);
+        if (confirmBtn) {
+          confirmBtn.disabled = true;
+          confirmBtn.textContent = '澶勭悊涓�...';
+        }
+        
+        const res = await http.post('/api/OutboundBatchPicking/split-package', {
+          orderNo: this.scanData.orderNo,
+          palletCode: this.scanData.palletCode,
+          originalBarcode: originalBarcode,
+          splitQuantity: splitQuantity
+        });
+        
+        if (res.status) {
+          ElMessage.success('鎷嗗寘鎴愬姛');
+          
+          // 鍏抽棴鎵嬪姩寮圭獥
+          const dialog = document.getElementById(dialogId);
+          if (dialog && dialog.parentNode) {
+            dialog.parentNode.removeChild(dialog);
+          }
+          
+          // 閲嶆柊鍔犺浇鏁版嵁
+          await this.loadPalletData();
+        } else {
+          ElMessage.error(res.message || '鎷嗗寘澶辫触');
+          
+          // 鎭㈠鎸夐挳鐘舵��
+          if (confirmBtn) {
+            confirmBtn.disabled = false;
+            confirmBtn.textContent = '纭鎷嗗寘';
+          }
+        }
+      } catch (error) {
+        console.error('鎷嗗寘澶辫触:', error);
+        ElMessage.error('鎷嗗寘澶辫触');
+        
+        // 鎭㈠鎸夐挳鐘舵��
+        const confirmBtn = document.getElementById(`${dialogId}-confirm`);
+        if (confirmBtn) {
+          confirmBtn.disabled = false;
+          confirmBtn.textContent = '纭鎷嗗寘';
+        }
       }
     },
       closeAllDialogsImmediately() {
@@ -910,11 +1278,26 @@
     closeAllDialogs() {
       this.activeDialog = null;
       // 纭繚鎵�鏈夊脊绐楃姸鎬侀兘琚噸缃�
+// 鍏抽棴Vue寮圭獥
       this.showCustomSplitDialog = false;
       this.showRevertSplitDialog = false;
       this.showBatchReturnDialog = false;
       this.showEmptyPalletDialog = false;
       this.showSplitChainDialog = false;
+      
+      // 鍏抽棴鎵嬪姩寮圭獥
+      if (this.manualDialog && this.manualDialog.parentNode) {
+        this.manualDialog.parentNode.removeChild(this.manualDialog);
+        this.manualDialog = null;
+      }
+      
+      // 绉婚櫎鎵�鏈夌揣鎬ュ脊绐�
+      const emergencyDialogs = document.querySelectorAll('.emergency-fix');
+      emergencyDialogs.forEach(dialog => {
+        if (dialog.parentNode) {
+          dialog.parentNode.removeChild(dialog);
+        }
+      });
     },
 
     // 鍥炲簱鐩稿叧鏂规硶
@@ -1318,4 +1701,140 @@
     width: 100%;
   }
 }
+
+/* 鍘熸湁鐨勬牱寮忎繚鎸佷笉鍙� */
+.OutboundPicking-container {
+  padding: 20px;
+}
+
+.scanner-form {
+  display: flex;
+  gap: 10px;
+  align-items: center;
+  flex-wrap: wrap;
+}
+
+.scanner-form .el-input {
+  width: 200px;
+}
+
+.summary-info {
+  display: flex;
+  gap: 20px;
+  flex-wrap: wrap;
+}
+
+.table-actions {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 10px;
+  padding: 0 10px;
+}
+
+.selection-count {
+  font-size: 12px;
+  color: #909399;
+}
+
+/* 鍘熸湁鐨勮嚜瀹氫箟寮圭獥鏍峰紡 */
+.custom-dialog-overlay {
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background-color: rgba(0, 0, 0, 0.5);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  z-index: 2000;
+}
+
+.custom-dialog-wrapper {
+  position: relative;
+  z-index: 2001;
+}
+
+.custom-dialog {
+  background: white;
+  border-radius: 4px;
+  width: 500px;
+  max-width: 90vw;
+  max-height: 90vh;
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  overflow: auto;
+}
+
+.custom-dialog-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 20px 20px 10px;
+  border-bottom: 1px solid #ebeef5;
+}
+
+.custom-dialog-header h3 {
+  margin: 0;
+  color: #303133;
+}
+
+.close-button {
+  font-size: 18px;
+  color: #909399;
+  padding: 0;
+  width: 24px;
+  height: 24px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.close-button:hover {
+  color: #409EFF;
+  background-color: transparent;
+}
+
+.custom-dialog-body {
+  padding: 20px;
+}
+
+.custom-dialog-footer {
+  padding: 10px 20px 20px;
+  text-align: right;
+  border-top: 1px solid #ebeef5;
+}
+
+.custom-dialog-footer .el-button {
+  margin-left: 10px;
+}
+
+@media (max-width: 768px) {
+  .custom-dialog {
+    width: 95vw;
+    margin: 10px;
+  }
+  
+  .scanner-form {
+    flex-direction: column;
+    align-items: stretch;
+  }
+  
+  .scanner-form .el-input {
+    width: 100%;
+  }
+}
+
+/* 鏂板锛氭墜鍔ㄥ脊绐楃殑鎸夐挳鎮仠鏁堟灉 */
+:deep(button) {
+  transition: all 0.3s;
+}
+
+:deep(button:hover) {
+  opacity: 0.8;
+}
+
+:deep(button:active) {
+  opacity: 0.6;
+}
 </style>
\ No newline at end of file
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/ErpApiService.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/ErpApiService.cs"
index 83277ed..b1304d5 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/ErpApiService.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/ErpApiService.cs"
@@ -41,7 +41,10 @@
         {
             try
             {
+                //erp 娴嬭瘯鐜
                 var request = new TokenRequest { appId = "BG_SYSTEM", secretKey = "7e9239c1e132462a9cf03bfa342a044aMTcxODE5MzgxODI4Mw" };
+                ////erp 姝e紡鐜
+                //var request = new TokenRequest { appId = "BG_SYSTEM", secretKey = "9a3d0b5a37Bfc6dAM4b34ODb8ebDOSb937106d1b19DS29098" };
                 var response = await PostAsync<TokenRequest, TokenResponse>("auth/getAccessToken", request, includeToken: false);
                 var _token = response?.data?.access_token;
                 return _token ?? "";
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/InvokeMESService.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/InvokeMESService.cs"
index 7d8276f..03077e3 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/InvokeMESService.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/InvokeMESService.cs"
@@ -26,6 +26,7 @@
 using WIDESEA_IBasicService;
 using WIDESEA_IOutboundService;
 using WIDESEA_Model.Models;
+using WIDESEA_Model.Models.Outbound;
 
 namespace WIDESEA_BasicService
 {
@@ -45,13 +46,14 @@
         private readonly IOutboundOrderService _outboundOrderService;
         private readonly IOutboundOrderDetailService _outboundOrderDetailService;
         private readonly IOutStockLockInfoService _outStockLockInfoService;
+        private readonly IRepository<Dt_InterfaceLog> _interfacelogRepository;
 
         // 瀛樺偍璧勬簮ID鍙婂叾瀵瑰簲鐨勯攣瀵硅薄銆備娇鐢� ConcurrentDictionary 纭繚瀵瑰瓧鍏告搷浣滄湰韬殑绾跨▼瀹夊叏銆�
         private static readonly ConcurrentDictionary<string, object> _resourceLocks = new ConcurrentDictionary<string, object>();
 
         // 鍏ㄥ眬闈欐�侀攣锛氱敤浜庝繚鎶� _resourceLocks 瀛楀吀涓� GetOrAdd 鎴� TryRemove 鏃剁殑绔炰簤
         private static readonly object _globalLocker = new object();
-        public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService, IRepository<Dt_PickingRecord> pickingRecoreRepository)
+        public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService, IRepository<Dt_PickingRecord> pickingRecoreRepository, IRepository<Dt_InterfaceLog> interfacelogRepository)
         {
             _httpClientFactory = httpClientFactory;
             _logger = logger;
@@ -64,6 +66,7 @@
             _outStockLockInfoService = outStockLockInfoService;
             _materialUnitService = materialUnitService;
             _pickingRecoreRepository = pickingRecoreRepository;
+            _interfacelogRepository = interfacelogRepository;
         }
 
         /// <summary>
@@ -393,7 +396,7 @@
             {
                 // 鎶㈤攣澶辫触锛氳鏄庢湁鍙︿竴涓嚎绋嬶紙WCS鍥炶皟鎴栦汉宸ユ搷浣滐級姝e湪澶勭悊
 
-                return WebResponseContent.Instance.OK("WMS姝e湪澶勭悊姝ゅ洖浼犱换鍔★紝璇峰嬁閲嶅鎿嶄綔銆�");
+                return WebResponseContent.Instance.Error("WMS姝e湪澶勭悊姝ゅ洖浼犱换鍔★紝璇峰嬁閲嶅鎿嶄綔銆�");
             }
             return WebResponseContent.Instance.OK();
         }
@@ -433,29 +436,49 @@
                 var groups = pickingRecords.GroupBy(x => x.FeedBackMesDocumentNo).ToList();
                 foreach (var group in groups)
                 {
-                    
+
                     List<Dt_PickingRecord> records = group.ToList(); // 璇ュ垎缁勪笅鐨勬墍鏈夎褰�
                     if (string.IsNullOrEmpty(group.Key))
                     {
                         var emptydocumentNo = UniqueValueGenerator.Generate();
                         records.ForEach(x => { x.FeedBackMesDocumentNo = emptydocumentNo; });
-                        var result=   await _pickingRecoreRepository.Db.Insertable(records).ExecuteCommandAsync();
+                        var result = await _pickingRecoreRepository.Db.Updateable(records).ExecuteCommandAsync();
+
+                        var interfacelog = new Dt_InterfaceLog
+                        {
+                            Content = JsonConvert.SerializeObject(records),
+                            DocumentNo = emptydocumentNo,
+                            OrderNo = orderNo,
+                            OrderType = "2",
+                        };
+                        _interfacelogRepository.AddData(interfacelog);
+
                         if (result > 0)
                         {
                             (bool _flowControl, WebResponseContent _value) = await FeedBackBatchToMes(outboundOrder, orderNo, orderDetails, pickingRecords, emptydocumentNo);
-                            if (!_flowControl)
-                            {
-                                return _value;
-                            }
+
+                            return _value;
+
                         }
                     }
                     else
                     {
-                        (bool _flowControl, WebResponseContent _value) = await FeedBackBatchToMes(outboundOrder, orderNo, orderDetails, pickingRecords, group.Key);
-                        if (!_flowControl)
+                        var ilog = _interfacelogRepository.QueryFirst(x => x.DocumentNo == group.Key);
+                        if (ilog == null)
                         {
-                            return _value;
+                            var interfacelog = new Dt_InterfaceLog
+                            {
+                                Content = JsonConvert.SerializeObject(records),
+                                DocumentNo = group.Key,
+                                OrderNo = orderNo,
+                                OrderType = "2",
+                            };
+                            _interfacelogRepository.AddData(interfacelog);
                         }
+                        (bool _flowControl, WebResponseContent _value) = await FeedBackBatchToMes(outboundOrder, orderNo, orderDetails, pickingRecords, group.Key);
+
+                        return _value;
+
                     }
                 }
 
@@ -637,6 +660,11 @@
                 x.ReturnToMESStatus = 1;
             });
             await _pickingRecoreRepository.Db.Updateable(updates).ExecuteCommandAsync();
+            await _interfacelogRepository.Db.Updateable<Dt_InterfaceLog>()
+                                             .SetColumns(x => x.ReturnToMESStatus == 1)
+                                             .Where(x => x.OrderNo == orderNo)
+                                             .ExecuteCommandAsync();
+
             if (allCompleted)
             {
                 //MES鍥炰紶鎴愬姛锛氭洿鏂版槑缁嗕负鍥炰紶鎴愬姛鐘舵��
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 edb4c46..bb8786c 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"
@@ -139,15 +139,26 @@
                 }
 
                 List<string> lockLocationCodes = locationCaches.Select(x => x.LocationCode).ToList();
+                
+                //Dictionary<string, SqlSugar.OrderByType> orderBy = new Dictionary<string, OrderByType>()
+                //{
+                //    { nameof(Dt_LocationInfo.RoadwayNo),OrderByType.Asc },
+                //    { nameof(Dt_LocationInfo.Layer),OrderByType.Asc },
+                //    { nameof(Dt_LocationInfo.Column),OrderByType.Asc },
+                //    { nameof(Dt_LocationInfo.Depth),OrderByType.Desc },
+                //    { nameof(Dt_LocationInfo.Row),OrderByType.Asc }
+                //};
 
                 Dictionary<string, SqlSugar.OrderByType> orderBy = new Dictionary<string, OrderByType>()
                 {
-                    { nameof(Dt_LocationInfo.RoadwayNo),OrderByType.Asc },
+                    //{ nameof(Dt_LocationInfo.RoadwayNo),OrderByType.Asc },                       
                     { nameof(Dt_LocationInfo.Layer),OrderByType.Asc },
+                    { nameof(Dt_LocationInfo.Row),OrderByType.Asc },
                     { nameof(Dt_LocationInfo.Column),OrderByType.Asc },
                     { nameof(Dt_LocationInfo.Depth),OrderByType.Desc },
-                    { nameof(Dt_LocationInfo.Row),OrderByType.Asc }
+
                 };
+
 
                 var first = BaseDal.QueryFirst(x => x.LocationType == locationType && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode), orderBy);//鏌ヨ绌鸿揣浣嶄俊鎭苟鎺掗櫎5鍒嗛挓鍐呭垎閰嶇殑璐т綅,鏍规嵁灞傘�佸垪銆佹繁搴︺�佽鎺掑簭
                 if (first != null)
@@ -157,7 +168,7 @@
                     {
                         LocationStatus = (int)LocationStatusEnum.InStockLock,
                     }).Where(x => x.Id == first.Id).ExecuteCommand();
-                }        
+                }
 
                 return first;
             }
@@ -217,7 +228,7 @@
         {
             return Repository.QueryData(x => locationCodes.Contains(x.LocationCode));
         }
-         
+
         public List<LocationTypeDto> GetLocationTypes()
         {
             return _locationTypeRepository.Db.Queryable<Dt_LocationType>().Select(x =>
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/TaskEnum/TaskStatusEnum.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/TaskEnum/TaskStatusEnum.cs"
index fdea881..38a980e 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/TaskEnum/TaskStatusEnum.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/TaskEnum/TaskStatusEnum.cs"
@@ -66,6 +66,8 @@
         [Description("AGV鎵ц涓�")]
         AGV_Executing = 310,
 
+        [Description("AGV鍙栬揣涓�")]
+        AGV_Pull = 315,
         /// <summary>
         /// AGV寰呯户缁墽琛�
         /// </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_ITaskInfoService/ITaskService.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_ITaskInfoService/ITaskService.cs"
index 7f01bf2..9c630cb 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_ITaskInfoService/ITaskService.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_ITaskInfoService/ITaskService.cs"
@@ -23,6 +23,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_Common.CommonEnum;
+using WIDESEA_Common.TaskEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
@@ -44,6 +45,8 @@
 
         Task<WebResponseContent> TaskCompleted(string taskNum);
 
+        Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum);
+
         Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys, string outStation);
 
         Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews,string station=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_ITaskInfoService/ITask_HtyService.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_ITaskInfoService/ITask_HtyService.cs"
index 8bd7243..0cbb6a1 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_ITaskInfoService/ITask_HtyService.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_ITaskInfoService/ITask_HtyService.cs"
@@ -15,4 +15,5 @@
 
 public interface ITask_HtyService : IService<Dt_Task_Hty>
 {
+    bool DeleteAndMoveIntoHty(Dt_Task task, OperateTypeEnum operateType);
 }
\ No newline at end of file
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/Outbound/NoStockOutModel.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/Outbound/NoStockOutModel.cs"
index 6ebc3ff..ec524fe 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/Outbound/NoStockOutModel.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/Outbound/NoStockOutModel.cs"
@@ -1,5 +1,8 @@
-锘縰sing System;
+锘縰sing Newtonsoft.Json;
+using SqlSugar;
+using System;
 using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -43,4 +46,5 @@
         public List<string> BarCodeSubmit { 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_OutboundService/OutboundBatchPickingService.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/OutboundBatchPickingService.cs"
index de06d72..e988272 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/OutboundBatchPickingService.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/OutboundBatchPickingService.cs"
@@ -21,6 +21,7 @@
 using WIDESEA_IBasicService;
 using WIDESEA_IOutboundService;
 using WIDESEA_IStockService;
+using WIDESEA_ITaskInfoService;
 using WIDESEA_Model.Models;
 using WIDESEA_Model.Models.Basic;
 using WIDESEA_Model.Models.Outbound;
@@ -49,6 +50,7 @@
         private readonly IDailySequenceService _dailySequenceService;
         private readonly IAllocateService _allocateService;
         private readonly IRepository<Dt_OutboundBatch> _outboundBatchRepository;
+        private readonly ITask_HtyService _task_HtyService;
         private readonly ILogger<OutboundPickingService> _logger;
 
         private Dictionary<string, string> stations = new Dictionary<string, string>
@@ -68,7 +70,7 @@
         public OutboundBatchPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService,
             IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService,
             IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService,
-            IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository) : base(BaseDal)
+            IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, ITask_HtyService task_HtyService) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _stockInfoService = stockInfoService;
@@ -86,6 +88,7 @@
             _dailySequenceService = dailySequenceService;
             _allocateService = allocateService;
             _outboundBatchRepository = outboundBatchRepository;
+            _task_HtyService = task_HtyService;
         }
 
         // <summary>
@@ -1798,7 +1801,7 @@
 
                 // 鏇存柊閿佸畾璁板綍鐘舵�佷负宸插洖搴�
                 lockInfo.Status = (int)OutLockStockStatusEnum.宸插洖搴�;
-                lockInfo.Operator = App.User.UserName; 
+                lockInfo.Operator = App.User.UserName;
 
                 await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync();
 
@@ -1854,7 +1857,7 @@
 
                     // 鏇存柊閿佸畾璁板綍鐘舵�佷负宸插洖搴�
                     lockInfo.Status = (int)OutLockStockStatusEnum.宸插洖搴�;
-                    lockInfo.Operator = App.User.UserName; 
+                    lockInfo.Operator = App.User.UserName;
 
                     await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync();
 
@@ -1945,9 +1948,17 @@
                     PalletType = stockInfo.PalletType,
                     WarehouseId = currentTask.WarehouseId
                 };
+                try
+                {
+                    await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync();
 
-                await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync();
-
+                }
+                catch (Exception ex)
+                {
+                    _logger.LogInformation($"鍒涘缓鍥炲簱浠诲姟澶辫触 - 璁㈠崟: {orderNo}, 鎵樼洏: {palletCode}");
+                    throw new Exception($"鍒涘缓鍥炲簱浠诲姟澶辫触 - 璁㈠崟: {orderNo}, 鎵樼洏: {palletCode}");
+                  
+                }
                 // 鍙戦�丒SS鍛戒护
                 await SendESSCommands(palletCode, currentTask.TargetAddress, returnTask);
 
@@ -2223,7 +2234,7 @@
                     // 鍒嗛厤鏁伴噺鍦ㄨ鍗曟槑缁嗗眰闈㈢粺涓�澶勭悊
                     var originalStatus = lockInfo.Status;
                     lockInfo.Status = (int)OutLockStockStatusEnum.宸插洖搴�;
-                    lockInfo.Operator = App.User.UserName; 
+                    lockInfo.Operator = App.User.UserName;
 
                     await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync();
 
@@ -2550,7 +2561,7 @@
         /// <summary>
         /// 澶勭悊鏈垎鎷g殑閿佸畾璁板綍鍥炲簱
         /// </summary>
-  
+
 
         /// <summary>
         /// 澶勭悊鎵樼洏涓婄殑搴撳瓨璐х墿鍥炲簱
@@ -3478,11 +3489,16 @@
 
             };
             // 淇濆瓨鍥炲簱浠诲姟
-            await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync();
+            var insertcount = await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync();
+            if (insertcount <= 0)
+            {
+                throw new Exception("鍒涘缓浠诲姟澶辫触锛�");
+            }
             var targetAddress = originalTask.TargetAddress;
 
             // 鍒犻櫎鍘熷鍑哄簱浠诲姟
-            _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.鑷姩瀹屾垚);
+            //_taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.鑷姩瀹屾垚);
+            _task_HtyService.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.浜哄伐鍒犻櫎);
             await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
 
 
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 6e1a64e..193040f 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"
@@ -32,6 +32,7 @@
 using WIDESEA_IInboundService;
 using WIDESEA_IOutboundService;
 using WIDESEA_IStockService;
+using WIDESEA_ITaskInfoService;
 using WIDESEA_Model.Models;
 using WIDESEA_Model.Models.Basic;
 using WIDESEA_Model.Models.Check;
@@ -63,6 +64,7 @@
         private readonly IInboundOrderDetailService _inboundOrderDetailService;
         private readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository;
         private readonly IReCheckOrderService _reCheckOrderService;
+        private readonly ITask_HtyService _task_HtyService;
         private readonly ILogger<OutboundPickingService> _logger;
 
         private Dictionary<string, string> stations = new Dictionary<string, string>
@@ -82,7 +84,7 @@
         public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService,
             IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService,
             IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService,
-            IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_InboundOrder> inboundOrderRepository, IInboundOrderDetailService inboundOrderDetailService, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IReCheckOrderService reCheckOrderService) : base(BaseDal)
+            IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_InboundOrder> inboundOrderRepository, IInboundOrderDetailService inboundOrderDetailService, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IReCheckOrderService reCheckOrderService, ITask_HtyService task_HtyService) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _stockInfoService = stockInfoService;
@@ -103,6 +105,7 @@
             _inboundOrderDetailService = inboundOrderDetailService;
             _warehouseAreaRepository = warehouseAreaRepository;
             _reCheckOrderService = reCheckOrderService;
+            _task_HtyService = task_HtyService;
         }
 
 
@@ -1685,13 +1688,20 @@
 
             };
             // 淇濆瓨鍥炲簱浠诲姟
-            await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync();
+            var insertcount = await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync();
+            if (insertcount <= 0)
+            {
+                throw new Exception("鍒涘缓浠诲姟澶辫触锛�");
+            }
             var targetAddress = originalTask.TargetAddress;
 
             // 鍒犻櫎鍘熷鍑哄簱浠诲姟
-            _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.鑷姩瀹屾垚);
-            await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
-
+            // _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.鑷姩瀹屾垚);
+            var result = _task_HtyService.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.浜哄伐鍒犻櫎);
+            if (!result)
+            {
+                await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
+            }
 
 
             // 缁� ESS 鍙戦�佹祦鍔ㄤ俊鍙峰拰鍒涘缓浠诲姟
@@ -2752,15 +2762,15 @@
                         TaskNum = 0,
                         Status = (int)OutLockStockStatusEnum.鎷i�夊畬鎴�,
                         Unit = outboundOrderDetail.Unit,
-                        SupplyCode = outboundOrderDetail.SupplyCode?? "鏃�",
+                        SupplyCode = outboundOrderDetail.SupplyCode ?? "鏃�",
                         OrderType = outboundOrder.OrderType,
                         CurrentBarcode = inboundOrderDetail.Barcode,
                         IsSplitted = 1,
                         Operator = App.User.UserName,
-                        lineNo= outboundOrderDetail.lineNo,
+                        lineNo = outboundOrderDetail.lineNo,
                         WarehouseCode = outboundOrderDetail.WarehouseCode ?? "鏃�",
-                        BarcodeQty=outboundOrderDetail.NoStockOutQty,
-                        BarcodeUnit =outboundOrderDetail.BarcodeUnit,
+                        BarcodeQty = outboundOrderDetail.NoStockOutQty,
+                        BarcodeUnit = outboundOrderDetail.BarcodeUnit,
                         BatchNo = outboundOrderDetail.BatchNo
                     };
                     _outStockLockInfoService.AddData(newLockInfo);
@@ -2842,18 +2852,18 @@
                 var documentNo = UniqueValueGenerator.Generate();
 
                 var outfeedmodel = new FeedbackOutboundRequestModel
-                    {
-                        reqCode = Guid.NewGuid().ToString(),
-                        reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
-                        business_type = outboundOrder.BusinessType,
-                        factoryArea = outboundOrder.FactoryArea,
-                        operationType = 1,
-                        Operator = App.User.UserName,
-                        orderNo = outboundOrder.UpperOrderNo,
-                        documentsNO = documentNo,
-                        status = outboundOrder.OrderStatus,
-                        details = new List<FeedbackOutboundDetailsModel>()
-                    };
+                {
+                    reqCode = Guid.NewGuid().ToString(),
+                    reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    business_type = outboundOrder.BusinessType,
+                    factoryArea = outboundOrder.FactoryArea,
+                    operationType = 1,
+                    Operator = App.User.UserName,
+                    orderNo = outboundOrder.UpperOrderNo,
+                    documentsNO = documentNo,
+                    status = outboundOrder.OrderStatus,
+                    details = new List<FeedbackOutboundDetailsModel>()
+                };
                 foreach (var detail in outboundOrder.Details)
                 {
                     // 鑾峰彇璇ユ槑缁嗗搴旂殑鏉$爜淇℃伅锛堜粠閿佸畾璁板綍锛�
@@ -2863,34 +2873,34 @@
                                         (x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴� || x.Status == (int)OutLockStockStatusEnum.宸插洖搴�))
                         .ToListAsync();
 
-                        var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
-                              .Select(group => new FeedbackOutboundDetailsModel
-                              {
+                    var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
+                          .Select(group => new FeedbackOutboundDetailsModel
+                          {
 
-                                  materialCode = group.Key.MaterielCode,
-                                  lineNo = group.Key.lineNo,
-                                  warehouseCode = group.Key.WarehouseCode,
-                                  qty = group.Sum(x => x.PickedQty),
-                                  currentDeliveryQty = group.Sum(x => x.PickedQty),
-                                  unit = group.Key.BarcodeUnit,
-                                  barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
-                                  {
-                                      barcode = lockInfo.CurrentBarcode,
-                                      supplyCode = lockInfo.SupplyCode,
-                                      batchNo = lockInfo.BatchNo,
-                                      unit = lockInfo.BarcodeUnit,
-                                      qty = lockInfo.PickedQty
-                                  }).ToList()
-                              }).ToList();
-                        outfeedmodel.details.AddRange(groupdata);
-                    }
-                    var result = await _invokeMESService.FeedbackOutbound(outfeedmodel);
-                    if (result != null && result.code == 200)
-                    {
-                        await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
-                            .SetColumns(x => x.ReturnToMESStatus == 1)
-                            .Where(x => x.OrderId == outboundOrder.Id)
-                            .ExecuteCommandAsync();
+                              materialCode = group.Key.MaterielCode,
+                              lineNo = group.Key.lineNo,
+                              warehouseCode = group.Key.WarehouseCode,
+                              qty = group.Sum(x => x.PickedQty),
+                              currentDeliveryQty = group.Sum(x => x.PickedQty),
+                              unit = group.Key.BarcodeUnit,
+                              barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
+                              {
+                                  barcode = lockInfo.CurrentBarcode,
+                                  supplyCode = lockInfo.SupplyCode,
+                                  batchNo = lockInfo.BatchNo,
+                                  unit = lockInfo.BarcodeUnit,
+                                  qty = lockInfo.PickedQty
+                              }).ToList()
+                          }).ToList();
+                    outfeedmodel.details.AddRange(groupdata);
+                }
+                var result = await _invokeMESService.FeedbackOutbound(outfeedmodel);
+                if (result != null && result.code == 200)
+                {
+                    await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
+                        .SetColumns(x => x.ReturnToMESStatus == 1)
+                        .Where(x => x.OrderId == outboundOrder.Id)
+                        .ExecuteCommandAsync();
 
                     await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
                         .SetColumns(x => x.ReturnToMESStatus == 1)
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/WIDESEA_OutboundService.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_OutboundService/WIDESEA_OutboundService.csproj"
index 17401e0..99ef843 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/WIDESEA_OutboundService.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_OutboundService/WIDESEA_OutboundService.csproj"
@@ -15,6 +15,7 @@
     <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" />
   </ItemGroup>
 
 </Project>
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.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.cs"
index 956fcca..c72a941 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.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.cs"
@@ -84,6 +84,7 @@
         private readonly IRecordService _recordService;
         private readonly IAllocateService _allocateService;
         private readonly IInvokeMESService _invokeMESService;
+        private readonly ITask_HtyService _task_HtyService;
         public IRepository<Dt_Task> Repository => BaseDal;
 
         private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new()
@@ -103,7 +104,7 @@
 
         public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
 
-        public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService) : base(BaseDal)
+        public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService) : base(BaseDal)
         {
             _mapper = mapper;
             _unitOfWorkManage = unitOfWorkManage;
@@ -126,8 +127,21 @@
             _allocateOrderDetailRepository = allocateOrderDetailRepository;
             _allocateOrderRepository = allocateOrderRepository;
             _materialUnitService = materialUnitService;
+            _task_HtyService = task_HtyService;
         }
 
+        public async Task TaskStatusChange(string taskNum,TaskStatusEnum taskStatusEnum)
+        {
+            if (int.TryParse(taskNum, out var newTaskNum))
+            {
+                await Db.Updateable<Dt_Task>().SetColumns(it => new Dt_Task {
+                        TaskStatus = taskStatusEnum.ObjToInt()
+                    })
+                    .Where(it => it.TaskNum == newTaskNum)
+                    .ExecuteCommandAsync();
+            }
+              
+        }
 
         /// <summary>
         /// 
@@ -276,8 +290,12 @@
 
             task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
 
-            BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
-
+            //  BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+            var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.浜哄伐鍒犻櫎);
+            if (!result)
+            {
+                await Db.Deleteable(task).ExecuteCommandAsync();
+            }
             _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
 
             _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, WIDESEA_Common.StockEnum.StockChangeType.MaterielGroup);
@@ -325,8 +343,8 @@
                                }).ToList();
                             allocatefeedmodel.Details = groupedData;
 
-                            var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
-                            if (result != null && result.code == 200)
+                            var feedbackresult = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
+                            if (feedbackresult != null && feedbackresult.code == 200)
                             {
                                 _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                                 .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
@@ -381,8 +399,8 @@
                                }).ToList();
                             allocatefeedmodel.Details = groupedData;
 
-                            var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
-                            if (result != null && result.code == 200)
+                            var feedbackresult = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
+                            if (feedbackresult != null && feedbackresult.code == 200)
                             {
                                 _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                                 .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
@@ -429,8 +447,8 @@
                                }).ToList();
                             feedmodel.details = groupedData;
 
-                            var result = await _invokeMESService.FeedbackInbound(feedmodel);
-                            if (result != null && result.code == 200)
+                            var feedbackresult = await _invokeMESService.FeedbackInbound(feedmodel);
+                            if (feedbackresult != null && feedbackresult.code == 200)
                             {
                                 _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                                 .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
@@ -536,8 +554,12 @@
                 var outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().First(x => x.OrderNo == task.OrderNo);
 
                 task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
-                BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? WIDESEA_Core.Enums.OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
-
+                // BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? WIDESEA_Core.Enums.OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+                var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.浜哄伐鍒犻櫎);
+                if (!result)
+                {
+                    await Db.Deleteable(task).ExecuteCommandAsync();
+                }
                 _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
 
 
@@ -650,9 +672,13 @@
                 task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
 
                 // 鍒犻櫎浠诲姟璁板綍
-                BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
-                BaseDal.DeleteData(task);
-
+                //BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+                //BaseDal.DeleteData(task);
+                var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.浜哄伐鍒犻櫎);
+                if (!result)
+                {
+                    await Db.Deleteable(task).ExecuteCommandAsync();
+                }
                 // 璁板綍璐т綅鐘舵�佸彉鏇�
                 _locationStatusChangeRecordService.AddLocationStatusChangeRecord(
                     locationInfo,
@@ -1105,7 +1131,7 @@
                         //涓嶇敤鍥炰紶
                     }
                     else
-                    {                    
+                    {
                         if (outboundOrder != null && outboundOrder.IsBatch == 0)
                         {
                             var feedmodel = new FeedbackOutboundRequestModel
@@ -1187,7 +1213,7 @@
                         }
                         else if (outboundOrder != null && outboundOrder.IsBatch == 1)
                         {
-                           await  _invokeMESService.BatchOrderFeedbackToMes(new List<string>(){outboundOrder.OrderNo },2);
+                            await _invokeMESService.BatchOrderFeedbackToMes(new List<string>() { outboundOrder.OrderNo }, 2);
                         }
 
                     }
@@ -1227,9 +1253,18 @@
 
 
                 task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
-                BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
-                _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
-                //_stockRepository.Db.Deleteable(stockInfo).ExecuteCommand();
+                // BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+                var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.浜哄伐鍒犻櫎);
+                if (!result)
+                {
+                    await Db.Deleteable(task).ExecuteCommandAsync();
+                }
+
+                var stockresult = _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+                if (!stockresult)
+                { 
+                    _stockRepository.Db.Deleteable(stockInfo).ExecuteCommand();
+                }
                 _stockService.StockInfoService.DeleteData(stockInfo);
                 _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
 
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/Task_HtyService.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/Task_HtyService.cs"
index 73bd716..0a6bc41 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/Task_HtyService.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/Task_HtyService.cs"
@@ -1,5 +1,10 @@
-锘縰sing WIDESEA_Core.BaseRepository;
+锘縰sing AutoMapper;
+using Microsoft.Extensions.Logging;
+using System.Transactions;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Enums;
 using WIDESEA_ITaskInfoService;
 using WIDESEA_Model.Models;
 
@@ -7,7 +12,58 @@
 
 public class Task_HtyService : ServiceBase<Dt_Task_Hty, IRepository<Dt_Task_Hty>>, ITask_HtyService
 {
-    public Task_HtyService(IRepository<Dt_Task_Hty> BaseDal) : base(BaseDal)
+    private readonly ILogger<Task_HtyService> _logger;
+
+    private readonly IMapper _mapper; // AutoMapper瀹炰緥
+    public Task_HtyService(IRepository<Dt_Task_Hty> BaseDal, IMapper mapper, ILogger<Task_HtyService> logger) : base(BaseDal)
     {
+        _mapper = mapper;
+        _logger = logger;
+    }
+    public bool DeleteAndMoveIntoHty(Dt_Task task, OperateTypeEnum operateType)
+    {
+       // using var transaction = Db.Ado.UseTran();
+        try
+        {
+           var historyEntity = _mapper.Map<Dt_Task_Hty>(task);
+
+            // 2. 濉厖鍘嗗彶瀹炰綋鏍稿績瀛楁
+            historyEntity.SourceId = task.TaskId;
+            historyEntity.OperateType =  App.User?.UserName != null ? OperateTypeEnum.鑷姩瀹屾垚.ToString() : OperateTypeEnum.浜哄伐瀹屾垚.ToString();
+            historyEntity.Creater = App.User?.UserName != null ? App.User.UserName : "System"; 
+
+            // 瑕嗙洊淇敼浜�/淇敼鏃堕棿锛堜紭鍏堢骇楂樹簬鏄犲皠锛�
+           // historyEntity.Modifier = App.User?.UserId > 0 ? App.User?.UserName : "System";
+           // historyEntity.ModifyDate = DateTime.Now;
+
+            // 3. 鎻掑叆鍘嗗彶琛紙绫诲瀷瀹夊叏锛屾棤鍙嶅皠鎷兼帴琛ㄥ悕锛�
+
+            int insertCount = Db.Insertable(historyEntity).ExecuteCommand();
+
+            if (insertCount <= 0)
+            {
+                _logger.LogError($"浠诲姟鍘嗗彶琛―t_Task_Hty [{task.TaskNum}]鎻掑叆澶辫触锛屽奖鍝嶈鏁颁负0");
+               // transaction.RollbackTran();
+                return false;
+            }
+
+            // 4. 鍒犻櫎鍘熷疄浣擄紙绫诲瀷瀹夊叏锛�
+            int deleteCount = Db.Deleteable(task).ExecuteCommand();
+            if (deleteCount <= 0)
+            {
+                _logger.LogError("浠诲姟涓氬姟瀹炰綋[{0}]鍒犻櫎澶辫触锛屽奖鍝嶈鏁颁负0", task.TaskNum);
+              //  transaction.RollbackTran();
+                return false;
+            }
+            //transaction.CommitTran();
+            _logger.LogInformation("浠诲姟瀹炰綋[{0}]宸叉垚鍔熺Щ鍏ュ巻鍙茶〃[{1}]骞跺垹闄ゅ師鏁版嵁", task.TaskNum);
+            return true;
+        }
+        catch (Exception ex)
+        {
+           // transaction.RollbackTran();
+            _logger.LogError(ex, "浠诲姟鍒犻櫎瀹炰綋[{0}]骞剁Щ鍏ュ巻鍙茶〃澶辫触", task.TaskNum);
+            return false;
+        }
     }
 }
\ No newline at end of file
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/ESSController.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/ESSController.cs"
index 6cfedd4..ba22c1c 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/ESSController.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/ESSController.cs"
@@ -287,8 +287,7 @@
         /// </summary>
         private async Task HandleTaskSuspended(StatusCallbackRequest request)
         {
-            _logger.LogWarning("浠诲姟鎸傝捣: TaskCode={TaskCode}, 绯荤粺浠诲姟鐮�={SysTaskCode}, 鍘熷洜={Message}",
-                request.TaskCode, request.SysTaskCode, request.Message);
+            _logger.LogWarning("浠诲姟鎸傝捣: TaskCode={TaskCode}, 绯荤粺浠诲姟鐮�={SysTaskCode}, 鍘熷洜={Message}",request.TaskCode, request.SysTaskCode, request.Message);
 
             // 杩欓噷娣诲姞鎮ㄧ殑鎸傝捣澶勭悊閫昏緫
             await Task.CompletedTask;
@@ -299,8 +298,7 @@
         /// </summary>
         private async Task HandleTaskAllocated(StatusCallbackRequest request)
         {
-            _logger.LogInformation("浠诲姟鍒嗛厤: TaskCode={TaskCode}, Robot={Robot}",
-                request.TaskCode, request.RobotCode);
+            _logger.LogInformation("浠诲姟鍒嗛厤: TaskCode={TaskCode}, Robot={Robot}",request.TaskCode, request.RobotCode);
 
             // 杩欓噷娣诲姞鎮ㄧ殑浠诲姟鍒嗛厤澶勭悊閫昏緫
             await Task.CompletedTask;
@@ -313,8 +311,9 @@
         {
             if (request.Status == WIDESEA_DTO.Basic.TaskStatus.success)
             {
-                _logger.LogInformation("鍙栫瀹屾垚: Container={Container}, Location={Location}",
-                    request.ContainerCode, request.LocationCode);
+                _logger.LogInformation("鍙栫瀹屾垚: Container={Container}, Location={Location}", request.ContainerCode, request.LocationCode);
+
+                await _taskService.TaskStatusChange(request.TaskCode, WIDESEA_Common.TaskEnum.TaskStatusEnum.AGV_Pull);
             }
             else
             {
@@ -333,8 +332,8 @@
         {
             if (request.Status == WIDESEA_DTO.Basic.TaskStatus.success)
             {
-                _logger.LogInformation("鏀剧瀹屾垚: Container={Container}, Location={Location}",
-                    request.ContainerCode, request.LocationCode);
+                _logger.LogInformation("鏀剧瀹屾垚: Container={Container}, Location={Location}", request.ContainerCode, request.LocationCode);
+                await _taskService.TaskStatusChange(request.TaskCode, WIDESEA_Common.TaskEnum.TaskStatusEnum.AGV_Puting);
             }
             else
             {
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/InboundOrderController.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/InboundOrderController.cs"
index cce5ef0..201f0f2 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/InboundOrderController.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/InboundOrderController.cs"
@@ -22,6 +22,7 @@
 using WIDESEA_IInboundService;
 using WIDESEA_InboundService;
 using WIDESEA_IOutboundService;
+using WIDESEA_ITaskInfoService;
 using WIDESEA_Model.Models;
 using WIDESEA_OutboundService;
 
@@ -45,8 +46,9 @@
         private readonly IOutStockLockInfoService _outStockLockInfoService;
         private readonly IOutboundOrderDetailService _outboundOrderDetailService;
         private readonly IRepository<Dt_Task> _taskRepository;
+        private readonly ITask_HtyService _task_HtyService;
         private readonly ILogger<InboundOrderController> _logger;
-        public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService, ILocationInfoService locationInfoService, ILogger<InboundOrderController> logger, IMaterialUnitService materialUnitService, IInboundService inboundService, IOutStockLockInfoService outStockLockInfoService, IOutboundOrderDetailService outboundOrderDetailService, IRepository<Dt_Task> taskRepository) : base(service)
+        public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService, ILocationInfoService locationInfoService, ILogger<InboundOrderController> logger, IMaterialUnitService materialUnitService, IInboundService inboundService, IOutStockLockInfoService outStockLockInfoService, IOutboundOrderDetailService outboundOrderDetailService, IRepository<Dt_Task> taskRepository, ITask_HtyService task_HtyService) : base(service)
         {
             this.erpApiService = erpApiService;
             _invokeMESService = invokeMESService;
@@ -59,13 +61,22 @@
             _outStockLockInfoService = outStockLockInfoService;
             _outboundOrderDetailService = outboundOrderDetailService;
             _taskRepository = taskRepository;
+            _task_HtyService = task_HtyService;
         }
 
         [HttpPost, Route("Test"), AllowAnonymous, MethodParamsValidate]
         public async Task<WebResponseContent> Test()
         {
+
             var originalTask = _taskRepository.Db.Queryable<Dt_Task>().First();
-            _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.鑷姩瀹屾垚);
+
+            var result = _task_HtyService.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.浜哄伐鍒犻櫎);
+            if (result)
+            {
+                var sddd = "trueee";
+            }
+            //var originalTask = _taskRepository.Db.Queryable<Dt_Task>().First();
+            //_taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.鑷姩瀹屾垚);
             // Service.Db.Deleteable<Dt_InboundOrder>().Where(x=>x.UpperOrderNo== "12020251100040").ExecuteCommand();
             //_inboundService.InboundOrderDetailService.Db.Deleteable<Dt_InboundOrderDetail>()
             // .Where(p => SqlFunc.Subqueryable<Dt_InboundOrder>().Where(s => s.Id == p.OrderId && s.UpperOrderNo == "12020251100040").Any()).ExecuteCommand();
@@ -74,7 +85,7 @@
 
             //var pdddurchaseToStockResult = await _materialUnitService.ConvertFromToStockAsync("100513-00303", "W013", 1);
 
-            //var sddd = _locationInfoService.AssignLocation();
+            //var sddd = _locationInfoService.AssignLocation(1);
             //var code = sddd.LocationCode;
             //var ssss=await _dailySequenceService.GetNextSequenceAsync();
             //var  ddddssss = "WSLOT" + DateTime.Now.ToString("yyyyMMddHHmmss") + ssss.ToString().PadLeft(5, '0');
@@ -108,7 +119,7 @@
             //await  erpApiService.GetMaterialInfoAsync(new WIDESEA_DTO.Basic.MaterialRequest());
 
 
-            return WebResponseContent.Instance.OK();
+            return WebResponseContent.Instance.OK(result?1:0 );
         }
 
         /// <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_WMSServer/Filter/CustomProfile.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/Filter/CustomProfile.cs"
index 8636c46..565c922 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/Filter/CustomProfile.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/Filter/CustomProfile.cs"
@@ -7,6 +7,7 @@
 using System.Threading.Tasks;
 using WIDESEA_Common.OrderEnum;
 using WIDESEA_Core.Helper;
+using WIDESEA_Core.HttpContextUser;
 using WIDESEA_DTO;
 using WIDESEA_DTO.Inbound;
 using WIDESEA_DTO.Outbound;
@@ -33,6 +34,10 @@
             CreateMap<Dt_ReceiveOrderDetail, Dt_CheckOrder>().ForMember(a => a.ReceivedQuantity, b => b.MapFrom(x => x.ReceivedQuantity)).ForMember(a => a.MaterielCode, b => b.MapFrom(x => x.MaterielCode)).ForMember(a => a.CheckOrderStatus, b => b.MapFrom(x => CheckOrderStatusEnum.NotCheck.ObjToInt()));
 
             CreateMap<Dt_Task, WMSTaskDTO>();
+
+            CreateMap<Dt_Task, Dt_Task_Hty>()
+         .ForMember(dest => dest.SourceId, opt => opt.Ignore()) // 鎵嬪姩濉厖锛屽拷鐣ユ槧灏�
+         .ForMember(dest => dest.OperateType, opt => opt.Ignore()); // 鎵嬪姩濉厖锛屽拷鐣ユ槧灏�
         }
     }
 }

--
Gitblit v1.9.3