From 8c998a765b56cba071e4d41f417589f6c0159dce Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期二, 19 十一月 2024 20:33:53 +0800
Subject: [PATCH] 获取出货信息更新

---
 Tiger.Controllers.MES/Controllers/MESController.BIZ_MES_WO.cs    |    6 +++---
 Tiger.IBusiness.MES/BIZ/IMES_WO.cs                               |    2 +-
 Tiger.Business.MES/BIZ/BIZ_MES_WO.cs                             |   14 ++++++++++++--
 Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs |    7 +++++++
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
index 29d2183..e494d65 100644
--- a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
+++ b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
@@ -605,22 +605,31 @@
         /// </summary>
         /// <param name="wo"></param>
         /// <returns></returns>
-        public async Task<ApiAction<ShippingOutput>> GetShipList(string wo, string orgCode)
+        public async Task<ApiAction<ShippingOutput>> GetShipList(ShippingInput input)
         {
             var result = new ApiAction<ShippingOutput>();
             try
             {
                 DbClient db = Biz.DataSource["YadaU9C"].Client;
-                var org = await Biz.Db.Queryable<SYS_ORGANIZATION>().Where(q => q.ORG_CODE == orgCode).FirstAsync();
+                var org = await Biz.Db.Queryable<SYS_ORGANIZATION>().Where(q => q.ORG_CODE == input.orgCode).FirstAsync();
+                string wo = input.wo;
+                if (!input.SN.IsNullOrEmpty() && input.wo.IsNullOrEmpty()) {
+                    var woSn = Biz.Db.Queryable<BIZ_MES_WO_SN>().Where(q => q.SN == input.SN || q.FLOW_SN == input.SN).First();
+                    if (!woSn.IsNullOrEmpty()) {
+                        wo = woSn.WORK_ORDER;
+                    }
+                }
                 var ship = db.Queryable<mes_ShipList>().Where(q => q.MoDoc.Equals(wo) && q.Org == org.ID.ToInt64()).First();
                 if (!ship.IsNullOrEmpty())
                 {
                     result.Data = ship.BusinessDate.Date == DateTime.Now.Date ? new()
                     {
+                        ShipDoc = ship.ShipDoc,
                         ShippingQty = ship.ShipQty,
                         Tag = "Customer"
                     } : new()
                     {
+                        ShipDoc = ship.ShipDoc,
                         ShippingQty = ship.ShipQty,
                         Tag = "InStoreLabel"
                     };
@@ -630,6 +639,7 @@
                 {
                     result.Data = new()
                     {
+                        ShipDoc = "",
                         ShippingQty = 0,
                         Tag = "InStoreLabel"
                     };
diff --git a/Tiger.Controllers.MES/Controllers/MESController.BIZ_MES_WO.cs b/Tiger.Controllers.MES/Controllers/MESController.BIZ_MES_WO.cs
index 2860075..5a61c42 100644
--- a/Tiger.Controllers.MES/Controllers/MESController.BIZ_MES_WO.cs
+++ b/Tiger.Controllers.MES/Controllers/MESController.BIZ_MES_WO.cs
@@ -8,6 +8,7 @@
 using Tiger.Model.Entitys.MES.BizMesWoBatch;
 using Tiger.Api.iBiz;
 using Newtonsoft.Json;
+using Tiger.Model.Entitys.MES.Position;
 
 namespace Tiger.Api.Controllers.MES
 {
@@ -226,13 +227,12 @@
         /// <returns></returns>
         [HttpPost]
         [Route("api/[controller]/[action]")]
-        public async Task<IActionResult> GetShipList([FromBody] ApiAction action)
+        public async Task<IActionResult> GetShipList([FromBody] ApiAction<ShippingInput> action)
         {
             ApiAction response = new();
             try
             {
-                var options = JsonConvert.DeserializeObject<AuthOption>(action.Options?.ToString()); 
-                response = response.GetResponse(await DI.Resolve<IBIZ_MES_WO>().GetShipList(action.Data?.ToString(), options.OrgCode));
+                response = response.GetResponse(await DI.Resolve<IBIZ_MES_WO>().GetShipList(action.Data));
             }
             catch (System.Exception ex)
             {
diff --git a/Tiger.IBusiness.MES/BIZ/IMES_WO.cs b/Tiger.IBusiness.MES/BIZ/IMES_WO.cs
index 795f0b0..e64d75c 100644
--- a/Tiger.IBusiness.MES/BIZ/IMES_WO.cs
+++ b/Tiger.IBusiness.MES/BIZ/IMES_WO.cs
@@ -21,7 +21,7 @@
         public Task<ApiAction> AddOrEditLabelVarByWorkOrder(BAS_LABEL_VAR_WO input);
         public Task<ApiAction<QueryAble<BAS_LABEL_VAR_WO>>> GetLabelVarByWorkOrder(BizLabelVarWoInput input);
         public Task<ApiAction> GetRePrintInfo(RePrintInput input);
-        public Task<ApiAction<ShippingOutput>> GetShipList(string wo, string orgCode);
+        public Task<ApiAction<ShippingOutput>> GetShipList(ShippingInput input);
         public Task<ApiAction> SavePrintLabelInAct(string code);
         public Task<ApiAction> UnbindWipSnFromWO(UnbindWipSnInput input);
         public Task<ApiAction<InStoreInfo>> GetErpProdInBth(string code);
diff --git a/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs b/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs
index d1766df..c8c1c0b 100644
--- a/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs
+++ b/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs
@@ -48,6 +48,13 @@
     public class ShippingOutput
     {
         public string Tag { get; set; }
+        public string ShipDoc { get; set; }
         public double ShippingQty { get; set; }
     }
+    public class ShippingInput
+    {
+        public string SN { get; set; }
+        public string wo { get; set; }
+        public string orgCode { get; set; }
+    }
 }

--
Gitblit v1.9.3