From 23d5fc6ea22d8acef338bf70c8c5399d5cdff0bd Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期日, 29 九月 2024 22:29:01 +0800
Subject: [PATCH] 白盒、箱条码生成更新

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

diff --git a/Tiger.Business.MES/Transaction/Position.cs b/Tiger.Business.MES/Transaction/Position.cs
index 63e0a2a..30ef901 100644
--- a/Tiger.Business.MES/Transaction/Position.cs
+++ b/Tiger.Business.MES/Transaction/Position.cs
@@ -511,7 +511,7 @@
                                 case "GetBAS_ITEM":
                                     return WorkBatch.Product.CUST_PROD_CODE;
                                 case "GetCustomer":
-                                    return WorkBatch.Batch.ToJson();
+                                    return WorkBatch.Batch.Customer.ToJson();
                                 case "GetBoxQR":
                                     return action is PackingAction ? GetBoxCode(lvars, action as PackingAction) : "";
                                 case "GetCardQR":
@@ -620,7 +620,8 @@
         /// <returns></returns>
         private string GetBoxCode(List<BAS_LABEL_VAR> lvars, PackingAction action)
         {
-            return GetCardOrBoxQR(CurSN, lvars, action);
+            var boxCode = Biz.CodeRule["WhiteBoxNo"]?.Generate("W", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? "";
+            return GetCardOrBoxQR(boxCode, lvars, action);
         }
 
         /// <summary>
@@ -631,7 +632,7 @@
         /// <returns></returns>
         private string GetCardCode(List<BAS_LABEL_VAR> lvars, PackingAction action)
         {
-            var cardCode = lvars.First(q=>q.VAR_NAME == "CardQR").Value;
+            var cardCode = Biz.CodeRule["CartonNo"]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? "" ;
             return GetCardOrBoxQR(cardCode, lvars, action);
         }
 
@@ -644,7 +645,7 @@
         /// <returns></returns>
         private string GetCardOrBoxQR(string code, List<BAS_LABEL_VAR> lvars, PackingAction action)
         {
-            var itemCode = WorkBatch.Product.ITEM_CODE;
+            var itemCode = WorkBatch.Product.CUST_PROD_CODE;
             var wo = WorkBatch.Batch.ORDER_NO;
             var snList = string.Join("\r\n", action.GetMinPackageList(action.CurPkg.Item).Select(q => q.SN));
             if (snList.IsNullOrEmpty()) { snList = $"{CurSN}"; }
@@ -655,9 +656,10 @@
             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}|鍨嬪彿:{model},杈撳叆:{Input},杈撳嚭:{OutPut},鐢垫簮:{Power},绮惧害:{Accuracy},澶囨敞:{Remark}";
+            return $"{code}|{itemCode}|{wo}|\r\n{snList}|{weight}|鍨嬪彿:{model},杈撳叆:{Input},鏄剧ず:{Display},杈撳嚭:{OutPut},鐢垫簮:{Power},绮惧害:{Accuracy},澶囨敞:{Remark}";
         }
 
         /// <summary>
@@ -676,7 +678,7 @@
                 var item = snOrder.FirstOrDefault(q => q.FLOW_SN == sn || q.CUST_SN == sn);
                 if (!item.IsNullOrEmpty())
                 {
-                    var date = item.ACT_START_TIME < new DateTime(2000, 1, 1) ? item.PLAN_START_TIME : item.ACT_START_TIME; ;
+                    var date = item.ACT_START_TIME < new DateTime(2000, 1, 1) ? item.PLAN_START_TIME : item.ACT_START_TIME;
                     var firstDay = new DateTime(date.Year, 1, 1);
                     int daysOffset = firstDay.DayOfWeek.GetValue() > 3 ? (firstDay.DayOfWeek.GetValue() - 7) : 0;
                     int year = date.Year + ((date - firstDay).TotalDays + daysOffset < 0 ? -1 : 0);

--
Gitblit v1.9.3