Ver a proveniência

update qc & item & inventory

master
cyril.tsui há 1 semana
ascendente
cometimento
671499e858
8 ficheiros alterados com 55 adições e 23 eliminações
  1. +16
    -14
      src/main/java/com/ffii/fpsms/m18/service/M18MasterDataService.kt
  2. +4
    -1
      src/main/java/com/ffii/fpsms/modules/master/entity/QcCategoryRepository.kt
  3. +11
    -0
      src/main/java/com/ffii/fpsms/modules/master/entity/projections/QcCategoryCombo.kt
  4. +7
    -3
      src/main/java/com/ffii/fpsms/modules/master/service/ItemsService.kt
  5. +5
    -0
      src/main/java/com/ffii/fpsms/modules/master/service/QcCategoryService.kt
  6. +6
    -0
      src/main/java/com/ffii/fpsms/modules/master/web/QcCategoryController.kt
  7. +2
    -1
      src/main/java/com/ffii/fpsms/modules/master/web/models/NewItemRequest.kt
  8. +4
    -4
      src/main/java/com/ffii/fpsms/modules/stock/entity/projection/InventoryInfo.kt

+ 16
- 14
src/main/java/com/ffii/fpsms/m18/service/M18MasterDataService.kt Ver ficheiro

@@ -150,12 +150,12 @@ open class M18MasterDataService(
// type = if (pro.seriesId == m18Config.SERIESID_PF) ProductType.MATERIAL
// else ItemType.PRODUCT,
type = when (pro.udfProducttype) {
M18ItemType.CONSUMABLES.type -> ItemType.CONSUMABLES
M18ItemType.NONCONSUMABLES.type -> ItemType.NONCONSUMABLES
M18ItemType.FG.type -> ItemType.FG
M18ItemType.SFG.type -> ItemType.SFG
M18ItemType.ITEM.type -> ItemType.ITEM
else -> ItemType.MATERIAL
M18ItemType.CONSUMABLES.type -> ItemType.CONSUMABLES.type
M18ItemType.NONCONSUMABLES.type -> ItemType.NONCONSUMABLES.type
M18ItemType.FG.type -> ItemType.FG.type
M18ItemType.SFG.type -> ItemType.SFG.type
M18ItemType.ITEM.type -> ItemType.ITEM.type
else -> ItemType.MATERIAL.type
},
id = existingItem?.id,
description = pro.desc,
@@ -164,7 +164,8 @@ open class M18MasterDataService(
countryOfOrigin = null,
maxQty = null,
m18Id = id,
m18LastModifyDate = commonUtils.timestampToLocalDateTime(pro.lastModifyDate)
m18LastModifyDate = commonUtils.timestampToLocalDateTime(pro.lastModifyDate),
qcCategoryId = null
)

val savedItem = itemsService.saveItem(saveItemRequest)
@@ -244,12 +245,12 @@ open class M18MasterDataService(
// type = if (pro.seriesId == m18Config.SERIESID_PF) ProductType.MATERIAL
// else ItemType.PRODUCT,
type = when (pro.udfProducttype) {
M18ItemType.CONSUMABLES.type -> ItemType.CONSUMABLES
M18ItemType.NONCONSUMABLES.type -> ItemType.NONCONSUMABLES
M18ItemType.FG.type -> ItemType.FG
M18ItemType.SFG.type -> ItemType.SFG
M18ItemType.ITEM.type -> ItemType.ITEM
else -> ItemType.MATERIAL
M18ItemType.CONSUMABLES.type -> ItemType.CONSUMABLES.type
M18ItemType.NONCONSUMABLES.type -> ItemType.NONCONSUMABLES.type
M18ItemType.FG.type -> ItemType.FG.type
M18ItemType.SFG.type -> ItemType.SFG.type
M18ItemType.ITEM.type -> ItemType.ITEM.type
else -> ItemType.MATERIAL.type
},
id = existingItem?.id,
description = pro.desc,
@@ -258,7 +259,8 @@ open class M18MasterDataService(
countryOfOrigin = null,
maxQty = null,
m18Id = item.id,
m18LastModifyDate = commonUtils.timestampToLocalDateTime(pro.lastModifyDate)
m18LastModifyDate = commonUtils.timestampToLocalDateTime(pro.lastModifyDate),
qcCategoryId = null
)

val savedItem = itemsService.saveItem(saveItemRequest)


+ 4
- 1
src/main/java/com/ffii/fpsms/modules/master/entity/QcCategoryRepository.kt Ver ficheiro

@@ -1,9 +1,12 @@
package com.ffii.fpsms.modules.master.entity

import com.ffii.core.support.AbstractRepository
import com.ffii.fpsms.modules.master.entity.projections.QcCategoryCombo
import org.springframework.stereotype.Repository

@Repository
interface QcCategoryRepository : AbstractRepository<QcCategory, Long> {
fun findAllByDeletedIsFalse(): List<QcCategory>
fun findAllByDeletedIsFalse(): List<QcCategory>;

fun findQcCategoryComboByDeletedIsFalse(): List<QcCategoryCombo>;
}

+ 11
- 0
src/main/java/com/ffii/fpsms/modules/master/entity/projections/QcCategoryCombo.kt Ver ficheiro

@@ -0,0 +1,11 @@
package com.ffii.fpsms.modules.master.entity.projections

import org.springframework.beans.factory.annotation.Value

interface QcCategoryCombo {
val id: Long;
@get:Value("#{target.id}")
val value: Long;
@get:Value("#{target.code}")
val label: String;
}

+ 7
- 3
src/main/java/com/ffii/fpsms/modules/master/service/ItemsService.kt Ver ficheiro

@@ -13,13 +13,14 @@ import java.io.IOException
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.time.temporal.TemporalAdjusters
import kotlin.jvm.optionals.getOrNull

@Service
open class ItemsService(
private val jdbcDao: JdbcDao,
private val itemsRepository: ItemsRepository,
private val qcCheckRepository: QcCheckRepository,
private val qcItemsRepository: QcItemRepository,
private val qcItemsRepository: QcItemRepository, private val qcCategoryRepository: QcCategoryRepository,
): AbstractBaseEntityService<Items, Long, ItemsRepository>(jdbcDao, itemsRepository) {
// do mapping with projection
open fun allItems(): List<Items> {
@@ -170,7 +171,7 @@ open class ItemsService(
@Throws(IOException::class)
@Transactional
open fun saveItem(request: NewItemRequest): MessageResponse {
val duplicatedItem = itemsRepository.findByCodeAndTypeAndDeletedFalse(request.code, request.type.type)
val duplicatedItem = itemsRepository.findByCodeAndTypeAndDeletedFalse(request.code, request.type)
if (duplicatedItem != null && duplicatedItem.id != request.id) {
return MessageResponse(
id = request.id,
@@ -196,6 +197,8 @@ open class ItemsService(
)
}

val qcCategory = request.qcCategoryId?.let { qcCategoryRepository.findById(it).getOrNull() }

item.apply {
code = request.code
name = request.name
@@ -204,7 +207,8 @@ open class ItemsService(
shelfLife = request.shelfLife
countryOfOrigin = request.countryOfOrigin
maxQty = request.maxQty
this.type = request.type.type
this.type = request.type
this.qcCategory = qcCategory
m18Id = request.m18Id ?: this.m18Id
m18LastModifyDate = request.m18LastModifyDate ?: this.m18LastModifyDate
}


+ 5
- 0
src/main/java/com/ffii/fpsms/modules/master/service/QcCategoryService.kt Ver ficheiro

@@ -3,6 +3,7 @@ package com.ffii.fpsms.modules.master.service
import com.ffii.core.support.AbstractBaseEntityService
import com.ffii.fpsms.modules.master.entity.QcCategory
import com.ffii.fpsms.modules.master.entity.QcCategoryRepository
import com.ffii.fpsms.modules.master.entity.projections.QcCategoryCombo
import org.springframework.stereotype.Service

@Service
@@ -12,4 +13,8 @@ open class QcCategoryService(
open fun allQcCategories(): List<QcCategory> {
return qcCategoryRepository.findAllByDeletedIsFalse()
}

open fun getQcCategoryCombo(): List<QcCategoryCombo> {
return qcCategoryRepository.findQcCategoryComboByDeletedIsFalse();
}
}

+ 6
- 0
src/main/java/com/ffii/fpsms/modules/master/web/QcCategoryController.kt Ver ficheiro

@@ -1,6 +1,7 @@
package com.ffii.fpsms.modules.master.web

import com.ffii.fpsms.modules.master.entity.QcCategory
import com.ffii.fpsms.modules.master.entity.projections.QcCategoryCombo
import com.ffii.fpsms.modules.master.service.QcCategoryService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
@@ -15,4 +16,9 @@ class QcCategoryController(
fun allQcCategories(): List<QcCategory> {
return qcCategoryService.allQcCategories()
}

@GetMapping("/combo")
fun getQcCategoryCombo(): List<QcCategoryCombo> {
return qcCategoryService.getQcCategoryCombo();
}
}

+ 2
- 1
src/main/java/com/ffii/fpsms/modules/master/web/models/NewItemRequest.kt Ver ficheiro

@@ -34,7 +34,7 @@ data class NewItemRequest(
@field:NotBlank(message = "material name cannot be empty")
val name: String,
@field:NotNull(message = "typeId cannot be null")
val type: ItemType,
val type: String,

val id: Long?,
val description: String?,
@@ -44,6 +44,7 @@ data class NewItemRequest(
val maxQty: Double?,
val m18Id: Long?,
val m18LastModifyDate: LocalDateTime?,
val qcCategoryId: Long?,
// val type: List<NewTypeRequest>?,
// val uom: List<NewUomRequest>?,
// val weightUnit: List<NewWeightUnitRequest>?,


+ 4
- 4
src/main/java/com/ffii/fpsms/modules/stock/entity/projection/InventoryInfo.kt Ver ficheiro

@@ -14,13 +14,13 @@ interface InventoryInfo{
@get:Value("#{target.item.type}")
val itemType: String?
// @get:Value("#{target.qty / (target.item.itemUoms.^[stockUnit == true && deleted == false]?.ratioN / target.item.itemUoms.^[stockUnit == true && deleted == false]?.ratioD)}")
@get:Value("#{target.onHandQty / (target.item.itemUoms.^[salesUnit == true && deleted == false]?.ratioN / target.item.itemUoms.^[salesUnit == true && deleted == false]?.ratioD)}")
@get:Value("#{target.onHandQty / (target.item.itemUoms.^[stockUnit == true && deleted == false]?.ratioN / target.item.itemUoms.^[stockUnit == true && deleted == false]?.ratioD)}")
val onHandQty: BigDecimal?
@get:Value("#{target.onHoldQty / (target.item.itemUoms.^[salesUnit == true && deleted == false]?.ratioN / target.item.itemUoms.^[salesUnit == true && deleted == false]?.ratioD)}")
@get:Value("#{target.onHoldQty / (target.item.itemUoms.^[stockUnit == true && deleted == false]?.ratioN / target.item.itemUoms.^[stockUnit == true && deleted == false]?.ratioD)}")
val onHoldQty: BigDecimal?
@get:Value("#{target.unavailableQty / (target.item.itemUoms.^[salesUnit == true && deleted == false]?.ratioN / target.item.itemUoms.^[salesUnit == true && deleted == false]?.ratioD)}")
@get:Value("#{target.unavailableQty / (target.item.itemUoms.^[stockUnit == true && deleted == false]?.ratioN / target.item.itemUoms.^[stockUnit == true && deleted == false]?.ratioD)}")
val unavailableQty: BigDecimal?
@get:Value("#{(target.onHandQty - target.onHoldQty - target.unavailableQty) / (target.item.itemUoms.^[salesUnit == true && deleted == false]?.ratioN / target.item.itemUoms.^[salesUnit == true && deleted == false]?.ratioD)}")
@get:Value("#{(target.onHandQty - target.onHoldQty - target.unavailableQty) / (target.item.itemUoms.^[stockUnit == true && deleted == false]?.ratioN / target.item.itemUoms.^[stockUnit == true && deleted == false]?.ratioD)}")
val availableQty: BigDecimal?
@get:Value("#{target.item.itemUoms.^[purchaseUnit == true && deleted == false]?.uom.code}")
val uomCode: String?


Carregando…
Cancelar
Guardar