服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-07-21 6ce619b328af4ec209a8a15ef5ba3416fd956c14
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()