Browse Source

update escalation log

master
kelvinsuen 3 months ago
parent
commit
bee502b0f3
2 changed files with 16 additions and 4 deletions
  1. +2
    -0
      src/main/java/com/ffii/fpsms/modules/stock/entity/EscalationLogInfo.kt
  2. +14
    -4
      src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt

+ 2
- 0
src/main/java/com/ffii/fpsms/modules/stock/entity/EscalationLogInfo.kt View File

@@ -68,6 +68,8 @@ interface EscalationLogInfo {

// @get:Value("#{target.type}")
// val escalationLevel: String
@get:Value("#{target.createdBy}")
val submitter: String?
val qcTotalCount: Int?;
val qcFailCount: Int?;
val reason: String?;


+ 14
- 4
src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt View File

@@ -223,15 +223,18 @@ open class StockInLineService(
@Throws(IOException::class)
@Transactional
fun saveEscalationLogWhenStockIn(request: SaveStockInLineRequest, stockInLine: StockInLine): EscalationLog? {
if (request.escalationLog != null) {
if (request.escalationLog != null) { // Save Esc log
val escReq = request.escalationLog;

var qcTotal = 0;
var qcFailed = 0;
if (request.qcResult!!.isEmpty()) {
// if (request.qcResult!!.isEmpty()) {
if (request.status == StockInLineStatus.ESCALATED.status) {
val escLogList = stockInLine.id?.let { escalationLogRepository.findAllByDeletedFalseAndStockInLineIdIn(listOf(it)); }
val latestLog = escLogList?.maxBy { it.id!! };
latestLog?.apply { status = EscalationLogStatus.ESCALATED }
latestLog?.apply {
status = if (request.qcAccept == true) EscalationLogStatus.ACCEPTED else EscalationLogStatus.REJECTED
}
escalationLogService.save(latestLog);

val qcRes = qcResultRepository.findQcResultInfoByStockInLineIdAndDeletedFalse(stockInLine.id!!);
@@ -251,6 +254,13 @@ open class StockInLineService(
val res = escalationLogService.saveEscalationLog(escReq)
return res.id?.let { escalationLogRepository.findById(it).orElseThrow() };
};
} else { // Update log status
val escLogList = stockInLine.id?.let { escalationLogRepository.findAllByDeletedFalseAndStockInLineIdIn(listOf(it)); }
val latestLog = escLogList?.maxBy { it.id!! };
latestLog?.apply {
status = if (request.qcAccept == true) EscalationLogStatus.ACCEPTED else EscalationLogStatus.REJECTED
}
escalationLogService.save(latestLog);
}
return null
}
@@ -379,7 +389,7 @@ open class StockInLineService(
var escLogId : Long? = 0L;
// Escalation
if (request.status == StockInLineStatus.ESCALATED.status) {
//
saveEscalationLogWhenStockIn(request, stockInLine)?.id;
}
// QC
if (request.qcAccept == true) {


Loading…
Cancel
Save