internal void Check_GioChuaXN(DateTime tempTimeStr, string pSource, int tempMachineNo) { if (tempMachineNo % 2 == 1) { cChkIn tChkIn = new cChkIn() { TimeStr = tempTimeStr, Source = pSource, MachineNo = tempMachineNo }; ds_CheckAuto.Add(tChkIn); } else { cChkOut tChkOut = new cChkOut() { TimeStr = tempTimeStr, Source = pSource, MachineNo = tempMachineNo }; ds_CheckAuto.Add(tChkOut); } }
internal void Check_GioDaXN(DateTime pTimeStr, string pSource, int tempMachineNo , int pIDXacnhan, int pShiftID, string pShiftCode, TimeSpan pOnduty, TimeSpan pOffduty, TimeSpan pLateGrace, TimeSpan pEarlyGrace, TimeSpan pAfterOT, bool pTinhPC150, int pDayCount, TimeSpan pWorkingTime, Single pWorkingday , DateTime pTimeStrIn, DateTime pTimeStrOut, int pOTMin, string pNote) { if (tempMachineNo % 2 == 1) { cChkIn tChkIn = new cChkIn() { TimeStr = pTimeStr, Source = pSource, MachineNo = tempMachineNo }; ds_Check_ID.Add(tChkIn); } else { cChkOut tChkOut = new cChkOut() { TimeStr = pTimeStr, Source = pSource, MachineNo = tempMachineNo }; ds_Check_ID.Add(tChkOut); if (ds_Check_ID.Count > 1 && ds_Check_ID[ds_Check_ID.Count - 2].GetType() == typeof(cChkIn)) { cChkIn tmpChkIn = (cChkIn)ds_Check_ID[ds_Check_ID.Count - 2]; cChkOut tmpChkOut = (cChkOut)ds_Check_ID[ds_Check_ID.Count - 1]; cChkInOut tmpChkINOUT = new cChkInOut() { Vao = tmpChkIn, Raa = tmpChkOut, HaveINOUT = 1, TongGioThuc = tmpChkOut.TimeStr - tmpChkIn.TimeStr, DaXN = true, IsOT = true, TinhPC150 = pTinhPC150, LamThem = new TimeSpan(0, pOTMin, 0), ThuocNgayCong = ThamSo.GetDate(tmpChkIn.TimeStr), // [TBD] xem lại thuộc ngày công }; cShift tmpThuocCa; if (pShiftID > 0) // ca trong ds ca { tmpThuocCa = DSCa.Find(item => item.ShiftID == pShiftID); } else if (pShiftID > int.MinValue + 100 && pShiftID < 0) // ca tách và ca kết hợp [Chú ý] + 100 vì chừa khoảng này cho các loại khác { tmpThuocCa = new cShift() { ShiftID = pShiftID, ShiftCode = pShiftCode, OnnDutyTS = pOnduty, OffDutyTS = pOffduty, chophepvaotreTS = pLateGrace, chopheprasomTS = pEarlyGrace, batdaulamthemTS = pAfterOT, WorkingTimeTS = pWorkingTime, Workingday = pWorkingday, DayCount = pDayCount, QuaDem = (pDayCount == 1), LunchMinute = ThamSo._0gio, LoaiCa = 0 } } ; //[TBD] else if (pShiftID < int.MinValue + 100) { tmpThuocCa = new cShift() { ShiftID = pShiftID, ShiftCode = pShiftCode, OnnDutyTS = pOnduty, OffDutyTS = pOffduty, chophepvaotreTS = pLateGrace, chopheprasomTS = pEarlyGrace, batdaulamthemTS = pAfterOT, WorkingTimeTS = pWorkingTime, Workingday = pWorkingday, DayCount = pDayCount, QuaDem = (pDayCount == 1), LunchMinute = ThamSo._0gio, LoaiCa = 1 } } ; else { tmpThuocCa = new cShift() { ShiftID = pShiftID, ShiftCode = "XacNhan8h", OnnDutyTS = pOnduty, OffDutyTS = pOffduty, chophepvaotreTS = pLateGrace, chopheprasomTS = pEarlyGrace, batdaulamthemTS = pAfterOT, WorkingTimeTS = pWorkingTime, Workingday = pWorkingday, DayCount = pDayCount, QuaDem = (pDayCount == 1), LunchMinute = ThamSo._0gio, LoaiCa = 1 }; //[TBD] } if (tmpThuocCa == null) { log4net.ILog log = log4net.LogManager.GetLogger("ERROR function Check_GioDaXN "); log.Fatal("ERROR function Check_GioDaXN"); } tmpChkINOUT.ThuocCa = tmpThuocCa; tmpChkINOUT.QuaDem = tmpThuocCa.QuaDem; XL.TinhCongTheoCa(tmpChkINOUT, tmpChkINOUT.ThuocCa); DSVaoRa.Add(tmpChkINOUT); } } }