From 9719a7f0ccbb70e4e51a93cbe1733d1424c16f6d Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期五, 06 十二月 2024 12:03:56 +0800
Subject: [PATCH] 优化Api数据库缓存模块,增加MES岗位缓存跟不良代码缓存

---
 Tiger.Business.WMS/Transaction/OutWorkOrder.cs |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/Tiger.Business.WMS/Transaction/OutWorkOrder.cs b/Tiger.Business.WMS/Transaction/OutWorkOrder.cs
index ac6ab1b..f0b24b6 100644
--- a/Tiger.Business.WMS/Transaction/OutWorkOrder.cs
+++ b/Tiger.Business.WMS/Transaction/OutWorkOrder.cs
@@ -240,7 +240,7 @@
             {
                 if (!input.Code.IsNullOrEmpty())
                 {
-                    Biz.Db.Deleteable<WMS_ITEM_POOL>().Where(q => CurPoolList.Select(q => q.SN).Contains(q.SN)).ExecuteCommand();
+                    Biz.Db.Deleteable<WMS_ITEM_POOL>().Where(q => q.TRANS_CODE == req.BILLCODE).ExecuteCommand();
                     //濡傛灉涓婁竴娆℃帹鑽愭湁鏁版嵁锛屽垯鍏堢伃鎺変寒鐨勭伅
                     if (Suggests.Any())
                     {
@@ -297,16 +297,7 @@
                     Suggests.RemoveAll(q => q.poolItem.IsNullOrEmpty());
 
                     //淇濆瓨鐗╂枡姹犲埌鏁版嵁搴�
-                    var db = Biz.Db;
-                    var dbTran = db.UseTran(() =>
-                    {
-                        db.Deleteable<WMS_ITEM_POOL>().Where(q => q.TRANS_CODE == req.BILLCODE).ExecuteCommand();
-                        db.Insertable(CurPoolList).ExecuteCommand();
-                    });
-                    if (!dbTran.IsSuccess)
-                    {
-                        throw dbTran.ErrorException;
-                    }
+                    Biz.Db.Insertable(CurPoolList).ExecuteCommand();
                     action = await LightAll(new() { AuthOption = input.AuthOption, ReqType = ReqType.IsWhole, Color = LedColor.Blue,ItemCode = input.Code });
                 }
             }
@@ -429,7 +420,7 @@
                 //}
                 var MaxDC = CurPoolList.Any(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE) ? CurPoolList.Where(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE).Max(t => t.PROD_DATE) : DateTime.MinValue;
                 //鍒ゆ柇绯荤粺鍙傛暟鏄惁璁剧疆鍏堣繘鍏堝嚭
-                if (Biz.SysParam["YesOrNo"].PARAM_VALUE == "Y")
+                if (Cache.SysParam["YesOrNo"].PARAM_VALUE == "Y")
                 {
                     if (CurInv.Items.Max(x => x.PROD_DATE).Date > MaxDC.Date)
                     {
@@ -784,10 +775,10 @@
                 }
 
                 //鍙戦�佸埌MES
-                var isSend = Biz.SysParam["IsSend", "SendToMES"].PARAM_VALUE.ToString() == "Y";
+                var isSend = Cache.SysParam["IsSend", "SendToMES"].PARAM_VALUE.ToString() == "Y";
                 if (isSend && !isCutting)
                 {
-                    var mesApi = _factory != null ? _factory.MES_API : Biz.SysParam["apiUrl", "SendToMES"].PARAM_VALUE.ToString();
+                    var mesApi = _factory != null ? _factory.MES_API : Cache.SysParam["apiUrl", "SendToMES"].PARAM_VALUE.ToString();
                     var response = HttpHelper.PostAsync(mesApi, JsonConvert.SerializeObject(toMes)).Result;
                     var _action = JsonConvert.DeserializeObject<ApiAction>(response.Message);
                     Logger.Interface.Info($"宸ュ崟棰嗘枡 =>鍙戞枡瀹屾垚锛屽崟鍙穂{req.BILLCODE}]锛屾潯鐮乕{CurInv.SN}]锛岀姸鎬乕{req.STATUS.GetEnumDesc<BIZ_ERP_PROD_OUT.STATUSs>()}]锛孧ES杩斿洖锛歿response.Message}");

--
Gitblit v1.9.3