From 12e2d0e41d52f36d0746118e24b3fed228f92f98 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 18 十二月 2024 08:58:41 +0800
Subject: [PATCH] WMS

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockOutboundOrderDTO.cs                 |   52 ++++++++
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs                 |    2 
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs                  |   26 ++++
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/TestToolModel.cs                           |   59 +++++++++
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs                   |    8 +
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesResponseContent.cs                      |   54 +++++++++
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs                   |   48 ++++++++
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs |   12 ++
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs         |   48 ++++++++
 9 files changed, 309 insertions(+), 0 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesResponseContent.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesResponseContent.cs"
new file mode 100644
index 0000000..9ed0fd6
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesResponseContent.cs"
@@ -0,0 +1,54 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core.Attributes;
+
+namespace WIDESEA_DTO
+{
+    [ModelValidate]
+    public class MesResponseContent
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public bool bSucc { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string StrCode { get; set; }
+        /// <summary>
+        /// 鎵ц鎴愬姛
+        /// </summary>
+        public string StrMsg { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime DataTime { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public content Content { get; set; }
+
+        public class content
+        {
+            /// <summary>
+            /// 
+            /// </summary>
+            public string Code { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public string Name { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public string ShortName { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public string Contacts { get; set; }
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/TestToolModel.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/TestToolModel.cs"
new file mode 100644
index 0000000..828a8ee
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/TestToolModel.cs"
@@ -0,0 +1,59 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core.Attributes;
+
+namespace WIDESEA_DTO
+{
+    /// <summary>
+    /// 娴嬭瘯鏋跺嚭浠撴ā鍨�
+    /// </summary>
+    [ModelValidate]
+    public class TestToolOutModel
+    {
+        /// <summary>
+        /// 娴嬫灦缂栫爜
+        /// </summary>
+        [PropertyValidate("娴嬫灦缂栫爜", NotNullAndEmpty = true)]
+        public string ToolCode { get; set; }
+        /// <summary>
+        /// 鐩爣鍦板潃鐮�
+        /// </summary>
+        [PropertyValidate("鐩爣鍦板潃鐮�", NotNullAndEmpty = true)]
+        public string TargetAddressCode { get; set; }
+    }
+
+    /// <summary>
+    /// 娴嬭瘯鏋舵姤搴熸ā鍨�
+    /// </summary>
+    [ModelValidate]
+    public class TestToolScrapModel
+    {
+        /// <summary>
+        /// 娴嬫灦缂栫爜
+        /// </summary>
+        [PropertyValidate("娴嬫灦缂栫爜", NotNullAndEmpty = true)]
+        public string ToolCode { get; set; }
+    }
+
+    /// <summary>
+    /// 娴嬭瘯鏋堕��搴撴ā鍨�
+    /// </summary>
+    [ModelValidate]
+    public class TestToolBackModel
+    {
+        /// <summary>
+        /// 婧愪綅缃�
+        /// </summary>
+        [PropertyValidate("婧愪綅缃�", NotNullAndEmpty = true)]
+        public string SourceAddressCode { get; set; }
+
+        /// <summary>
+        /// 娴嬭瘯鏋剁紪鐮�
+        /// </summary>
+        [PropertyValidate("娴嬭瘯鏋剁紪鐮�", NotNullAndEmpty = true)]
+        public string TestToolCode { get; set; }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockOutboundOrderDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockOutboundOrderDTO.cs"
new file mode 100644
index 0000000..e3ef4c8
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockOutboundOrderDTO.cs"
@@ -0,0 +1,52 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO.Stock
+{
+    public class StockOutboundOrderDTO
+    {
+        /// <summary>
+        /// 鍗曟嵁缂栫爜
+        /// </summary>
+        public string OrderNo { get; set; }
+        /// <summary>
+        /// 鎵樼洏鍙�
+        /// </summary>
+        public string PalletCode { get; set; }
+        /// <summary>
+        /// 鐗╂枡缂栫爜
+        /// </summary>
+        public string MaterielCode { get; set; }
+        /// <summary>
+        /// 鐗╂枡鍚嶇О
+        /// </summary>
+        public string MaterielName { get; set; }
+        /// <summary>
+        /// 鎵规鍙�
+        /// </summary>
+        public string BatchNo { get; set; }
+        /// <summary>
+        /// 搴忓垪鍙�
+        /// </summary>
+        public string SerialNumber {  get; set; }
+        /// <summary>
+        /// 搴撳瓨鏁伴噺
+        /// </summary>
+        public float StockQuantity { get; set; }
+        /// <summary>
+        /// 鍑哄簱鏁伴噺
+        /// </summary>
+        public float OutboundQuantity { get; set; }
+        /// <summary>
+        /// 宸ュ崟鎬绘暟
+        /// </summary>
+        public float OrderQuantity { get; set; }
+        /// <summary>
+        /// 宸插嚭鏁伴噺
+        /// </summary>
+        public float OverOutQuantity { get; set; }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs"
index 8ed19f0..0851e31 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs"
@@ -3,6 +3,7 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Core;
 using WIDESEA_Core.BaseServices;
 using WIDESEA_DTO.Stock;
 using WIDESEA_IStockRepository;
@@ -19,5 +20,6 @@
         List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity);
 
         List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo, int warehoseId);
+        StockOutboundOrderDTO GetStockOutboundOrder(SaveModel saveModel);
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
index ef679ce..d803621 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
@@ -25,6 +25,8 @@
 using WIDESEA_Core;
 using WIDESEA_Core.BaseServices;
 using WIDESEA_Core.Enums;
+using WIDESEA_DTO;
+using WIDESEA_DTO.ERP;
 using WIDESEA_DTO.Stock;
 using WIDESEA_ITaskInfoRepository;
 using WIDESEA_Model.Models;
@@ -38,5 +40,11 @@
         WebResponseContent RequestInboundTask(string palletCode, string stationCode);
 
         WebResponseContent InboundTaskCompleted(int taskNum);
+        /// <summary>
+        /// 娴嬭瘯鏋跺嚭浠�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        MesResponseContent TestToolOut(TestToolOutModel model);
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
index 5c4209b..de66c45 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
@@ -1,4 +1,5 @@
 锘縰sing AutoMapper;
+using MailKit.Search;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
 using SqlSugar;
 using System;
@@ -70,7 +71,54 @@
             }
 
         }
+        public StockOutboundOrderDTO GetStockOutboundOrder(SaveModel saveModel)
+        {
+            try
+            {
+                var palletCode = saveModel.MainData["barcode"].ToString();
+                Dt_StockInfo stockInfo = BaseDal.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First();
+                if (stockInfo == null)
+                {
+                    throw new Exception($"鏈壘鍒板簱瀛樹俊鎭�");
+                }
+                Dt_StockInfoDetail stockInfoDetail = stockInfo.Details.FirstOrDefault();
+                if (stockInfoDetail == null)
+                {
+                    throw new Exception($"鏈壘鍒板簱瀛樿鎯�");
+                }
+                BaseDal.QueryTabs<Dt_OutboundOrder, Dt_OutboundOrderDetail, StockOutboundOrderDTO>((a, b) => a.Id == b.OrderId, (a, b) => new StockOutboundOrderDTO
+                {
+                    OrderNo = a.OrderNo,
+                    MaterielCode = b.MaterielCode,
+                    MaterielName = b.MaterielName,
+                    PalletCode = stockInfo.PalletCode,
+                    BatchNo = b.BatchNo,
+                    OrderQuantity = b.OrderQuantity,
+                    OverOutQuantity = b.OverOutQuantity,
+                    OutboundQuantity = stockInfoDetail.OutboundQuantity,
+                    SerialNumber = stockInfoDetail.SerialNumber,
+                    StockQuantity = stockInfoDetail.StockQuantity,
 
+                }, a => true, b => b.BatchNo == stockInfoDetail.BatchNo && b.MaterielCode == stockInfoDetail.MaterielCode, x => true).Select(x => new StockOutboundOrderDTO
+                {
+                    OrderNo = x.OrderNo,
+                    MaterielCode = x.MaterielCode,
+                    MaterielName = x.MaterielName,
+                    PalletCode = x.PalletCode,
+                    BatchNo = x.BatchNo,
+                    OrderQuantity = x.OrderQuantity,
+                    OverOutQuantity = x.OverOutQuantity,
+                    OutboundQuantity = x.OutboundQuantity,
+                    SerialNumber = x.SerialNumber,
+                    StockQuantity = x.StockQuantity,
+                }).ToList();
+                return new StockOutboundOrderDTO();
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
         public List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity)
         {
             List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>();
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
new file mode 100644
index 0000000..4d5a5fd
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
@@ -0,0 +1,26 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core.BaseServices;
+using WIDESEA_DTO;
+using WIDESEA_ITaskInfoRepository;
+using WIDESEA_ITaskInfoService;
+using WIDESEA_Model.Models;
+
+namespace WIDESEA_TaskInfoService
+{
+    public partial class TaskService : ServiceBase<Dt_Task, ITaskRepository>, ITaskService
+    {
+        /// <summary>
+        /// 娴嬭瘯鏋跺嚭浠�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public MesResponseContent TestToolOut(TestToolOutModel model)
+        {
+            return new MesResponseContent();
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs"
new file mode 100644
index 0000000..2ba94bd
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs"
@@ -0,0 +1,48 @@
+锘縰sing Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using WIDESEA_Core.Attributes;
+using WIDESEA_Core;
+using WIDESEA_DTO;
+using WIDESEA_IBasicService;
+using WIDESEA_IInboundRepository;
+using WIDESEA_IInboundService;
+using WIDESEA_IOutboundService;
+using WIDESEA_ITaskInfoService;
+using WIDESEA_TaskInfoService;
+using WIDESEA_DTO.ERP;
+
+namespace WIDESEA_WMSServer.Controllers.MES
+{
+    [Route("api/Mes")]
+    [ApiController]
+    public class MesController : ControllerBase
+    {
+        private readonly IPurchaseOrderRepository _purchaseOrderRepository;
+        private readonly IPurchaseOrderService _purchaseOrderService;
+        private readonly ISupplierInfoService _supplierInfoService;
+        private readonly IMaterielInfoService _materielInfoService;
+        private readonly IOutboundOrderService _outboundOrderService;
+        private readonly ITaskService _taskService;
+
+        public MesController(IPurchaseOrderRepository purchaseOrderRepository, IPurchaseOrderService purchaseOrderService, ISupplierInfoService supplierInfoService, IMaterielInfoService materielInfoService, IOutboundOrderService outboundOrderService,ITaskService taskService)
+        {
+            _purchaseOrderRepository = purchaseOrderRepository;
+            _purchaseOrderService = purchaseOrderService;
+            _supplierInfoService = supplierInfoService;
+            _materielInfoService = materielInfoService;
+            _outboundOrderService = outboundOrderService;
+            _taskService = taskService;
+        }
+
+        /// <summary>
+        /// 鎺ユ敹MES娴嬭瘯鏋跺嚭搴�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost, Route("TestToolOut"), AllowAnonymous, MethodParamsValidate]
+        public MesResponseContent TestToolOut([FromBody] Root<TestToolOutModel> model)
+        {
+          return  _taskService.TestToolOut(model.Content);
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs"
index 49837c9..0626847 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs"
@@ -1,6 +1,7 @@
 锘縰sing Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
+using WIDESEA_Core;
 using WIDESEA_Core.BaseController;
 using WIDESEA_DTO.Stock;
 using WIDESEA_IBasicRepository;
@@ -23,5 +24,16 @@
         {
             return Service.GetStockSelectViews(orderId, materielCode);
         }
+
+        /// <summary>
+        /// 鎷i��
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
+        [HttpPost, HttpGet, Route("GetStockOutboundOrder")]
+        public StockOutboundOrderDTO GetStockOutboundOrder([FromBody] SaveModel saveModel)
+        {
+            return Service.GetStockOutboundOrder(saveModel);
+        }
     }
 }

--
Gitblit v1.9.3