From 35176501d2f73523c5771d7bdc87d6d07c164386 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 30 十月 2024 23:02:52 +0800
Subject: [PATCH] 重打条码更新

---
 Tiger.Business.MES/BIZ/BIZ_MES_WO.cs |   52 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
index 993645e..f95f3e9 100644
--- a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
+++ b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
@@ -17,6 +17,7 @@
 using Microsoft.AspNetCore.Mvc.RazorPages;
 using System.Drawing.Printing;
 using System.Net.NetworkInformation;
+using Tiger.Model.MES.Yada;
 
 namespace Tiger.Business.MES
 {
@@ -456,9 +457,9 @@
         /// </summary>
         /// <param name="input"></param>
         /// <returns></returns>
-        public async Task<ApiAction<LOG_LABEL_PRINT>> GetRePrintInfo(RePrintInput input)
+        public async Task<ApiAction> GetRePrintInfo(RePrintInput input)
         {
-            var result = new ApiAction<LOG_LABEL_PRINT>();
+            var result = new ApiAction();
             try
             {
                 //鍏堟煡鍑哄伐鍗曟潯鐮佷腑鏄惁瀛樺湪
@@ -469,11 +470,23 @@
                     result.LocaleMsg = new($"鏉$爜涓嶅瓨鍦紒");
                     return result;
                 }
-
-                result.Data = await Biz.Db.Queryable<LOG_LABEL_PRINT>()
+                string printParam = "";
+                var labelPrint = await Biz.Db.Queryable<LOG_LABEL_PRINT>()
                     .WhereIF(input.ReqType == 0, q => q.SN.Equals(woSn.SN) || q.SN.Equals(woSn.FLOW_SN)) //鐧界洅鏍囩
-                    .WhereIF(input.ReqType == 1, q => q.SN.Equals(woSn.OUTER_SN)) //绠辨爣绛�
+                    .WhereIF(input.ReqType == 1, q => q.SN.Equals(woSn.OUTER_SN) && q.PRINT_LABEL != "InStoreLabel") //绠辨爣绛�-瀹㈡埛
+                    .WhereIF(input.ReqType == 2, q => q.SN.Equals(woSn.OUTER_SN) && q.PRINT_LABEL == "InStoreLabel") //绠辨爣绛�-鍏ュ簱
                     .FirstAsync();
+                //濡傛灉鏌ヤ笉鍒板氨鍘昏涓烘棩蹇楁煡
+                if (labelPrint.IsNullOrEmpty() && input.ReqType == 1)
+                {
+                    printParam = Biz.Db.Queryable<MES_WIP_ACT>().Where(q => (q.SN.Equals(input.Code) || q.FLOW_SN.Equals(input.Code)) && q.ACT_VALUE_4 == "Customer").First()?.ACT_VALUE_3 ?? "";
+                }
+                else
+                {
+                    printParam = labelPrint.PRINT_PARAM;
+                }
+                result.Data = printParam;
+                result.LocaleMsg = new($"閲嶆墦鏉$爜[{input.Code}]鐨勬爣绛炬垚鍔�");
             }
             catch (Exception ex)
             {
@@ -481,5 +494,34 @@
             }
             return result;
         }
+
+        /// <summary>
+        /// 鑾峰彇鍑鸿揣淇℃伅
+        /// </summary>
+        /// <param name="wo"></param>
+        /// <returns></returns>
+        public async Task<ApiAction> GetShipList(string wo, string orgCode)
+        {
+            var result = new ApiAction();
+            try
+            {
+                DbClient db = Biz.DataSource["YadaU9C"].Client;
+                var org = await Biz.Db.Queryable<SYS_ORGANIZATION>().Where(q=>q.ORG_CODE == orgCode).FirstAsync();
+                if (db.Queryable<mes_ShipList>().Any(q => q.MoDoc.Equals(wo) && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now) && q.Status == 2 && q.Org == org.ID.ToInt64()))
+                {
+                    result.Data = "Customer";
+                }
+                else
+                {
+                    result.LocaleMsg = new($"鍑鸿揣淇℃伅瀛樺湪锛�");
+                    result.Data = "InStoreLabel";
+                }
+            }
+            catch (Exception ex)
+            {
+                result.CatchExceptionWithLog(ex, "鑾峰彇鍑鸿揣淇℃伅寮傚父");
+            }
+            return result;
+        }
     }
 }

--
Gitblit v1.9.3