disabledLocation.java
2.67 KB
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
package com.huaheng.test;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.HuaHengApplication;
import com.huaheng.pc.config.location.domain.Location;
import com.huaheng.pc.config.location.service.LocationService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List;
/**
* @author yiwenpeng
* @date 2023/7/20 09:49
*/
@Slf4j
@SpringBootTest(classes = HuaHengApplication.class)
@RunWith(SpringRunner.class)
public class disabledLocation {
@Autowired
private LocationService locationService;
@Test
public void test() {
ArrayList<Location> newLocations = new ArrayList<>();
ArrayList<Location> newLocations2 = new ArrayList<>();
ArrayList<Location> newLocations3 = new ArrayList<>();
//所有禁用库位
List<Location> lists = locationService.list(new LambdaQueryWrapper<Location>()
.eq(Location::getStatus, "disable")
.eq(Location::getZoneCode, "C"));
//所有禁用库位的右边库位
for (Location list : lists) {
Location one = locationService.getOne(new LambdaQueryWrapper<Location>()
.eq(Location::getZoneCode, "C")
.eq(Location::getILayer, list.getILayer())
.eq(Location::getIColumn, list.getIColumn() + 1)
.eq(Location::getIRow, list.getIRow()));
newLocations.add(one);
}
//右边不是G开头的容器,的库位
for (Location newLocation : newLocations) {
String containerCode = newLocation.getContainerCode();
if (!containerCode.contains("G")) {
System.err.println(newLocation.getCode());
newLocations2.add(newLocation);
}
}
//不该禁用的库位
System.out.println("***********************************");
for (Location location : newLocations2) {
Location one = locationService.getOne(new LambdaQueryWrapper<Location>()
.eq(Location::getZoneCode, "C")
.eq(Location::getILayer, location.getILayer())
.eq(Location::getIColumn, location.getIColumn() - 1)
.eq(Location::getIRow, location.getIRow()));
newLocations3.add(one);
}
for (Location location : newLocations3) {
System.out.println(location.getCode());
}
}
}