/// <summary> /// 检查是否需要重新加载数据 每天检查一次 /// </summary> public void CheckReload(DateTime curTime, EMSUnit unit) { if (this.lists == null || this.lists.Count < 1) { return; } //采集时间是否大于计算列表的启动时间 //int days = (curTime - this.lists[0].rang.StartTime).Days;//天数差 TimeSpan ts1 = new TimeSpan(curTime.Ticks); TimeSpan ts2 = new TimeSpan(this.lists[0].rang.StartTime.Ticks); TimeSpan ts = ts1.Subtract(ts2).Duration(); ///满足24小时时间 if (ts.Days >= 1) { this.ReLoad(); this.ems = unit; } }
/// <summary> /// 判断产品是否换型 /// </summary> /// <param name="unit"></param> /// <returns></returns> public bool IsChangeProduct(EMSUnit unit) { if (this.ems == null || this.ems.EMS == 0) { this.ems = unit; return(false); } if (!this.ems.Equals(unit)) { return(true); } return(false); }
/// <summary> /// 处理换型添加记录 /// </summary> /// <param name="unit"></param> /// <returns></returns> public int ProcessAcqLineData(string lineID, string unitid, EMSUnit unit) { int ret = 0; try { ChangeTimeDAL dal = new ChangeTimeDAL(); ChangeTimeMDL mdl = new ChangeTimeMDL(); unit.SetTime = DateTime.Now; mdl.SetTID(unit.SetTime, lineID, unit.EMS, 0); mdl.PLID = lineID; mdl.UNITID = unitid; mdl.PER_PN = this.ems.EMS.ToString(); mdl.CUR_PN = unit.EMS.ToString(); mdl.TIME_MIG = TimeRange.ExecDateDiffSecond(this.ems.SetTime, unit.SetTime); mdl.PER_TIME = this.ems.SetTime; mdl.CUR_TIME = DateTime.Now; int count = dal.IsUionCOUint(unitid, lineID); if (count <= 0) { mdl.SetTID(unit.SetTime, lineID, unit.EMS, 1); ret = dal.AddChangeUnitItem(mdl); } else { count += 1; mdl.SetTID(unit.SetTime, lineID, unit.EMS, count); ret = dal.AddChangeUnitItem(mdl); } LoadEMS(unit); return(ret); } catch { throw; } }
/// <summary> /// /// </summary> /// <param name="unit"></param> /// <returns></returns> public bool Equals(EMSUnit unit) { try { if (unit == null) { return(false); } if (unit.EMS == this.ems) { return(true); } return(false); } catch { throw; } }
public void LoadEMS(EMSUnit unit) { this.ems = new EMSUnit(unit.EMS, unit.SetTime); }