From e070b26178e324ea7afecccb4c5ff41f96d2dd8d Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 26 三月 2025 18:25:16 +0800
Subject: [PATCH] 一些更改

---
 Tiger.Business.WMS/Transaction/Yada/Print_BIZ_U9_ASN.cs |  104 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 74 insertions(+), 30 deletions(-)

diff --git a/Tiger.Business.WMS/Transaction/Yada/Print_BIZ_U9_ASN.cs b/Tiger.Business.WMS/Transaction/Yada/Print_BIZ_U9_ASN.cs
index 0c0ad4a..1bb9fa1 100644
--- a/Tiger.Business.WMS/Transaction/Yada/Print_BIZ_U9_ASN.cs
+++ b/Tiger.Business.WMS/Transaction/Yada/Print_BIZ_U9_ASN.cs
@@ -13,6 +13,7 @@
 using Tiger.Model.Entitys.MES.U9C;
 using System.Security.Policy;
 using Tiger.Model.Entitys.MES.Position;
+using MailKit.Search;
 
 namespace Tiger.Business.WMS.Transaction
 {
@@ -25,7 +26,7 @@
         {
             base.Init(id, userCode, apiHost, orgCode);
             //鍔犺浇宸茬粡娓呯偣鏁版嵁
-            LoadData();
+            //LoadData();
             Logger.Console.Info($"Start {this.GetType().Name} Transaction[ID: {TransID}]");
             return this;
         }
@@ -33,6 +34,7 @@
         #region Propertys & Variables
         //private List<WmsOrder<BIZ_U9_ASN>> _OrderList { get; set; } = new();
         private List<string> OrderList = new();
+        private BIZ_U9_ASN order = new();
         private List<BIZ_U9_ASN_SN> CurSn = new();
         private List<BIZ_U9_ASN_SN> ScanList = new();
         #endregion
@@ -60,8 +62,21 @@
                     action.LocaleMsg = Biz.L("WMS.Default.ScanItem.SnEmptyFailure");
                     return SetOutPutMqttMsg(action, input.Locale);
                 }
-                //鎵弿鐗╂枡骞跺鏍�
-                else //if (Command == "Normal")
+                //濡傛灉鏄湭涓婇棬鎴�
+                else if (input.Data == "0")
+                {
+                    action = await GetAsnInfoForPrint(input);
+                }
+                //濡傛灉鏄殢鍗曡禒鍝佹垨鑰呮牱鍝�
+                else if (input.Data == "1")
+                {
+                    action = await Submit(input);
+                }
+                else if (input.Data == "Submit")
+                {
+
+                }
+                else
                 {
                     action = await ScanItem(input);
                 }
@@ -77,7 +92,61 @@
         }
 
         /// <summary>
