廖井涛
2025-06-11 42154214c5698326710edf336b3148830b646bb2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.northglass.repository;
 
import java.util.List;
 
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
 
import com.northglass.constants.ShelfTaskType;
import com.northglass.constants.StateConstants.ShelfTaskState;
import com.northglass.entity.ShelfTask;
 
public interface ShelfTaskDao extends JpaRepository<ShelfTask, Long>{
 
    /*@Query("select t from RawPackage t where t.fileName = '052-123' and t.fileUrl = '1' and t.state = '已下发' and t.operator = '1' and t.createTime = '2021-09-22 13:22:18' and t.receiveTime = '2021-09-22 13:22:21' ")
    public List<RawPackage> findMachineDispose();*/
    @Query("select t from ShelfTask t where t.taskId = ?1")
    public ShelfTask findtaskid(long taskid);
    
    @Query("select t from ShelfTask t where t.taskState = '等待中'")
    public List<ShelfTask> findWaitingTasks();
    
    @Query("select count(t) from ShelfTask t where (t.taskState = '等待中' or t.taskState = '正在工作') and t.loadRack=?1 and t.shelfRack.id=?2 and t.taskType='从仓位到上片位'")
    public int pandian(String loadid,Long shelfranid);
    
    @Query("select t from ShelfTask t where t.taskState = '已完成'")
    public List<ShelfTask> findCompletedTasks();
 
    @Query("select t from ShelfTask t where t.taskState = '正在工作'")
    public List<ShelfTask> findInWorkTask1();
    
    @Query("select t from ShelfTask t where t.taskState = '正在工作' ")
    public ShelfTask findInWorkTask();
    
    @Query("select t from ShelfTask t where t.rawFile.id = ?1")
    public ShelfTask findbyfile(long id);
    
    @Query("select t from ShelfTask t where t.rawFile.id = ?1")
    public List<ShelfTask> findbyfilelist(long id);
    
    @Query("select t from ShelfTask t where t.taskState='等待中' and t.groups is not null")
    public List<ShelfTask> findWaitingTasksByFlag();
    
    @Query("select t from ShelfTask t where t.taskState='正在工作' and t.groups is not null")
    public ShelfTask findInWorkTasksByFlag();
    
    @Query("select t from ShelfTask t where (t.taskType = '从吊装位到仓位' or t.taskType = '从仓位到吊装位') and t.taskState = '等待中'")
    public List<ShelfTask> findShelfTaskFromShelfRackToHoist();
    
    @Query("select t from ShelfTask t where  (t.taskState = '等待中' or t.taskState = '正在工作') and t.loadRack= ?1")
    public List<ShelfTask> selectloadMachineId(String id);
    
    @Query("select max(t.taskId) from ShelfTask t  ")
    public Long findtaskid();
}