From 20a71f4bafb8cda355948cc061827b8d4752966f Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期三, 17 十二月 2025 10:44:17 +0800
Subject: [PATCH] Merge branch 'htq20251215' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu into htq20251215

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_TakeStockOrder.cs        |   62 ++++
 项目代码/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js                    |  253 +++----------------
 项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue                          |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs          |  185 ++++++++++++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Core/CodeConfigEnum/RuleCodeEnum.cs              |    9 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs                 |    7 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs |   14 +
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/TakeStockStatusEnum.cs          |   68 +++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs                 |    7 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_TakeStockOrderDetail.cs  |  125 +++++++++
 10 files changed, 510 insertions(+), 222 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js"
index ca0f429..3a6458b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js"
@@ -3,12 +3,13 @@
 import http from '@/api/http.js'
 import { h,createVNode, render,reactive,ref  } from 'vue';
 import { ElDialog , ElForm, ElFormItem, ElInput, ElButton, ElMessage ,ElSelect ,ElOption } from 'element-plus'; // 寮曞叆ElMessage锛岃В鍐虫彁绀烘棤鍙嶅簲
-
+import gridBody from '../inbound/extend/Pallet.vue'
+import gridHeader from './extend/EmptyTrayInbound.vue'
 let extension = {
     components: {
       //鏌ヨ鐣岄潰鎵╁睍缁勪欢
-      gridHeader: '',
-      gridBody: '',
+      gridHeader: gridHeader,
+      gridBody: gridBody,
       gridFooter: '',
       //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢
       modelHeader: '',
@@ -17,32 +18,32 @@
     },
     tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓)
     buttons: { view: [
-       {
-        name: '缁勭洏',
-        type: 'primary',
-        value: '缁勭洏',
-        onClick: function () { // 淇1锛氱Щ闄ゆ棤鐢╮ow鍙傛暟锛屽姞鏃ュ織璋冭瘯
-          console.log('缁勭洏鎸夐挳琚偣鍑伙紝寮�濮嬫牎楠�');
-          const selectedRows = this.$refs.table.getSelected();
+      //  {
+      //   name: '缁勭洏',
+      //   type: 'primary',
+      //   value: '缁勭洏',
+      //   onClick: function () { // 淇1锛氱Щ闄ゆ棤鐢╮ow鍙傛暟锛屽姞鏃ュ織璋冭瘯
+      //     console.log('缁勭洏鎸夐挳琚偣鍑伙紝寮�濮嬫牎楠�');
+      //     const selectedRows = this.$refs.table.getSelected();
 
-          // 鏍¢獙1锛氭槸鍚﹂�変腑琛�
-          if (selectedRows.length === 0) {
-            console.log('鏍¢獙涓嶉�氳繃锛氭湭閫変腑浠讳綍鍗曟嵁');
-            ElMessage.warning('璇烽�夋嫨涓�鏉″崟鎹�');
-            return;
-          }
-          // 鏍¢獙2锛氭槸鍚﹂�変腑鍗曡
-          if (selectedRows.length > 1) {
-            console.log('鏍¢獙涓嶉�氳繃锛氶�変腑澶氳鍗曟嵁');
-            ElMessage.warning('鍙兘閫夋嫨涓�鏉″崟鎹�');
-            return;
-          }
+      //     // 鏍¢獙1锛氭槸鍚﹂�変腑琛�
+      //     if (selectedRows.length === 0) {
+      //       console.log('鏍¢獙涓嶉�氳繃锛氭湭閫変腑浠讳綍鍗曟嵁');
+      //       ElMessage.warning('璇烽�夋嫨涓�鏉″崟鎹�');
+      //       return;
+      //     }
+      //     // 鏍¢獙2锛氭槸鍚﹂�変腑鍗曡
+      //     if (selectedRows.length > 1) {
+      //       console.log('鏍¢獙涓嶉�氳繃锛氶�変腑澶氳鍗曟嵁');
+      //       ElMessage.warning('鍙兘閫夋嫨涓�鏉″崟鎹�');
+      //       return;
+      //     }
 
-          const targetRow = selectedRows[0];
+      //     const targetRow = selectedRows[0];
      
-          this.$emit('openPalletDialog', targetRow.orderNo);
-        }
-      },
+      //     this.$emit('openPalletDialog', targetRow.orderNo);
+      //   }
+      // },
       {
                 name: '鎾ら攢缁勭洏',
                 type: 'primary',
@@ -243,196 +244,22 @@
       ElMessage.error('缃戠粶寮傚父鎴栨帴鍙i敊璇紝璇风◢鍚庨噸璇�');
     }
   }
-},
-     {
-  name: '绌烘墭鐩樺叆搴�',
-  type: 'primary',
-  value: '绌烘墭鐩樺叆搴�',
-  
-  onClick: function () {
-    const mountNode = document.createElement('div');
-    document.body.appendChild(mountNode);
-
-    const boxCodeReg = /^[A-Z]\d{9}$/;
-    // 鍝嶅簲寮忚〃鍗曟暟鎹細鏂欑鐮侊紙蹇呭~锛屾壂鐮佹灙/鎵嬪姩杈撳叆锛�
-    const formData = reactive({ 
-      boxCode: '',
-      warehouseCode:''
-    });
-
-    const warehouses = ref([]);
-    const isLoadingWarehouses = ref(false);
-
-    const getWarehouseList = async () => {
-      isLoadingWarehouses.value = true;
-      try {
-        const { data, status } = await http.post('/api/LocationInfo/GetLocationTypes'); 
-        if (status && Array.isArray(data)) {
-          // 鏍煎紡鍖栦粨搴撻�夐」锛氶�傞厤ElSelect鐨刲abel-value鏍煎紡
-          warehouses.value = data.map(item => ({
-            label: item.locationTypeDesc,
-            value: item.locationType  
-          }));
-        } else {
-          ElMessage.error('鑾峰彇鍖哄煙鍒楄〃澶辫触');
-          warehouses.value = [];
-        }
-      } catch (err) {
-        ElMessage.error('鍖哄煙鏁版嵁璇锋眰寮傚父锛岃绋嶅悗閲嶈瘯');
-        warehouses.value = [];
-      } finally {
-        isLoadingWarehouses.value = false;
-      }
-    };
-
-    // 鎻愪氦琛ㄥ崟鐨勭粺涓�閫昏緫锛堜緵鍥炶溅瑙﹀彂鍜屾寜閽偣鍑诲叡鐢級
-    const submitForm = async () => {
-      const formRef = vnode.component.refs.batchInForm;
-
-      if (!boxCodeReg.test(formData.boxCode.trim())) {
-        ElMessage.warning('鏂欑鐮佹牸寮忛敊璇�');
-        selectBoxCodeInput();
-        return;
-      }
-      
-      try {
-        // 鎵ц琛ㄥ崟鏍¢獙锛堟枡绠辩爜蹇呭~锛�
-        await formRef.validate();
-      } catch (err) {
-        const errorMsg = err?.[0]?.message || '璇疯緭鍏ユ湁鏁堢殑鏂欑鐮�';
-        ElMessage.warning(errorMsg);
-        selectBoxCodeInput();
-        return;
-      }
-
-      http.post('/api/InboundOrder/EmptyMaterielGroup', {
-        palletCode: formData.boxCode.trim(),
-        warehouseCode:formData.warehouseCode
-      }).then(({ data, status, message }) => {
-        if (status) {
-          ElMessage.success(`鍏ュ簱鎴愬姛锛屾枡绠辩爜锛�${formData.boxCode.trim()}`);
-          this.refresh(); 
-          formData.boxCode = ''; 
-          
-          setTimeout(() => {
-            const inputRef = vnode.component.refs.boxCodeInput;
-            inputRef?.focus();
-          }, 100);
-        } else {
-          ElMessage.error(message || data?.message || '鍏ュ簱澶辫触');
-          selectBoxCodeInput();
-        }
-      }).catch(() => {
-        ElMessage.error('璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯');
-        selectBoxCodeInput();
-      });
-    };
-
-    const selectBoxCodeInput = () => {
-      setTimeout(() => {
-        const inputRef = vnode.component.refs.boxCodeInput;
-        if (inputRef) {
-          const targetInput = inputRef.$el?.querySelector('input') || inputRef;
-          targetInput?.focus(); 
-          targetInput?.select(); 
-        }
-  }, 100);
-}
-    const vnode = createVNode(ElDialog, {
-      title: '绌烘墭鐩樺叆搴�',
-      width: '400px',
-      modelValue: true,
-      appendToBody: true,
-      
-      onOpened: async () => {
-        await getWarehouseList();
-        const inputRef = vnode.component.refs.boxCodeInput;
-        inputRef?.focus();
-      },
-      'onUpdate:modelValue': (isVisible) => {
-        if (!isVisible) {
-          render(null, mountNode);
-          document.body.removeChild(mountNode);
-        }
-      }
-    }, {
-      default: () => h(ElForm, {
-        model: formData,
-        rules: {
-          boxCode: [
-            { required: true, message: '璇疯緭鍏ユ枡绠辩爜', trigger: ['blur', 'change'] },
-            { pattern: boxCodeReg, message: '鏂欑鐮佹牸寮忛敊璇�', trigger: ['blur', 'change'] }
-          ],
-          warehouseCode:[
-            { required: true, message: '璇烽�夋嫨鍖哄煙', trigger: ['change', 'blur'] }
-          ]
-        },
-        ref: 'batchInForm'
-      }, [
-        //浠撳簱鏁版嵁
-        h(ElFormItem, { label: '鍖哄煙', prop: 'warehouseCode', required: true }, [
-          h(ElSelect, {
-            modelValue: formData.warehouseCode,
-            'onUpdate:modelValue': (val) => {
-              formData.warehouseCode = val;
-            },
-            placeholder: '璇烽�夋嫨鍏ュ簱鍖哄煙',
-            filterable: true, // 鏀寔鎼滅储浠撳簱
-            loading: isLoadingWarehouses.value, // 鍔犺浇鐘舵��
-            style: { width: '100%' }
-          }, [
-            // 娓叉煋浠撳簱涓嬫媺閫夐」
-            warehouses.value.map(item => h(ElOption, {
-              label: item.label,
-              value: item.value
-            }))
-          ])
-        ]),
-        // 鏂欑鐮佽緭鍏ラ」锛堟敮鎸佽仛鐒︺�佸洖杞︽彁浜わ級
-        h(ElFormItem, { label: '鏂欑鐮�', prop: 'boxCode', required: true }, [
-          h(ElInput, {
-            type: 'text',
-            modelValue: formData.boxCode,
-            'onUpdate:modelValue': (val) => {
-              formData.boxCode = val;
-            },
-            ref: 'boxCodeInput', 
-            placeholder: '鎵爜杈撳叆鎴栨墜鍔ㄨ緭鍏ユ枡绠辩爜',
-            // 鐩戝惉鍥炶溅浜嬩欢锛堟壂鐮佹灙榛樿浼氬彂閫佸洖杞︼級
-            onKeydown: (e) => {
-              if (e.key === 'Enter') {
-                e.preventDefault(); 
-                submitForm(); 
-              }
-            }
-          })
-        ]),
-        // 搴曢儴鎸夐挳鍖�
-        h('div', { style: { textAlign: 'right', marginTop: '16px' } }, [
-          h(ElButton, {
-            type: 'text',
-            onClick: () => {
-              render(null, mountNode);
-              document.body.removeChild(mountNode);
-              ElMessage.info('鍙栨秷鍏ュ簱浠诲姟');
-            }
-          }, '鍙栨秷'),
-          h(ElButton, {
-            type: 'primary',
-            onClick: submitForm 
-          }, '纭畾')
-        ])
-      ])
-    });
-
-    vnode.appContext = this.$.appContext;
-    render(vnode, mountNode);
-  }
-}
-    ], box: [], detail: [] }, 
+},], box: [], detail: [] }, 
     methods: {
        //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄�
       onInit() {  
+        var GroupPalletBtn = this.buttons.find(x => x.value == "GroupPallet");
+        if (GroupPalletBtn != null) {
+          GroupPalletBtn.onClick = () => {
+               this.$refs.gridBody.open();
+            }
+        }
+        var EmptyTrayInboundBtn = this.buttons.find(x => x.value == "EmptyTrayInbound");
+        if (EmptyTrayInboundBtn != null) {
+          EmptyTrayInboundBtn.onClick = () => {
+               this.$refs.gridHeader.open();
+            }
+        }
       },
       onInited() {
         
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
index 39cbe94..244102a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
@@ -371,7 +371,7 @@
       this.sumLoading = true;
       this.sumError = '';
       try {
-        const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + this.docNo, {});
+        const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + this.orderNo, {});
         if (response.data) {
           this.totalStockSum = response.data.stockSumQuantity || 0;
           this.totalStockCount = response.data.stockCount || 0;
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"
new file mode 100644
index 0000000..cf918d8
--- /dev/null
+++ "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"
@@ -0,0 +1,68 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Common.OrderEnum
+{
+    /// <summary>
+    /// 鐩樼偣鐘舵��
+    /// </summary>
+    public enum TakeStockStatusEnum
+    {
+        /// <summary>
+        /// 鏈洏鐐�
+        /// </summary>
+        [Description("鏈洏鐐�")]
+        鏈洏鐐� = 0,
+
+        /// <summary>
+        /// 鐩樼偣涓�
+        /// </summary>
+        [Description("鐩樼偣涓�")]
+        鐩樼偣涓� = 1,
+
+        /// <summary>
+        /// 鐩樼偣瀹屾垚
+        /// </summary>
+        [Description("鐩樼偣瀹屾垚")]
+        鐩樼偣瀹屾垚 = 2,
+
+        /// <summary>
+        /// 鐩樼偣鍏抽棴
+        /// </summary>
+        [Description("鐩樼偣鍏抽棴")]
+        鐩樼偣鍏抽棴 = 3,
+    }
+    /// <summary>
+    /// 鐩樼偣鏄庣粏鐘舵��
+    /// </summary>
+    public enum TakeStockDetailStatusEnum
+    {
+        /// <summary>
+        /// 鏈洏鐐�
+        /// </summary>
+        [Description("鏈洏鐐�")]
+        鏈洏鐐� = 0,
+
+        /// <summary>
+        /// 鐩樼偣涓�
+        /// </summary>
+        [Description("鐩樼偣鍑哄簱涓�")]
+        鐩樼偣鍑哄簱涓� = 1,
+
+        /// <summary>
+        /// 鐩樼偣鍑哄簱瀹屾垚
+        /// </summary>
+        [Description("鐩樼偣鍑哄簱瀹屾垚")]
+        鐩樼偣鍑哄簱瀹屾垚 = 2,
+
+        /// <summary>
+        /// 鐩樼偣瀹屾垚
+        /// </summary>
+        [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_Core/CodeConfigEnum/RuleCodeEnum.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_Core/CodeConfigEnum/RuleCodeEnum.cs"
index fbe470b..f735843 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_Core/CodeConfigEnum/RuleCodeEnum.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_Core/CodeConfigEnum/RuleCodeEnum.cs"
@@ -51,6 +51,13 @@
         [Description("璋冩嫧鍗曞彿缂栫爜瑙勫垯")]
         AllocateOrderCodeRule,
 
-        NewBarcodeRule
+        NewBarcodeRule,
+        /// <summary>
+        /// 鐩樼偣鍗曞彿缂栫爜瑙勫垯
+        /// </summary>
+        [Description("鐩樼偣鍗曞彿缂栫爜瑙勫垯")]
+        PDCodeRule
+
+
     }
 }
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 9c630cb..2095eb9 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"
@@ -54,5 +54,12 @@
         Task<WebResponseContent> GenerateOutboundBatchTasksAsync(int orderDetailId, decimal batchQuantity, string outStation);
 
         Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews, string station);
+
+        /// <summary>
+        /// 搴撳瓨鐩樼偣
+        /// </summary>
+        /// <param name="stockViews"></param>
+        /// <returns></returns>
+       Task <WebResponseContent> TakeOutbound(List<StockViewDTO> stockViews,string outStation);
     }
 }
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 d35fbfe..01502e4 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"
@@ -63,13 +63,8 @@
                     return content.Error($"浠撳簱涓病鏈夎{palletDto.WarehouseType}缂栧彿銆�");
                 }
 