-        /// 鎵弿鐗╂枡骞跺鏍�
+        /// 鑾峰彇鐢ㄤ簬鎵撳嵃鐨� asn 淇℃伅
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        public async Task<ApiAction<ScanOutput>> GetAsnInfoForPrint(BaseInput input)
+        {
+            var action = new ApiAction<ScanOutput>($"鎴愬姛鑾峰彇ASN鍗昜{input.SN}]淇℃伅", new ScanOutput());
+            try
+            {
+                order = await MainDB.Queryable<BIZ_U9_ASN>().Where(q => q.ORDER_NO == input.SN).Includes(q => q.Details, d => d._ItemInfos).IncludesAllFirstLayer().FirstAsync();
+                if (order==null) {
+                    action.IsSuccessed = false;
+                    action.LocaleMsg = Biz.L($"鏌ヤ笉鍒癆SN鍗昜{input.SN}]鐨勬暟鎹�");
+                    return action;
+                }
+                action.Data.Data = order;
+            }
+            catch (Exception ex)
+            {
+                //鍙栨秷褰撳墠鎿嶄綔
+                ResetScan();
+                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN));
+            }
+            return SetOutPutMqttMsg(action, input.Locale);
+        }
+
+        /// <summary>
+        /// 鎻愪氦鏁版嵁
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        public async Task<ApiAction<ScanOutput>> Submit(BaseInput input)
+        {
+            var action = new ApiAction<ScanOutput>($"鎴愬姛鎻愪氦ASN鍗昜{input.SN}]琛屾暟鎹紝骞跺畬鎴愭竻鐐癸紝璇风偣鍑绘墦鍗版寜閽墦鍗版爣绛�", new ScanOutput());
+            try
+            {
+                var snlist = input.Options["Snlist"].ToString().JsonToObject<List<string>>();
+                List<string> SnList = new();
+                foreach (var sn in snlist)
+                {
+                    SnList.Add(DI.Resolve<ICodeRuleCache>()["InitialBarcode"]?.Generate($"{sn}").Data.ToString() ?? "");
+                }
+                action.Data.Data = SnList;
+            }
+            catch (Exception ex)
+            {
+                //鍙栨秷褰撳墠鎿嶄綔
+                ResetScan();
+                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN));
+            }
+            return SetOutPutMqttMsg(action, input.Locale);
+        }
+
+        /// <summary>
+        /// 鎵弿鏉$爜鍒嗘瀽绫诲瀷
         /// </summary>
         public async Task<ApiAction<ScanOutput>> ScanItem(BaseInput input)
         {
@@ -117,7 +186,7 @@
                     action.IsSuccessed = false;
                     //action.LocaleMsg = Biz.L("ASN鍗曚腑涓嶅瓨鍦ㄦ潯鐮乕{0}]");
                     action.LocaleMsg = Biz.L("WMS.Print_BIZ_U9_ASN.SnNotExists", input.SN);
-                    return SetOutPutMqttMsg(action, input.Locale); ;
+                    return SetOutPutMqttMsg(action, input.Locale); 
                 }
                 if (CurSn.First().AUTH_ORG != input.AuthOption.CurOrg)
                 {
@@ -210,21 +279,6 @@
                     sn.RECEIVE_DATE = DateTime.MinValue;
                 }
 
-                //var historys = new List<WMS_ITEM_HIS>();
-                //var items = await Biz.Db.Queryable<WMS_ITEM>().Where(q => ScanList.Select(s => s.SN).Contains(q.SN)).ToListAsync();
-                //foreach (var item in items)
-                //{
-                //	var order = item.TRANS_CODE;
-                //	item.STATUS = WMS_ITEM.STATUSs.Incoming.GetValue();
-                //	item.SOURCE_CODE = "";
-                //	item.SOURCE_ORDER = "";
-                //	item.SOURCE_LINE = "";
-                //	item.TRANS_CODE = item.SOURCE_CODE;
-                //	item.TRANS_NO = item.SOURCE_ORDER;
-                //	item.TRANS_LINE = item.SOURCE_LINE;
-                //	historys.Add(new WMS_ITEM_HIS(item, $"鏉$爜[{item.SN}]鍙栨秷娓呯偣锛屾搷浣滃崟鎹甗{order}]"));
-                //}
-
                 //浣跨敤缁熶竴鐨勪簨鍔B瀵硅薄
                 var db = GetCommitDB();
                 var dbTran = db.UseTran(() =>
@@ -261,16 +315,6 @@
             var action = new ApiAction();
             try
             {
-                //var item = await Biz.Db.Queryable<WMS_ITEM>().Where(q => q.SN == input.SN).FirstAsync();
-                //var order = item.TRANS_CODE;
-                //item.STATUS = WMS_ITEM.STATUSs.Incoming.GetValue();
-                //item.SOURCE_CODE = "";
-                //item.SOURCE_ORDER = "";
-                //item.SOURCE_LINE = "";
-                //item.TRANS_CODE = item.SOURCE_CODE;
-                //item.TRANS_NO = item.SOURCE_ORDER;
-                //item.TRANS_LINE = item.SOURCE_LINE;
-
                 //浣跨敤缁熶竴鐨勪簨鍔B瀵硅薄
                 var db = GetCommitDB();
                 var dbTran = db.UseTran(() =>

--
Gitblit v1.9.3