From 69fef376518defe5748839d08a8445e3a757ba65 Mon Sep 17 00:00:00 2001 From: "CANCERYS\\kw093" Date: Fri, 9 Oct 2026 14:53:31 +0800 Subject: [PATCH] 2.1 deleted fix --- .../service/ledgerfix/StockLedgerFixBackfillService.kt | 7 +++---- .../master/service/ledgerfix/StockLedgerFixQueryService.kt | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ffii/fpsms/modules/master/service/ledgerfix/StockLedgerFixBackfillService.kt b/src/main/java/com/ffii/fpsms/modules/master/service/ledgerfix/StockLedgerFixBackfillService.kt index bd586ccb..47213821 100644 --- a/src/main/java/com/ffii/fpsms/modules/master/service/ledgerfix/StockLedgerFixBackfillService.kt +++ b/src/main/java/com/ffii/fpsms/modules/master/service/ledgerfix/StockLedgerFixBackfillService.kt @@ -409,8 +409,9 @@ open class StockLedgerFixBackfillService( } /** - * Rows that already have a lot line stay. Soft-delete only when a related - * stock in/out line exists and 2.1a/2.1b still could not set inventoryLotLineId. + * Rows that already have a lot line stay. Soft-delete when 2.1a/2.1b still + * left inventoryLotLineId null: a related in/out line that cannot point at a lot, + * or neither stockInLineId nor stockOutLineId is set. */ private fun softDeleteUnlinkedLot( dateWhere: String, @@ -429,7 +430,6 @@ open class StockLedgerFixBackfillService( WHERE sl.deleted = 0 AND ($dateWhere) AND sl.inventoryLotLineId IS NULL - AND (sl.stockInLineId IS NOT NULL OR sl.stockOutLineId IS NOT NULL) AND ($extraAnd) """.trimIndent(), args, @@ -1139,7 +1139,6 @@ open class StockLedgerFixBackfillService( sl.modifiedBy = 'stock-ledger-fix' WHERE sl.deleted = 0 AND sl.inventoryLotLineId IS NULL - AND (sl.stockInLineId IS NOT NULL OR sl.stockOutLineId IS NOT NULL) """.trimIndent(), ) val outLine = alignExistingOutLine("sl.date < :today", args, "sl.inventoryId = :inventoryId") diff --git a/src/main/java/com/ffii/fpsms/modules/master/service/ledgerfix/StockLedgerFixQueryService.kt b/src/main/java/com/ffii/fpsms/modules/master/service/ledgerfix/StockLedgerFixQueryService.kt index 38659152..e576ab57 100644 --- a/src/main/java/com/ffii/fpsms/modules/master/service/ledgerfix/StockLedgerFixQueryService.kt +++ b/src/main/java/com/ffii/fpsms/modules/master/service/ledgerfix/StockLedgerFixQueryService.kt @@ -180,7 +180,6 @@ open class StockLedgerFixQueryService( sl.inventoryLotLineId IS NULL AND COALESCE(sol.inventoryLotLineId, sil.inventoryLotLineId) IS NULL AND (sil.inventoryLotId IS NULL OR IFNULL(lc.lineCnt, 0) = 0) - AND (sl.stockInLineId IS NOT NULL OR sl.stockOutLineId IS NOT NULL) ) AS cannotNoSource, SUM( sl.inventoryLotLineId IS NOT NULL @@ -571,7 +570,6 @@ open class StockLedgerFixQueryService( sl.inventoryLotLineId IS NULL AND COALESCE(sol.inventoryLotLineId, sil.inventoryLotLineId) IS NULL AND (sil.inventoryLotId IS NULL OR IFNULL(lc.lineCnt, 0) = 0) - AND (sl.stockInLineId IS NOT NULL OR sl.stockOutLineId IS NOT NULL) ) AS cannotNoSource, SUM( sl.inventoryLotLineId IS NOT NULL @@ -721,7 +719,7 @@ open class StockLedgerFixQueryService( add(canFix("fixable21a", "可修 2.1a:SIL/SOL 已有 lot line", fixable21a)) add(canFix("fixable21b", "可修 2.1b:inventoryLotId 僅一條 line", fixable21b)) add(canFix("fixableLotQty", "可修:lot 已有但缺 lotQty", lotQtyMissWithLot)) - add(cannotFix("cannotNoSource", "2.1 軟刪:入出倉列對不到批號列", cannotNoSource)) + add(cannotFix("cannotNoSource", "2.1 軟刪:對不到批號列(含沒有入出倉列)", cannotNoSource)) add(cannotFix("cannotMultiLine", "2.1 軟刪:同一 lot 有多條 warehouse line", cannotMultiLine)) add(cannotFix("earlyTke", "不能修:舊 TKE 開新批(sibling 盤盈)", earlyTkeOver)) add(cannotFix("realOver", "不能修:over-issue 非舊 TKE(真超發/帳不一致)", otherOver))