From 70c9c84b932d4e85c8230a3b042bd984a1feb717 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期四, 10 四月 2025 10:08:37 +0800
Subject: [PATCH] 优化了一些已知问题

---
 Tiger.Business.WMS/Transaction/PrintSemiProdLabel.cs |   75 +++++++++++++++++++++++++++++--------
 1 files changed, 58 insertions(+), 17 deletions(-)

diff --git a/Tiger.Business.WMS/Transaction/PrintSemiProdLabel.cs b/Tiger.Business.WMS/Transaction/PrintSemiProdLabel.cs
index 1ae0373..9b74fea 100644
--- a/Tiger.Business.WMS/Transaction/PrintSemiProdLabel.cs
+++ b/Tiger.Business.WMS/Transaction/PrintSemiProdLabel.cs
@@ -16,6 +16,8 @@
 using Tiger.Model.MES.Yada;
 using Apache.NMS.ActiveMQ.Commands;
 using System.Diagnostics;
+using static Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser;
+using Tiger.Model.Entitys.MES.U9C;
 
 namespace Tiger.Business.WMS.Transaction
 {
@@ -24,6 +26,7 @@
     /// </summary>
     public class PrintSemiProdLabel : WMSTransactionBase, IPrintSemiProdLabel
     {
+        private readonly IMES_U9C _IMES_U9C = DI.Resolve<IMES_U9C>();
         public IPrintSemiProdLabel Init(string id, string userCode, string apiHost, string orgCode)
         {
             TransID = id;
@@ -58,36 +61,74 @@
                     return SetOutPutMqttMsg(action, input.Locale);
                 }
                 var DocLines = Biz.DataSource["YadaU9C"].Client.Ado.SqlQuery<mes_RcvRptDocLine>($"select * from mes_RcvRptDocLine where DocNo = '{input.SN}'");
-                
-                var temps = new List<TemplateInput>();
+
+                var temps = new List<SemiTemplateInput>();
                 foreach (var item in DocLines)
                 {
-                    var temp = new TemplateInput
+                    var temp = new SemiTemplateInput
                     {
-                        custCode="",
-                        itemCode= item.ItemCode,
-                        itemDesc= item.ItemDescription,
-                        sapItemCode= "",
+                        RcvRptDocId = item.ID.ToString(),
+                        ItemCode = item.ItemCode,
+                        ItemDesc = item.ItemDescription,
+                        SapItemCode = "",
                         WoBatch = item.LotCode,
-                        batchQty= item.PackQty,
-                        qrCode="",
+                        PackQty = item.PackQty.ToDouble(),
+                        Qty = item.RcvQtyByWhUOM.ToDouble(),
+                        DocNo = item.DocNo,
+                        WorkOrder = item.Mo
                     };
                     temps.Add(temp);
                 }
 
-                //var y = Biz.Db.Storageable(DocLines, UserCode)
-                //               .WhereColumns(t => new { t.ItemCode, t.LotCode })
-                //               .ToStorage();
-                //y.AsInsertable.ExecuteCommand();
-                //y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand();
-
                 action.Data.Data = temps;
-                action.LocaleMsg = Biz.L("WMS.PrintSemiProdLabel.Scan.ScanSuccessed");
+                action.LocaleMsg = Biz.L("WMS.PrintSemiProdLabel.Scan.ScanSuccessed", input.SN);
             }
             catch (Exception ex)
             {
                 //action.CatchExceptionWithLog(ex, $"鎵弿[{input.SN}]寮傚父");
-                action.CatchExceptionWithLog(ex, Biz.L("WMS.RePrint.Scan.ScanException", input.SN));
+                action.CatchExceptionWithLog(ex, Biz.L("WMS.PrintSemiProdLabel.Scan.ScanException", input.SN));
+            }
+            return SetOutPutMqttMsg(action, input.Locale);
+        }
+
+        /// <summary>
+        /// 鎵爜鎻愪氦
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        public async Task<ApiAction<ScanOutput>> ScanItem(BaseInput input)
+        {
+            var action = new ApiAction<ScanOutput>(new ScanOutput());
+            try
+            {
+                var semiTemplate = (input.Data ?? "").JsonToObject<SemiTemplateInput>() ?? new SemiTemplateInput();
+
+                //鐢熸垚鏉$爜
+                BarcodeCreateByAssignQtyInput barcodeCreateInput = new()
+                {
+                    RevDocId = semiTemplate.RcvRptDocId,
+                    userId = input.AuthOption.UserId,
+                    token = "",
+                    IsLogin = true,
+                    CreateBarCodeItemQty = semiTemplate.Qty,
+                    LabelQty = semiTemplate.PackQty,
+                };
+
+                var snList = await _IMES_U9C.U9CCreateBarCodeByAssignQty(barcodeCreateInput);
+                action.Data.Data = snList;
+                //action.Data.Data = new List<string> {
+                //    "YDRKD241200014/10/20051210.0013.00/YDMB241254400/0001",
+                //    "YDRKD241200014/10/20051210.0013.00/YDMB241254400/0002",
+                //    "YDRKD241200014/10/20051210.0013.00/YDMB241254400/0003",
+                //    "YDRKD241200014/10/20051210.0013.00/YDMB241254400/0004"
+
+                //};
+            }
+            catch (Exception ex)
+            {
+                //action.CatchExceptionWithLog(ex, $"鎵弿[{input.SN}]鎻愪氦寮傚父");
+                action.CatchExceptionWithLog(ex, Biz.L("WMS.PrintSemiProdLabel.ScanItem.ScanItemException", input.SN));
+
             }
             return SetOutPutMqttMsg(action, input.Locale);
         }

--
Gitblit v1.9.3