@@ -3,6 +3,7 @@ plugins { | |||||
id 'org.springframework.boot' version '3.1.1' | id 'org.springframework.boot' version '3.1.1' | ||||
id 'io.spring.dependency-management' version '1.1.0' | id 'io.spring.dependency-management' version '1.1.0' | ||||
id 'org.jetbrains.kotlin.jvm' | id 'org.jetbrains.kotlin.jvm' | ||||
id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.0' | |||||
} | } | ||||
group = 'com.ffii' | group = 'com.ffii' | ||||
@@ -30,6 +31,9 @@ dependencies { | |||||
implementation 'org.liquibase:liquibase-core' | implementation 'org.liquibase:liquibase-core' | ||||
implementation 'com.google.code.gson:gson:2.8.5' | implementation 'com.google.code.gson:gson:2.8.5' | ||||
// // https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-webmvc-ui | |||||
// implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.8") | |||||
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 group: 'com.google.zxing', name: 'core', version: '3.5.2' | implementation group: 'com.google.zxing', name: 'core', version: '3.5.2' | ||||
@@ -61,9 +65,9 @@ dependencies { | |||||
implementation "org.jetbrains.kotlin:kotlin-reflect" | implementation "org.jetbrains.kotlin:kotlin-reflect" | ||||
implementation("org.springframework.boot:spring-boot-starter-webflux") | implementation("org.springframework.boot:spring-boot-starter-webflux") | ||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0") | |||||
compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '6.0.0' | compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '6.0.0' | ||||
runtimeOnly 'com.mysql:mysql-connector-j' | runtimeOnly 'com.mysql:mysql-connector-j' | ||||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||||
@@ -25,11 +25,6 @@ open class PurchaseOrderLine : BaseEntity<Long>() { | |||||
@Column(name = "itemNo", nullable = false, length = 20) | @Column(name = "itemNo", nullable = false, length = 20) | ||||
open var itemNo: String? = null | open var itemNo: String? = null | ||||
// @NotNull | |||||
// @ManyToOne(fetch = FetchType.LAZY, optional = false) | |||||
// @JoinColumn(name = "uomId", nullable = false) | |||||
// open var uom: UomConversion? = null | |||||
@NotNull | @NotNull | ||||
@ManyToOne | @ManyToOne | ||||
@JoinColumn(name = "purchaseOrderId", nullable = false) | @JoinColumn(name = "purchaseOrderId", nullable = false) | ||||
@@ -51,6 +46,7 @@ open class PurchaseOrderLine : BaseEntity<Long>() { | |||||
@JoinColumn(name = "m18DataLogId", nullable = false) | @JoinColumn(name = "m18DataLogId", nullable = false) | ||||
open var m18DataLog: M18DataLog? = null | open var m18DataLog: M18DataLog? = null | ||||
@NotNull | |||||
@ManyToOne | @ManyToOne | ||||
@JoinColumn(name = "uomId", nullable = false) | @JoinColumn(name = "uomId", nullable = false) | ||||
open var uom: UomConversion? = null | open var uom: UomConversion? = null |
@@ -1,5 +1,6 @@ | |||||
package com.ffii.fpsms.modules.purchaseOrder.entity.projections | package com.ffii.fpsms.modules.purchaseOrder.entity.projections | ||||
import com.ffii.fpsms.modules.master.entity.UomConversion | |||||
import com.ffii.fpsms.modules.stock.entity.StockInLine | import com.ffii.fpsms.modules.stock.entity.StockInLine | ||||
import com.ffii.fpsms.modules.stock.entity.projection.StockInLineInfo | import com.ffii.fpsms.modules.stock.entity.projection.StockInLineInfo | ||||
import org.springframework.beans.factory.annotation.Value | import org.springframework.beans.factory.annotation.Value | ||||
@@ -13,6 +14,8 @@ interface PurchaseOrderLineInfo { | |||||
@get:Value("#{target.items?.name}") | @get:Value("#{target.items?.name}") | ||||
val itemName: String? | val itemName: String? | ||||
val qty: BigDecimal | val qty: BigDecimal | ||||
@get:Value("#{target.uom}") | |||||
val uom: UomConversion | |||||
val price: BigDecimal | val price: BigDecimal | ||||
val status: String | val status: String | ||||
} | } | ||||
@@ -25,7 +28,8 @@ data class PoLineWithStockInLine ( | |||||
val itemName: String?, | val itemName: String?, | ||||
val qty: BigDecimal, | val qty: BigDecimal, | ||||
val processed: BigDecimal, | val processed: BigDecimal, | ||||
val uom: String? = null, | |||||
@get:Value("#{target.uom}") | |||||
val uom: UomConversion, | |||||
val price: BigDecimal, | val price: BigDecimal, | ||||
val status: String, | val status: String, | ||||
@@ -65,7 +65,7 @@ open class PurchaseOrderService( | |||||
thisPol.item!!.name, | thisPol.item!!.name, | ||||
thisPol.qty!!, | thisPol.qty!!, | ||||
inLine.filter{ it.status == StockInLineStatus.COMPLETE.status}.sumOf { it.acceptedQty }, | inLine.filter{ it.status == StockInLineStatus.COMPLETE.status}.sumOf { it.acceptedQty }, | ||||
thisPol.uom!!.code, | |||||
thisPol.uom!!, | |||||
thisPol.price!!, | thisPol.price!!, | ||||
thisPol.status!!.toString(), | thisPol.status!!.toString(), | ||||
inLine | inLine | ||||
@@ -2,9 +2,10 @@ package com.ffii.fpsms.modules.qc.entity | |||||
import com.ffii.core.support.AbstractRepository | import com.ffii.core.support.AbstractRepository | ||||
import com.ffii.fpsms.modules.qc.entity.projection.QcResultInfo | import com.ffii.fpsms.modules.qc.entity.projection.QcResultInfo | ||||
import com.ffii.fpsms.modules.stock.entity.StockInLine | |||||
import org.springframework.stereotype.Repository | import org.springframework.stereotype.Repository | ||||
@Repository | @Repository | ||||
interface QcResultRepository: AbstractRepository<QcResult, Long> { | interface QcResultRepository: AbstractRepository<QcResult, Long> { | ||||
fun findAllQcResultInfoByStockInLineIdAndDeletedFalse(stockInLineId: Long): List<QcResultInfo> | |||||
fun findQcResultInfoByStockInLineIdAndDeletedFalse(stockInLineId: Long): List<QcResultInfo> | |||||
} | } |
@@ -5,12 +5,10 @@ import com.ffii.core.support.JdbcDao | |||||
import com.ffii.fpsms.modules.master.entity.ItemsRepository | import com.ffii.fpsms.modules.master.entity.ItemsRepository | ||||
import com.ffii.fpsms.modules.master.entity.QcItemRepository | import com.ffii.fpsms.modules.master.entity.QcItemRepository | ||||
import com.ffii.fpsms.modules.master.web.models.MessageResponse | import com.ffii.fpsms.modules.master.web.models.MessageResponse | ||||
import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrderLineRepository | |||||
import com.ffii.fpsms.modules.qc.entity.QcResult | import com.ffii.fpsms.modules.qc.entity.QcResult | ||||
import com.ffii.fpsms.modules.qc.entity.QcResultRepository | import com.ffii.fpsms.modules.qc.entity.QcResultRepository | ||||
import com.ffii.fpsms.modules.qc.entity.projection.QcResultInfo | import com.ffii.fpsms.modules.qc.entity.projection.QcResultInfo | ||||
import com.ffii.fpsms.modules.qc.web.model.SaveQcResultRequest | import com.ffii.fpsms.modules.qc.web.model.SaveQcResultRequest | ||||
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.StockOutLIneRepository | import com.ffii.fpsms.modules.stock.entity.StockOutLIneRepository | ||||
import org.springframework.stereotype.Service | import org.springframework.stereotype.Service | ||||
@@ -26,6 +24,7 @@ open class QcResultService( | |||||
private val stockInLineRepository: StockInLineRepository, | private val stockInLineRepository: StockInLineRepository, | ||||
private val stockOutLIneRepository: StockOutLIneRepository, | private val stockOutLIneRepository: StockOutLIneRepository, | ||||
): AbstractBaseEntityService<QcResult, Long, QcResultRepository>(jdbcDao, qcResultRepository) { | ): AbstractBaseEntityService<QcResult, Long, QcResultRepository>(jdbcDao, qcResultRepository) { | ||||
@Throws(IOException::class) | @Throws(IOException::class) | ||||
@Transactional | @Transactional | ||||
open fun createOrUpdate(request: SaveQcResultRequest): MessageResponse { | open fun createOrUpdate(request: SaveQcResultRequest): MessageResponse { | ||||
@@ -55,7 +54,7 @@ open class QcResultService( | |||||
) | ) | ||||
} | } | ||||
fun getAllQcResultInfoByStockInLineId(stockInLineId: Long): List<QcResultInfo> { | |||||
return qcResultRepository.findAllQcResultInfoByStockInLineIdAndDeletedFalse(stockInLineId) | |||||
open fun getAllQcResultInfoByStockInLineId(stockInLineId: Long): List<QcResultInfo> { | |||||
return qcResultRepository.findQcResultInfoByStockInLineIdAndDeletedFalse(stockInLineId) | |||||
} | } | ||||
} | } |
@@ -2,6 +2,7 @@ package com.ffii.fpsms.modules.stock.entity.projection | |||||
import com.ffii.fpsms.modules.master.entity.Items | import com.ffii.fpsms.modules.master.entity.Items | ||||
import com.ffii.fpsms.modules.master.entity.ItemsRepository | import com.ffii.fpsms.modules.master.entity.ItemsRepository | ||||
import com.ffii.fpsms.modules.master.entity.UomConversion | |||||
import org.springframework.beans.factory.annotation.Value | import org.springframework.beans.factory.annotation.Value | ||||
import java.math.BigDecimal | import java.math.BigDecimal | ||||
import java.time.LocalDate | import java.time.LocalDate | ||||
@@ -30,8 +31,8 @@ interface StockInLineInfo { | |||||
var productLotNo: String? | var productLotNo: String? | ||||
@get:Value("#{target.stockIn?.supplier?.name}") | @get:Value("#{target.stockIn?.supplier?.name}") | ||||
val supplier: String? | val supplier: String? | ||||
@get:Value("#{target.purchaseOrderLine?.uom?.code}") | |||||
val uom: String? | |||||
@get:Value("#{target.purchaseOrderLine?.uom}") | |||||
val uom: UomConversion | |||||
@get:Value("#{target.stockIn?.purchaseOrder?.code}") | @get:Value("#{target.stockIn?.purchaseOrder?.code}") | ||||
val poCode: String | val poCode: String | ||||
@get:Value("#{target.item?.type}") | @get:Value("#{target.item?.type}") | ||||
@@ -2,6 +2,7 @@ package com.ffii.fpsms.modules.stock.service | |||||
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.core.utils.JsonUtils | |||||
import com.ffii.core.utils.QrCodeUtil | import com.ffii.core.utils.QrCodeUtil | ||||
import com.ffii.fpsms.modules.common.CodeGenerator | import com.ffii.fpsms.modules.common.CodeGenerator | ||||
import com.ffii.fpsms.modules.master.entity.ItemsRepository | import com.ffii.fpsms.modules.master.entity.ItemsRepository | ||||
@@ -28,7 +29,12 @@ import com.ffii.core.utils.PdfUtils; | |||||
import com.ffii.fpsms.modules.master.entity.WarehouseRepository | import com.ffii.fpsms.modules.master.entity.WarehouseRepository | ||||
import java.io.FileNotFoundException | import java.io.FileNotFoundException | ||||
import java.time.format.DateTimeFormatter | import java.time.format.DateTimeFormatter | ||||
import kotlinx.serialization.Serializable | |||||
import kotlinx.serialization.json.Json | |||||
import kotlinx.serialization.encodeToString | |||||
@Serializable | |||||
data class QrContent(val itemId: Long, val stockInLineId: Long) | |||||
@Service | @Service | ||||
open class StockInLineService( | open class StockInLineService( | ||||
@@ -167,7 +173,6 @@ open class StockInLineService( | |||||
this.expiryDate = stockInLine.expiryDate ?: request.expiryDate | this.expiryDate = stockInLine.expiryDate ?: request.expiryDate | ||||
this.inventoryLot = stockInLine.inventoryLot ?: savedInventoryLot | this.inventoryLot = stockInLine.inventoryLot ?: savedInventoryLot | ||||
this.lotNo = stockInLine.lotNo ?: savedInventoryLot?.lotNo | this.lotNo = stockInLine.lotNo ?: savedInventoryLot?.lotNo | ||||
this.lotNo = savedInventoryLot?.lotNo | |||||
} | } | ||||
val savedStockInLine = saveAndFlush(stockInLine) | val savedStockInLine = saveAndFlush(stockInLine) | ||||
val lineInfo = stockInLineRepository.findStockInLineInfoByIdAndDeletedFalse(savedStockInLine.id!!) | val lineInfo = stockInLineRepository.findStockInLineInfoByIdAndDeletedFalse(savedStockInLine.id!!) | ||||
@@ -258,19 +263,18 @@ open class StockInLineService( | |||||
val poLabel = JasperCompileManager.compileReport(inputStream) | val poLabel = JasperCompileManager.compileReport(inputStream) | ||||
val qrCodeInfo = stockInLineRepository.findStockInLineInfoByIdInAndDeletedFalse(request.stockInLineIds).toMutableList() | val qrCodeInfo = stockInLineRepository.findStockInLineInfoByIdInAndDeletedFalse(request.stockInLineIds).toMutableList() | ||||
val fields = mutableListOf<MutableMap<String ,Any>>() | val fields = mutableListOf<MutableMap<String ,Any>>() | ||||
for (info in qrCodeInfo) { | for (info in qrCodeInfo) { | ||||
val field = mutableMapOf<String, Any>() | val field = mutableMapOf<String, Any>() | ||||
val qrCodeContent = ( | |||||
"itemId:${info.itemId}" + | |||||
",stockInLineId:${info.id}" | |||||
) | |||||
val qrContent = QrContent(info.itemId, info.id) | |||||
val qrCodeContent = (Json.encodeToString(qrContent)) | |||||
// field["itemId"] = info.itemId | // field["itemId"] = info.itemId | ||||
field["itemName"] = info.itemName!! | field["itemName"] = info.itemName!! | ||||
field["itemNo"] = info.itemNo | field["itemNo"] = info.itemNo | ||||
field["poCode"] = info.poCode | field["poCode"] = info.poCode | ||||
field["itemType"] = info.itemType | field["itemType"] = info.itemType | ||||
field["acceptedQty"] = info.acceptedQty.toString() | field["acceptedQty"] = info.acceptedQty.toString() | ||||
field["uom"] = info.uom!! | |||||
field["uom"] = info.uom.code.toString() | |||||
field["productionDate"] = info.productionDate?.format(DateTimeFormatter.ISO_LOCAL_DATE) ?: "" | field["productionDate"] = info.productionDate?.format(DateTimeFormatter.ISO_LOCAL_DATE) ?: "" | ||||
field["expiryDate"] = info.expiryDate?.format(DateTimeFormatter.ISO_LOCAL_DATE) ?: "" | field["expiryDate"] = info.expiryDate?.format(DateTimeFormatter.ISO_LOCAL_DATE) ?: "" | ||||
field["lotNo"] = info.lotNo!! | field["lotNo"] = info.lotNo!! | ||||
@@ -39,7 +39,7 @@ class StockInLineController( | |||||
response.characterEncoding = "utf-8"; | response.characterEncoding = "utf-8"; | ||||
response.contentType = "application/pdf"; | response.contentType = "application/pdf"; | ||||
val out: OutputStream = response.outputStream | val out: OutputStream = response.outputStream | ||||
val pdf: Map<String, Any> = stockInLineService.exportStockInLineQrcode(request) | |||||
val pdf = stockInLineService.exportStockInLineQrcode(request) | |||||
val jasperPrint = pdf["report"] as JasperPrint | val jasperPrint = pdf["report"] as JasperPrint | ||||
response.addHeader("filename", "${pdf["fileName"]}.pdf") | response.addHeader("filename", "${pdf["fileName"]}.pdf") | ||||
out.write(JasperExportManager.exportReportToPdf(jasperPrint)); | out.write(JasperExportManager.exportReportToPdf(jasperPrint)); | ||||
@@ -0,0 +1,6 @@ | |||||
package com.ffii.fpsms.modules.stock.web.model | |||||
import kotlinx.serialization.Serializable | |||||
@Serializable | |||||
data class QrContent(val itemId: Long, val stockInLineId: Long) |