|
|
@@ -6,6 +6,7 @@ import com.ffii.fpsms.modules.pickOrder.entity.projection.PickOrderInfo |
|
|
|
import com.ffii.fpsms.modules.pickOrder.web.models.SearchPickOrderRequest |
|
|
|
import org.springframework.data.domain.PageRequest |
|
|
|
import org.springframework.stereotype.Service |
|
|
|
import java.time.LocalDate |
|
|
|
import java.time.LocalDateTime |
|
|
|
import java.time.format.DateTimeFormatter |
|
|
|
|
|
|
@@ -35,7 +36,7 @@ open class PickOrderService( |
|
|
|
targetDateTo = LocalDateTimeParse(request.targetDateTo), |
|
|
|
type = request.type ?: "all", |
|
|
|
status = request.status ?: "all", |
|
|
|
items = request.items ?: "all", |
|
|
|
itemName = request.itemName ?: "all", |
|
|
|
pageable = pageable |
|
|
|
) |
|
|
|
|
|
|
@@ -45,6 +46,28 @@ open class PickOrderService( |
|
|
|
} |
|
|
|
|
|
|
|
// Consolidating Pick Orders |
|
|
|
open fun assignConsoCode(): String { |
|
|
|
val suffixFormat = "%03d" |
|
|
|
val pattern = "YYYYMMDD" |
|
|
|
val formatter = DateTimeFormatter.ofPattern(pattern) |
|
|
|
|
|
|
|
val prefix = "PICK" |
|
|
|
val midfix = LocalDate.now().format(formatter) |
|
|
|
val suffix = String.format(suffixFormat, 1) |
|
|
|
|
|
|
|
val latestConsoCode = pickOrderRepository.findLatestConsoCodeByPrefix("${prefix}-${midfix}") |
|
|
|
|
|
|
|
if (latestConsoCode != null) { |
|
|
|
val splitLatestConsoCode = latestConsoCode.split("-") |
|
|
|
if (splitLatestConsoCode.size > 2) { |
|
|
|
val latestNo = splitLatestConsoCode[2].toInt() |
|
|
|
return listOf<String>(prefix, midfix, String.format(suffixFormat, latestNo + 1)).joinToString("-") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return listOf<String>(prefix, midfix, suffix).joinToString("-") |
|
|
|
} |
|
|
|
|
|
|
|
open fun consoPickOrders() { |
|
|
|
|
|
|
|
} |