From df3b96fa372f3e7bac5867fdec643f2e931e32a7 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期五, 11 十月 2024 20:17:09 +0800 Subject: [PATCH] Merge branch 'master' of http://47.115.28.255:8110/r/TigerClouds-Tech/Server/TigerApi6_2024 --- Tiger.Business.MES/Transaction/Position.cs | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Tiger.Business.MES/Transaction/Position.cs b/Tiger.Business.MES/Transaction/Position.cs index a6e3e83..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).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()); @@ -752,7 +755,7 @@ int daysOffset = firstDay.DayOfWeek.GetValue() > 3 ? (firstDay.DayOfWeek.GetValue() - 7) : 0; int year = date.Year + ((date - firstDay).TotalDays + daysOffset < 0 ? -1 : 0); int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday); - dic.Add(sn, $"{year.ToString().Substring(2, 2)}{week:00}"); + dic.Add(sn, $"{year.ToString("0000").Substring(2, 2)}{week:00}"); } else { -- Gitblit v1.9.3