|
|
@@ -73,43 +73,43 @@ interface JobTicketDao {
|
|
|
/**
|
|
|
* 根据作业票id删除作业票数据
|
|
|
*/
|
|
|
- @Query("delete from is_job_ticket where ticket_id in (:ticketIds)")
|
|
|
+ @Query("update is_job_ticket set del_flag = 1 where ticket_id in (:ticketIds)")
|
|
|
fun deleteJobTicketByTicketIds(ticketIds: List<Long>)
|
|
|
|
|
|
/**
|
|
|
* 根据作业票id删除作业票钥匙数据
|
|
|
*/
|
|
|
- @Query("delete from is_job_ticket_key where ticket_id in (:ticketIds)")
|
|
|
+ @Query("update is_job_ticket_key set del_flag = 1 where ticket_id in (:ticketIds)")
|
|
|
fun deleteJobTicketKeyByTicketIds(ticketIds: List<Long>)
|
|
|
|
|
|
/**
|
|
|
* 根据作业票id删除作业票挂锁数据
|
|
|
*/
|
|
|
- @Query("delete from is_job_ticket_lock where ticket_id in (:ticketIds)")
|
|
|
+ @Query("update is_job_ticket_lock set del_flag = 1 where ticket_id in (:ticketIds)")
|
|
|
fun deleteJobTicketLockByTicketIds(ticketIds: List<Long>)
|
|
|
|
|
|
/**
|
|
|
* 根据作业票id删除作业票点位数据
|
|
|
*/
|
|
|
- @Query("delete from is_job_ticket_points where ticket_id in (:ticketIds)")
|
|
|
+ @Query("update is_job_ticket_points set del_flag = 1 where ticket_id in (:ticketIds)")
|
|
|
fun deleteJobTicketPointsByTicketIds(ticketIds: List<Long>)
|
|
|
|
|
|
/**
|
|
|
* 根据作业票id删除作业票步骤数据
|
|
|
*/
|
|
|
- @Query("delete from is_job_ticket_step where ticket_id in (:ticketIds)")
|
|
|
+ @Query("update is_job_ticket_step set del_flag = 1 where ticket_id in (:ticketIds)")
|
|
|
fun deleteJobTicketStepByTicketIds(ticketIds: List<Long>)
|
|
|
|
|
|
/**
|
|
|
* 根据作业票id删除作业票用户数据
|
|
|
*/
|
|
|
- @Query("delete from is_job_ticket_user where ticket_id in (:ticketIds)")
|
|
|
+ @Query("update is_job_ticket_user set del_flag = 1 where ticket_id in (:ticketIds)")
|
|
|
fun deleteJobTicketUserByTicketIds(ticketIds: List<Long>)
|
|
|
|
|
|
/**
|
|
|
* 根据用户id删除作业票用户数据
|
|
|
*/
|
|
|
- @Query("delete from is_job_ticket_user where user_id in (:userIds)")
|
|
|
+ @Query("update is_job_ticket_user set del_flag = 1 where user_id in (:userIds)")
|
|
|
fun deleteJobTicketUserByUserIds(userIds: List<Long>)
|
|
|
|
|
|
/**
|
|
|
@@ -129,6 +129,7 @@ interface JobTicketDao {
|
|
|
remark
|
|
|
FROM is_job_ticket ijt
|
|
|
WHERE (:isAdmin = 1 OR ex_status is NUll or ex_status NOT IN (:exStatusList))
|
|
|
+ and ijt.del_flag = 0
|
|
|
ORDER BY update_time DESC
|
|
|
LIMIT :size OFFSET :offset
|
|
|
"""
|
|
|
@@ -207,6 +208,7 @@ interface JobTicketDao {
|
|
|
remark
|
|
|
from is_job_ticket ijt
|
|
|
where ticket_id = :ticketId
|
|
|
+ and ijt.del_flag = 0
|
|
|
"""
|
|
|
)
|
|
|
fun getTicketDataByTicketId(ticketId: Long): JobTicketManageVo?
|
|
|
@@ -350,7 +352,8 @@ interface JobTicketDao {
|
|
|
"select count(1) from is_job_ticket where ticket_status in ('1','2','3','4','7') " +
|
|
|
"AND (:workstationId IS NULL OR trim(:workstationId) = '' OR workstation_id = :workstationId) " +
|
|
|
"AND (:modeId IS NULL OR trim(:modeId) = '' OR mode_id = :modeId) " +
|
|
|
- "AND (ex_status is NULL or ex_status not in (:exStatusList))"
|
|
|
+ "AND (ex_status is NULL or ex_status not in (:exStatusList)) " +
|
|
|
+ "and del_flag = 0"
|
|
|
)
|
|
|
fun getInProgressJobSize(workstationId: Long?, modeId: Long?, exStatusList: List<String>): Int
|
|
|
|
|
|
@@ -359,7 +362,7 @@ interface JobTicketDao {
|
|
|
*/
|
|
|
@Query(
|
|
|
"""select count(1) from is_job_ticket ijt
|
|
|
- where ijt.ticket_status in (1,2,3,4,7) and (:isAdmin = 1 OR ex_status is NUll or ex_status NOT IN (:exStatusList))
|
|
|
+ where ijt.ticket_status in (1,2,3,4,7) and (:isAdmin = 1 OR ex_status is NUll or ex_status NOT IN (:exStatusList)) and ijt.del_flag = 0
|
|
|
"""
|
|
|
)
|
|
|
fun getInProgressJobSize(
|
|
|
@@ -371,7 +374,7 @@ interface JobTicketDao {
|
|
|
* 获取所有作业数量
|
|
|
*/
|
|
|
@Query(
|
|
|
- "select count(1) from is_job_ticket where (:workstationId IS NULL OR trim(:workstationId) = '' OR workstation_id = :workstationId) " + "AND (:startTime IS NULL OR trim(:startTime) = '' OR (create_time >= :startTime OR update_time >= :startTime)) " + "AND (:endTime IS NULL OR trim(:endTime) = '' OR (create_time <= :endTime OR update_time <= :endTime)) "
|
|
|
+ "select count(1) from is_job_ticket where (:workstationId IS NULL OR trim(:workstationId) = '' OR workstation_id = :workstationId) " + "AND (:startTime IS NULL OR trim(:startTime) = '' OR (create_time >= :startTime OR update_time >= :startTime)) " + "AND (:endTime IS NULL OR trim(:endTime) = '' OR (create_time <= :endTime OR update_time <= :endTime)) and del_flag = 0"
|
|
|
)
|
|
|
fun getAllJobSize(workstationId: Long?, startTime: String?, endTime: String?): Int
|
|
|
|
|
|
@@ -391,6 +394,7 @@ interface JobTicketDao {
|
|
|
left join is_job_ticket ijt on ijtp.ticket_id=ijt.ticket_id
|
|
|
left join is_isolation_point iip on iip.point_id = ijtp.point_id
|
|
|
where ijtp.point_status = "1" and ijt.ticket_status in ('1','2','3','4','5','7')
|
|
|
+ and ijt.del_flag = 0
|
|
|
order by ijtp.update_time desc
|
|
|
limit :size offset :offset
|
|
|
"""
|
|
|
@@ -412,6 +416,7 @@ interface JobTicketDao {
|
|
|
left join is_job_ticket ijt on ijtp.ticket_id=ijt.ticket_id
|
|
|
left join is_isolation_point iip on iip.point_id = ijtp.point_id
|
|
|
where ijtp.point_status = "1" and ijt.ticket_status in ('1','2','3','4','5','7')
|
|
|
+ and ijt.del_flag = 0
|
|
|
order by ijtp.update_time desc
|
|
|
"""
|
|
|
)
|
|
|
@@ -442,6 +447,7 @@ interface JobTicketDao {
|
|
|
and k.group_id = p.group_id
|
|
|
and k.ticket_type = 0
|
|
|
and j.ticket_id != :ticketId
|
|
|
+ and j.del_flag = 0
|
|
|
GROUP BY
|
|
|
j.ticket_id
|
|
|
"""
|
|
|
@@ -488,6 +494,7 @@ interface JobTicketDao {
|
|
|
AND p.point_id =:pointId
|
|
|
AND p.lock_id = :lockId
|
|
|
AND p.ticket_id != :ticketId
|
|
|
+ and t.del_flag = 0
|
|
|
"""
|
|
|
)
|
|
|
fun
|
|
|
@@ -516,7 +523,7 @@ interface JobTicketDao {
|
|
|
/**
|
|
|
* 获取所有进行中的作业
|
|
|
*/
|
|
|
- @Query("select * from is_job_ticket where ticket_status in ('1','2','3','4','7')")
|
|
|
+ @Query("select * from is_job_ticket where ticket_status in ('1','2','3','4','7') and del_flag = 0")
|
|
|
fun getAllInProgressJob(): List<IsJobTicket>
|
|
|
|
|
|
/**
|
|
|
@@ -541,6 +548,7 @@ interface JobTicketDao {
|
|
|
JOIN is_job_ticket AS t
|
|
|
ON p.ticket_id = t.ticket_id
|
|
|
WHERE p.point_id IN (:workstationPointIds)
|
|
|
+ and t.del_flag = 0
|
|
|
-- 1) 最新已结束的那条
|
|
|
AND p.update_time = (
|
|
|
SELECT MAX(p2.update_time)
|
|
|
@@ -550,6 +558,7 @@ interface JobTicketDao {
|
|
|
WHERE p2.point_id = p.point_id
|
|
|
AND t2.ticket_status = 5
|
|
|
AND t2.ex_status is null
|
|
|
+ and t2.del_flag = 0
|
|
|
)
|
|
|
-- 2) 最新那条的状态必须是“上锁”
|
|
|
AND p.point_status = 1
|
|
|
@@ -562,6 +571,7 @@ interface JobTicketDao {
|
|
|
WHERE p3.point_id = p.point_id
|
|
|
AND t3.ticket_status <> 5
|
|
|
AND t3.ex_status is null
|
|
|
+ and t3.del_flag = 0
|
|
|
)
|
|
|
"""
|
|
|
)
|
|
|
@@ -577,6 +587,7 @@ interface JobTicketDao {
|
|
|
where ijtp.point_status = "1"
|
|
|
and ijt.ex_status is not null
|
|
|
and ijtp.point_id in (:workstationPointIds)
|
|
|
+ and ijt.del_flag = 0
|
|
|
"""
|
|
|
)
|
|
|
fun getAllLockedPointDataWithExceptionJob(workstationPointIds: List<Long>): List<IsJobTicketPoints>
|
|
|
@@ -592,6 +603,7 @@ interface JobTicketDao {
|
|
|
and ijt.ticket_status in ('1','2','3','4','7')
|
|
|
and (:selectedWorkflowMode IS NULL OR trim(:selectedWorkflowMode) = '' OR ijt.mode_id=:selectedWorkflowMode)
|
|
|
and (:realTimeDataZoneId IS NULL OR trim(:realTimeDataZoneId) = '' OR ijt.workstation_id = :realTimeDataZoneId)
|
|
|
+ and ijt.del_flag = 0
|
|
|
group by ijtp.point_id
|
|
|
"""
|
|
|
)
|
|
|
@@ -607,6 +619,7 @@ interface JobTicketDao {
|
|
|
where ijt.ticket_status in ('1','2','3','4','7')
|
|
|
and (:workflowModeId IS NULL OR trim(:workflowModeId) = '' OR ijt.mode_id = :workflowModeId)
|
|
|
and (:workstationId IS NULL OR trim(:workstationId) = '' OR ijt.workstation_id = :workstationId)
|
|
|
+ and ijt.del_flag = 0
|
|
|
group by ijtp.lock_id
|
|
|
"""
|
|
|
)
|
|
|
@@ -615,7 +628,7 @@ interface JobTicketDao {
|
|
|
/**
|
|
|
* 根据sopId获取作业
|
|
|
*/
|
|
|
- @Query("select * from is_job_ticket where sop_id in (:sopIds)")
|
|
|
+ @Query("select * from is_job_ticket where sop_id in (:sopIds) and del_flag = 0")
|
|
|
fun getTicketBySopIds(sopIds: List<Long>): List<IsJobTicket>
|
|
|
|
|
|
/**
|
|
|
@@ -627,6 +640,7 @@ interface JobTicketDao {
|
|
|
from is_job_ticket ijt
|
|
|
left join is_job_ticket_points ijtp on ijt.ticket_id = ijtp.ticket_id
|
|
|
where ijtp.point_id in (:pointIds) and ijtp.ticket_id != :ticketId and ijt.ticket_status in ('1','2','3','4','7')
|
|
|
+ and ijt.del_flag = 0
|
|
|
"""
|
|
|
)
|
|
|
fun getProgressTicketIdsByPointsAndExceptTicketId(
|
|
|
@@ -674,7 +688,7 @@ interface JobTicketDao {
|
|
|
/**
|
|
|
* 根据作业id删除分组
|
|
|
*/
|
|
|
- @Query("delete from is_job_ticket_group where ticket_id in (:ticketIds)")
|
|
|
+ @Query("update is_job_ticket_group set deleted = 1 where ticket_id in (:ticketIds)")
|
|
|
fun deleteJobTicketGroupByTicketIds(ticketIds: List<Long>)
|
|
|
|
|
|
/**
|
|
|
@@ -697,6 +711,7 @@ interface JobTicketDao {
|
|
|
su.user_id = :userId -- 是创建者
|
|
|
OR ijtu.user_id = :userId -- 是参与人
|
|
|
)
|
|
|
+ and ijt.del_flag = 0
|
|
|
"""
|
|
|
)
|
|
|
fun getTicketThatUserJoin(userId: Long): List<IsJobTicket>
|
|
|
@@ -737,7 +752,7 @@ interface JobTicketDao {
|
|
|
/**
|
|
|
* 检查sop是否有进行中的作业
|
|
|
*/
|
|
|
- @Query("select count(1) from is_job_ticket where sop_id = :sopId and ticket_status in ('1','2','3','4','7')")
|
|
|
+ @Query("select count(1) from is_job_ticket where sop_id = :sopId and ticket_status in ('1','2','3','4','7') and del_flag = 0")
|
|
|
fun checkSopHasJobInProgress(sopId: Long): Int
|
|
|
|
|
|
/**
|
|
|
@@ -802,6 +817,7 @@ interface JobTicketDao {
|
|
|
select * from is_job_ticket_points ijtp
|
|
|
left join is_job_ticket ijt on ijtp.ticket_id = ijt.ticket_id
|
|
|
where ijt.ticket_status in ('1','2','3','4','7')
|
|
|
+ and ijt.del_flag = 0
|
|
|
"""
|
|
|
)
|
|
|
fun getAllInUsePoints(): List<IsJobTicketPoints>
|
|
|
@@ -809,19 +825,19 @@ interface JobTicketDao {
|
|
|
/**
|
|
|
* 检查用户是否在作业中
|
|
|
*/
|
|
|
- @Query("select count(1) from is_job_ticket ijt left join is_job_ticket_user ijtu on ijt.ticket_id = ijtu.ticket_id left join sys_user su on ijt.create_by = su.user_name where (su.user_id in (:userIds) or ijtu.user_id in (:userIds)) and ijt.ticket_status in ('1','2','3','4','7') ")
|
|
|
+ @Query("select count(1) from is_job_ticket ijt left join is_job_ticket_user ijtu on ijt.ticket_id = ijtu.ticket_id left join sys_user su on ijt.create_by = su.user_name where (su.user_id in (:userIds) or ijtu.user_id in (:userIds)) and ijt.ticket_status in ('1','2','3','4','7') and ijt.del_flag = 0")
|
|
|
fun checkUserInProgressJob(userIds: List<Long>): Int
|
|
|
|
|
|
/**
|
|
|
* 检查挂锁是否在使用
|
|
|
*/
|
|
|
- @Query("select count(1) from is_job_ticket ijt left join is_job_ticket_points ijtp on ijt.ticket_id = ijtp.ticket_id where ijtp.lock_id in (:lockIds) and ijt.ticket_status in ('1','2','3','4','7')")
|
|
|
+ @Query("select count(1) from is_job_ticket ijt left join is_job_ticket_points ijtp on ijt.ticket_id = ijtp.ticket_id where ijtp.lock_id in (:lockIds) and ijt.ticket_status in ('1','2','3','4','7') and ijt.del_flag = 0")
|
|
|
fun checkLockInUse(lockIds: List<Long>): Int
|
|
|
|
|
|
/**
|
|
|
* 检查钥匙是否在使用
|
|
|
*/
|
|
|
- @Query("select count(1) from is_job_ticket ijt left join is_job_ticket_key ijtk on ijt.ticket_id = ijtk.ticket_id where ijtk.key_id in (:keyIds) and ijtk.collect_time is not null and ijtk.give_back_time is null and ijt.ticket_status in ('1','2','3','4','7')")
|
|
|
+ @Query("select count(1) from is_job_ticket ijt left join is_job_ticket_key ijtk on ijt.ticket_id = ijtk.ticket_id where ijtk.key_id in (:keyIds) and ijtk.collect_time is not null and ijtk.give_back_time is null and ijt.ticket_status in ('1','2','3','4','7') and ijt.del_flag = 0")
|
|
|
fun checkKeyInUse(keyIds: List<Long>): Int
|
|
|
|
|
|
/**
|