From 6ce619b328af4ec209a8a15ef5ba3416fd956c14 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期日, 21 七月 2024 19:51:14 +0800 Subject: [PATCH] 产品信息增加权限查询 --- Tiger.Business.MES/Transaction/Position.cs | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/Tiger.Business.MES/Transaction/Position.cs b/Tiger.Business.MES/Transaction/Position.cs index fd494ab..dbcd9fd 100644 --- a/Tiger.Business.MES/Transaction/Position.cs +++ b/Tiger.Business.MES/Transaction/Position.cs @@ -39,6 +39,9 @@ //if (CurFactory.IsNullOrEmpty()) throw new InvalidDataException($"MES.Transaction.Position.FactoryNotExistsException", new Exception($"{postCode}|{CurWorkshop.FTY_CODE}")); if (CurFactory.IsNullOrEmpty()) throw new InvalidDataException($"宀椾綅[{postCode}]鎵�灞炵殑宸ュ巶[{CurWorkshop.FTY_CODE}]涓嶅瓨鍦紝璇峰厛璁剧疆鎵�灞炲伐鍘�", new Exception($"{postCode}|{CurWorkshop.FTY_CODE}")); + //鍔犺浇褰撳墠浜х嚎鐨勭彮鍒� + CurShiftSys = Biz.Db.Queryable<MES_SHIFT_SYS>().Where(q => q.SFTS_CODE == CurLine.SFTS_CODE).IncludesAllFirstLayer().IncludesAllSecondLayer(q => q.Shifts).First(); + return this; } @@ -49,6 +52,7 @@ public MES_WORKSHOP CurWorkshop { get; set; } public MES_LINE CurLine { get; set; } public MES_POSITION CurPosition { get; set; } + public MES_SHIFT_SYS CurShiftSys { get; set; } public WorkBatch CurBatch { get; set; } public IWorkBatch WorkBatch => CurBatch; public MES_WIP_DATA CurWipSN { get; set; } @@ -121,6 +125,27 @@ } /// <summary> + /// 鑾峰彇褰撳墠鏃堕棿鎵�灞炵殑鐝埗鐝鏃舵 + /// </summary> + public ShiftPeriod GetShiftPeriodForNow() + { + var time = DateTime.Now.ToString("HHmm").ToInt32(); + foreach (var shift in CurShiftSys.Shifts) + { + var period = shift.Periods.Where(q => q.PRD_BEGIN <= time && time <= q.PRD_END).FirstOrDefault(); + if (!period.IsNullOrEmpty()) + { + var result = new ShiftPeriod(); + result.ShiftSys = CurShiftSys; + result.Shift = shift; + result.Period = period; + return result; + } + } + return null; + } + + /// <summary> /// 閲嶇疆褰撳墠宸ユ /// </summary> public void ResetSteps() -- Gitblit v1.9.3