public void AddProduct(DateTime time, string lotID) { var oldShiftType = Equipment.EquipmentManager.Instance.GetShift(LastUpdateTime.TimeOfDay); var currentShiftType = Equipment.EquipmentManager.Instance.GetShift(time.TimeOfDay); if (oldShiftType != currentShiftType) { if (currentShiftType == Equipment.EquipmentManager.ShiftType.GY) { AllClear(); } } DayProductOutput.AddOutput(time); if (CurrentLotProductOutput == null) { CurrentLotProductOutput = new LotProductOutputInfo(); CurrentLotProductOutput.LotID = lotID; LotProductOutputList.Add(CurrentLotProductOutput); } if (CurrentLotProductOutput.LotID != lotID) { TrackOutLot(time, CurrentLotProductOutput.LotID); TrackInLot(time, lotID); CurrentLotProductOutput.LotID = lotID; CurrentLotProductOutput.LastUpdateTime = time; } if (CurrentUnitPerHour == null) { CurrentUnitPerHour = new UnitPerHourInfo(); CurrentUnitPerHour.LastUpdateTime = time; UnitPerHourList.Add(CurrentUnitPerHour); } if (CurrentUnitPerHour.LastUpdateTime.Hour != time.Hour) { UnitPerHourList.Add(new UnitPerHourInfo()); CurrentUnitPerHour = UnitPerHourList.Last(); } CurrentLotProductOutput.AddOutput(time, lotID); CurrentUnitPerHour.AddOutput(time); Save(time); LastUpdateTime = time; }
public void CopyTo(UnitPerHourInfo dest) { dest.LastUpdateTime = this.LastUpdateTime; dest.OutputCount = this.OutputCount; }
public bool TryParse(string str, out UnitPerHourInfo result) { result = null; if (string.IsNullOrEmpty(str)) return false; result = new UnitPerHourInfo(); try { string[] splitData = str.Split(','); foreach (var item in splitData) { string[] itemSplit = item.Split('='); if (itemSplit.Length < 2) continue; string value = itemSplit[1].Trim(); switch (itemSplit[0].Trim()) { case "OutputCount": { int temp; if (int.TryParse(value, out temp)) result.OutputCount = temp; } break; case "LastUpdateTime": { DateTime temp; if (DateTime.TryParse(value, out temp)) result.LastUpdateTime = temp; } break; } } } catch { result = null; return false; } return true; }
public void LoadUnitPerHour(DateTime date) { var loadTime = GetTimeForSamsungShift(date); StreamReader sr = null; try { string path = ROOT_PATH + loadTime.ToString("yyyy") + @"\" + loadTime.ToString("MM") + @"\" + loadTime.ToString("dd") + @"\"; string filename = path + UnitPerHourInfo.FILE_NAME + loadTime.ToString(@"yyyy-MM-dd") + ".log"; if (File.Exists(filename) == false) return; sr = new StreamReader(filename); while (sr.EndOfStream == false) { UnitPerHourInfo obj = new UnitPerHourInfo(); obj.Load(sr); UnitPerHourList.Add(obj); } } catch { if (sr != null) { sr.Close(); sr.Dispose(); } } }
public void AddProduct(DateTime time, string lotID, int count) { var oldShiftType = Equipment.MainEquipment.GetShift(LastUpdateTime.TimeOfDay); var currentShiftType = Equipment.MainEquipment.GetShift(time.TimeOfDay); if (oldShiftType != currentShiftType) { if (currentShiftType == Equipment.MainEquipment.ShiftType.GY) { AllClear(); } } DayProductOutput.AddOutput(time, count); if (CurrentLotProductOutput == null) { CurrentLotProductOutput = new LotProductOutputInfo(); CurrentLotProductOutput.UseSetUPHOnTrackOut = UseSetUPHOnTrackOut; CurrentLotProductOutput.LotID = lotID; LotProductOutputList.Add(CurrentLotProductOutput); } if (CurrentLotProductOutput.LotID != lotID) { TrackOutLot(time, CurrentLotProductOutput.LotID); TrackInLot(time, lotID); CurrentLotProductOutput.LotID = lotID; CurrentLotProductOutput.LastUpdateTime = time; } if (UnitPerHourList != null && UnitPerHourList.Count > 0) { var last = UnitPerHourList.Last(); if (last.StartTime.Date == time.Date) { CurrentUnitPerHour = last; } } if (CurrentUnitPerHour == null) { CurrentUnitPerHour = new UnitPerHourInfo(); CurrentUnitPerHour.LastUpdateTime = time; UnitPerHourList.Add(CurrentUnitPerHour); } if (CurrentUnitPerHour.LastUpdateTime.Hour != time.Hour) { UnitPerHourList.Add(new UnitPerHourInfo()); CurrentUnitPerHour = UnitPerHourList.Last(); } CurrentLotProductOutput.AddOutput(time, lotID, count); OnAddedLotProduct(this, new FAGenericEventArgs<LotProductOutputInfo>(CurrentLotProductOutput)); CurrentUnitPerHour.AddOutput(time, count); Save(time); LastUpdateTime = time; UPEHString = GetUPEHString(); }