From c827cf7fe5e4561dbb8424f6d423200f2f03caa4 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期五, 18 十月 2024 09:21:43 +0800
Subject: [PATCH] 优化了一些已知问题

---
 Tiger.Business.MES/Transaction/Position.cs |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/Tiger.Business.MES/Transaction/Position.cs b/Tiger.Business.MES/Transaction/Position.cs
index 5a72b52..7059542 100644
--- a/Tiger.Business.MES/Transaction/Position.cs
+++ b/Tiger.Business.MES/Transaction/Position.cs
@@ -117,7 +117,7 @@
                     {
                         action.IsSuccessed = false;
                         //action.LocaleMsg = new($"宸ュ崟[{0}]鐘舵�乕{1}]涓嶈兘鐢熶骇");
-                        action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.StatusException", input.OrderNo, wo.STATUS.GetEnum<BIZ_MES_WO.STATUSs>().GetName());
+                        action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.StatusException", input.OrderNo, wo.STATUS.GetEnumDesc<BIZ_MES_WO.STATUSs>());
                         return action;
                     }
                     var batch = await Biz.Db.Queryable<BIZ_MES_WO_BATCH>().ByAuth(input.AuthOption)
@@ -135,7 +135,7 @@
                     {
                         action.IsSuccessed = false;
                         //action.LocaleMsg = new($"宸ュ崟[{0}]鎵规[1]鐘舵�乕{2}]涓嶈兘鐢熶骇");
-                        action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.BatchStatusException", input.OrderNo, batch.BATCH_NO, batch.STATUS.GetEnum<BIZ_MES_WO_BATCH.STATUSs>().GetName());
+                        action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.BatchStatusException", input.OrderNo, batch.BATCH_NO, batch.STATUS.GetEnumDesc<BIZ_MES_WO_BATCH.STATUSs>());
                         return action;
                     }
                     var wb = new WorkBatch(input.OrderNo).Init(CurLine.LINE_CODE);
@@ -557,6 +557,10 @@
                                     return WorkBatch.Product.ITEM_NAME;
                                 case "GetCustomer":
                                     return WorkBatch.Batch.Customer.ToJson();
+                                case "GetSalesOrder":
+                                    return WorkBatch.WO.SALES_ORDER;
+                                case "GetPackNumber":
+                                    return WorkBatch.WO.ORDER_NO;
                                 case "GetBoxQR":
                                     return action is PackingAction ? GetBoxCode(lvars, action as PackingAction) : "";
                                 case "GetCardQR":
@@ -576,7 +580,7 @@
                                 case "GetPAndO":
                                     return WorkBatch.WO.SALES_CONTRACT;
                                 case "GetLTD":
-                                    return WorkBatch.Batch.Customer.CUST_NAME_CN;
+                                    return WorkBatch.WO.Customer?.CUST_NAME_CN;
                                 case "GetHWDate":
                                     List<string> list = new List<string>();
                                     var _action = action is PackingAction ? action as PackingAction : null;
@@ -606,13 +610,19 @@
                                 case "GetVarByWo":
                                     return GetLabelVarWo(lv, "");
                                 case "GetLOTNO":
+                                    string _lotnos = "";
                                     var _orderAction = action is PackingAction ? action as PackingAction : null;
                                     if (_orderAction != null)
                                     {
-                                        var snList = _orderAction.GetMinPackageList(_orderAction.CurPkg.Item).Select(q => q.FLOW_SN);
-                                        return string.Join(",", Biz.Db.Queryable<MES_CUST_SN>()
-                                                .Where((q) => snList.Contains(q.FLOW_SN))
-                                                .Select((q) => q.WORK_ORDER).Distinct());
+                                        var snList = _orderAction.GetMinPackageList(_orderAction.CurPkg.Item).Select(q => q.FLOW_SN).ToList();
+                                        if (!snList.Any())
+                                        {
+                                            snList.Add(_orderAction.CurPkg.CustSN.FLOW_SN);
+                                        }
+                                        _lotnos = string.Join(",", Biz.Db.Queryable<MES_CUST_SN>()
+                                            .Where((q) => snList.Contains(q.FLOW_SN))
+                                            .Select((q) => q.WORK_ORDER).Distinct().ToList());
+                                        return _lotnos;
                                     }
                                     return "";
                                 case "GetNOTES":
@@ -752,13 +762,13 @@
             var itemCode = action.CurPkg.CustSN?.ITEM_CODE;
             var weight = action.CurPkg.WeightInfo.Weight;
             var unit = action.CurPkg.WeightInfo.Unit.ToUpper();
-            var model = WorkBatch.Product.ExtInfo.Model;
-            var Input = WorkBatch.Product.ExtInfo.Input;
-            var OutPut = WorkBatch.Product.ExtInfo.OutPut;
-            var Power = WorkBatch.Product.ExtInfo.Power;
-            var Accuracy = WorkBatch.Product.ExtInfo.Accuracy;
-            var Display = WorkBatch.Product.ExtInfo.Display;
-            var Remark = WorkBatch.Product.ExtInfo.Remark;
+            var model = WorkBatch.Product.ExtInfo?.Model;
+            var Input = WorkBatch.Product.ExtInfo?.Input;
+            var OutPut = WorkBatch.Product.ExtInfo?.OutPut;
+            var Power = WorkBatch.Product.ExtInfo?.Power;
+            var Accuracy = WorkBatch.Product.ExtInfo?.Accuracy;
+            var Display = WorkBatch.Product.ExtInfo?.Display;
+            var Remark = WorkBatch.Product.ExtInfo?.Remark;
 
             return $"{code}|{itemCode}|{wo}|\r\n{snList}|{weight}{unit}|鍨嬪彿:{model},杈撳叆:{Input},鏄剧ず:{Display},杈撳嚭:{OutPut},鐢垫簮:{Power},绮惧害:{Accuracy},澶囨敞:{Remark}";
         }

--
Gitblit v1.9.3