fix(firstleg): defer PDA allocation release transition
This commit is contained in:
+5
-4
@@ -24,10 +24,11 @@ public interface InboundPalletAllocationMapper extends BaseMapper<InboundPalletA
|
|||||||
@Update("""
|
@Update("""
|
||||||
UPDATE fl_inbound_pallet_allocation
|
UPDATE fl_inbound_pallet_allocation
|
||||||
SET picked_package_count = picked_package_count + #{count},
|
SET picked_package_count = picked_package_count + #{count},
|
||||||
allocation_status = CASE
|
/* Keep the snapshot confirmed until the atomic warehouse release
|
||||||
WHEN picked_package_count + #{count} = allocated_package_count THEN 'RELEASED'
|
succeeds. markReleased is the single owner of this transition;
|
||||||
ELSE 'CONFIRMED'
|
changing it here makes the subsequent idempotent release update
|
||||||
END,
|
affect zero rows and surfaces as S0500 from PDA pick. */
|
||||||
|
allocation_status = 'CONFIRMED',
|
||||||
updated_at = CURRENT_TIMESTAMP(3)
|
updated_at = CURRENT_TIMESTAMP(3)
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
AND tenant_id = #{tenantId}
|
AND tenant_id = #{tenantId}
|
||||||
|
|||||||
+18
@@ -1,6 +1,7 @@
|
|||||||
package com.baiyue.firstleg.repository;
|
package com.baiyue.firstleg.repository;
|
||||||
|
|
||||||
import com.baiyue.firstleg.mapper.InboundSplitSettlementMapper;
|
import com.baiyue.firstleg.mapper.InboundSplitSettlementMapper;
|
||||||
|
import com.baiyue.firstleg.mapper.InboundPalletAllocationMapper;
|
||||||
import com.baiyue.firstleg.mapper.SmartLoadingCandidateMapper;
|
import com.baiyue.firstleg.mapper.SmartLoadingCandidateMapper;
|
||||||
import org.apache.ibatis.annotations.Insert;
|
import org.apache.ibatis.annotations.Insert;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
@@ -89,4 +90,21 @@ class PdaSplitSettlementSqlContractTest {
|
|||||||
.getAnnotation(Update.class).value()[0];
|
.getAnnotation(Update.class).value()[0];
|
||||||
assertThat(markRoot).contains("process_status IN ('INBOUNDED','LOADING')");
|
assertThat(markRoot).contains("process_status IN ('INBOUNDED','LOADING')");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void keepsAllocationConfirmedUntilReleaseStep() throws Exception {
|
||||||
|
String consume = InboundPalletAllocationMapper.class.getMethod("consume",
|
||||||
|
long.class, long.class, long.class, int.class)
|
||||||
|
.getAnnotation(Update.class).value()[0];
|
||||||
|
assertThat(consume)
|
||||||
|
.contains("allocation_status = 'CONFIRMED'")
|
||||||
|
.doesNotContain("THEN 'RELEASED'");
|
||||||
|
|
||||||
|
String release = InboundPalletAllocationMapper.class.getMethod("markReleased",
|
||||||
|
long.class, long.class, long.class)
|
||||||
|
.getAnnotation(Update.class).value()[0];
|
||||||
|
assertThat(release)
|
||||||
|
.contains("allocation_status = 'RELEASED'")
|
||||||
|
.contains("allocation_status = 'CONFIRMED'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user