From cbf06cbb2e7988fdee53507dede034756ebfbf59 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期二, 14 一月 2025 15:47:40 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.cs |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.cs"
index 26a6b2b..d1a47ae 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.cs"
@@ -21,6 +21,7 @@
 using WIDESEA_Common.LocationEnum;
 using WIDESEA_IRecordService;
 using WIDESEA_Common.StockEnum;
+using WIDESEA_Common.TaskEnum;
 
 namespace WIDESEA_OutboundService
 {
@@ -144,5 +145,54 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
+
+        public WebResponseContent AddMesOrder(SubstrateOutModel substrateOutModel)
+        {
+            try
+            {
+                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA57.ToString());
+                if (warehouse == null)
+                {
+                    return WebResponseContent.Instance.Error($"浠撳簱鍩虹淇℃伅鏈厤缃�");
+                }
+
+                Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == substrateOutModel.MaterialCode);
+                if (materielInfo == null)
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒拌鐗╂枡淇℃伅");
+                }
+                int orderType = 0;
+                if(substrateOutModel.Line == "1011")
+                {
+                    orderType = MesOutboundOrderTypeEnum.HandSubstrateOutPick.ObjToInt();
+                }
+                else
+                {
+                    orderType = MesOutboundOrderTypeEnum.HandSubstrateOut.ObjToInt();
+                }
+
+                Dt_MesOutboundOrder mesOutboundOrder = new Dt_MesOutboundOrder()
+                {
+                    CreateType = OrderCreateTypeEnum.CreateInSystem.ObjToInt(),
+                    Line = substrateOutModel.Line,
+                    MaterialCode = substrateOutModel.MaterialCode,
+                    MaterialName = materielInfo.MaterielName,
+                    OrderQuantity = substrateOutModel.RequiredQuantity,
+                    TaskNo = DateTime.Now.ToString("yyyyMMddHHmmss"),
+                    Unit = substrateOutModel.Unit,
+                    OrderType = orderType,
+                    OrderStatus = OutOrderStatusEnum.鏈紑濮�.ObjToInt(),
+                    WarehouseId = warehouse.WarehouseId
+                };
+
+                AddData(mesOutboundOrder);
+                
+                return WebResponseContent.Instance.OK();
+            }
+            catch (Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
     }
 }

--
Gitblit v1.9.3