|
@@ -10,15 +10,13 @@ import com.ffii.fpsms.m18.utils.CommonUtils |
|
|
import com.ffii.fpsms.modules.master.entity.QcItem |
|
|
import com.ffii.fpsms.modules.master.entity.QcItem |
|
|
import com.ffii.fpsms.modules.master.entity.ShopRepository |
|
|
import com.ffii.fpsms.modules.master.entity.ShopRepository |
|
|
import com.ffii.fpsms.modules.master.service.CurrencyService |
|
|
import com.ffii.fpsms.modules.master.service.CurrencyService |
|
|
|
|
|
import com.ffii.fpsms.modules.master.service.ItemUomService |
|
|
import com.ffii.fpsms.modules.master.service.ShopService |
|
|
import com.ffii.fpsms.modules.master.service.ShopService |
|
|
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.PurchaseOrder |
|
|
import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrder |
|
|
import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrderLineRepository |
|
|
import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrderLineRepository |
|
|
import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrderRepository |
|
|
import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrderRepository |
|
|
import com.ffii.fpsms.modules.purchaseOrder.entity.projections.PoLineWithStockInLine |
|
|
|
|
|
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.QcForPoLine |
|
|
|
|
|
|
|
|
import com.ffii.fpsms.modules.purchaseOrder.entity.projections.* |
|
|
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 |
|
@@ -53,6 +51,7 @@ open class PurchaseOrderService( |
|
|
private val currencyService: CurrencyService, |
|
|
private val currencyService: CurrencyService, |
|
|
private val shopService: ShopService, |
|
|
private val shopService: ShopService, |
|
|
private val grnSendLogRepository: GrnSendLogRepository, |
|
|
private val grnSendLogRepository: GrnSendLogRepository, |
|
|
|
|
|
val itemUomService: ItemUomService, |
|
|
) : AbstractBaseEntityService<PurchaseOrder, Long, PurchaseOrderRepository>(jdbcDao, purchaseOrderRepository) { |
|
|
) : AbstractBaseEntityService<PurchaseOrder, Long, PurchaseOrderRepository>(jdbcDao, purchaseOrderRepository) { |
|
|
// open fun getPurchaseOrderInfo(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
// open fun getPurchaseOrderInfo(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
// val sql = StringBuilder( |
|
|
// val sql = StringBuilder( |
|
@@ -166,7 +165,7 @@ open class PurchaseOrderService( |
|
|
// println(value1) |
|
|
// println(value1) |
|
|
// println(value1 == 1L) |
|
|
// println(value1 == 1L) |
|
|
// println(value2) |
|
|
// println(value2) |
|
|
println(mappedList) |
|
|
|
|
|
|
|
|
// println(mappedList) |
|
|
return mappedList |
|
|
return mappedList |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -194,6 +193,19 @@ open class PurchaseOrderService( |
|
|
description = it.description |
|
|
description = it.description |
|
|
) |
|
|
) |
|
|
} ?: mutableListOf(); |
|
|
} ?: mutableListOf(); |
|
|
|
|
|
val purchaseUnit = thisPol.item?.id?.let { itemUomService.findPurchaseUnitByItemId(it) } |
|
|
|
|
|
val stockUnit = thisPol.item?.id?.let { itemUomService.findStockUnitByItemId(it).let { iu -> |
|
|
|
|
|
StockUomForPoLine( |
|
|
|
|
|
id = iu?.id, |
|
|
|
|
|
stockUomCode = iu?.uom?.code, |
|
|
|
|
|
stockUomDesc = iu?.uom?.udfudesc, |
|
|
|
|
|
stockQty = iu?.item?.id?.let { iId -> itemUomService.convertPurchaseQtyToStockQty(iId, (thisPol.qty ?: BigDecimal.ZERO)) } ?: BigDecimal.ZERO, |
|
|
|
|
|
stockRatioN = iu?.ratioN, |
|
|
|
|
|
stockRatioD = iu?.ratioD, |
|
|
|
|
|
purchaseRatioN = purchaseUnit?.ratioN, |
|
|
|
|
|
purchaseRatioD = purchaseUnit?.ratioD, |
|
|
|
|
|
) |
|
|
|
|
|
} } ?: StockUomForPoLine() |
|
|
PoLineWithStockInLine( |
|
|
PoLineWithStockInLine( |
|
|
id = thisPol.id!!, |
|
|
id = thisPol.id!!, |
|
|
purchaseOrderId = thisPol.purchaseOrder!!.id!!, |
|
|
purchaseOrderId = thisPol.purchaseOrder!!.id!!, |
|
@@ -207,12 +219,14 @@ open class PurchaseOrderService( |
|
|
price = thisPol.price!!, |
|
|
price = thisPol.price!!, |
|
|
status = thisPol.status!!.toString(), |
|
|
status = thisPol.status!!.toString(), |
|
|
stockInLine = inLine, |
|
|
stockInLine = inLine, |
|
|
qcItems = qcItems |
|
|
|
|
|
|
|
|
qcItems = qcItems, |
|
|
|
|
|
stockUom = stockUnit |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
val result = mapOf( |
|
|
val result = mapOf( |
|
|
"id" to po.id, |
|
|
"id" to po.id, |
|
|
"code" to po.code, |
|
|
"code" to po.code, |
|
|
|
|
|
"supplier" to (po.supplier ?: "N/A"), |
|
|
"orderDate" to po.orderDate, |
|
|
"orderDate" to po.orderDate, |
|
|
"estimatedArrivalDate" to po.estimatedArrivalDate, |
|
|
"estimatedArrivalDate" to po.estimatedArrivalDate, |
|
|
"completeDate" to po.completeDate, |
|
|
"completeDate" to po.completeDate, |
|
|