瀏覽代碼

update escalation log

master
kelvinsuen 3 月之前
父節點
當前提交
bee502b0f3
共有 2 個檔案被更改,包括 16 行新增4 行删除
  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 查看文件

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


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


+ 14
- 4
src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt 查看文件

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


var qcTotal = 0; var qcTotal = 0;
var qcFailed = 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 escLogList = stockInLine.id?.let { escalationLogRepository.findAllByDeletedFalseAndStockInLineIdIn(listOf(it)); }
val latestLog = escLogList?.maxBy { it.id!! }; 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); escalationLogService.save(latestLog);


val qcRes = qcResultRepository.findQcResultInfoByStockInLineIdAndDeletedFalse(stockInLine.id!!); val qcRes = qcResultRepository.findQcResultInfoByStockInLineIdAndDeletedFalse(stockInLine.id!!);
@@ -251,6 +254,13 @@ open class StockInLineService(
val res = escalationLogService.saveEscalationLog(escReq) val res = escalationLogService.saveEscalationLog(escReq)
return res.id?.let { escalationLogRepository.findById(it).orElseThrow() }; 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 return null
} }
@@ -379,7 +389,7 @@ open class StockInLineService(
var escLogId : Long? = 0L; var escLogId : Long? = 0L;
// Escalation // Escalation
if (request.status == StockInLineStatus.ESCALATED.status) { if (request.status == StockInLineStatus.ESCALATED.status) {
//
saveEscalationLogWhenStockIn(request, stockInLine)?.id;
} }
// QC // QC
if (request.qcAccept == true) { if (request.qcAccept == true) {


Loading…
取消
儲存