Compare commits
2 commits
1a0e712a1c
...
7775ea85c3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7775ea85c3 | ||
|
|
19000b2e42 |
1 changed files with 87 additions and 31 deletions
|
|
@ -527,12 +527,13 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
if (sameTypeJob != null)
|
||||
{
|
||||
// ตรวจสอบว่างานที่มีอยู่ถูกสร้างเมื่อไหร่ ถ้าเกิน 2 นาทีให้สร้างใหม่ได้
|
||||
var timeDiff = (currentDate - sameTypeJob.CreatedDate).TotalMinutes;
|
||||
if (timeDiff < 2)
|
||||
{
|
||||
return Error($"มีงาน {checkType} กำลังดำเนินการอยู่ กรุณารอสักครู่", StatusCodes.Status409Conflict);
|
||||
}
|
||||
|
||||
return Error($"มีงาน {checkType} กำลังดำเนินการอยู่", StatusCodes.Status500InternalServerError);
|
||||
// var timeDiff = (currentDate - sameTypeJob.CreatedDate).TotalMinutes;
|
||||
// if (timeDiff < 2)
|
||||
// {
|
||||
// return Error($"มีงาน {checkType} กำลังดำเนินการอยู่ กรุณารอสักครู่", StatusCodes.Status409Conflict);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -623,7 +624,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
// Ignore delete error
|
||||
}
|
||||
}
|
||||
throw new Exception($"ไม่สามารถส่งงานไปยัง Queue ได้: {ex.Message}");
|
||||
return Error($"ไม่สามารถส่งงานไปยัง Queue ได้: {ex.Message}");
|
||||
//throw new Exception($"ไม่สามารถส่งงานไปยัง Queue ได้: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
@ -1158,35 +1160,89 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
else
|
||||
{
|
||||
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลาเข้า-ออกงาน (กรณีลงเวลาออกอีกวัน) #921
|
||||
checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||
// "ABSENT" :
|
||||
checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
|
||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >=
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {endTime}") ?
|
||||
"NORMAL" :
|
||||
"ABSENT" :
|
||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {endTimeMorning}") ?
|
||||
"ABSENT" :
|
||||
"NORMAL";
|
||||
var currentDateTime = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm"));
|
||||
var dutyEndTimeAfternoon = DateTime.Parse($"{checkout.CheckIn.ToString("yyyy-MM-dd")} {endTime}");
|
||||
var dutyEndTimeMorning = DateTime.Parse($"{checkout.CheckIn.ToString("yyyy-MM-dd")} {endTimeMorning}");
|
||||
|
||||
|
||||
if(currentDateTime.Date > checkout.CheckIn.Date)
|
||||
{
|
||||
// ถ้า check-out เป็นวันถัดไป สถานะปกติเสมอ
|
||||
checkOutStatus = "NORMAL";
|
||||
}
|
||||
else
|
||||
{
|
||||
// ถ้า check-out เป็นวันเดียวกับ check-in
|
||||
// ตรวจสอบเวลาว่าสิ้นสุดก่อนบ่ายหรือไม่
|
||||
if(currentDateTime < dutyEndTimeMorning) // ถ้าออกก่อนเวลาสิ้นสุดตอนเช้า ขาดราชการ
|
||||
{
|
||||
checkOutStatus = "ABSENT";
|
||||
}
|
||||
else if(currentDateTime >= dutyEndTimeAfternoon) // ถ้าออกหลังเวลาสิ้นสุดตอนบ่าย ปกติ
|
||||
{
|
||||
checkOutStatus = "NORMAL";
|
||||
}
|
||||
else
|
||||
{
|
||||
checkOutStatus = "ABSENT";
|
||||
}
|
||||
}
|
||||
// checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
// DateTime.Parse($"{checkout.CheckIn.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||
// // "ABSENT" :
|
||||
// checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
|
||||
// DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >=
|
||||
// DateTime.Parse($"{checkout.CheckIn.ToString("yyyy-MM-dd")} {endTime}") ?
|
||||
// "NORMAL" :
|
||||
// "ABSENT" :
|
||||
// DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
// DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {endTimeMorning}") ?
|
||||
// "ABSENT" :
|
||||
// "NORMAL";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลาเข้า-ออกงาน (กรณีลงเวลาออกอีกวัน) #921
|
||||
checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||
// "ABSENT" :
|
||||
checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
|
||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >=
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {endTime}") ?
|
||||
"NORMAL" :
|
||||
"ABSENT" :
|
||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {endTimeMorning}") ?
|
||||
"ABSENT" :
|
||||
"NORMAL";
|
||||
var currentDateTime = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm"));
|
||||
var dutyEndTimeAfternoon = DateTime.Parse($"{checkout.CheckIn.ToString("yyyy-MM-dd")} {endTime}");
|
||||
var dutyEndTimeMorning = DateTime.Parse($"{checkout.CheckIn.ToString("yyyy-MM-dd")} {endTimeMorning}");
|
||||
|
||||
|
||||
if(currentDateTime.Date > checkout.CheckIn.Date)
|
||||
{
|
||||
// ถ้า check-out เป็นวันถัดไป สถานะปกติเสมอ
|
||||
checkOutStatus = "NORMAL";
|
||||
}
|
||||
else
|
||||
{
|
||||
// ถ้า check-out เป็นวันเดียวกับ check-in
|
||||
// ตรวจสอบเวลาว่าสิ้นสุดก่อนบ่ายหรือไม่
|
||||
if(currentDateTime < dutyEndTimeMorning) // ถ้าออกก่อนเวลาสิ้นสุดตอนเช้า ขาดราชการ
|
||||
{
|
||||
checkOutStatus = "ABSENT";
|
||||
}
|
||||
else if(currentDateTime >= dutyEndTimeAfternoon) // ถ้าออกหลังเวลาสิ้นสุดตอนบ่าย ปกติ
|
||||
{
|
||||
checkOutStatus = "NORMAL";
|
||||
}
|
||||
else
|
||||
{
|
||||
checkOutStatus = "ABSENT";
|
||||
}
|
||||
}
|
||||
// checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
// DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||
// // "ABSENT" :
|
||||
// checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
|
||||
// DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >=
|
||||
// DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {endTime}") ?
|
||||
// "NORMAL" :
|
||||
// "ABSENT" :
|
||||
// DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
// DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {endTimeMorning}") ?
|
||||
// "ABSENT" :
|
||||
// "NORMAL";
|
||||
}
|
||||
|
||||
if (checkout_process != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue