/// <summary> /// 创建序号件装机历史。 /// </summary> /// <param name="snReg">序号件</param> /// <param name="pnReg">附件</param> /// <param name="csn">CSN,自装机以来使用循环</param> /// <param name="tsn">TSN,自装机以来使用小时数</param> /// <param name="actionType">操作类型</param> /// <param name="aircraft">装机所在飞机</param> /// <param name="actionDate">操作日期</param> /// <param name="remInstRecord">拆换记录</param> /// <param name="csn2">的基础上再累加在库时间折算的使用循环数</param> /// <param name="tsn2">的基础上再累加在库时间折算的使用小时数</param> /// <param name="status">序号件在历史节点上的状态</param> /// <param name="position">位置信息</param> /// <returns></returns> public static SnHistory CreateSnHistory(SnReg snReg, PnReg pnReg, int csn, decimal tsn, int csn2, decimal tsn2, int actionType, Aircraft aircraft, DateTime actionDate, SnRemInstRecord remInstRecord, int status, int position) { var snHistory = new SnHistory {CreateDate = DateTime.Now}; snHistory.GenerateNewIdentity(); snHistory.SetAircraft(aircraft); snHistory.SetActionDate(actionDate); snHistory.SetActionType((ActionType) actionType); snHistory.SetSn(snReg); snHistory.SetPn(pnReg); snHistory.SetCSN(csn); snHistory.SetTSN(tsn); snHistory.SetCSN2(csn2); snHistory.SetTSN2(tsn2); snHistory.SetSnStatus((SnStatus) status); snHistory.SetRemInstRecord(remInstRecord); snHistory.SetPosition((Position) position); return snHistory; }
/// <summary> /// 插入到寿监控 /// </summary> /// <param name="snReg">序号件</param> /// <param name="lifeMonitorDto">到寿监控DTO</param> private void InsertLifeMonitor(SnReg snReg, LifeMonitorDTO lifeMonitorDto) { // 添加到寿监控 snReg.AddNewLifeMonitor(lifeMonitorDto.WorkDescription, lifeMonitorDto.MointorStart, lifeMonitorDto.MointorEnd); }
/// <summary> /// 创建序号件 /// </summary> /// <param name="sn">序号</param> /// <returns>序号件</returns> public static SnReg CreateSnReg(string sn) { var snReg = new SnReg { Sn = sn, }; snReg.GenerateNewIdentity(); snReg.CreateDate = DateTime.Now; return snReg; }
/// <summary> /// 更新序号件 /// </summary> /// <param name="updateSnReg">需要更新的序号件</param> /// <param name="installDate">初始安装日期</param> /// <param name="pnReg">附件</param> /// <param name="sn">序号</param> /// <returns>序号件</returns> public static SnReg UpdateSnReg( SnReg updateSnReg, DateTime installDate, PnReg pnReg, string sn) { updateSnReg.InstallDate = installDate; updateSnReg.Sn = sn; updateSnReg.SetPnReg(pnReg); updateSnReg.UpdateDate = DateTime.Now; return updateSnReg; }
/// <summary> /// 创建序号件 /// </summary> /// <param name="installDate">初始安装日期</param> /// <param name="pnReg">附件</param> /// <param name="sn">序号</param> /// <returns>序号件</returns> public static SnReg CreateSnReg( DateTime installDate, PnReg pnReg, string sn) { var snReg = new SnReg { InstallDate = installDate, Sn = sn, }; snReg.GenerateNewIdentity(); snReg.SetPnReg(pnReg); snReg.CreateDate = DateTime.Now; snReg.UpdateDate = DateTime.Now; return snReg; }
/// <summary> /// 由维修控制组计算 /// </summary> /// <param name="sn"></param> /// <param name="mc"></param> /// <returns></returns> private LifeMonitor CreateLifeMonitor(SnReg sn, MaintainCtrl mc) { var workDescription = ""; if (mc.MaintainWork != null) workDescription = mc.MaintainWork.WorkCode; else workDescription = mc.Description; if (!string.IsNullOrWhiteSpace(workDescription)) { var lifeMointor = _unitOfWork.CreateSet<LifeMonitor>().FirstOrDefault(lm => lm.WorkDescription == workDescription); if (lifeMointor != null) { //TODO 需要完善 } } return null; }
/// <summary> /// 设置装机序号 /// </summary> /// <param name="snReg">装机序号</param> public void SetSn(SnReg snReg) { if (snReg == null || snReg.IsTransient()) { throw new ArgumentException("装机序号参数为空!"); } Sn = snReg.Sn; SnRegId = snReg.Id; }