浏览代码

UPDATE

production_process
MSI\derek 2 个月前
父节点
当前提交
b14abff3b5
共有 5 个文件被更改,包括 19 次插入9 次删除
  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 查看文件

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


fun findByItemM18IdAndPurchaseUnitIsTrueAndDeletedIsFalse(itemM18Id: Long): 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 查看文件

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


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


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


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

@@ -130,19 +130,21 @@ open class StockInLineService(
@Transactional @Transactional
fun saveInventoryLotLineWhenStockIn(request: SaveStockInLineRequest, stockInLine: StockInLine): InventoryLotLine { fun saveInventoryLotLineWhenStockIn(request: SaveStockInLineRequest, stockInLine: StockInLine): InventoryLotLine {
val inventoryLotLine = InventoryLotLine() val inventoryLotLine = InventoryLotLine()
println(request.warehouseId!!)
val warehouse = warehouseRepository.findById(request.warehouseId!!).orElseThrow() val warehouse = warehouseRepository.findById(request.warehouseId!!).orElseThrow()
val baseItemUom = itemUomRespository.findBaseUnitByItemIdAndBaseUnitIsTrueAndDeletedIsFalse(
val stockItemUom = itemUomRespository.findBaseUnitByItemIdAndStockUnitIsTrueAndDeletedIsFalse(
itemId = request.itemId 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 { inventoryLotLine.apply {
this.inventoryLot = stockInLine.inventoryLot this.inventoryLot = stockInLine.inventoryLot
this.warehouse = warehouse this.warehouse = warehouse
this.inQty = request.acceptedQty
this.inQty = convertedBaseQty
this.status = "available" this.status = "available"
this.baseUom = baseItemUom
this.stockUom = stockItemUom
} }
val savedInventoryLotLine = inventoryLotLineRepository.saveAndFlush(inventoryLotLine) val savedInventoryLotLine = inventoryLotLineRepository.saveAndFlush(inventoryLotLine)
return savedInventoryLotLine return savedInventoryLotLine


+ 4
- 0
src/main/resources/db/changelog/changes/20250617_01_derek/01_update_lot_line_to_sales_unit.sql 查看文件

@@ -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 查看文件

@@ -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;

正在加载...
取消
保存