@@ -28,8 +28,8 @@ interface ProductionScheduleRepository : AbstractRepository<ProductionSchedule, | |||||
ps.id, | ps.id, | ||||
ps.deleted, | ps.deleted, | ||||
ps.scheduleAt, | ps.scheduleAt, | ||||
date_add(ps.scheduleAt, interval 7 - if(weekday(ps.scheduleAt) = 6, 0, weekday(ps.scheduleAt) + 1) day) as schedulePeriod, | |||||
date_add(ps.scheduleAt, interval 7 + 6 - if(weekday(ps.scheduleAt) = 6, 0, weekday(ps.scheduleAt) + 1) day) as schedulePeriodTo, | |||||
date_add(ps.scheduleAt, interval 7 + 4 - if(weekday(ps.scheduleAt) = 6, 0, weekday(ps.scheduleAt) + 1) day) as schedulePeriod, | |||||
date_add(ps.scheduleAt, interval 7 + 4 + 6 - if(weekday(ps.scheduleAt) = 6, 0, weekday(ps.scheduleAt) + 1) day) as schedulePeriodTo, | |||||
ps.totalEstProdCount, | ps.totalEstProdCount, | ||||
ps.totalFGType, | ps.totalFGType, | ||||
ps.`type` | ps.`type` | ||||
@@ -51,8 +51,8 @@ interface ProductionScheduleRepository : AbstractRepository<ProductionSchedule, | |||||
ps.id, | ps.id, | ||||
ps.deleted, | ps.deleted, | ||||
ps.scheduleAt, | ps.scheduleAt, | ||||
date_add(ps.scheduleAt, interval 7 - if(weekday(ps.scheduleAt) = 6, 0, weekday(ps.scheduleAt) + 1) day) as schedulePeriod, | |||||
date_add(ps.scheduleAt, interval 7 + 6 - if(weekday(ps.scheduleAt) = 6, 0, weekday(ps.scheduleAt) + 1) day) as schedulePeriodTo, | |||||
date_add(ps.scheduleAt, interval 7 + 4 - if(weekday(ps.scheduleAt) = 6, 0, weekday(ps.scheduleAt) + 1) day) as schedulePeriod, | |||||
date_add(ps.scheduleAt, interval 7 + 4 + 6 - if(weekday(ps.scheduleAt) = 6, 0, weekday(ps.scheduleAt) + 1) day) as schedulePeriodTo, | |||||
ps.totalEstProdCount, | ps.totalEstProdCount, | ||||
ps.totalFGType, | ps.totalFGType, | ||||
ps.`type` | ps.`type` | ||||
@@ -86,8 +86,8 @@ open class ProductionScheduleService( | |||||
val prodSchedule = productionScheduleRepository.findById(id).getOrNull() ?: throw NoSuchElementException() | val prodSchedule = productionScheduleRepository.findById(id).getOrNull() ?: throw NoSuchElementException() | ||||
val dayOfWeekValue = | val dayOfWeekValue = | ||||
if (prodSchedule.scheduleAt.dayOfWeek.value >= 7) prodSchedule.scheduleAt.dayOfWeek.value - 7 else prodSchedule.scheduleAt.dayOfWeek.value | if (prodSchedule.scheduleAt.dayOfWeek.value >= 7) prodSchedule.scheduleAt.dayOfWeek.value - 7 else prodSchedule.scheduleAt.dayOfWeek.value | ||||
val schedulePeriod = prodSchedule.scheduleAt.plusDays((7 - dayOfWeekValue).toLong()) | |||||
val schedulePeriodTo = prodSchedule.scheduleAt.plusDays((7 + 6 - dayOfWeekValue).toLong()) | |||||
val schedulePeriod = prodSchedule.scheduleAt.plusDays((7 + 4 - dayOfWeekValue).toLong()) | |||||
val schedulePeriodTo = prodSchedule.scheduleAt.plusDays((7 + 4 + 6 - dayOfWeekValue).toLong()) | |||||
val prodScheduleLines = prodSchedule.productionScheduleLines.filter { !it.deleted } | val prodScheduleLines = prodSchedule.productionScheduleLines.filter { !it.deleted } | ||||
// ---------------------------------- By FG ----------------------------------// | // ---------------------------------- By FG ----------------------------------// | ||||
@@ -85,8 +85,8 @@ class ProductionScheduleController( | |||||
val today = LocalDateTime.now() | val today = LocalDateTime.now() | ||||
val latestRoughScheduleAt = productionScheduleService.getLatestScheduleAt("rough") | val latestRoughScheduleAt = productionScheduleService.getLatestScheduleAt("rough") | ||||
// assume schedule period is sunday to saturday | |||||
val assignDate = (genDate ?: today).dayOfWeek.value | |||||
// assume schedule period is thursday to wednesday | |||||
val assignDate = ((genDate ?: today).dayOfWeek.value + 4) % 7 + 1 | |||||
// val assignDate = abs(Duration.between(latestRoughScheduleAt, today).toDays() % 7) + 1 | // val assignDate = abs(Duration.between(latestRoughScheduleAt, today).toDays() % 7) + 1 | ||||
// val finalAssignDate = if (assignDate.toInt() == 0) { | // val finalAssignDate = if (assignDate.toInt() == 0) { | ||||