rev: 压机送料上下分配规则

This commit is contained in:
2023-09-12 15:37:04 +08:00
parent 725e32bff3
commit 7882eb9907
3 changed files with 59 additions and 8 deletions

View File

@@ -7,6 +7,8 @@ import org.nl.wms.ext.mes.service.dto.MesMudConsumptionDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @Author: lyd
* @Description:
@@ -19,8 +21,39 @@ public class TestDemo {
private MesRequestMapper mesRequestMapper;
@Autowired
private WmsToMesService wmsToMesService;
private static AtomicInteger countUp = new AtomicInteger(0); // 上层数量
private static AtomicInteger countLower = new AtomicInteger(0); // 下层数量
@Test
public void test01() {
wmsToMesService.reportProductData("1701105828406366210");
for (int i = 0; i < 13; i++) {
toAdd();
int up = countUp.get();
int lower = countLower.get();
if (lower == 0 || lower != 5) {
countLower.incrementAndGet();
} else {
countUp.incrementAndGet();
}
if (up == 4) {
countLower = new AtomicInteger(0);
}
if (lower == 4 && up == 4) {
countUp = new AtomicInteger(0);
}
}
}
public void toAdd() {
int up = countUp.get();
int lower = countLower.get();
boolean isASC = false;
if (lower == 0 || lower != 5) {
isASC = true;
}
if (isASC) {
System.out.println("下面第" + lower + "");
} else {
System.out.println("上面第" + up + "");
}
}
}