wuyouming666
2024-04-19 4a489b6d2a512169c7422d282ec73b0b01329c44
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package com.mes.downstorage.service.impl;
 
import com.github.yulichang.query.MPJQueryWrapper;
import com.mes.downstorage.entity.DownStorageCage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.downstorage.entity.DownStorageCageDetails;
import com.mes.downstorage.mapper.DownStorageCageDetailsMapper;
import com.mes.downstorage.mapper.DownStorageCageMapper;
import com.mes.downstorage.service.DownStorageCageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Collections;
import java.util.Comparator;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhoush
 * @since 2024-03-27
 */
@Slf4j
@Service
public class DownStorageCageServiceImpl extends ServiceImpl<DownStorageCageMapper, DownStorageCage> implements DownStorageCageService {
    @Autowired
    private DownStorageCageMapper downStorageCageMapper;
    @Override
    public List<Map> gettask(){
        downStorageCageMapper.selectList(null);
//        downStorageCageMapper.selectJoin();
        return null;
    };
 
 
 
    @Override
    public List<Map> getCacheLeisure() {
        log.info(" 查询笼子内空闲");
        List<Map> map = downStorageCageMapper.selectJoinList(
                Map.class, new MPJQueryWrapper<DownStorageCageDetails>()
                        .select("escd.*")
                        .leftJoin("down_storage_cage_details escd on t.slot = escd.slot")
                        .isNull("escd.slot")
                        .orderByAsc("escd.slot")
        );
        return map;
    }
 
//    @Override
//    public List<Map> getCacheOut(int start, int end) {
//        log.info(" 根据传入的工位查询符合按照顺序和大小出片的小片");
//        List<Map> map = downStorageCageMapper.selectJoinList(
//                Map.class, new MPJQueryWrapper<DownStorageCageDetails>()
//                        .select("escd.*")
//                        .leftJoin("down_storage_cage_details escd on t.slot = escd.slot")
//                        .leftJoin("down_workstation dw on escd.flow_card_id = dw.flow_card_id")
//                        .isNotNull("escd.slot")
//                        .between("dw.workstation_id", start, end)
//                        .orderByAsc("escd.tempering_layout_id, escd.tempering_feed_sequence")
//        );
//        return map;
//    }
 
 
 
 
 
    @Override
    public List<Map> getCacheOut(int start, int end) {
        log.info("根据传入的工位查询符合按照顺序和大小出片的小片");
        List<Map> map = downStorageCageMapper.selectJoinList(
                Map.class, new MPJQueryWrapper<DownStorageCageDetails>()
                        .select("escd.*")
                        .leftJoin("down_storage_cage_details escd on t.slot = escd.slot")
                        .leftJoin("down_workstation dw on escd.flow_card_id = dw.flow_card_id")
                        .isNotNull("escd.slot")
                        .between("dw.workstation_id", start, end)
                        .orderByAsc("escd.tempering_layout_id, escd.tempering_feed_sequence")
        );
 
        // 对获取的数据列表按照宽度进行排序
        Collections.sort(map, new Comparator<Map>() {
            @Override
            public int compare(Map o1, Map o2) {
                // 获取宽度并比较
                double width1 = (double) o1.get("width");
                double width2 = (double) o2.get("width");
                return Double.compare(width2, width1);
            }
        });
 
        return map;
    }
 
 
    @Override
    public List<Map> getCacheInfo() {
        log.info(" 查询笼子内信息");
        List<Map> map = downStorageCageMapper.selectJoinList(
                Map.class, new MPJQueryWrapper<DownStorageCageDetails>()
                        .select("escd.*")
                        .leftJoin("down_storage_cage_details escd on t.slot = escd.slot")
                        .orderByAsc("t.slot")
        );
        return map;
    }
 
    @Override
    public List<Map> getIsExistIntoCacheByLayoutAndSequence(Integer tempering_layout_id, Integer tempering_feed_sequence, double width) {
        log.info(" 查询可进此片玻璃的栅格号  找到相同版图id并且大于前面的顺序的空格");
 
 
        List<Map> map = downStorageCageMapper.selectJoinList(
                Map.class, new MPJQueryWrapper<DownStorageCageDetails>()
                        .select("escd.*")
                        .leftJoin("down_storage_cage_details escd on t.slot = escd.slot")
                        .isNotNull("escd.slot")
                        .eq("escd.tempering_layout_id", tempering_layout_id)
                        .lt("escd.tempering_feed_sequence", tempering_feed_sequence)
                        .gt("t.remain_width", width)
                        .orderByAsc("escd.tempering_feed_sequence")
        );
        return map;
    }
 
    @Override
    public List<Map> getIsExistIntoCacheByLayout(Integer tempering_layout_id, double width) {
        List<Map> map = downStorageCageMapper.selectJoinList(
                Map.class, new MPJQueryWrapper<DownStorageCageDetails>()
                        .select("escd.*")
                        .leftJoin("down_storage_cage_details escd on t.slot = escd.slot")
                        .isNotNull("escd.slot")
                        .lt("escd.tempering_layout_id", tempering_layout_id)
                        .gt("t.remain_width", width)
                        .orderByDesc("escd.tempering_layout_id, escd.tempering_feed_sequence")
        );
        return map;
    }
 
 
 
 
}