@@ -18,4 +18,5 @@ interface ItemUomRespository : AbstractRepository<ItemUom, Long> { | |||||
fun findByItemIdAndPurchaseUnitIsTrueAndDeletedIsFalse(itemId: Serializable): ItemUom? | fun findByItemIdAndPurchaseUnitIsTrueAndDeletedIsFalse(itemId: Serializable): ItemUom? | ||||
fun findByItemM18IdAndPurchaseUnitIsTrueAndDeletedIsFalse(itemM18Id: Long): ItemUom? | fun findByItemM18IdAndPurchaseUnitIsTrueAndDeletedIsFalse(itemM18Id: Long): ItemUom? | ||||
fun findBaseUnitByItemIdAndBaseUnitIsTrueAndDeletedIsFalse(itemId: Long): ItemUom? | |||||
} | } |
@@ -100,7 +100,7 @@ open class BomService( | |||||
return savedBom | return savedBom | ||||
} | } | ||||
fun saveBomMaterial(req: ImportBomMatRequest): BomMaterial { | |||||
private fun saveBomMaterial(req: ImportBomMatRequest): BomMaterial { | |||||
// val uom = uomConversionRepository.findByCodeAndDeletedFalse() | // val uom = uomConversionRepository.findByCodeAndDeletedFalse() | ||||
val bomMaterial = BomMaterial().apply { | val bomMaterial = BomMaterial().apply { | ||||
this.item = req.item | this.item = req.item | ||||
@@ -116,7 +116,7 @@ open class BomService( | |||||
} | } | ||||
return bomMaterialRepository.saveAndFlush(bomMaterial) | return bomMaterialRepository.saveAndFlush(bomMaterial) | ||||
} | } | ||||
fun saveBomProcess(req: ImportBomProcessRequest): BomProcess { | |||||
private fun saveBomProcess(req: ImportBomProcessRequest): BomProcess { | |||||
val bomProcess = BomProcess().apply { | val bomProcess = BomProcess().apply { | ||||
this.process = req.process | this.process = req.process | ||||
this.equipment = req.equipment | this.equipment = req.equipment | ||||
@@ -155,10 +155,11 @@ open class BomService( | |||||
var bomMatRequest = ImportBomMatRequest( | var bomMatRequest = ImportBomMatRequest( | ||||
bom = bom | bom = bom | ||||
) | ) | ||||
println("starting new loop") | |||||
while (startRowIndex != endRowIndex || startColumnIndex != endColumnIndex) { | while (startRowIndex != endRowIndex || startColumnIndex != endColumnIndex) { | ||||
val tempRow = sheet.getRow(startRowIndex) | val tempRow = sheet.getRow(startRowIndex) | ||||
val tempCell = tempRow.getCell(startColumnIndex) | val tempCell = tempRow.getCell(startColumnIndex) | ||||
if (tempCell == null || tempCell.cellType == CellType.BLANK) { | |||||
if (startColumnIndex == 0 && (tempCell == null || tempCell.cellType == CellType.BLANK)) { | |||||
break | break | ||||
} else { | } else { | ||||
try { | try { | ||||
@@ -185,6 +186,8 @@ open class BomService( | |||||
bomMatRequest.salesUnit = salesUnit | bomMatRequest.salesUnit = salesUnit | ||||
} | } | ||||
10 -> { | 10 -> { | ||||
println("seqNo: ${tempCell.numericCellValue.toInt()}") | |||||
println("bomId: ${bom.id!!}") | |||||
val bomProcess = bomProcessRepository.findBySeqNoAndBomIdAndDeletedIsFalse( | val bomProcess = bomProcessRepository.findBySeqNoAndBomIdAndDeletedIsFalse( | ||||
seqNo = tempCell.numericCellValue.toInt(), | seqNo = tempCell.numericCellValue.toInt(), | ||||
bomId = bom.id!! | bomId = bom.id!! | ||||
@@ -192,11 +195,19 @@ open class BomService( | |||||
bomProcessMatRequest.bomProcess = bomProcess | bomProcessMatRequest.bomProcess = bomProcess | ||||
} | } | ||||
} | } | ||||
println("startRowIndex: $startRowIndex") | |||||
println("endRowIndex: $endRowIndex") | |||||
println("first condition: ${startColumnIndex < endColumnIndex}") | |||||
println("second condition: ${startRowIndex < endRowIndex}") | |||||
if (startColumnIndex < endColumnIndex) { | if (startColumnIndex < endColumnIndex) { | ||||
startColumnIndex++ | startColumnIndex++ | ||||
} else if (startRowIndex < endRowIndex) { | } else if (startRowIndex < endRowIndex) { | ||||
startRowIndex++ | startRowIndex++ | ||||
// do save | // do save | ||||
println("req:") | |||||
println(bomMatRequest) | |||||
val bomMaterial = saveBomMaterial(bomMatRequest) | val bomMaterial = saveBomMaterial(bomMatRequest) | ||||
bomProcessMatRequest.bomMaterial = bomMaterial | bomProcessMatRequest.bomMaterial = bomMaterial | ||||
val bomProcessMaterial = saveBomProcessMaterial(bomProcessMatRequest) | val bomProcessMaterial = saveBomProcessMaterial(bomProcessMatRequest) | ||||
@@ -205,6 +216,7 @@ open class BomService( | |||||
bomMatRequest = ImportBomMatRequest( | bomMatRequest = ImportBomMatRequest( | ||||
bom = bom | bom = bom | ||||
) | ) | ||||
println("saved: $bomMatRequest") | |||||
} | } | ||||
} catch(e: Error) { | } catch(e: Error) { | ||||
println("DEBUG ERROR:") | println("DEBUG ERROR:") | ||||
@@ -307,13 +319,17 @@ open class BomService( | |||||
} | } | ||||
private fun extractDurationStringToMinutes(str: String): Int { | private fun extractDurationStringToMinutes(str: String): Int { | ||||
val regex = """(\d+)(\D+)""".toRegex() | |||||
val regex = """(\d+)(\D+)(\d+)(\D+)""".toRegex() | |||||
val matchResult = regex.find(str) | val matchResult = regex.find(str) | ||||
// fun returnMultiplier(unit: String): { | |||||
// | |||||
// } | |||||
val (number, unit) = matchResult?.let { | val (number, unit) = matchResult?.let { | ||||
val number = it.groupValues[1].toInt() | |||||
val unit = it.groupValues[2] | |||||
Pair(number, unit) | |||||
val num1 = it.groupValues[1].toInt() | |||||
val unit1 = it.groupValues[2] | |||||
// val num2 = it.groupValues[3].toInt() | |||||
// val unit2 = it.groupValues[4] | |||||
Pair(num1, unit1) | |||||
}!! | }!! | ||||
var multiplier = 1 | var multiplier = 1 | ||||
when { | when { | ||||
@@ -336,7 +352,7 @@ open class BomService( | |||||
val tempCell = tempRow.getCell(startColumnIndex) | val tempCell = tempRow.getCell(startColumnIndex) | ||||
if (tempCell != null && tempCell.cellType == CellType.STRING && tempCell.stringCellValue.trim() == "工序") { | if (tempCell != null && tempCell.cellType == CellType.STRING && tempCell.stringCellValue.trim() == "工序") { | ||||
startRowIndex += 2 // skip column header | startRowIndex += 2 // skip column header | ||||
println("last: $startRowIndex") | |||||
// println("last: $startRowIndex") | |||||
break | break | ||||
} | } | ||||
startRowIndex++ | startRowIndex++ | ||||
@@ -349,7 +365,7 @@ open class BomService( | |||||
val tempCell = tempRow.getCell(startColumnIndex) | val tempCell = tempRow.getCell(startColumnIndex) | ||||
val checkCell = tempRow.getCell(0) | val checkCell = tempRow.getCell(0) | ||||
if (startColumnIndex == 0 && (tempCell == null || tempCell.cellType == CellType.BLANK)) { | if (startColumnIndex == 0 && (tempCell == null || tempCell.cellType == CellType.BLANK)) { | ||||
println("hi") | |||||
// println("hi") | |||||
break | break | ||||
} else { | } else { | ||||
println(tempCell.cellType) | println(tempCell.cellType) | ||||
@@ -357,16 +373,16 @@ open class BomService( | |||||
try { | try { | ||||
when (startColumnIndex) { | when (startColumnIndex) { | ||||
0 -> { | 0 -> { | ||||
println("startRowIndex: $startRowIndex") | |||||
// println("startRowIndex: $startRowIndex") | |||||
bomProcessRequest.seqNo = tempCell.numericCellValue.toLong() | bomProcessRequest.seqNo = tempCell.numericCellValue.toLong() | ||||
println("seqNo: ${tempCell.numericCellValue.toLong()}") | |||||
println("bomProcessRequest: $bomProcessRequest") | |||||
// println("seqNo: ${tempCell.numericCellValue.toLong()}") | |||||
// println("bomProcessRequest: $bomProcessRequest") | |||||
} | } | ||||
1 -> { | 1 -> { | ||||
val equipmentName = tempCell.stringCellValue.trim() | val equipmentName = tempCell.stringCellValue.trim() | ||||
if (equipmentName != "不適用") { | if (equipmentName != "不適用") { | ||||
val equipment = bomGetOrCreateEquipment(equipmentName) | val equipment = bomGetOrCreateEquipment(equipmentName) | ||||
println("equipment created") | |||||
// println("equipment created") | |||||
bomProcessRequest.equipment = equipment | bomProcessRequest.equipment = equipment | ||||
} | } | ||||
} | } | ||||
@@ -374,7 +390,7 @@ open class BomService( | |||||
val processName = tempCell.stringCellValue.trim() | val processName = tempCell.stringCellValue.trim() | ||||
val process = bomGetOrCreateProcess(processName) | val process = bomGetOrCreateProcess(processName) | ||||
bomProcessRequest.process = process | bomProcessRequest.process = process | ||||
println("process created") | |||||
// println("process created") | |||||
} | } | ||||
3 -> { | 3 -> { | ||||
val description = tempCell.stringCellValue.trim() | val description = tempCell.stringCellValue.trim() | ||||
@@ -420,18 +436,18 @@ open class BomService( | |||||
} | } | ||||
} | } | ||||
} | } | ||||
println("req:") | |||||
println(bomProcessRequest) | |||||
// println("req:") | |||||
// println(bomProcessRequest) | |||||
// moving the loop | // moving the loop | ||||
if (startColumnIndex < endColumnIndex) { | if (startColumnIndex < endColumnIndex) { | ||||
println("case1") | |||||
// println("case1") | |||||
startColumnIndex++ | startColumnIndex++ | ||||
println("next col startColumnIndex: $startColumnIndex") | |||||
// println("next col startColumnIndex: $startColumnIndex") | |||||
} else if (startRowIndex < endRowIndex) { | } else if (startRowIndex < endRowIndex) { | ||||
println("case2") | |||||
// println("case2") | |||||
// when doesn't meet first condition, falls to this and go new row | // when doesn't meet first condition, falls to this and go new row | ||||
startRowIndex++ | startRowIndex++ | ||||
println("next row startRowIndex: $startRowIndex") | |||||
// println("next row startRowIndex: $startRowIndex") | |||||
// do save | // do save | ||||
saveBomProcess(bomProcessRequest) | saveBomProcess(bomProcessRequest) | ||||
// clean up | // clean up | ||||
@@ -2,16 +2,21 @@ package com.ffii.fpsms.modules.purchaseOrder.entity | |||||
import com.ffii.core.support.AbstractRepository | import com.ffii.core.support.AbstractRepository | ||||
import com.ffii.fpsms.modules.purchaseOrder.entity.projections.PurchaseOrderInfo | import com.ffii.fpsms.modules.purchaseOrder.entity.projections.PurchaseOrderInfo | ||||
import org.springframework.data.domain.Page | |||||
import org.springframework.stereotype.Repository | import org.springframework.stereotype.Repository | ||||
import java.io.Serializable | import java.io.Serializable | ||||
import java.util.Optional | import java.util.Optional | ||||
import org.springframework.data.domain.Pageable | |||||
@Repository | @Repository | ||||
interface PurchaseOrderRepository : AbstractRepository<PurchaseOrder, Long> { | interface PurchaseOrderRepository : AbstractRepository<PurchaseOrder, Long> { | ||||
fun findTopByM18DataLogIdAndDeletedIsFalseOrderByModifiedDesc(m18datalogId: Serializable): PurchaseOrder? | fun findTopByM18DataLogIdAndDeletedIsFalseOrderByModifiedDesc(m18datalogId: Serializable): PurchaseOrder? | ||||
fun findPurchaseOrderInfoByDeletedIsFalse(): List<PurchaseOrderInfo> | fun findPurchaseOrderInfoByDeletedIsFalse(): List<PurchaseOrderInfo> | ||||
fun findPurchaseOrderInfoByDeletedIsFalse(pageable: Pageable): Page<PurchaseOrderInfo> | |||||
fun findPurchaseOrderInfoByIdAndDeletedIsFalse(id: Long): PurchaseOrderInfo | fun findPurchaseOrderInfoByIdAndDeletedIsFalse(id: Long): PurchaseOrderInfo | ||||
fun findByIdAndDeletedFalse(id: Long): Optional<PurchaseOrder> | fun findByIdAndDeletedFalse(id: Long): Optional<PurchaseOrder> | ||||
override fun findAll(pageable: Pageable): Page<PurchaseOrder> | |||||
} | } |
@@ -1,5 +1,6 @@ | |||||
package com.ffii.fpsms.modules.purchaseOrder.service | package com.ffii.fpsms.modules.purchaseOrder.service | ||||
import com.ffii.core.response.RecordsRes | |||||
import com.ffii.core.support.AbstractBaseEntityService | import com.ffii.core.support.AbstractBaseEntityService | ||||
import com.ffii.core.support.JdbcDao | import com.ffii.core.support.JdbcDao | ||||
import com.ffii.fpsms.m18.entity.M18DataLogRepository | import com.ffii.fpsms.m18.entity.M18DataLogRepository | ||||
@@ -16,12 +17,16 @@ import com.ffii.fpsms.modules.purchaseOrder.entity.projections.PurchaseOrderInfo | |||||
import com.ffii.fpsms.modules.purchaseOrder.enums.PurchaseOrderLineStatus | import com.ffii.fpsms.modules.purchaseOrder.enums.PurchaseOrderLineStatus | ||||
import com.ffii.fpsms.modules.purchaseOrder.enums.PurchaseOrderStatus | import com.ffii.fpsms.modules.purchaseOrder.enums.PurchaseOrderStatus | ||||
import com.ffii.fpsms.modules.purchaseOrder.enums.PurchaseOrderType | import com.ffii.fpsms.modules.purchaseOrder.enums.PurchaseOrderType | ||||
import com.ffii.fpsms.modules.purchaseOrder.web.model.PagingRequest | |||||
import com.ffii.fpsms.modules.purchaseOrder.web.model.SavePurchaseOrderRequest | import com.ffii.fpsms.modules.purchaseOrder.web.model.SavePurchaseOrderRequest | ||||
import com.ffii.fpsms.modules.purchaseOrder.web.model.SavePurchaseOrderResponse | import com.ffii.fpsms.modules.purchaseOrder.web.model.SavePurchaseOrderResponse | ||||
import com.ffii.fpsms.modules.stock.entity.StockInLine | import com.ffii.fpsms.modules.stock.entity.StockInLine | ||||
import com.ffii.fpsms.modules.stock.entity.StockInLineRepository | import com.ffii.fpsms.modules.stock.entity.StockInLineRepository | ||||
import com.ffii.fpsms.modules.stock.entity.StockInRepository | import com.ffii.fpsms.modules.stock.entity.StockInRepository | ||||
import com.ffii.fpsms.modules.stock.web.model.StockInLineStatus | import com.ffii.fpsms.modules.stock.web.model.StockInLineStatus | ||||
import org.springframework.data.domain.Page | |||||
import org.springframework.data.domain.PageRequest | |||||
import org.springframework.data.domain.Pageable | |||||
import org.springframework.stereotype.Service | import org.springframework.stereotype.Service | ||||
import org.springframework.transaction.annotation.Transactional | import org.springframework.transaction.annotation.Transactional | ||||
import java.io.IOException | import java.io.IOException | ||||
@@ -42,8 +47,16 @@ open class PurchaseOrderService( | |||||
private val currencyService: CurrencyService, | private val currencyService: CurrencyService, | ||||
private val shopService: ShopService, | private val shopService: ShopService, | ||||
) : AbstractBaseEntityService<PurchaseOrder, Long, PurchaseOrderRepository>(jdbcDao, purchaseOrderRepository) { | ) : AbstractBaseEntityService<PurchaseOrder, Long, PurchaseOrderRepository>(jdbcDao, purchaseOrderRepository) { | ||||
open fun getPoList(): List<PurchaseOrderDataClass> { | |||||
val list = purchaseOrderRepository.findPurchaseOrderInfoByDeletedIsFalse() | |||||
open fun getPoList(request: PagingRequest): RecordsRes<PurchaseOrderDataClass> { | |||||
println(request) | |||||
val totalCount = purchaseOrderRepository.count().toInt() | |||||
val list: List<PurchaseOrderInfo> = if (request.pageNum != null && request.pageSize != null) { | |||||
val pageable = PageRequest.of(request.pageNum!!, request.pageSize!!) | |||||
purchaseOrderRepository.findPurchaseOrderInfoByDeletedIsFalse(pageable).content | |||||
} else { | |||||
purchaseOrderRepository.findPurchaseOrderInfoByDeletedIsFalse() | |||||
} | |||||
val mappedList = list.map { | val mappedList = list.map { | ||||
val escalated = stockInLineRepository.findAllStockInLineInfoByPurchaseOrderIdAndStatusStartsWithAndDeletedFalse( | val escalated = stockInLineRepository.findAllStockInLineInfoByPurchaseOrderIdAndStatusStartsWithAndDeletedFalse( | ||||
purchaseOrderId = it.id, | purchaseOrderId = it.id, | ||||
@@ -60,7 +73,7 @@ open class PurchaseOrderService( | |||||
escalated = escalated.isNotEmpty(), | escalated = escalated.isNotEmpty(), | ||||
) | ) | ||||
} | } | ||||
return mappedList | |||||
return RecordsRes(mappedList, totalCount) | |||||
} | } | ||||
open fun allPurchaseOrder(): List<PurchaseOrder> { | open fun allPurchaseOrder(): List<PurchaseOrder> { | ||||
@@ -1,5 +1,6 @@ | |||||
package com.ffii.fpsms.modules.purchaseOrder.web | package com.ffii.fpsms.modules.purchaseOrder.web | ||||
import com.ffii.core.response.RecordsRes | |||||
import com.ffii.core.support.JdbcDao | import com.ffii.core.support.JdbcDao | ||||
import com.ffii.fpsms.modules.master.entity.Items | import com.ffii.fpsms.modules.master.entity.Items | ||||
import com.ffii.fpsms.modules.master.service.ItemsService | import com.ffii.fpsms.modules.master.service.ItemsService | ||||
@@ -8,6 +9,11 @@ import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrder | |||||
import com.ffii.fpsms.modules.purchaseOrder.entity.projections.PurchaseOrderDataClass | import com.ffii.fpsms.modules.purchaseOrder.entity.projections.PurchaseOrderDataClass | ||||
import com.ffii.fpsms.modules.purchaseOrder.entity.projections.PurchaseOrderInfo | import com.ffii.fpsms.modules.purchaseOrder.entity.projections.PurchaseOrderInfo | ||||
import com.ffii.fpsms.modules.purchaseOrder.service.PurchaseOrderService | import com.ffii.fpsms.modules.purchaseOrder.service.PurchaseOrderService | ||||
import com.ffii.fpsms.modules.purchaseOrder.web.model.PagingRequest | |||||
import com.ffii.fpsms.modules.stock.web.model.SaveStockInLineRequest | |||||
import jakarta.servlet.http.HttpServletRequest | |||||
import org.springframework.data.domain.Page | |||||
import org.springframework.data.domain.PageRequest | |||||
import org.springframework.web.bind.annotation.* | import org.springframework.web.bind.annotation.* | ||||
@RestController | @RestController | ||||
@@ -16,9 +22,12 @@ class PurchaseOrderController( | |||||
private val purchaseOrderService: PurchaseOrderService | private val purchaseOrderService: PurchaseOrderService | ||||
) { | ) { | ||||
@GetMapping("/list") | @GetMapping("/list") | ||||
fun getPoList(): List<PurchaseOrderDataClass> { | |||||
return purchaseOrderService.getPoList() | |||||
fun getPoList(@RequestParam(required = false) pageNum: Int, @RequestParam(required = false) pageSize: Int ): RecordsRes<PurchaseOrderDataClass> { | |||||
println("request") | |||||
val pageRequest = PagingRequest(pageSize = pageSize, pageNum = pageNum,) | |||||
return purchaseOrderService.getPoList(pageRequest) | |||||
} | } | ||||
@GetMapping("/detail/{id}") // purchaseOrderId | @GetMapping("/detail/{id}") // purchaseOrderId | ||||
fun getDetailedPo(@PathVariable id: Long): Map<String, Any> { | fun getDetailedPo(@PathVariable id: Long): Map<String, Any> { | ||||
return purchaseOrderService.getDetailedPo(id) | return purchaseOrderService.getDetailedPo(id) | ||||
@@ -0,0 +1,6 @@ | |||||
package com.ffii.fpsms.modules.purchaseOrder.web.model | |||||
data class PagingRequest( | |||||
var pageNum: Int?, | |||||
var pageSize: Int? | |||||
) |
@@ -1,6 +1,7 @@ | |||||
package com.ffii.fpsms.modules.stock.entity | package com.ffii.fpsms.modules.stock.entity | ||||
import com.ffii.core.entity.BaseEntity | import com.ffii.core.entity.BaseEntity | ||||
import com.ffii.fpsms.modules.master.entity.ItemUom | |||||
import com.ffii.fpsms.modules.master.entity.Warehouse | import com.ffii.fpsms.modules.master.entity.Warehouse | ||||
import jakarta.persistence.Column | import jakarta.persistence.Column | ||||
import jakarta.persistence.Entity | import jakarta.persistence.Entity | ||||
@@ -31,6 +32,11 @@ open class InventoryLotLine : BaseEntity<Long>() { | |||||
@Column(name = "outQty") | @Column(name = "outQty") | ||||
open var outQty: BigDecimal? = null | open var outQty: BigDecimal? = null | ||||
@NotNull | |||||
@ManyToOne | |||||
@JoinColumn(name = "baseItemUomId") | |||||
open var baseUom: ItemUom? = null | |||||
@Column(name = "holdQty") | @Column(name = "holdQty") | ||||
open var holdQty: BigDecimal? = null | open var holdQty: BigDecimal? = null | ||||
@@ -25,6 +25,7 @@ import java.math.BigDecimal | |||||
import java.time.LocalDate | import java.time.LocalDate | ||||
import java.time.LocalDateTime | import java.time.LocalDateTime | ||||
import com.ffii.core.utils.PdfUtils; | import com.ffii.core.utils.PdfUtils; | ||||
import com.ffii.fpsms.modules.master.entity.ItemUomRespository | |||||
import com.ffii.fpsms.modules.master.entity.WarehouseRepository | import com.ffii.fpsms.modules.master.entity.WarehouseRepository | ||||
import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrderRepository | import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrderRepository | ||||
import com.ffii.fpsms.modules.purchaseOrder.enums.PurchaseOrderLineStatus | import com.ffii.fpsms.modules.purchaseOrder.enums.PurchaseOrderLineStatus | ||||
@@ -53,6 +54,7 @@ open class StockInLineService( | |||||
private val inventoryLotLineRepository: InventoryLotLineRepository, | private val inventoryLotLineRepository: InventoryLotLineRepository, | ||||
private val itemRepository: ItemsRepository, | private val itemRepository: ItemsRepository, | ||||
private val warehouseRepository: WarehouseRepository, | private val warehouseRepository: WarehouseRepository, | ||||
private val itemUomRespository: ItemUomRespository, | |||||
): AbstractBaseEntityService<StockInLine, Long, StockInLineRepository>(jdbcDao, stockInLineRepository) { | ): AbstractBaseEntityService<StockInLine, Long, StockInLineRepository>(jdbcDao, stockInLineRepository) { | ||||
open fun getStockInLineInfo(stockInLineId: Long): StockInLineInfo { | open fun getStockInLineInfo(stockInLineId: Long): StockInLineInfo { | ||||
@@ -130,11 +132,17 @@ open class StockInLineService( | |||||
val inventoryLotLine = InventoryLotLine() | val inventoryLotLine = InventoryLotLine() | ||||
println(request.warehouseId!!) | println(request.warehouseId!!) | ||||
val warehouse = warehouseRepository.findById(request.warehouseId!!).orElseThrow() | val warehouse = warehouseRepository.findById(request.warehouseId!!).orElseThrow() | ||||
val baseItemUom = itemUomRespository.findBaseUnitByItemIdAndBaseUnitIsTrueAndDeletedIsFalse( | |||||
itemId = request.itemId | |||||
) | |||||
println(stockInLine.purchaseOrderLine!!.uom!!.id!!) | |||||
println(request.itemId) | |||||
inventoryLotLine.apply { | inventoryLotLine.apply { | ||||
this.inventoryLot = stockInLine.inventoryLot | this.inventoryLot = stockInLine.inventoryLot | ||||
this.warehouse = warehouse | this.warehouse = warehouse | ||||
this.inQty = request.acceptedQty | this.inQty = request.acceptedQty | ||||
this.status = "available" | this.status = "available" | ||||
this.baseUom = baseItemUom | |||||
} | } | ||||
val savedInventoryLotLine = inventoryLotLineRepository.saveAndFlush(inventoryLotLine) | val savedInventoryLotLine = inventoryLotLineRepository.saveAndFlush(inventoryLotLine) | ||||
return savedInventoryLotLine | return savedInventoryLotLine | ||||
@@ -0,0 +1,4 @@ | |||||
-- liquibase formatted sql | |||||
-- changeset derek:update_inventory_lot_line_uom_id | |||||
ALTER TABLE `inventory_lot_line` | |||||
ADD COLUMN `baseItemUomId` INT(11) NOT NULL |