From 545bc1c267a939cf3259afcda1ba60feedd7e7eb Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期五, 11 十月 2024 20:15:25 +0800 Subject: [PATCH] 更新工序自动更新工单状态 --- Tiger.Business.MES/Transaction/Position.cs | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Tiger.Business.MES/Transaction/Position.cs b/Tiger.Business.MES/Transaction/Position.cs index 5a8ded0..1277758 100644 --- a/Tiger.Business.MES/Transaction/Position.cs +++ b/Tiger.Business.MES/Transaction/Position.cs @@ -97,12 +97,12 @@ /// </summary> /// <param name="input"></param> /// <returns></returns> - public async Task<ApiAction> SelectOrder(WoInput input) + public async Task<ApiAction> SelectOrder(WoInput input, string batchNo = "") { var action = new ApiAction(); try { - if (!WoContext.ExistsBatch(input.OrderNo, CurLine.LINE_CODE)) + if (!WoContext.ExistsBatch(input.OrderNo, CurLine.LINE_CODE, batchNo)) { var wo = await Biz.Db.Queryable<BIZ_MES_WO>().ByAuth(input.AuthOption).Where(q => q.ORDER_NO == input.OrderNo).FirstAsync(); //楠岃瘉鏄庣粏鏄惁姝g‘ @@ -116,11 +116,14 @@ if (wo.STATUS != BIZ_MES_WO.STATUSs.Release.GetValue() && wo.STATUS != BIZ_MES_WO.STATUSs.Working.GetValue()) { action.IsSuccessed = false; - //action.LocaleMsg = new($"宸ュ崟[{input.OrderNo}]鐘舵�乕{wo.STATUS.GetEnum<BIZ_MES_WO.STATUSs>().GetName()}]涓嶈兘鐢熶骇"); + //action.LocaleMsg = new($"宸ュ崟[{0}]鐘舵�乕{1}]涓嶈兘鐢熶骇"); action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.StatusException", input.OrderNo, wo.STATUS.GetEnum<BIZ_MES_WO.STATUSs>().GetName()); return action; } - var batch = await Biz.Db.Queryable<BIZ_MES_WO_BATCH>().ByAuth(input.AuthOption).Where(q => q.ORDER_NO == input.OrderNo && q.ACT_LINE == CurLine.LINE_CODE).OrderBy(q => q.STATUS).FirstAsync(); + var batch = await Biz.Db.Queryable<BIZ_MES_WO_BATCH>().ByAuth(input.AuthOption) + .Where(q => q.ORDER_NO == input.OrderNo && q.ACT_LINE == CurLine.LINE_CODE) + .WhereIF(!batchNo.IsNullOrEmpty(), q => q.BATCH_NO == batchNo) + .OrderBy(q => q.STATUS).FirstAsync(); if (batch.IsNullOrEmpty()) { action.IsSuccessed = false; @@ -131,14 +134,14 @@ if (batch.STATUS != BIZ_MES_WO_BATCH.STATUSs.Release.GetValue() && batch.STATUS != BIZ_MES_WO_BATCH.STATUSs.Working.GetValue()) { action.IsSuccessed = false; - //action.LocaleMsg = new($"宸ュ崟[{input.OrderNo}]鐘舵�乕{wo.STATUS.GetEnum<BIZ_MES_WO_BATCH.STATUSs>().GetName()}]涓嶈兘鐢熶骇"); - action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.StatusException", input.OrderNo, batch.STATUS.GetEnum<BIZ_MES_WO_BATCH.STATUSs>().GetName()); + //action.LocaleMsg = new($"宸ュ崟[{0}]鎵规[1]鐘舵�乕{2}]涓嶈兘鐢熶骇"); + action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.BatchStatusException", input.OrderNo, batch.BATCH_NO, batch.STATUS.GetEnum<BIZ_MES_WO_BATCH.STATUSs>().GetName()); return action; } var wb = new WorkBatch(input.OrderNo).Init(CurLine.LINE_CODE); WoContext.WoBatchDic.Add(wb.Batch.BATCH_NO, wb); } - CurBatch = WoContext.GetBatch(input.OrderNo, CurLine.LINE_CODE); + CurBatch = WoContext.GetBatch(input.OrderNo, CurLine.LINE_CODE, batchNo); if (!OperInfoDic.ContainsKey(CurBatch.Batch.BATCH_NO)) { OperInfoDic.Add(CurBatch.Batch.BATCH_NO, new()); -- Gitblit v1.9.3