Explorar el Código

UPDATE

production_process
MSI\derek hace 2 meses
padre
commit
b14abff3b5
Se han modificado 5 ficheros con 19 adiciones y 9 borrados
  1. +1
    -1
      src/main/java/com/ffii/fpsms/modules/master/entity/ItemUomRespository.kt
  2. +2
    -2
      src/main/java/com/ffii/fpsms/modules/stock/entity/InventoryLotLine.kt
  3. +8
    -6
      src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt
  4. +4
    -0
      src/main/resources/db/changelog/changes/20250617_01_derek/01_update_lot_line_to_sales_unit.sql
  5. +4
    -0
      src/main/resources/db/changelog/changes/20250617_01_derek/02_update_salesUnit_to_stockUnit.sql

+ 1
- 1
src/main/java/com/ffii/fpsms/modules/master/entity/ItemUomRespository.kt Ver fichero

@@ -20,5 +20,5 @@ interface ItemUomRespository : AbstractRepository<ItemUom, Long> {
fun findByItemIdAndSalesUnitIsTrueAndDeletedIsFalse(itemId: Serializable): ItemUom?

fun findByItemM18IdAndPurchaseUnitIsTrueAndDeletedIsFalse(itemM18Id: Long): ItemUom?
fun findBaseUnitByItemIdAndBaseUnitIsTrueAndDeletedIsFalse(itemId: Long): ItemUom?
fun findBaseUnitByItemIdAndStockUnitIsTrueAndDeletedIsFalse(itemId: Long): ItemUom?
}

+ 2
- 2
src/main/java/com/ffii/fpsms/modules/stock/entity/InventoryLotLine.kt Ver fichero

@@ -34,8 +34,8 @@ open class InventoryLotLine : BaseEntity<Long>() {

@NotNull
@ManyToOne
@JoinColumn(name = "baseItemUomId")
open var baseUom: ItemUom? = null
@JoinColumn(name = "stockItemUomId")
open var stockUom: ItemUom? = null

@Column(name = "holdQty")
open var holdQty: BigDecimal? = null


+ 8
- 6
src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt Ver fichero

@@ -130,19 +130,21 @@ open class StockInLineService(
@Transactional
fun saveInventoryLotLineWhenStockIn(request: SaveStockInLineRequest, stockInLine: StockInLine): InventoryLotLine {
val inventoryLotLine = InventoryLotLine()
println(request.warehouseId!!)
val warehouse = warehouseRepository.findById(request.warehouseId!!).orElseThrow()
val baseItemUom = itemUomRespository.findBaseUnitByItemIdAndBaseUnitIsTrueAndDeletedIsFalse(
val stockItemUom = itemUomRespository.findBaseUnitByItemIdAndStockUnitIsTrueAndDeletedIsFalse(
itemId = request.itemId
)
println(stockInLine.purchaseOrderLine!!.uom!!.id!!)
println(request.itemId)
val convertedBaseQty = if (stockItemUom != null) {
request.acceptedQty * stockItemUom.ratioN!! / stockItemUom.ratioD!!
} else {
request.acceptedQty
}
inventoryLotLine.apply {
this.inventoryLot = stockInLine.inventoryLot
this.warehouse = warehouse
this.inQty = request.acceptedQty
this.inQty = convertedBaseQty
this.status = "available"
this.baseUom = baseItemUom
this.stockUom = stockItemUom
}
val savedInventoryLotLine = inventoryLotLineRepository.saveAndFlush(inventoryLotLine)
return savedInventoryLotLine


+ 4
- 0
src/main/resources/db/changelog/changes/20250617_01_derek/01_update_lot_line_to_sales_unit.sql Ver fichero

@@ -0,0 +1,4 @@
-- liquibase formatted sql
-- changeset derek:update_lot_line_to_sales_unit
ALTER TABLE `inventory_lot_line`
CHANGE COLUMN `baseItemUomId` `salesItemUomId` INT(11) NOT NULL;

+ 4
- 0
src/main/resources/db/changelog/changes/20250617_01_derek/02_update_salesUnit_to_stockUnit.sql Ver fichero

@@ -0,0 +1,4 @@
-- liquibase formatted sql
-- changeset derek:update_salesUnit_to_stockUnit
ALTER TABLE `inventory_lot_line`
CHANGE COLUMN `salesItemUomId` `stockItemUomId` INT(11) NOT NULL;

Cargando…
Cancelar
Guardar