コード例 #1
0
        /// <summary>
        /// 根据模具警报类型获得模具警报信息
        /// </summary>
        /// <param name="type">模具警报类型</param>
        /// <returns>模具警报信息列表</returns>
        public List <MoldWarnInfo> GetMoldWarnInfo(MoldWarnType type)
        {
            using (IUnitOfWork unitwork = MSSqlHelper.DataContext())
            {
                IMoldRepository     moldRepostitory = new MoldRepository(unitwork);
                List <MoldView>     molds           = moldRepostitory.GetByWarnType(type);
                List <MoldWarnInfo> moldWarnInfos   = new List <MoldWarnInfo>();

                foreach (MoldView m in molds)
                {
                    MoldWarnInfo moldWarnInfo = new MoldWarnInfo()
                    {
                        MoldNR          = m.MoldNR,
                        Type            = m.TypeName,
                        ProjectName     = m.ProjectName,
                        MaxLendHour     = (double)m.MaxLendHour,
                        LendTime        = (DateTime)m.LastRecordDate,
                        CurrentPosition = m.StorageRecordNR.HasValue ? moldRepostitory.GetMoldCurrPosiByRecordNR((Guid)m.StorageRecordNR) : string.Empty
                    };
                    moldWarnInfos.Add(moldWarnInfo);
                }

                return(moldWarnInfos);
            }
        }