Przeglądaj źródła

delete first stock take function, db updates (items, printer, equipment_details, warehouse)

master
kelvin.yau 18 godzin temu
rodzic
commit
99c6e9ccc3
13 zmienionych plików z 187 dodań i 917 usunięć
  1. +5
    -1
      src/main/java/com/ffii/fpsms/modules/master/entity/EquipmentDetail.kt
  2. +9
    -11
      src/main/java/com/ffii/fpsms/modules/master/entity/Items.kt
  3. +4
    -0
      src/main/java/com/ffii/fpsms/modules/master/entity/Printer.kt
  4. +6
    -6
      src/main/java/com/ffii/fpsms/modules/master/entity/Warehouse.kt
  5. +1
    -15
      src/main/java/com/ffii/fpsms/modules/master/entity/WarehouseRepository.kt
  6. +122
    -851
      src/main/java/com/ffii/fpsms/modules/master/service/ItemsService.kt
  7. +0
    -17
      src/main/java/com/ffii/fpsms/modules/master/service/WarehouseService.kt
  8. +0
    -15
      src/main/java/com/ffii/fpsms/modules/master/web/ItemsController.kt
  9. +3
    -1
      src/main/resources/db/changelog/changes/20251216_01_Enson/01_add_column.sql
  10. +5
    -0
      src/main/resources/db/changelog/changes/20251219_01_KelvinY/01_add_equipmentCode_to_equipment_detail.sql
  11. +5
    -0
      src/main/resources/db/changelog/changes/20251219_01_KelvinY/02_add_type_to_printer.sql
  12. +15
    -0
      src/main/resources/db/changelog/changes/20251219_01_KelvinY/03_modify_items_table.sql
  13. +12
    -0
      src/main/resources/db/changelog/changes/20251219_01_KelvinY/04_modify_warehouse_table.sql

+ 5
- 1
src/main/java/com/ffii/fpsms/modules/master/entity/EquipmentDetail.kt Wyświetl plik

