| | |
| | | //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; |
| | | } |
| | | |
| | |
| | | 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; } |
| | |
| | | action.CatchExceptionWithLog(ex, $"采集工序:选择工单异常"); |
| | | } |
| | | return action; |
| | | } |
| | | |
| | | /// <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> |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | #endregion Functions |
| | | |
| | | public override bool Close(bool needSaveHistoryLog = false) |