-                List<Dt_InboundOrderDetail> details = new List<Dt_InboundOrderDetail>();
                 Dt_InboundOrder inboundOrder = new Dt_InboundOrder();
-                details = _inboundOrderDetailRepository.QueryData(x => x.OutBoxbarcodes == palletDto.Barcode && x.OrderDetailStatus == (int)InOrderStatusEnum.鏈紑濮�);
-                if (details.Count <= 0)
-                {
-                    details = _inboundOrderDetailRepository.QueryData(x => x.Barcode == palletDto.Barcode && x.OrderDetailStatus == (int)InOrderStatusEnum.鏈紑濮�);
-                }
+                var details = _inboundOrderDetailRepository.QueryData(x => (x.OutBoxbarcodes == palletDto.Barcode|| x.Barcode == palletDto.Barcode) && x.OrderDetailStatus == (int)InOrderStatusEnum.鏈紑濮�);
 
                 if (details.Count() <= 0)
                 {
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_TakeStockOrder.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_TakeStockOrder.cs"
new file mode 100644
index 0000000..ee5433b
--- /dev/null
+++ "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_TakeStockOrder.cs"
@@ -0,0 +1,62 @@
+锘縰sing SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core.Attributes;
+using WIDESEA_Core.CodeConfigEnum;
+using WIDESEA_Core.DB.Models;
+using WIDESEA_Core.Enums;
+
+namespace WIDESEA_Model.Models
+{
+    /// <summary>
+    /// 鐩樼偣鍗�
+    /// </summary>
+    [SugarTable(nameof(Dt_TakeStockOrder), "鐩樼偣鍗�")]
+    public class Dt_TakeStockOrder : BaseEntity
+    {
+        /// <summary>
+        /// 涓婚敭
+        /// </summary>
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭")]
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 鐩樼偣鍗曞彿
+        /// </summary>
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鐩樼偣鍗曞彿")]
+        public string OrderNo { get; set; }
+
+        /// <summary>
+        /// 浠撳簱涓婚敭
+        /// </summary>
+        [SugarColumn(IsNullable = false, ColumnDescription = "鎵�灞炰粨搴�")]
+        public int WarehouseId { get; set; }
+
+        /// <summary>
+        /// 鐩樼偣鐘舵��
+        /// </summary>
+        [SugarColumn(IsNullable = false, ColumnDescription = "鐩樼偣鐘舵��")]
+        public int TakeStockStatus { get; set; }
+
+        /// <summary>
+        /// 澶囨敞
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "澶囨敞")]
+        public string Remark { get; set; }
+
+        /// <summary>
+        /// 澶囨敞
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "鎵�鍚洏鐐规墭鐩�")]
+        public string AllPalletCode { get; set; }
+
+        /// <summary>
+        /// 鐩樼偣鏄庣粏
+        /// </summary>
+        [PropertyValidate("鐩樼偣鏄庣粏", NotNullAndEmpty = true), Navigate(NavigateType.OneToMany, nameof(Dt_TakeStockOrderDetail.TakeStockId), nameof(Id))]
+        public List<Dt_TakeStockOrderDetail> Details { 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_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"
new file mode 100644
index 0000000..2c6c80b
--- /dev/null
+++ "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"
@@ -0,0 +1,125 @@
+锘縰sing SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core.DB.Models;
+
+namespace WIDESEA_Model.Models
+{
+    /// <summary>
+    /// 鐩樼偣鍗曟槑缁�
+    /// </summary>
+    [SugarTable(nameof(Dt_TakeStockOrderDetail), "鐩樼偣鍗曟槑缁�")]
+    public class Dt_TakeStockOrderDetail : BaseEntity
+    {
+        /// <summary>
+        /// 涓婚敭
+        /// </summary>
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭")]
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 鐩樼偣鍗曚富閿�
+        /// </summary>
+        [SugarColumn(IsNullable = false, ColumnDescription = "鐩樼偣鍗曚富閿�")]
+        public int TakeStockId { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡缂栫爜
+        /// </summary>
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鐗╂枡缂栫爜")]
+        public string MaterielCode { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡鍚嶇О
+        /// </summary>
+        [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "鐗╂枡鍚嶇О")]
+        public string MaterielName { get; set; }
+
+        /// <summary>
+        /// 鎵规鍙�
+        /// </summary>
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鎵规鍙�")]
+        public string BatchNo { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡瑙勬牸
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "鐗╂枡瑙勬牸")]
+        public string MaterielSpec { get; set; }
+
+        /// <summary>
+        /// 鍘熶粨浣�
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鍘熶粨浣�")]
+        public string LocationCode { get; set; }
+
+        /// <summary>
+        /// 鐩樼偣鎵樼洏
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鐩樼偣鎵樼洏")]
+        public string TakePalletCode { get; set; }
+
+        /// <summary>
+        /// 鐩樼偣鏄庣粏鐘舵��
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDescription = "鐩樼偣鏄庣粏鐘舵��")]
+        public int TakeDetalStatus { get; set; }
+
+        /// <summary>
+        /// 鍗曚綅
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鍗曚綅")]
+        public string Unit { get; set; }
+
+        /// <summary>
+        /// 璐﹂潰鏁伴噺
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDescription = "璐﹂潰鏁伴噺")]
+        public decimal SysQty { get; set; }
+
+        /// <summary>
+        /// 瀹炵洏鏁伴噺
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDescription = "瀹炵洏鏁伴噺")]
+        public decimal Qty { get; set; }
+
+        /// <summary>
+        /// 澶囨敞
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "澶囨敞")]
+        public string Remark { get; set; }
+
+        /// <summary>
+        /// 鏉$爜
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鏉$爜")]
+        public string barcode { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡浠撳簱
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "鐗╂枡浠撳簱")]
+        public string WarehouseCode { get; set; }
+
+        /// <summary>
+        /// 鍘傚尯
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 10, ColumnDescription = "鍘傚尯")]
+        public string FactoryArea { get; set; }
+
+        /// <summary>
+        /// 渚涘簲鍟嗙紪鍙�
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "渚涘簲鍟嗙紪鍙�")]
+        public string SupplyCode { get; set; }
+
+        /// <summary>
+        /// 鐩樼偣鍗曞崟鎹�
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鐩樼偣鍗曞崟鎹�")]
+        public string TakeStockNo { 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_TaskInfoService/TaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index 6457db1..e5090c9 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -2,6 +2,7 @@
 using Microsoft.Extensions.Logging;
 using Newtonsoft.Json;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
+using SqlSugar;
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
@@ -16,9 +17,13 @@
 using WIDESEA_Common.StockEnum;
 using WIDESEA_Common.TaskEnum;
 using WIDESEA_Core;
+using WIDESEA_Core.CodeConfigEnum;
+using WIDESEA_Core.DB;
 using WIDESEA_Core.Helper;
+using WIDESEA_Core.Seed;
 using WIDESEA_DTO.Basic;
 using WIDESEA_DTO.Stock;
+using WIDESEA_IBasicService;
 using WIDESEA_Model.Models;
 using WIDESEA_Model.Models.Basic;
 using WIDESEA_Model.Models.Check;
@@ -1098,6 +1103,186 @@
 
         #endregion
 
+        /// <summary>
+        /// 閫夊畾搴撳瓨鐢熸垚鐩樼偣鍗曞嚭搴�
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<WebResponseContent> TakeOutbound(List<StockViewDTO> stockViews, string outStation)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                List<int> ids = stockViews.Select(x => x.StockId).ToList();
+                //鑾峰彇搴撳瓨
+                List<Dt_StockInfo> stockInfos = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => ids.Contains(x.Id)).Includes(x => x.Details).ToList();
+                if (stockInfos.Count != stockViews.Count)
+                {
+                    StockViewDTO? stockViewDTO = stockViews.FirstOrDefault(x => !stockInfos.Select(x => x.PalletCode).ToList().Contains(x.PalletCode));
+                    return content.Error($"鏈壘鍒皗stockViewDTO?.PalletCode}搴撳瓨");
+                }
+                //鑾峰彇璐т綅
+                List<string> locStrs = stockInfos.Select(x => x.LocationCode).ToList();
+                List<Dt_LocationInfo> locationInfos = (List<Dt_LocationInfo>)_locationInfoService.Db.Queryable<Dt_LocationInfo>().Where(x => locStrs.Contains(x.LocationCode));
+                if (stockInfos.Count != locationInfos.Count)
+                {
+                    string? locStr = locStrs.FirstOrDefault(x => !locationInfos.Select(x => x.LocationCode).ToList().Contains(x));
+                    return content.Error($"鏈壘鍒皗locStr}璐т綅鏁版嵁");
+                }
+                Dt_TakeStockOrder takeStockOrder = new Dt_TakeStockOrder()
+                {
+                    WarehouseId = stockInfos.FirstOrDefault().WarehouseId,
+                    TakeStockStatus = TakeStockStatusEnum.鐩樼偣涓�.ObjToInt(),
+                    OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.PDCodeRule)),
+                    Details = new List<Dt_TakeStockOrderDetail>()
+                };
+                foreach (var item in stockInfos)
+                {
+                    if (item.Details.Count <= 0)
+                    {
+                        return content.Error($"鏈壘鍒皗item.PalletCode}搴撳瓨鏄庣粏鏁版嵁");
+                    }
+                    Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode);
+                    if (locationInfo == null && (locationInfo.EnableStatus == EnableStatusEnum.Disable.ObjToInt() || locationInfo.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && item.StockStatus != StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt())
+                    {
+                        content.Error($"{item.PalletCode}璐т綅鎴栧簱瀛樼姸鎬佷笉婊¤冻鍑哄簱鏉′欢");
+                    }   
+                }
+                List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutInventory,outStation);
+                if (tasks == null || tasks.Count <= 0)
+                {
+                    return content.Error($"鐢熸垚浠诲姟澶辫触");
+                }
+                stockInfos.ForEach(x =>
+                {
+                    x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+                });
+                tasks.ForEach(x =>
+                {
+                    x.OrderNo = takeStockOrder.OrderNo;
+                });
+                locationInfos.ForEach(x =>
+                {
+                    x.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
+                });
+                _unitOfWorkManage.BeginTran();
+                //鏇存柊搴撳瓨鐘舵��
+                _stockRepository.UpdateData(stockInfos);
+                BaseDal.Db.InsertNav(takeStockOrder);
+                //鏂板缓浠诲姟
+                BaseDal.AddData(tasks);
+                _locationInfoService.UpdateData(locationInfos);
+                _unitOfWorkManage.CommitTran();
+                TaskModel esstask = new TaskModel()
+                {
+                    taskType = "carry",
+                    taskGroupCode = "",
+                    groupPriority = 0,
+                    tasks = new List<TasksType>()
+                };
 
