diff --git a/src/main/java/com/ffii/fpsms/modules/master/service/ProductionScheduleService.kt b/src/main/java/com/ffii/fpsms/modules/master/service/ProductionScheduleService.kt index 40dd0ce..75a5a29 100644 --- a/src/main/java/com/ffii/fpsms/modules/master/service/ProductionScheduleService.kt +++ b/src/main/java/com/ffii/fpsms/modules/master/service/ProductionScheduleService.kt @@ -233,10 +233,27 @@ open class ProductionScheduleService( this.isDark = row["isDark"].toString().toInt() this.isDense = row["isDense"].toString().toInt() this.isFloat = row["isFloat"].toString().toInt() + + val isDarkValue = row["isDark"].toString().toInt() + val isDenseValue = row["isDense"].toString().toInt() + val isFloatValue = row["isFloat"].toString().toInt() + this.weightingRef = - (DARK_MAX_VALUE - row["isDark"].toString().toInt() ) / DARK_MAX_VALUE.toDouble() * DARK_WEIGHTING + - (DENSE_MAX_VALUE - row["isDense"].toString().toInt()) / DENSE_MAX_VALUE.toDouble() * DENSE_WEIGHTING + - (FLOAT_MAX_VALUE - row["isFloat"].toString().toInt()) / FLOAT_MAX_VALUE.toDouble() * FLOAT_WEIGHTING + if (isDarkValue > 0) { + (DARK_MAX_VALUE+1 - isDarkValue) / DARK_MAX_VALUE.toDouble() * DARK_WEIGHTING + } else { + 0.0 + } + + if (isDenseValue > 0) { + (DENSE_MAX_VALUE+1 - isDenseValue) / DENSE_MAX_VALUE.toDouble() * DENSE_WEIGHTING + } else { + 0.0 + } + + if (isFloatValue > 0) { + (FLOAT_MAX_VALUE+1 - isFloatValue) / FLOAT_MAX_VALUE.toDouble() * FLOAT_WEIGHTING + } else { + 0.0 + } } } } diff --git a/src/main/java/com/ffii/fpsms/modules/master/web/ProductionScheduleController.kt b/src/main/java/com/ffii/fpsms/modules/master/web/ProductionScheduleController.kt index 424e9ee..49e8fd8 100644 --- a/src/main/java/com/ffii/fpsms/modules/master/web/ProductionScheduleController.kt +++ b/src/main/java/com/ffii/fpsms/modules/master/web/ProductionScheduleController.kt @@ -27,7 +27,8 @@ class ProductionScheduleController( @RequestMapping(value = ["/testDetailSchedule"], method = [RequestMethod.GET]) fun generateDetailSchedule(request: HttpServletRequest?): Int { try { - productionScheduleService.generateDetailedScheduleByDay(1, LocalDateTime.of(2025,6,18,0,0,0)) + //TODO: update this to receive selectedDate and assignDate from api + productionScheduleService.generateDetailedScheduleByDay(1, LocalDateTime.of(2025,6,19,0,0,0)) return 200 } catch (e: Exception) { throw RuntimeException("Error generate schedule: ${e.message}", e)