@@ -10,6 +10,11 @@ import jakarta.validation.constraints.Size
@Table(name = "equipment_detail")
@Entity
open class EquipmentDetail : BaseEntity<Long>() {

@Size(max = 255)
@Column(name = "equipmentCode", nullable = true, length = 255)
open var equipmentCode: String? = null

@Size(max = 30)
@NotNull
@Column(name = "code", nullable = false, length = 30)
@@ -25,7 +30,6 @@ open class EquipmentDetail : BaseEntity<Long>() {
@Column(name = "description", nullable = false, length = 500)
open var description: String? = null


@Column(name = "equipmentTypeID")
open var equipmentTypeId: Long? = null



+ 9
- 11
src/main/java/com/ffii/fpsms/modules/master/entity/Items.kt Wyświetl plik

@@ -34,15 +34,9 @@ open class Items : BaseEntity<Long>() {
@Column(name = "countryOfOrigin")
open var countryOfOrigin: String? = null

@Column(name = "inventorySheet")
open var inventorySheet: String? = null

@Column(name = "store_id", nullable = true, length = 255)
open var store_id: String? = null

@Column(name = "storeLocation", nullable = true, length = 255)
open var storeLocation: String? = null

@Column(name = "warehouse", nullable = true, length = 255)
open var warehouse: String? = null

@@ -52,14 +46,17 @@ open class Items : BaseEntity<Long>() {
@Column(name = "slot", nullable = true, length = 255)
open var slot: String? = null

@Column(name = "MTMSPickRoutingID", nullable = true)
open var MTMSPickRoutingID: Int? = null

@Column(name = "LocationCode", nullable = true, length = 255)
open var LocationCode: String? = null

@Column(name = "company", nullable = true, length = 30)
open var company: String? = null
@Column(name = "isEgg", nullable = true)
open var isEgg: Boolean? = false

@Column(name = "isFee", nullable = true)
open var isFee: Boolean? = false

@Column(name = "isBag", nullable = true)
open var isBag: Boolean? = false

@Column(name = "maxQty")
open var maxQty: Double? = null
@@ -90,4 +87,5 @@ open class Items : BaseEntity<Long>() {
@JsonManagedReference
@JoinColumn(name = "qcCategoryId")
open var qcCategory: QcCategory? = null

}

+ 4
- 0
src/main/java/com/ffii/fpsms/modules/master/entity/Printer.kt Wyświetl plik

@@ -18,6 +18,10 @@ open class Printer : BaseEntity<Long>() {
@Column(name = "name", length = 500)
open var name: String? = null

@Size(max = 255)
@Column(name = "type", nullable = true, length = 255)
open var type: String? = null

@Size(max = 500)
@Column(name = "description", length = 500)
open var description: String? = null


+ 6
- 6
src/main/java/com/ffii/fpsms/modules/master/entity/Warehouse.kt Wyświetl plik

@@ -32,16 +32,16 @@ open class Warehouse : BaseEntity<Long>() {

@Column(name = "store_id", nullable = false, length = 30)
open var store_id: String? = null
@Column(name = "storeLocation", nullable = true, length = 30)
open var storeLocation: String? = null
@Column(name = "stockTakeTable", nullable = true, length = 30)
open var stockTakeTable: String? = null
@Column(name = "company", nullable = true, length = 30)
open var company: String? = null

@Column(name = "warehouse", nullable = true, length = 30)
open var warehouse: String? = null

@Column(name = "area", nullable = true, length = 30)
open var area: String? = null

@Column(name = "slot", nullable = true, length = 30)
open var slot: String? = null

@Column(name = "stockTakeSection", nullable = true, length = 255)
open var stockTakeSection: String? = null
}

+ 1
- 15
src/main/java/com/ffii/fpsms/modules/master/entity/WarehouseRepository.kt Wyświetl plik

@@ -13,19 +13,5 @@ interface WarehouseRepository : AbstractRepository<Warehouse, Long> {
fun findByIdAndDeletedIsFalse(id: Serializable): Warehouse?;

fun findByCodeAndDeletedIsFalse(code: String): Warehouse?;

@Query("""
SELECT w FROM Warehouse w
WHERE w.code = :code
AND w.stockTakeTable = :stockTakeTable
AND w.company = :company
AND w.storeLocation = :storeLocation
AND w.deleted = false
""")
fun findByCodeAndStockTakeTableAndCompanyAndStoreLocationAndDeletedIsFalse(
code: String,
stockTakeTable: String,
company: String,
storeLocation: String
): Warehouse?
}

+ 122
- 851
src/main/java/com/ffii/fpsms/modules/master/service/ItemsService.kt
Plik diff jest za duży
Wyświetl plik


+ 0
- 17
src/main/java/com/ffii/fpsms/modules/master/service/WarehouseService.kt Wyświetl plik

@@ -244,9 +244,6 @@ open class WarehouseService(
this.store_id = store_id
this.slot = slot
this.order = order
this.storeLocation = storeLocation
this.stockTakeTable = stockTakeTable
this.company = company
}
warehouseRepository.save(existingWarehouse)
updateCount++
@@ -262,9 +259,6 @@ open class WarehouseService(
this.store_id = store_id
this.slot = slot
this.order = order
this.storeLocation = storeLocation
this.stockTakeTable = stockTakeTable
this.company = company
}
warehouseRepository.save(newWarehouse)
createCount++
@@ -342,15 +336,4 @@ open class WarehouseService(
// calculate total sort value: floor * 10000 + letter * 100 + slot
return floorOrder * 10000L + letterOrder * 100L + slot
}

open fun findByCodeAndStockTakeTableAndCompanyAndStoreLocation(
code: String,
stockTakeTable: String,
company: String,
storeLocation: String
): Warehouse? {
return warehouseRepository.findByCodeAndStockTakeTableAndCompanyAndStoreLocationAndDeletedIsFalse(
code, stockTakeTable, company, storeLocation
)
}
}

+ 0
- 15
src/main/java/com/ffii/fpsms/modules/master/web/ItemsController.kt Wyświetl plik

@@ -128,19 +128,4 @@ fun getItemsWithDetailsByPage(request: HttpServletRequest): RecordsRes<Map<Strin
return RecordsRes(paginatedList, fullList.size)
}

@PostMapping("/patch/file")
fun patchItemsFromExcelFile(@RequestParam("fileName") fileName: String): ResponseEntity<*> {
return try {
if (fileName.isBlank()) {
return ResponseEntity.badRequest().body("File name cannot be empty")
}

logger.info("Request to patch items from file: $fileName")
val result = itemsService.patchItemsFromExcelFileName(fileName)
ResponseEntity.ok(result)
} catch (e: Exception) {
logger.error("Error patching from file: ${e.message}", e)
ResponseEntity.badRequest().body("Error: ${e.message}")
}
}
}

+ 3
- 1
src/main/resources/db/changelog/changes/20251216_01_Enson/01_add_column.sql Wyświetl plik

@@ -1,5 +1,7 @@
-- liquibase formatted sql
-- changeset Enson:add_column
-- preconditions onFail:MARK_RAN
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'fpsmsdb' AND table_name = 'bag'

create table `fpsmsdb`.`bag` (
`id` int not null auto_increment,
@@ -56,4 +58,4 @@ create table `fpsmsdb`.`jo_bag_consumption` (
`deleted` tinyint(1) NOT NULL DEFAULT '0',
primary key (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

+ 5
- 0
src/main/resources/db/changelog/changes/20251219_01_KelvinY/01_add_equipmentCode_to_equipment_detail.sql Wyświetl plik

@@ -0,0 +1,5 @@
-- liquibase formatted sql
-- changeset KelvinY:add_equipmentCode_to_equipment_detail

ALTER TABLE `fpsmsdb`.`equipment_detail`
ADD COLUMN `equipmentCode` VARCHAR(255) NULL;

+ 5
- 0
src/main/resources/db/changelog/changes/20251219_01_KelvinY/02_add_type_to_printer.sql Wyświetl plik

@@ -0,0 +1,5 @@
-- liquibase formatted sql
-- changeset KelvinY:add_type_to_printer

ALTER TABLE `fpsmsdb`.`printer`
ADD COLUMN `type` VARCHAR(255) NULL;

+ 15
- 0
src/main/resources/db/changelog/changes/20251219_01_KelvinY/03_modify_items_table.sql Wyświetl plik

@@ -0,0 +1,15 @@
-- liquibase formatted sql
-- changeset KelvinY:modify_items_table

-- Add new columns
ALTER TABLE `fpsmsdb`.`items`
ADD COLUMN `isEgg` TINYINT(1) NULL DEFAULT 0 AFTER `LocationCode`,
ADD COLUMN `isFee` TINYINT(1) NULL DEFAULT 0 AFTER `isEgg`,
ADD COLUMN `isBag` TINYINT(1) NULL DEFAULT 0 AFTER `isFee`;

-- Remove old columns
ALTER TABLE `fpsmsdb`.`items`
DROP COLUMN `storeLocation`,
DROP COLUMN `MTMSPickRoutingID`,
DROP COLUMN `inventorySheet`,
DROP COLUMN `company`;

+ 12
- 0
src/main/resources/db/changelog/changes/20251219_01_KelvinY/04_modify_warehouse_table.sql Wyświetl plik

@@ -0,0 +1,12 @@
-- liquibase formatted sql
-- changeset KelvinY:modify_warehouse_table

-- Add new column
ALTER TABLE `fpsmsdb`.`warehouse`
ADD COLUMN `stockTakeSection` VARCHAR(255) NULL;

-- Remove old columns
ALTER TABLE `fpsmsdb`.`warehouse`
DROP COLUMN `storeLocation`,
DROP COLUMN `stockTakeTable`,
DROP COLUMN `company`;

Ładowanie…
Anuluj
Zapisz