This commit is contained in:
2026-09-01 11:09:14 +08:00
191 changed files with 6486 additions and 403 deletions
@@ -78,6 +78,28 @@ public interface LastlegOrderMapper extends BaseMapper<LastlegOrder> {
List<ContainerPlanProgressDetail.Item> findContainerProgressItems(
@Param("sourceContainerBookingId") String sourceContainerBookingId);
record PalletMergeRelationRow(Long orderId, String relatedInboundNo, String mergeGroupNo) {}
@Select("<script>SELECT relation.order_id AS orderId," +
"COALESCE(NULLIF(related.inbound_code,''),NULLIF(related.inbound_order_no,''),related.source_order_no) AS relatedInboundNo, " +
"relation.merge_group_no AS mergeGroupNo FROM (" +
"SELECT marked.customer_id,marked.id AS order_id,related.id AS related_order_id," +
"marked.pallet_merge_batch_id AS merge_group_no FROM ll_order marked " +
"JOIN ll_order related ON related.customer_id=marked.customer_id " +
"AND related.pallet_merge_batch_id=marked.pallet_merge_batch_id AND related.id&lt;&gt;marked.id " +
"WHERE marked.pallet_merge_batch_id IS NOT NULL AND marked.id IN " +
"<foreach collection='orderIds' item='id' open='(' separator=',' close=')'>#{id}</foreach> " +
"UNION ALL " +
"SELECT customer_id,source_order_id AS order_id,target_order_id AS related_order_id,merge_group_no " +
"FROM ll_inbound_pallet_merge WHERE status='CONFIRMED' AND source_order_id IN " +
"<foreach collection='orderIds' item='id' open='(' separator=',' close=')'>#{id}</foreach> " +
"UNION ALL SELECT customer_id,target_order_id AS order_id,source_order_id AS related_order_id,merge_group_no " +
"FROM ll_inbound_pallet_merge WHERE status='CONFIRMED' AND target_order_id IN " +
"<foreach collection='orderIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>) relation " +
"JOIN ll_order related ON related.id=relation.related_order_id AND related.customer_id=relation.customer_id " +
"ORDER BY relation.order_id,relation.merge_group_no,related.order_no</script>")
List<PalletMergeRelationRow> findPalletMergeRelations(@Param("orderIds") List<Long> orderIds);
@Select("SELECT * FROM ll_order WHERE customer_id=#{customerId} AND source_region=#{sourceRegion} " +
"AND source_inbound_id=#{sourceInboundId} LIMIT 1")
LastlegOrder findSource(@Param("customerId") String customerId,
@@ -116,4 +138,18 @@ public interface LastlegOrderMapper extends BaseMapper<LastlegOrder> {
int claimReceivingWarehouse(@Param("customerId") String customerId, @Param("orderId") long orderId,
@Param("warehouseId") String warehouseId,
@Param("warehouseName") String warehouseName);
@Update("UPDATE ll_order SET pallet_merge_flag=#{flag}," +
"pallet_merge_batch_id=CASE WHEN #{flag} IS NULL THEN NULL ELSE pallet_merge_batch_id END," +
"updated_at=#{updatedAt} " +
"WHERE customer_id=#{customerId} AND id=#{id}")
int updatePalletMergeFlag(@Param("customerId") String customerId, @Param("id") long id,
@Param("flag") String flag,
@Param("updatedAt") java.time.LocalDateTime updatedAt);
@Update("UPDATE ll_order SET pallet_merge_flag=#{flag},pallet_merge_batch_id=#{batchId},updated_at=#{updatedAt} " +
"WHERE customer_id=#{customerId} AND id=#{id}")
int updatePalletMergeBatch(@Param("customerId") String customerId, @Param("id") long id,
@Param("flag") String flag, @Param("batchId") String batchId,
@Param("updatedAt") java.time.LocalDateTime updatedAt);
}