|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.ffii.fpsms.modules.stock.service |
|
|
|
|
|
|
|
import com.ffii.core.exception.BadRequestException |
|
|
|
import com.ffii.core.support.AbstractBaseEntityService |
|
|
|
import com.ffii.core.support.JdbcDao |
|
|
|
import com.ffii.core.utils.QrCodeUtil |
|
|
@@ -74,7 +75,7 @@ open class StockInLineService( |
|
|
|
purchaseOrderLine.apply { |
|
|
|
status = PurchaseOrderLineStatus.RECEIVING |
|
|
|
} |
|
|
|
polRepository.saveAndFlush(purchaseOrderLine) |
|
|
|
val pol = polRepository.saveAndFlush(purchaseOrderLine) |
|
|
|
if (stockIn == null) { |
|
|
|
stockIn = stockInService.create(SaveStockInRequest(purchaseOrderId = request.purchaseOrderId)).entity as StockIn |
|
|
|
// update po status to receiving |
|
|
@@ -84,6 +85,10 @@ open class StockInLineService( |
|
|
|
} |
|
|
|
purchaseOrderRepository.save(po) |
|
|
|
} |
|
|
|
val allStockInLine = stockInLineRepository.findAllStockInLineInfoByStockInIdAndDeletedFalse(stockIn.id!!) |
|
|
|
if (pol.qty!! < request.acceptedQty) { |
|
|
|
throw BadRequestException() |
|
|
|
} |
|
|
|
stockInLine.apply { |
|
|
|
this.item = item |
|
|
|
itemNo = item.code |
|
|
@@ -116,7 +121,7 @@ open class StockInLineService( |
|
|
|
"itemId" to stockInLine.item!!.id |
|
|
|
) |
|
|
|
val inventoryCount = jdbcDao.queryForInt(INVENTORY_COUNT.toString(), args) |
|
|
|
val newLotNo = CodeGenerator.generateCode(prefix = "POLOT", itemId = stockInLine.item!!.id!!, count = inventoryCount) |
|
|
|
val newLotNo = CodeGenerator.generateCode(prefix = "MPO", itemId = stockInLine.item!!.id!!, count = inventoryCount) |
|
|
|
inventoryLot.apply { |
|
|
|
this.item = stockInLine.item |
|
|
|
this.stockInLine = stockInLine |
|
|
@@ -247,11 +252,15 @@ open class StockInLineService( |
|
|
|
message = "stock in line id is null", |
|
|
|
errorPosition = null, |
|
|
|
) |
|
|
|
// val allStockInLine = stockInLineRepository.findAllStockInLineInfoByStockInIdAndDeletedFalse(stockInLine!!.stockIn!!.id!!) |
|
|
|
|
|
|
|
if (stockInLine.expiryDate != null && request.expiryDate == null) { |
|
|
|
request.apply { |
|
|
|
expiryDate = stockInLine.expiryDate |
|
|
|
} |
|
|
|
} |
|
|
|
// TODO: check all status to prevent reverting progress due to multiple users access to the same po? |
|
|
|
|
|
|
|
// return list of stock in line, update data grid with the list |
|
|
|
if (request.acceptedQty.compareTo(stockInLine.acceptedQty) == 0) { |
|
|
|
var savedInventoryLot: InventoryLot? = null |
|
|
|