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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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.entity.LoadRack;
 
public interface LoadRackDao extends JpaRepository<LoadRack, Long>{
    
    @Query("select t from LoadRack t where t.machineLoad!=null and t.rackName=?1")
    public List<LoadRack> findRackName(String rackName);
    
    //查找  上片工位
    @Query("select t from LoadRack t where t.machineLoad!=null")
    public List<LoadRack> findLoads();
    
    //查找  此上片机  有任务的工位
    @Query("select t from LoadRack t where t.machineLoad=null")
    public List<LoadRack> findDiaos();
    
    //查找  此上片机工位
    @Query("select t from LoadRack t where t.machineSecondrelay.id=?1")
    public List<LoadRack> findOnlySecondrelayMachine(Long machineSecondrelay);
    
    //查找  此上片机  有任务的工位
    @Query("select t from LoadRack t where t.machineLoad.id=?1 and t.outTasks!=null")
    public List<LoadRack> findLoadMachine(Long machineLoad);
    
    //查找  此上片机  在上片工位 任务
    @Query("select t from LoadRack t where t.machineLoad.id=?1 and t.outTasks.machineStatus='铁架已到上片位'")
    public List<LoadRack> findLoadMachineTasks(Long machineLoad);
    
    //查找  此上片机  machineStatus状态下的料架
    @Query("select t from LoadRack t where t.machineLoad.id=?1 and t.outTasks.machineStatus='铁架已到上片位' and t.outTasks.workStatus=?2")
    public List<LoadRack> findLoadMachineTaskWorkStatus(Long machineLoad,String workStatus);
    
    //查找  此二次接力 正在工作的工位
    @Query("select t from LoadRack t where t.machineSecondrelay.id=?1")
    public List<LoadRack> findSecondRelays(Long machineSecondrelay);
    
    //查找  此二次接力 正在工作的工位
    @Query("select t from LoadRack t where t.machineSecondrelay.id=?1 and (t.outTasks.machineStatus='铁架已到二次接力' or t.outTasks.machineStatus='铁架退回二次接力') and t.outTasks.workStatus='正在工作'")
    public List<LoadRack> findSecondRelayTasking(Long machineSecondrelay);
    
    //查找  此二次接力 正在工作的工位
    @Query("select t from LoadRack t where t.machineSecondrelay.id=?1 and (t.outTasks.machineStatus='铁架已到二次接力' or t.outTasks.machineStatus='铁架退回二次接力') and t.outTasks.workStatus='等待中'")
    public List<LoadRack> findSecondRelayTasksa(Long machineSecondrelay);
    
    //查找  此二次接力  有任务的工位
    @Query("select t from LoadRack t where t.machineSecondrelay.id=?1 and t.outTasks.machineStatus=?2 and t.outTasks.workStatus='等待中' order by t.outTasks.id")
    public List<LoadRack> findSecondRelayTasks(Long machineSecondrelay,String machineStatus);
    
    //查找  此二次接力  补片任务工位
    @Query("select t from LoadRack t where t.machineSecondrelay.id=?1 and t.outTasks.machineStatus=?2 and t.outTasks.workStatus='等待中' and t.outTasks.taskType='在线库到上片台(补片)' order by t.outTasks.id")
    public List<LoadRack> findSecondRelayBuTasks(Long machineSecondrelay,String machineStatus);
    
    //查找此此编号工位 空工位
    @Query("select t from LoadRack t where t.number=?1 and t.outTasks=null")
    public List<LoadRack> findNumber(String number);
    
    //查找此架号是否再某工位上     outTasks.stockName
    @Query("select t from LoadRack t where t.outTasks.stockName=?1")
    public List<LoadRack> findLoadRacksTasksRacks(String stockName);
    
    //查找   t.rackName (根据目的地查找)   无任务 ,且启用的工位
    @Query("select t from LoadRack t where t.rackName=?1 and t.outTasks=null and flag='启用'")
    public List<LoadRack> findRackNames(String rackName);
    
    //查找 此任务ID在 哪个工位     outTasks.id
    @Query("select t from LoadRack t where t.outTasks.id=?1")
    public List<LoadRack> findOutTasksId(Long outTasksId);
    
}