[email protected] 2 недель назад
Родитель
Сommit
7bf37b28ce
1 измененных файлов: 14 добавлений и 12 удалений
  1. +14
    -12
      src/main/java/com/ffii/fpsms/modules/master/service/ProductionScheduleService.kt

+ 14
- 12
src/main/java/com/ffii/fpsms/modules/master/service/ProductionScheduleService.kt Просмотреть файл

@@ -627,9 +627,8 @@ open class ProductionScheduleService(
SELECT SELECT
i.outputQty, i.outputQty,
i.avgQtyLastMonth, i.avgQtyLastMonth,
(i.onHandQty -500),
-- (i.onHandQty -500) * 1.0 / i.avgQtyLastMonth as daysLeft, -- (i.onHandQty -500) * 1.0 / i.avgQtyLastMonth as daysLeft,
i.avgQtyLastMonth * 2.6 - stockQty as needQty,
0 as needQty,
i.stockQty, i.stockQty,
-- CASE -- CASE
-- WHEN stockQty * 1.0 / i.avgQtyLastMonth <= 1.9 THEN -- WHEN stockQty * 1.0 / i.avgQtyLastMonth <= 1.9 THEN
@@ -640,7 +639,7 @@ open class ProductionScheduleService(
0 AS needNoOfJobOrder, 0 AS needNoOfJobOrder,
0 AS batchNeed, 0 AS batchNeed,
i.pendingJobQty, i.pendingJobQty,
((i.stockQty * 1.0) + (i.needNoOfJobOrder * i.outputQty) ) / i.avgQtyLastMonth as daysLeft,
((i.stockQty * 1.0) + ifnull(i.pendingJobQty, 0) ) / i.avgQtyLastMonth as daysLeft,


25 + 25 + markDark + markFloat + markDense + markAS + markTimeSequence + markComplexity as priority, 25 + 25 + markDark + markFloat + markDense + markAS + markTimeSequence + markComplexity as priority,
i.* i.*
@@ -784,15 +783,16 @@ open class ProductionScheduleService(
//match id with rough schedule record to create new record //match id with rough schedule record to create new record
val targetRecord = needQtyList.find { it.id == updatedScheduleRecord.id } val targetRecord = needQtyList.find { it.id == updatedScheduleRecord.id }
//??? this should be the bom output Qty * no. of job order needed //??? this should be the bom output Qty * no. of job order needed
val prodDifference = updatedScheduleRecord.outputQty - (targetRecord?.outputQty ?: 0.0)
updatedScheduleRecord.itemPriority = priority;
val prodDifference = 0
updatedScheduleRecord.itemPriority = priority;
detailedScheduleOutputList.add(updatedScheduleRecord)
if (updatedScheduleRecord.batchNeed.toInt() > 0) { if (updatedScheduleRecord.batchNeed.toInt() > 0) {
//have enough quoter for adjustment //have enough quoter for adjustment
machineCap -= prodDifference; machineCap -= prodDifference;
detailedScheduleOutputList.add(updatedScheduleRecord)
accProdCount += updatedScheduleRecord.outputQty
println("[INFO] item " + updatedScheduleRecord.name + " added " + (updatedScheduleRecord.batchNeed.toInt() * updatedScheduleRecord.outputQty));
accProdCount += updatedScheduleRecord.batchNeed.toInt() * updatedScheduleRecord.outputQty
fgCount++ fgCount++
} else { } else {
println("[INFO] item " + updatedScheduleRecord.name + " have bee skipped"); println("[INFO] item " + updatedScheduleRecord.name + " have bee skipped");
@@ -820,7 +820,7 @@ open class ProductionScheduleService(
val isSunday = targetDate.dayOfWeek == DayOfWeek.SUNDAY val isSunday = targetDate.dayOfWeek == DayOfWeek.SUNDAY
val isFriSat = isFri || isSat val isFriSat = isFri || isSat


logger.info("##targetDate:" + targetDate + " isFri:"+ isFri + " isSat:" + isSat + " isSunday:" + isSunday)
println("##targetDate:" + targetDate + " isFri:"+ isFri + " isSat:" + isSat + " isSunday:" + isSunday)




fgCount = 0 fgCount = 0
@@ -828,15 +828,17 @@ open class ProductionScheduleService(
sortedOutputList.forEach { record -> sortedOutputList.forEach { record ->
record.stockQty = record.stockQty + (record.outputQty * record.needNoOfJobOrder.toInt()) - record.avgQtyLastMonth record.stockQty = record.stockQty + (record.outputQty * record.needNoOfJobOrder.toInt()) - record.avgQtyLastMonth


//compare if less than 1.9 days
//compare if less than 1.9 days
record.daysLeft = record.stockQty / record.avgQtyLastMonth record.daysLeft = record.stockQty / record.avgQtyLastMonth

println("name: " + record.name + " stockQty:" + record.stockQty + " avgQtyLastMonth:" + record.avgQtyLastMonth + " daysLeft:" + record.daysLeft)
var safetyStockDay = 2.0 var safetyStockDay = 2.0
var redLine = 1.9 var redLine = 1.9


if(isFriSat){ if(isFriSat){
//record.daysLeft = record.daysLeft //record.daysLeft = record.daysLeft
safetyStockDay = 2.6 safetyStockDay = 2.6
redLine = 3.0
} }


if(record.daysLeft < redLine){ if(record.daysLeft < redLine){
@@ -859,7 +861,7 @@ open class ProductionScheduleService(
record.batchNeed = 0 record.batchNeed = 0
} }


logger.info(record.name + " record.batchNeed: " + record.batchNeed + " record.stockQty:" + record.stockQty + " record.daysLeft:" + record.daysLeft)
println(record.name + " record.batchNeed: " + record.batchNeed + " record.stockQty:" + record.stockQty + " record.daysLeft:" + record.daysLeft)


} }




Загрузка…
Отмена
Сохранить