From 24c0e02411353dd5ea2c17449ef4cd1a0db1ce82 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 19 十二月 2024 17:04:14 +0800 Subject: [PATCH] 入库标签也是出货标签时也需要HWDate, LOTNO --- Tiger.Business.MES/iERP/U9C_MES.cs | 55 ++++++++++++++++++++++++++----------------------------- 1 files changed, 26 insertions(+), 29 deletions(-) diff --git a/Tiger.Business.MES/iERP/U9C_MES.cs b/Tiger.Business.MES/iERP/U9C_MES.cs index 7f56288..7c8579c 100644 --- a/Tiger.Business.MES/iERP/U9C_MES.cs +++ b/Tiger.Business.MES/iERP/U9C_MES.cs @@ -78,6 +78,7 @@ Accuracy = (di["Accuracy"] ?? "").ToString(), Remark = (di["Remark"] ?? "").ToString(), Packaging = (di["Packaging"] ?? "").ToString(), + SapCode = (di["Code1"] ?? "").ToString(), }; itemExts.Add(extInfo); } @@ -118,7 +119,7 @@ .WhereColumns(t => new { t.ITEM_ID, t.GHOST_ROW }) .ToStorage(); y.AsInsertable.ExecuteCommand(); - y.AsUpdateable.ExecuteCommand(); + y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); }); } else @@ -207,15 +208,15 @@ db.Storageable(LastRun, "U9C_MES_GetWo").ExecuteCommand(); if (items.Any()) { - if (items.Count > 150) + if (items.Count > 100) { - db.Utilities.PageEach(items, 1000, pageList => + db.Utilities.PageEach(items, 100, pageList => { var y = db.Storageable(pageList, "U9C") .WhereColumns(t => new { t.ORDER_NO, t.GHOST_ROW }) .ToStorage(); - y.BulkCopy(); - y.BulkUpdate(); + y.AsInsertable.ExecuteCommand(); + y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); }); } else @@ -284,11 +285,7 @@ { if (woList.Any()) { - var s = _db.Storageable(woList, "U9C") - .WhereColumns(t => new { t.ORDER_NO, t.GHOST_ROW }) - .ToStorage(); - s.AsInsertable.ExecuteCommand(); - s.AsUpdateable.IgnoreColumns(x => x.ID).UpdateColumns(x => new { x.ROUTE_STATUS}).ExecuteCommand(); + _db.Updateable(woList, "U9C").UpdateColumns(x => new { x.ROUTE_STATUS }).ExecuteCommand(); } }); @@ -496,8 +493,8 @@ } Logger.Scheduler.Info($"瀹㈡埛鏉$爜淇℃伅瀛樺叆瀹炰綋涓紝鎬绘暟锛歔{items.Count}]"); db = Biz.Db; - var dbTran = db.UseTran(() => - { + //var dbTran = db.UseTran(() => + //{ if (items.Any()) { if (items.Count > 100) @@ -508,7 +505,7 @@ .WhereColumns(t => new { t.CUST_SN, t.GHOST_ROW }) .ToStorage(); y.AsInsertable.ExecuteCommand(); - y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); + y.AsUpdateable.IgnoreColumns(x => x.ID).UpdateColumns(q => new { q.CUST_CODE,q.WORK_ORDER,q.CUST_SN,q.FLOW_SN,q.ITEM_CODE,q.CREATE_TIME,q.UPDATE_TIME,q.UPDATE_USER,q.AUTH_ORG}).ExecuteCommand(); }); } else @@ -517,16 +514,16 @@ .WhereColumns(t => new { t.CUST_SN, t.GHOST_ROW }) .ToStorage(); s.AsInsertable.ExecuteCommand(); - s.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); + s.AsUpdateable.IgnoreColumns(x => x.ID).UpdateColumns(q => new { q.CUST_CODE, q.WORK_ORDER, q.CUST_SN, q.FLOW_SN, q.ITEM_CODE, q.CREATE_TIME, q.UPDATE_TIME, q.UPDATE_USER, q.AUTH_ORG }).ExecuteCommand(); } } - }); - if (!dbTran.IsSuccess) - { - action.CatchExceptionWithLog(dbTran.ErrorException, $"鏁版嵁澶勭悊澶辫触"); - Logger.Scheduler.Error(action.Message); - } + //}); + //if (!dbTran.IsSuccess) + //{ + // action.CatchExceptionWithLog(dbTran.ErrorException, $"鏁版嵁澶勭悊澶辫触"); + // Logger.Scheduler.Error(action.Message); + //} Logger.Scheduler.Info($"瀹㈡埛鏉$爜淇℃伅瀛樺叆鏁版嵁搴擄紝鎬绘暟锛歔{items.Count}]"); action.Message = $"瀹㈡埛鏉$爜淇℃伅瀛樺叆鏁版嵁搴擄紝鎬绘暟锛歔{items.Count}]"; return action; @@ -572,7 +569,7 @@ CUST_PREFIX = di["OutBarHead"] == null ? "" : di["OutBarHead"].ToString(), SALES_CONTRACT = di["Contracts"] == null ? "" : di["Contracts"].ToString(), }; - if (!Biz.Db.Queryable<BIZ_MES_WO>().Any(x => x.ORDER_NO == woItem.ORDER_NO && (x.STATUS > BIZ_MES_WO.STATUSs.Init.GetValue() || x.ROUTE_STATUS > BIZ_MES_WO.ROUTE_STATUSs.WaitSet.GetValue()))) + if (!Biz.Db.Queryable<BIZ_MES_WO>().Any(x => x.ORDER_NO == woItem.ORDER_NO && x.STATUS > BIZ_MES_WO.STATUSs.Imported.GetValue())) { items.Add(woItem); } @@ -586,8 +583,8 @@ } Logger.Scheduler.Info($"宸ュ崟淇℃伅瀛樺叆瀹炰綋涓紝鎬绘暟锛歔{items.Count}]"); db = Biz.Db; - var dbTran = db.UseTran(() => - { + //var dbTran = db.UseTran(() => + //{ if (items.Any()) { if (items.Count > 100) @@ -611,12 +608,12 @@ } } - }); - if (!dbTran.IsSuccess) - { - action.CatchExceptionWithLog(dbTran.ErrorException, $"鏁版嵁澶勭悊澶辫触"); - Logger.Scheduler.Error(action.Message); - } + //}); + //if (!dbTran.IsSuccess) + //{ + // action.CatchExceptionWithLog(dbTran.ErrorException, $"鏁版嵁澶勭悊澶辫触"); + // Logger.Scheduler.Error(action.Message); + //} action.Message = $"宸ュ崟淇℃伅瀛樺叆鏁版嵁搴擄紝鎬绘暟锛歔{items.Count}]"; Logger.Scheduler.Info($"{action.Message}"); if (action.IsSuccessed && items.Count > 0) -- Gitblit v1.9.3