@@ -32,6 +32,11 @@ dependencies { | |||||
implementation group: 'org.springframework.cloud', name: 'spring-cloud-context', version: '4.2.1' | implementation group: 'org.springframework.cloud', name: 'spring-cloud-context', version: '4.2.1' | ||||
implementation("net.sf.jasperreports:jasperreports:7.0.0") { | |||||
exclude group: "com.fasterxml.jackson.dataformat", module: "jackson-dataformat-xml" | |||||
} | |||||
implementation group: 'net.sf.jasperreports', name: 'jasperreports-fonts', version: '7.0.0' | |||||
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' | implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' | ||||
implementation group: 'org.apache.poi', name: 'poi', version: '5.2.3' | implementation group: 'org.apache.poi', name: 'poi', version: '5.2.3' | ||||
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '5.2.3' | implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '5.2.3' | ||||
@@ -3,6 +3,7 @@ package com.ffii.fpsms.modules.master.entity | |||||
import com.ffii.core.entity.BaseEntity | import com.ffii.core.entity.BaseEntity | ||||
import jakarta.persistence.* | import jakarta.persistence.* | ||||
import jakarta.validation.constraints.NotNull | import jakarta.validation.constraints.NotNull | ||||
import java.math.BigDecimal | |||||
@Entity | @Entity | ||||
@Table(name = "qc_check") | @Table(name = "qc_check") | ||||
@@ -1,10 +1,14 @@ | |||||
package com.ffii.fpsms.modules.master.entity | package com.ffii.fpsms.modules.master.entity | ||||
import com.ffii.core.support.AbstractRepository | import com.ffii.core.support.AbstractRepository | ||||
import com.ffii.fpsms.modules.master.entity.projections.QcCheckInfo | |||||
import org.springframework.stereotype.Repository | import org.springframework.stereotype.Repository | ||||
@Repository | @Repository | ||||
interface QcCheckRepository: AbstractRepository<QcCheck, Long> { | interface QcCheckRepository: AbstractRepository<QcCheck, Long> { | ||||
fun findAllByDeletedIsFalse(): List<QcCheck> | fun findAllByDeletedIsFalse(): List<QcCheck> | ||||
fun findAllByItemIdAndDeletedFalse(itemId: Long): List<QcCheck> | fun findAllByItemIdAndDeletedFalse(itemId: Long): List<QcCheck> | ||||
fun findAllQcCheckInfoByDeletedFalse(): List<QcCheckInfo> | |||||
fun findAllQcCheckInfoByItemIdAndDeletedFalse(itemId: Long): List<QcCheckInfo> | |||||
} | } |
@@ -11,17 +11,14 @@ import java.math.BigDecimal | |||||
@Entity | @Entity | ||||
@Table(name = "warehouse") | @Table(name = "warehouse") | ||||
open class Warehouse : BaseEntity<Long>() { | open class Warehouse : BaseEntity<Long>() { | ||||
@Size(max = 30) | |||||
@NotNull | @NotNull | ||||
@Column(name = "code", nullable = false, length = 30) | @Column(name = "code", nullable = false, length = 30) | ||||
open var code: String? = null | open var code: String? = null | ||||
@Size(max = 30) | |||||
@NotNull | @NotNull | ||||
@Column(name = "name", nullable = false, length = 30) | @Column(name = "name", nullable = false, length = 30) | ||||
open var name: String? = null | open var name: String? = null | ||||
@Size(max = 30) | |||||
@NotNull | @NotNull | ||||
@Column(name = "description", nullable = false, length = 30) | @Column(name = "description", nullable = false, length = 30) | ||||
open var description: String? = null | open var description: String? = null | ||||
@@ -0,0 +1,18 @@ | |||||
package com.ffii.fpsms.modules.master.entity.projections | |||||
import org.springframework.beans.factory.annotation.Value | |||||
import java.math.BigDecimal | |||||
interface QcCheckInfo { | |||||
val id: Long | |||||
@get:Value("#{target.qcItem?.code}") | |||||
val code: String | |||||
@get:Value("#{target.qcItem?.name}") | |||||
val name: String | |||||
@get:Value("#{target.item?.id}") | |||||
val itemId: Long | |||||
// val isRange: Boolean // bug jor | |||||
val systemInput: Boolean | |||||
val lowerLimit: Double? | |||||
val upperLimit: Double? | |||||
} |
@@ -69,7 +69,7 @@ open class ItemsService( | |||||
code = it.code!!, | code = it.code!!, | ||||
description = it.description!!, | description = it.description!!, | ||||
instruction = check?.description, | instruction = check?.description, | ||||
lowerLimit = check?.lowerLimit, | |||||
lowerLimit = check?.lowerLimit , | |||||
upperLimit = check?.upperLimit, | upperLimit = check?.upperLimit, | ||||
isActive = check != null | isActive = check != null | ||||
) // Create combined item | ) // Create combined item | ||||
@@ -4,8 +4,8 @@ import com.ffii.core.support.AbstractBaseEntityService | |||||
import com.ffii.core.support.JdbcDao | import com.ffii.core.support.JdbcDao | ||||
import com.ffii.fpsms.modules.master.entity.* | import com.ffii.fpsms.modules.master.entity.* | ||||
import com.ffii.fpsms.modules.master.web.models.MessageResponse | import com.ffii.fpsms.modules.master.web.models.MessageResponse | ||||
import com.ffii.fpsms.modules.master.web.models.NewItemRequest | |||||
import com.ffii.fpsms.modules.master.web.models.NewQcCheckRequest | import com.ffii.fpsms.modules.master.web.models.NewQcCheckRequest | ||||
import com.ffii.fpsms.modules.master.entity.projections.QcCheckInfo | |||||
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 | ||||
@@ -17,6 +17,12 @@ open class QcCheckService( | |||||
private val qcCheckRepository: QcCheckRepository, | private val qcCheckRepository: QcCheckRepository, | ||||
private val qcItemRepository: QcItemRepository, | private val qcItemRepository: QcItemRepository, | ||||
): AbstractBaseEntityService<QcCheck, Long, QcCheckRepository>(jdbcDao, qcCheckRepository) { | ): AbstractBaseEntityService<QcCheck, Long, QcCheckRepository>(jdbcDao, qcCheckRepository) { | ||||
open fun getAllQcCheckInfo(): List<QcCheckInfo> { | |||||
return qcCheckRepository.findAllQcCheckInfoByDeletedFalse() | |||||
} | |||||
open fun getAllQcCheckInfoById(itemId: Long): List<QcCheckInfo> { | |||||
return qcCheckRepository.findAllQcCheckInfoByItemIdAndDeletedFalse(itemId) | |||||
} | |||||
@Throws(IOException::class) | @Throws(IOException::class) | ||||
@Transactional | @Transactional | ||||
@@ -0,0 +1,26 @@ | |||||
package com.ffii.fpsms.modules.master.service | |||||
import com.ffii.core.support.AbstractBaseEntityService | |||||
import com.ffii.core.support.JdbcDao | |||||
import com.ffii.fpsms.modules.master.entity.ItemsRepository | |||||
import com.ffii.fpsms.modules.master.entity.Warehouse | |||||
import com.ffii.fpsms.modules.master.entity.WarehouseRepository | |||||
import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrderLineRepository | |||||
import com.ffii.fpsms.modules.stock.entity.InventoryLotRepository | |||||
import com.ffii.fpsms.modules.stock.entity.StockInLine | |||||
import com.ffii.fpsms.modules.stock.entity.StockInLineRepository | |||||
import com.ffii.fpsms.modules.stock.entity.StockInRepository | |||||
import com.ffii.fpsms.modules.stock.service.InventoryLotService | |||||
import com.ffii.fpsms.modules.stock.service.StockInService | |||||
import org.springframework.stereotype.Service | |||||
@Service | |||||
open class WarehouseService( | |||||
private val jdbcDao: JdbcDao, | |||||
private val warehouseRepository: WarehouseRepository, | |||||
): AbstractBaseEntityService<Warehouse, Long, WarehouseRepository>(jdbcDao, warehouseRepository) { | |||||
open fun getWarehouses(): List<Warehouse> { | |||||
return warehouseRepository.findAll().filter { it.deleted == false } | |||||
} | |||||
} |
@@ -1,14 +1,14 @@ | |||||
package com.ffii.fpsms.modules.master.web | package com.ffii.fpsms.modules.master.web | ||||
import com.ffii.core.utils.CriteriaArgsBuilder | |||||
import com.ffii.fpsms.modules.master.entity.projections.QcCheckInfo | |||||
import com.ffii.fpsms.modules.master.service.QcCheckService | import com.ffii.fpsms.modules.master.service.QcCheckService | ||||
import com.ffii.fpsms.modules.master.web.models.MessageResponse | import com.ffii.fpsms.modules.master.web.models.MessageResponse | ||||
import com.ffii.fpsms.modules.master.web.models.NewItemRequest | import com.ffii.fpsms.modules.master.web.models.NewItemRequest | ||||
import com.ffii.fpsms.modules.master.web.models.NewQcCheckRequest | import com.ffii.fpsms.modules.master.web.models.NewQcCheckRequest | ||||
import jakarta.servlet.http.HttpServletRequest | |||||
import jakarta.validation.Valid | import jakarta.validation.Valid | ||||
import org.springframework.web.bind.annotation.PostMapping | |||||
import org.springframework.web.bind.annotation.RequestBody | |||||
import org.springframework.web.bind.annotation.RequestMapping | |||||
import org.springframework.web.bind.annotation.RestController | |||||
import org.springframework.web.bind.annotation.* | |||||
@RestController | @RestController | ||||
@RequestMapping("/qcCheck") | @RequestMapping("/qcCheck") | ||||
@@ -19,4 +19,13 @@ class QcCheckController( | |||||
fun saveItem(@Valid @RequestBody newQcs: List<NewQcCheckRequest>): MessageResponse { | fun saveItem(@Valid @RequestBody newQcs: List<NewQcCheckRequest>): MessageResponse { | ||||
return qcCheckService.saveQcChecks(newQcs) | return qcCheckService.saveQcChecks(newQcs) | ||||
} | } | ||||
@GetMapping | |||||
fun allQcCheckInfo(): List<QcCheckInfo> { | |||||
return qcCheckService.getAllQcCheckInfo() | |||||
} | |||||
@GetMapping("/{itemId}") | |||||
fun allQcCheckInfoByItemId(@PathVariable itemId: Long): List<QcCheckInfo> { | |||||
return qcCheckService.getAllQcCheckInfoById(itemId) | |||||
} | |||||
} | } |
@@ -0,0 +1,18 @@ | |||||
package com.ffii.fpsms.modules.master.web | |||||
import com.ffii.fpsms.modules.master.entity.Warehouse | |||||
import com.ffii.fpsms.modules.master.service.WarehouseService | |||||
import org.springframework.web.bind.annotation.GetMapping | |||||
import org.springframework.web.bind.annotation.RequestMapping | |||||
import org.springframework.web.bind.annotation.RestController | |||||
@RestController | |||||
@RequestMapping("/warehouse") | |||||
class WarehouseController( | |||||
private val warehouseService: WarehouseService | |||||
) { | |||||
@GetMapping | |||||
fun getWarehouses(): List<Warehouse> { | |||||
return warehouseService.getWarehouses() | |||||
} | |||||
} |
@@ -24,6 +24,7 @@ data class PoLineWithStockInLine ( | |||||
val itemNo: String, | val itemNo: String, | ||||
val itemName: String?, | val itemName: String?, | ||||
val qty: BigDecimal, | val qty: BigDecimal, | ||||
val processed: BigDecimal, | |||||
val uom: String? = null, | val uom: String? = null, | ||||
val price: BigDecimal, | val price: BigDecimal, | ||||
val status: String, | val status: String, | ||||
@@ -16,6 +16,7 @@ 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 org.springframework.stereotype.Service | import org.springframework.stereotype.Service | ||||
import java.util.HashMap | import java.util.HashMap | ||||
import java.util.Objects | import java.util.Objects | ||||
@@ -56,6 +57,7 @@ open class PurchaseOrderService( | |||||
thisPol.itemNo!!, | thisPol.itemNo!!, | ||||
thisPol.item!!.name, | thisPol.item!!.name, | ||||
thisPol.qty!!, | thisPol.qty!!, | ||||
inLine.filter{ it.status == StockInLineStatus.COMPLETE.status}.sumOf { it.acceptedQty }, | |||||
thisPol.uom!!.code, | thisPol.uom!!.code, | ||||
thisPol.price!!, | thisPol.price!!, | ||||
thisPol.status!!.toString(), | thisPol.status!!.toString(), | ||||
@@ -91,11 +91,17 @@ open class StockInLineService( | |||||
message = "stock in line id is null", | message = "stock in line id is null", | ||||
errorPosition = null, | errorPosition = null, | ||||
) | ) | ||||
if (stockInLine.expiryDate != null && request.expiryDate == null) { | |||||
request.apply { | |||||
expiryDate = stockInLine.expiryDate | |||||
} | |||||
} | |||||
// return list of stock in line, update data grid with the list | // return list of stock in line, update data grid with the list | ||||
if (request.acceptedQty.compareTo(stockInLine.acceptedQty) == 0) { | if (request.acceptedQty.compareTo(stockInLine.acceptedQty) == 0) { | ||||
var savedInventoryLot: InventoryLot? = null | var savedInventoryLot: InventoryLot? = null | ||||
if (request.status == StockInLineStatus.RECEIVED.status) { | if (request.status == StockInLineStatus.RECEIVED.status) { | ||||
if (request.expiryDate == null) { | if (request.expiryDate == null) { | ||||
println("trigger1?") | |||||
return MessageResponse( | return MessageResponse( | ||||
id = null, | id = null, | ||||
code = null, | code = null, | ||||
@@ -107,13 +113,15 @@ open class StockInLineService( | |||||
} | } | ||||
savedInventoryLot = saveInventoryLotWhenStockIn(request = request, stockInLine = stockInLine) | savedInventoryLot = saveInventoryLotWhenStockIn(request = request, stockInLine = stockInLine) | ||||
} | } | ||||
// if (request.status == StockInLineStatus.RECEIVED.status) { | |||||
// } | |||||
stockInLine.apply { | stockInLine.apply { | ||||
// user = null | // user = null | ||||
productionDate = request.productionDate?.atStartOfDay() // maybe need to change the request to LocalDateTime | productionDate = request.productionDate?.atStartOfDay() // maybe need to change the request to LocalDateTime | ||||
productLotNo = request.productLotNo | productLotNo = request.productLotNo | ||||
receiptDate = request.receiptDate?.atStartOfDay() | receiptDate = request.receiptDate?.atStartOfDay() | ||||
status = request.status | status = request.status | ||||
expiryDate = request.expiryDate | |||||
expiryDate = stockInLine.expiryDate ?: request.expiryDate | |||||
lotNo = savedInventoryLot?.lotNo | lotNo = savedInventoryLot?.lotNo | ||||
} | } | ||||
val savedStockInLine = saveAndFlush(stockInLine) | val savedStockInLine = saveAndFlush(stockInLine) | ||||
@@ -173,7 +181,7 @@ open class StockInLineService( | |||||
acceptedQty = request.acceptedQty | acceptedQty = request.acceptedQty | ||||
status = request.status | status = request.status | ||||
lotNo = savedInventoryLot?.lotNo | lotNo = savedInventoryLot?.lotNo | ||||
expiryDate = request.expiryDate | |||||
expiryDate = stockInLine.expiryDate ?: request.expiryDate | |||||
productLotNo = request.productLotNo | productLotNo = request.productLotNo | ||||
} | } | ||||
@@ -34,15 +34,15 @@ data class SaveStockInRequest( | |||||
) | ) | ||||
data class SaveStockInLineRequest( | data class SaveStockInLineRequest( | ||||
val id: Long?, | |||||
val purchaseOrderId: Long, | |||||
val purchaseOrderLineId: Long, | |||||
val itemId: Long, | |||||
val acceptedQty: BigDecimal, | |||||
val acceptedWeight: BigDecimal?, | |||||
val status: String?, | |||||
val expiryDate: LocalDate?, | |||||
val productLotNo: String?, | |||||
val receiptDate: LocalDate?, | |||||
val productionDate: LocalDate?, | |||||
var id: Long?, | |||||
var purchaseOrderId: Long, | |||||
var purchaseOrderLineId: Long, | |||||
var itemId: Long, | |||||
var acceptedQty: BigDecimal, | |||||
var acceptedWeight: BigDecimal?, | |||||
var status: String?, | |||||
var expiryDate: LocalDate?, | |||||
var productLotNo: String?, | |||||
var receiptDate: LocalDate?, | |||||
var productionDate: LocalDate?, | |||||
) | ) |