From a5b9869da4b61e7b7db678bfac71f040a4195620 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期日, 13 十月 2024 22:06:19 +0800 Subject: [PATCH] 一些更改 --- Tiger.Business.MES/Transaction/Position.cs | 2 +- Tiger.Business.MES/Common/WorkBatch.cs | 13 +++++++++++++ Tiger.Business.MES/Common/WoContext.cs | 7 +++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Tiger.Business.MES/Common/WoContext.cs b/Tiger.Business.MES/Common/WoContext.cs index 107746d..6fcdb16 100644 --- a/Tiger.Business.MES/Common/WoContext.cs +++ b/Tiger.Business.MES/Common/WoContext.cs @@ -45,10 +45,13 @@ /// </summary> /// <param name="workorder"></param> /// <param name="lineCode"></param> + /// <param name="batchNo"></param> + /// <param name="canDoWork"></param> /// <returns></returns> - public static bool ExistsBatch(string workorder, string lineCode, string batchNo = "") + public static bool ExistsBatch(string workorder, string lineCode, string batchNo = "", bool canDoWork = false) { - return WoBatchDic.Any(q => q.Value.Batch.ORDER_NO == workorder && q.Value.Batch.ACT_LINE == lineCode && (batchNo.IsNullOrEmpty() || q.Value.Batch.BATCH_NO == batchNo)); + return WoBatchDic.WhereIF(canDoWork, q => q.Value.Batch.STATUS == BIZ_MES_WO_BATCH.STATUSs.Release.GetValue() || q.Value.Batch.STATUS == BIZ_MES_WO_BATCH.STATUSs.Working.GetValue()) + .Any(q => q.Value.Batch.ORDER_NO == workorder && q.Value.Batch.ACT_LINE == lineCode && (batchNo.IsNullOrEmpty() || q.Value.Batch.BATCH_NO == batchNo)); } /// 浠庡伐鍗曟壒娆″瓧鍏镐腑鍒犻櫎涓�涓伐鍗曟壒娆″璞� diff --git a/Tiger.Business.MES/Common/WorkBatch.cs b/Tiger.Business.MES/Common/WorkBatch.cs index 214a269..7554540 100644 --- a/Tiger.Business.MES/Common/WorkBatch.cs +++ b/Tiger.Business.MES/Common/WorkBatch.cs @@ -274,6 +274,19 @@ Logger.Default.Fatal(dbTran.ErrorException, $"妫�鏌ュ伐鍗曟壒娆{Batch.BATCH_NO}]鏄惁瀹屽伐寮傚父"); return false; } + //鍒犻櫎缂撳瓨 + if (Batch.STATUS == BIZ_MES_WO_BATCH.STATUSs.Closed.GetValue()) + { + WoContext.WoBatchDic.Remove(Batch.BATCH_NO); + } + if (WO.STATUS == BIZ_MES_WO.STATUSs.Closed.GetValue()) + { + var list = WoContext.WoBatchDic.Where(q => q.Value.WO.ORDER_NO == OrderNo).Select(q => q.Key); + foreach (var item in list) + { + WoContext.WoBatchDic.Remove(item); + } + } return true; } diff --git a/Tiger.Business.MES/Transaction/Position.cs b/Tiger.Business.MES/Transaction/Position.cs index a5433bb..2429dad 100644 --- a/Tiger.Business.MES/Transaction/Position.cs +++ b/Tiger.Business.MES/Transaction/Position.cs @@ -102,7 +102,7 @@ var action = new ApiAction(); try { - if (!WoContext.ExistsBatch(input.OrderNo, CurLine.LINE_CODE, batchNo)) + if (!WoContext.ExistsBatch(input.OrderNo, CurLine.LINE_CODE, batchNo, true)) { var wo = await Biz.Db.Queryable<BIZ_MES_WO>().ByAuth(input.AuthOption).Where(q => q.ORDER_NO == input.OrderNo).FirstAsync(); //楠岃瘉鏄庣粏鏄惁姝g‘ -- Gitblit v1.9.3