Пример #1
0
        /// <summary>
        ///     设置发动机滑油用户
        /// </summary>
        /// <param name="snReg">发动机滑油用户</param>
        /// <returns>滑油用户</returns>
        public EngineReg SetEngineOil(EngineReg snReg)
        {
            if (snReg == null || snReg.IsTransient())
            {
                throw new ArgumentException("发动机滑油用户参数为空!");
            }

            SnRegID = snReg.Id;
            return snReg;
        }
Пример #2
0
        /// <summary>
        ///     创建发动机滑油消耗数据
        /// </summary>
        /// <param name="engineReg">发动机</param>
        /// <param name="date">日期</param>
        /// <param name="tsn">TSN</param>
        /// <param name="tsr">TSR</param>
        /// <param name="totalRate">总消耗率</param>
        /// <param name="intervalRate">区间消耗率</param>
        /// <param name="deltaIntervalRate">区间消耗率增量</param>
        /// <param name="averageRate3">总消耗率3天移动平均</param>
        /// <param name="averageRate7">总消耗率7天移动平均</param>
        /// <returns>滑油消耗数据</returns>
        public static OilMonitor CreateEngineOil(
            EngineReg engineReg,
            DateTime date,
            decimal tsn,
            decimal tsr,
            decimal totalRate,
            decimal intervalRate,
            decimal deltaIntervalRate,
            decimal averageRate3,
            decimal averageRate7)
        {
            var oilMonitor = new OilMonitor
            {
                Date = date,
                TSN = tsn,
                TSR = tsr,
                TotalRate = totalRate,
                IntervalRate = intervalRate,
                DeltaIntervalRate = deltaIntervalRate,
                AverageRate3 = averageRate3,
                AverageRate7 = averageRate7,
            };
            oilMonitor.GenerateNewIdentity();

            var user = oilMonitor.SetEngineOil(engineReg);
            if (!user.NeedMonitor)
                user.NeedMonitor = true;

            return oilMonitor;
        }