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.Business.WMS/Transaction/ReprintLabel.cs |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

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);
         }

--
Gitblit v1.9.3