@@ -4,6 +4,7 @@ import com.ffii.core.support.AbstractRepository | |||||
import com.ffii.fpsms.modules.stock.entity.projection.QrCodeInfo | import com.ffii.fpsms.modules.stock.entity.projection.QrCodeInfo | ||||
import com.ffii.fpsms.modules.stock.entity.projection.StockInLineInfo | import com.ffii.fpsms.modules.stock.entity.projection.StockInLineInfo | ||||
import org.springframework.stereotype.Repository | import org.springframework.stereotype.Repository | ||||
import java.util.Optional | |||||
@Repository | @Repository | ||||
interface StockInLineRepository : AbstractRepository<StockInLine, Long> { | interface StockInLineRepository : AbstractRepository<StockInLine, Long> { | ||||
@@ -12,4 +13,5 @@ interface StockInLineRepository : AbstractRepository<StockInLine, Long> { | |||||
fun findStockInLineInfoByIdAndDeletedFalse(id: Long): StockInLineInfo | fun findStockInLineInfoByIdAndDeletedFalse(id: Long): StockInLineInfo | ||||
fun findStockInLineInfoByIdInAndDeletedFalse(id: List<Long>): List<StockInLineInfo> | fun findStockInLineInfoByIdInAndDeletedFalse(id: List<Long>): List<StockInLineInfo> | ||||
fun findStockInLineInfoByPurchaseOrderLineIdAndStatusNotAndDeletedFalse(purchaseOrderLineId: Long, status: String): List<StockInLineInfo> | fun findStockInLineInfoByPurchaseOrderLineIdAndStatusNotAndDeletedFalse(purchaseOrderLineId: Long, status: String): List<StockInLineInfo> | ||||
fun findStockInLineInfoByIdAndStatusAndDeletedFalse(id: Long, status: String): Optional<StockInLineInfo> | |||||
} | } |
@@ -58,6 +58,9 @@ open class StockInLineService( | |||||
open fun getStockInLineInfo(stockInLineId: Long): StockInLineInfo { | open fun getStockInLineInfo(stockInLineId: Long): StockInLineInfo { | ||||
return stockInLineRepository.findStockInLineInfoByIdAndDeletedFalse(stockInLineId) | return stockInLineRepository.findStockInLineInfoByIdAndDeletedFalse(stockInLineId) | ||||
} | } | ||||
open fun getReceiveedStockInLineInfo(stockInLineId: Long): StockInLineInfo { | |||||
return stockInLineRepository.findStockInLineInfoByIdAndStatusAndDeletedFalse(id = stockInLineId, status = StockInLineStatus.RECEIVED.status).orElseThrow() | |||||
} | |||||
@Throws(IOException::class) | @Throws(IOException::class) | ||||
@Transactional | @Transactional | ||||
open fun create(request: SaveStockInLineRequest): MessageResponse { | open fun create(request: SaveStockInLineRequest): MessageResponse { | ||||
@@ -299,7 +302,7 @@ open class StockInLineService( | |||||
this.inventoryLot = savedInventoryLot ?: stockInLine.inventoryLot | this.inventoryLot = savedInventoryLot ?: stockInLine.inventoryLot | ||||
this.lotNo = savedInventoryLot?.lotNo ?: stockInLine.lotNo | this.lotNo = savedInventoryLot?.lotNo ?: stockInLine.lotNo | ||||
this.expiryDate = stockInLine.expiryDate ?: request.expiryDate | this.expiryDate = stockInLine.expiryDate ?: request.expiryDate | ||||
this.productLotNo = request.productLotNo | |||||
this.productLotNo = stockInLine.productLotNo ?: request.productLotNo | |||||
} | } | ||||
val stockInLineEntries = listOf(stockInLine, newStockInLine) | val stockInLineEntries = listOf(stockInLine, newStockInLine) | ||||
@@ -27,6 +27,10 @@ class StockInLineController( | |||||
fun get(@PathVariable stockInLineId: Long): StockInLineInfo { | fun get(@PathVariable stockInLineId: Long): StockInLineInfo { | ||||
return stockInLineService.getStockInLineInfo(stockInLineId) | return stockInLineService.getStockInLineInfo(stockInLineId) | ||||
} | } | ||||
@GetMapping("/received/{stockInLineId}") | |||||
fun getReceived(@PathVariable stockInLineId: Long): StockInLineInfo { | |||||
return stockInLineService.getStockInLineInfo(stockInLineId) | |||||
} | |||||
@PostMapping("/create") | @PostMapping("/create") | ||||
fun create(@Valid @RequestBody newItem: SaveStockInLineRequest): MessageResponse { | fun create(@Valid @RequestBody newItem: SaveStockInLineRequest): MessageResponse { | ||||
return stockInLineService.create(newItem) | return stockInLineService.create(newItem) | ||||
@@ -0,0 +1,20 @@ | |||||
package com.ffii.fpsms.modules.user.web | |||||
import com.ffii.fpsms.modules.stock.service.StockInLineService | |||||
import com.ffii.fpsms.modules.user.service.UserAuthorityService | |||||
import org.springframework.web.bind.annotation.GetMapping | |||||
import org.springframework.web.bind.annotation.PathVariable | |||||
import org.springframework.web.bind.annotation.RequestMapping | |||||
import org.springframework.web.bind.annotation.RestController | |||||
@RestController | |||||
@RequestMapping("/auths") | |||||
class AuthorityController( | |||||
private val userAuthorityService: UserAuthorityService | |||||
) { | |||||
@GetMapping("/by-user/{userId}") | |||||
fun getAuthByUser(@PathVariable userId: Long) { | |||||
} | |||||
} |