package com.klp.aps.mapper; import com.klp.aps.domain.entity.ApsScheduleChangeLogEntity; import com.klp.aps.domain.entity.ApsScheduleOperationEntity; import com.klp.aps.domain.row.ApsLineCapabilityRow; import com.klp.aps.domain.row.ApsLineMetaRow; import com.klp.aps.domain.row.ApsOrderDetailRow; import com.klp.aps.domain.row.ApsPlanDetailRow; import com.klp.aps.domain.row.ApsProductMetaRow; import com.klp.aps.domain.row.ApsSchedulePlanRow; import com.klp.aps.domain.row.ApsShiftSlotRow; import org.apache.ibatis.annotations.Param; import java.time.LocalDateTime; import java.time.LocalDate; import java.util.List; public interface ApsAutoScheduleMapper { ApsSchedulePlanRow selectPlanByIdForUpdate(@Param("planId") Long planId); List selectOrderDetailsByOrderId(@Param("orderId") Long orderId); List selectPlanDetailsByPlanId(@Param("planId") Long planId); List selectLineCandidatesByProductAndLine(@Param("productId") Long productId, @Param("lineId") Long lineId); ApsLineMetaRow selectLineMetaById(@Param("lineId") Long lineId); ApsProductMetaRow selectProductMetaById(@Param("productId") Long productId); List selectAvailableShifts(@Param("lineId") Long lineId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate); Long selectPlanDetailId(@Param("planId") Long planId, @Param("taskId") Long taskId); int deleteUnlockedOperationsByPlanId(@Param("planId") Long planId); /** * 返回冲突记录的 end_time(若无冲突返回 null) */ LocalDateTime selectFirstConflictEndTime(@Param("lineId") Long lineId, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("excludeOperationId") Long excludeOperationId); /** * 返回命中锁定的 lock_end_time(若未命中返回 null) */ LocalDateTime selectFirstHitLockEndTime(@Param("lineId") Long lineId, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("planId") Long planId, @Param("excludeOperationId") Long excludeOperationId); int insertOperation(ApsScheduleOperationEntity op); int insertChangeLog(ApsScheduleChangeLogEntity log); int updatePlanStatus(@Param("planId") Long planId, @Param("status") Integer status, @Param("updateBy") String updateBy); }