服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-07-21 f656805650f0024d30ede19d8c32070f319ed507
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; }
@@ -118,6 +122,27 @@
                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>
@@ -279,7 +304,7 @@
            }
            return result;
        }
        #endregion Functions
        public override bool Close(bool needSaveHistoryLog = false)