+                foreach (var task in tasks)
+                {
+                    esstask.
+                       tasks.Add(new TasksType
+                       {
+                           taskCode = task.TaskNum.ToString(),
+                           taskPriority = 0,
+                           taskDescribe = new TaskDescribeType
+                           {
+                               containerCode = task.PalletCode,
+                               containerType = "CT_KUBOT_STANDARD",
+                               fromLocationCode = task.SourceAddress ?? "",
+                               toStationCode = "",
+                               toLocationCode = task.TargetAddress,
+                               deadline = 0,
+                               storageTag = ""
+                           }
+                       }
+                   );
+                }
+                var result = await _eSSApiService.CreateTaskAsync(esstask);
+
+                _logger.LogInformation("鍒涘缓浠诲姟PalletOutboundTask 杩斿洖:  " + result);
+                if (result)
+                {
+                    return WebResponseContent.Instance.OK();
+                }
+                else
+                {
+                    return WebResponseContent.Instance.Error("涓嬪彂鏈哄櫒浜轰换鍔″け璐ワ紒");
+                }
+                content.OK();
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+        /// <summary>
+        /// 鍗曟嵁鐢熸垚鏂规硶
+        /// </summary>
+        static object lock_code = new object();
+        public string CreateCodeByRule(string ruleCode)
+        {
+            lock (lock_code)
+            {
+
+                string code = string.Empty;
+                DateTime dateTime = DateTime.Now;
+                DateTime now = DateTime.Now;
+                try
+                {
+                    if (string.IsNullOrEmpty(ruleCode))
+                        throw new ArgumentNullException(nameof(ruleCode));
+                    SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig
+                    {
+                        IsAutoCloseConnection = true,
+                        DbType = DbType.SqlServer,
+                        ConnectionString = DBContext.ConnectionString
+                    });
+                    Dt_CodeRuleConfig codeRuleConfig = sugarClient.Queryable<Dt_CodeRuleConfig>().Where(x => x.RuleCode == ruleCode).First();
+                    if (codeRuleConfig == null)
+                        throw new ArgumentNullException(nameof(codeRuleConfig));
+                    if (codeRuleConfig.ModifyDate != null)
+                    {
+                        dateTime = Convert.ToDateTime(codeRuleConfig.ModifyDate);
+                    }
+                    else
+                    {
+                        dateTime = Convert.ToDateTime(codeRuleConfig.CreateDate);
+                    }
+
+                    if (now.Year == dateTime.Year && now.Month == dateTime.Month && now.Day == dateTime.Day)
+                    {
+                        now = dateTime;
+                        codeRuleConfig.CurrentVal = Convert.ToInt32(codeRuleConfig.CurrentVal) + 1;
+                    }
+                    else
+                    {
+                        codeRuleConfig.CurrentVal = 1;
+                    }
+                    codeRuleConfig.ModifyDate = DateTime.Now;
+                    code = codeRuleConfig.StartStr + codeRuleConfig.Format;
+                    code = code.Replace($"[{CodeFormatTypeEnum.YYYY}]", now.Year.ToString().PadLeft(4, '0'));
+                    code = code.Replace($"[{CodeFormatTypeEnum.MM}]", now.Month.ToString().PadLeft(2, '0'));
+                    code = code.Replace($"[{CodeFormatTypeEnum.DD}]", now.Day.ToString().PadLeft(2, '0'));
+                    code = code.Replace($"[{CodeFormatTypeEnum.ST}]", codeRuleConfig.StartStr?.ToString() ?? "");
+                    code = code.Replace($"[{CodeFormatTypeEnum.NUM}]", codeRuleConfig.CurrentVal.ToString().PadLeft(codeRuleConfig.Length, '0'));
+                    Dictionary<string, object> keyValuePairs = new Dictionary<string, object>() { { nameof(codeRuleConfig.CurrentVal), codeRuleConfig.CurrentVal }, { nameof(codeRuleConfig.Id), codeRuleConfig.Id }, { nameof(codeRuleConfig.ModifyDate), DateTime.Now } };
+                    sugarClient.Updateable(keyValuePairs).AS(MainDb.CodeRuleConfig).WhereColumns(nameof(codeRuleConfig.Id)).ExecuteCommand();
+                    sugarClient.Updateable(codeRuleConfig);
+
+                }
+                catch (Exception ex)
+                {
+
+                }
+                return code;
+            }
+        }
     }
+
 }
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/TaskInfo/TaskController.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/TaskInfo/TaskController.cs"
index a8b86b7..c52883d 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/TaskInfo/TaskController.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/TaskInfo/TaskController.cs"
@@ -108,6 +108,18 @@
             return await Service.GenerateOutboundBatchTasksAsync(data.orderDetailId,data.batchQuantity, data.outboundPlatform);
         }
 
-        
+        /// <summary>
+        /// 鐩樼偣搴撳瓨鍑哄簱
+        /// </summary>
+        /// <param name="stockViews"></param>
+        /// <param name="outStation"></param>
+        /// <returns></returns>
+        [HttpPost, HttpGet, Route("TakeOutbound"), AllowAnonymous]
+        public async Task<WebResponseContent> TakeOutbound([FromBody] List<StockViewDTO> stockViews, string outStation)
+        {
+            return await Service.TakeOutbound(stockViews, outStation);
+        }
+
+
     }
 }

--
Gitblit v1.9.3