| | |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProTaskStatusEnum; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | |
| | | @Mapper |
| | | public interface MesProTaskMapper extends BaseMapperX<MesProTaskDO> { |
| | | |
| | | @Select({"<script>", |
| | | "SELECT t.workstation_id AS workstationId, COUNT(*) AS pendingCount FROM mes_pro_task t", |
| | | "WHERE t.deleted = 0 AND t.workstation_id IS NOT NULL AND t.status IN (#{prepare}, #{producing}, #{partial}, #{paused})", |
| | | "<if test='assigneeId != null'>AND EXISTS (SELECT 1 FROM mes_pro_task_assignee a", |
| | | "WHERE a.task_id=t.id AND a.user_id=#{assigneeId} AND a.deleted=0)</if>", |
| | | "GROUP BY t.workstation_id", "</script>"}) |
| | | java.util.List<cn.iocoder.yudao.module.mes.controller.admin.pro.task.vo.MesProWorkstationPendingCountVO> selectPendingCounts( |
| | | @Param("assigneeId") Long assigneeId, @Param("prepare") Integer prepare, |
| | | @Param("producing") Integer producing, @Param("partial") Integer partial, @Param("paused") Integer paused); |
| | | |
| | | /** 所有排产写入口以相同顺序锁定工作站;事务提交后释放,跨进程防止资源竞态。 */ |
| | | @org.apache.ibatis.annotations.Select("SELECT id FROM mes_md_workstation WHERE deleted = 0 ORDER BY id FOR UPDATE") |
| | | List<Long> lockSchedulingResources(); |