|
|
@@ -14,6 +14,7 @@ import com.ffii.fpsms.modules.qc.entity.QcResultRepository |
|
|
import com.ffii.fpsms.modules.stock.entity.* |
|
|
import com.ffii.fpsms.modules.stock.entity.* |
|
|
import com.ffii.fpsms.modules.stock.sql.StockSql.SQL.INVENTORY_COUNT |
|
|
import com.ffii.fpsms.modules.stock.sql.StockSql.SQL.INVENTORY_COUNT |
|
|
import net.sf.jasperreports.engine.JasperCompileManager |
|
|
import net.sf.jasperreports.engine.JasperCompileManager |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value |
|
|
import org.springframework.context.annotation.Lazy |
|
|
import org.springframework.context.annotation.Lazy |
|
|
import org.springframework.core.io.ClassPathResource |
|
|
import org.springframework.core.io.ClassPathResource |
|
|
import org.springframework.stereotype.Service |
|
|
import org.springframework.stereotype.Service |
|
|
@@ -102,6 +103,8 @@ open class StockInLineService( |
|
|
private val m18GoodsReceiptNoteLogRepository: M18GoodsReceiptNoteLogRepository, |
|
|
private val m18GoodsReceiptNoteLogRepository: M18GoodsReceiptNoteLogRepository, |
|
|
/** Lazy to avoid circular dependency: M18PurchaseOrderService → … → StockInLineService. */ |
|
|
/** Lazy to avoid circular dependency: M18PurchaseOrderService → … → StockInLineService. */ |
|
|
@Lazy private val m18PurchaseOrderService: M18PurchaseOrderService, |
|
|
@Lazy private val m18PurchaseOrderService: M18PurchaseOrderService, |
|
|
|
|
|
/** When false (default), M18 GRN create API is not called — set true in production only. */ |
|
|
|
|
|
@Value("\${scheduler.m18Grn.createEnabled:false}") private val m18GrnCreateEnabled: Boolean, |
|
|
) : AbstractBaseEntityService<StockInLine, Long, StockInLineRepository>(jdbcDao, stockInLineRepository) { |
|
|
) : AbstractBaseEntityService<StockInLine, Long, StockInLineRepository>(jdbcDao, stockInLineRepository) { |
|
|
|
|
|
|
|
|
private val logger = LoggerFactory.getLogger(StockInLineService::class.java) |
|
|
private val logger = LoggerFactory.getLogger(StockInLineService::class.java) |
|
|
@@ -694,6 +697,13 @@ open class StockInLineService( |
|
|
logger.info("[tryUpdatePurchaseOrderAndCreateGrnIfCompleted] Skipping M18 GRN - m18CreatedUId=$m18Created in skip list for PO id=${savedPo.id} code=${savedPo.code}") |
|
|
logger.info("[tryUpdatePurchaseOrderAndCreateGrnIfCompleted] Skipping M18 GRN - m18CreatedUId=$m18Created in skip list for PO id=${savedPo.id} code=${savedPo.code}") |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
if (!m18GrnCreateEnabled) { |
|
|
|
|
|
logger.info( |
|
|
|
|
|
"[tryUpdatePurchaseOrderAndCreateGrnIfCompleted] Skipping M18 GRN API — scheduler.m18Grn.createEnabled=false " + |
|
|
|
|
|
"(enable only in production) PO id=${savedPo.id} code=${savedPo.code}" |
|
|
|
|
|
) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
//temp comment this TODO will only check purchase order + dnNo duplicated |
|
|
//temp comment this TODO will only check purchase order + dnNo duplicated |
|
|
//if (m18GoodsReceiptNoteLogRepository.existsByPurchaseOrderIdAndStatusTrue(savedPo.id!!)) { |
|
|
//if (m18GoodsReceiptNoteLogRepository.existsByPurchaseOrderIdAndStatusTrue(savedPo.id!!)) { |
|
|
// logger.info("[tryUpdatePurchaseOrderAndCreateGrnIfCompleted] Skipping M18 GRN - already created for PO id=${savedPo.id} code=${savedPo.code} (avoids core_201 duplicate)") |
|
|
// logger.info("[tryUpdatePurchaseOrderAndCreateGrnIfCompleted] Skipping M18 GRN - already created for PO id=${savedPo.id} code=${savedPo.code} (avoids core_201 duplicate)") |
|
|
|