From a3b21ee43b13ad79302aceb9a68405b45e6467a4 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 15 一月 2025 20:05:25 +0800
Subject: [PATCH] 更新 ReprintLabel 逻辑,增加 TemplateInput 类

---
 Tiger.Api/Language.db                              |    0 
 Tiger.Business.WMS/Transaction/ReprintLabel.cs     |   27 +++++++++++++++++++++++----
 Tiger.Model.Net/Entitys/WMS/Api/RePrint_Entitys.cs |   25 +++++++++++++++++++++++++
 Tiger.Model.Net/Tiger.Model.Net.csproj             |    1 +
 4 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/Tiger.Api/Language.db b/Tiger.Api/Language.db
index f40c99a..de8909e 100644
--- a/Tiger.Api/Language.db
+++ b/Tiger.Api/Language.db
Binary files differ
diff --git a/Tiger.Business.WMS/Transaction/ReprintLabel.cs b/Tiger.Business.WMS/Transaction/ReprintLabel.cs
index 02d8510..cdc9c08 100644
--- a/Tiger.Business.WMS/Transaction/ReprintLabel.cs
+++ b/Tiger.Business.WMS/Transaction/ReprintLabel.cs
@@ -14,6 +14,7 @@
 using System.Drawing.Drawing2D;
 using Tiger.Model.Sharetronic.Shelf;
 using Tiger.IBusiness;
+using Tiger.Model.MES.Yada;
 
 namespace Tiger.Business.WMS.Transaction
 {
@@ -56,14 +57,32 @@
                     action.LocaleMsg = Biz.L("WMS.RePrint.ScanItem.SnEmptyFailure");
                     return SetOutPutMqttMsg(action, input.Locale);
                 }
-                
-                var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => (t.SHELF_CODE.ToUpper() == input.SN || t.LOCATION_CODE.ToUpper() == input.SN) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync();
-                
+                var LotNos = Biz.DataSource["YadaU9C"].Client.Queryable<mes_WhLotCodeQtyInfo>().Where(t => t.Bin == input.SN).ToList();
+                //var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.LOCATION_CODE.ToUpper() == input.SN && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync();
+                var items = LotNos.Select(q => q.ItemCode);
+                var ItemList = Biz.Db.Queryable<BAS_ITEM>().Where(t => t.AUTH_ORG == OrgCode && items.Contains(t.ITEM_CODE)).IncludesAllFirstLayer().ToList();
+                var temps = new List<TemplateInput>();
+                foreach (var item in LotNos)
+                {
+                    var temp = new TemplateInput
+                    {
+                        custCode="",
+                        itemCode= item.ItemCode,
+                        itemDesc= ItemList.Where(q => q.ITEM_CODE == item.ItemCode).FirstOrDefault()?.ITEM_DESC,
+                        sapItemCode= ItemList.Where(q => q.ITEM_CODE == item.ItemCode).FirstOrDefault()?.ExtInfo?.SapCode,
+                        WoBatch = item.LotCode,
+                        batchQty= item.StoreQty,
+                        qrCode="",
+                    };
+                    temps.Add(temp);
+                }
+                action.Data.Data = temps;
+                action.LocaleMsg = Biz.L("WMS.RePrint.ScanItem.ScanSuccessed");
             }
             catch (Exception ex)
             {
                 //action.CatchExceptionWithLog(ex, $"鎵弿[{input.SN}]寮傚父");
-                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN));
+                action.CatchExceptionWithLog(ex, Biz.L("WMS.RePrint.Scan.ScanException", input.SN));
             }
             return SetOutPutMqttMsg(action, input.Locale);
         }
diff --git a/Tiger.Model.Net/Entitys/WMS/Api/RePrint_Entitys.cs b/Tiger.Model.Net/Entitys/WMS/Api/RePrint_Entitys.cs
new file mode 100644
index 0000000..6482f4f
--- /dev/null
+++ b/Tiger.Model.Net/Entitys/WMS/Api/RePrint_Entitys.cs
@@ -0,0 +1,25 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tiger.Model.Minsun;
+
+namespace Tiger.Model
+{
+    public class TemplateInput
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public string custCode { get; set; }
+        public string itemCode { get; set; }
+        public string sapItemCode { get; set; }
+        public string itemDesc { get; set; }
+        public string WoBatch { get; set; }
+        public decimal batchQty { get; set; }
+        public decimal qty { get; set; }
+        public string qrCode { get; set; }
+    }
+}
diff --git a/Tiger.Model.Net/Tiger.Model.Net.csproj b/Tiger.Model.Net/Tiger.Model.Net.csproj
index 539fd4b..43f63ba 100644
--- a/Tiger.Model.Net/Tiger.Model.Net.csproj
+++ b/Tiger.Model.Net/Tiger.Model.Net.csproj
@@ -240,6 +240,7 @@
     <Compile Include="Entitys\SYS\SYS_CS_LOGIN.cs" />
     <Compile Include="Entitys\SYS\SYS_LOW_CODE.cs" />
     <Compile Include="Entitys\SYS\SYS_PDA_LOGIN.cs" />
+    <Compile Include="Entitys\WMS\Api\RePrint_Entitys.cs" />
     <Compile Include="Entitys\WMS\Api\Input_Entitys.cs" />
     <Compile Include="Entitys\WMS\Api\Output_Entitys.cs" />
     <Compile Include="Entitys\WMS\Api\Resell.cs" />

--
Gitblit v1.9.3