现场调度修改
This commit is contained in:
@@ -182,41 +182,79 @@ public class MydoJobServiceImpl implements IMydoJobService
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, List<MydoJobScreen>> selectJobListByWarehouseIdAndType(String warehouseId, String type) {
|
public Map<String, List<MydoJobScreen>> selectJobListByWarehouseIdAndType(String warehouseId, String type) {
|
||||||
Map<String, List<MydoJobScreen>> map = new HashMap<>();
|
Map<String, List<MydoJobScreen>> map = new HashMap<>();
|
||||||
map.put("1",new ArrayList<>());
|
if ("01".equals(warehouseId)){
|
||||||
map.put("2",new ArrayList<>());
|
map.put("1",new ArrayList<>());
|
||||||
map.put("3",new ArrayList<>());
|
map.put("2",new ArrayList<>());
|
||||||
map.put("4",new ArrayList<>());
|
map.put("3",new ArrayList<>());
|
||||||
map.put("5",new ArrayList<>());
|
MydoJob outParam = new MydoJob();
|
||||||
map.put("6",new ArrayList<>());
|
outParam.setWarehouseId(warehouseId);
|
||||||
MydoJob outParam = new MydoJob();
|
outParam.setExitId(type);
|
||||||
outParam.setWarehouseId(warehouseId);
|
List<MydoJobScreen> outMydoJobs = mydoJobMapper.selectJobListByWarehouseIdAndType(outParam);
|
||||||
outParam.setExitId(type);
|
if (CollUtil.isNotEmpty(outMydoJobs)){
|
||||||
List<MydoJobScreen> outMydoJobs = mydoJobMapper.selectJobListByWarehouseIdAndType(outParam);
|
Map<String, List<MydoJobScreen>> collect = outMydoJobs.stream().collect(Collectors.groupingBy(MydoJobScreen::getRoadwayId));
|
||||||
if (CollUtil.isNotEmpty(outMydoJobs)){
|
for (String roadwayId : collect.keySet()) {
|
||||||
Map<String, List<MydoJobScreen>> collect = outMydoJobs.stream().collect(Collectors.groupingBy(MydoJobScreen::getRoadwayId));
|
if (map.containsKey(roadwayId)){
|
||||||
for (String roadwayId : collect.keySet()) {
|
List<MydoJobScreen> mydoJobs = map.get(roadwayId);
|
||||||
if (map.containsKey(roadwayId)){
|
mydoJobs.addAll(collect.get(roadwayId));
|
||||||
List<MydoJobScreen> mydoJobs = map.get(roadwayId);
|
map.put(roadwayId,mydoJobs);
|
||||||
mydoJobs.addAll(collect.get(roadwayId));
|
}
|
||||||
map.put(roadwayId,mydoJobs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
MydoJob inParam = new MydoJob();
|
||||||
MydoJob inParam = new MydoJob();
|
inParam.setWarehouseId(warehouseId);
|
||||||
inParam.setWarehouseId(warehouseId);
|
inParam.setEntranceId(type);
|
||||||
inParam.setEntranceId(type);
|
List<MydoJobScreen> inMydoJobs = mydoJobMapper.selectJobListByWarehouseIdAndType(inParam);
|
||||||
List<MydoJobScreen> inMydoJobs = mydoJobMapper.selectJobListByWarehouseIdAndType(inParam);
|
if (CollUtil.isNotEmpty(inMydoJobs)) {
|
||||||
if (CollUtil.isNotEmpty(inMydoJobs)) {
|
Map<String, List<MydoJobScreen>> collect = inMydoJobs.stream().collect(Collectors.groupingBy(MydoJobScreen::getRoadwayId));
|
||||||
Map<String, List<MydoJobScreen>> collect = inMydoJobs.stream().collect(Collectors.groupingBy(MydoJobScreen::getRoadwayId));
|
for (String roadwayId : collect.keySet()) {
|
||||||
for (String roadwayId : collect.keySet()) {
|
if (map.containsKey(roadwayId)){
|
||||||
if (map.containsKey(roadwayId)){
|
List<MydoJobScreen> mydoJobs = map.get(roadwayId);
|
||||||
List<MydoJobScreen> mydoJobs = map.get(roadwayId);
|
mydoJobs.addAll(collect.get(roadwayId));
|
||||||
mydoJobs.addAll(collect.get(roadwayId));
|
map.put(roadwayId,mydoJobs);
|
||||||
map.put(roadwayId,mydoJobs);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return map;
|
||||||
|
}else {
|
||||||
|
map.put("1",new ArrayList<>());
|
||||||
|
map.put("2",new ArrayList<>());
|
||||||
|
map.put("3",new ArrayList<>());
|
||||||
|
map.put("4",new ArrayList<>());
|
||||||
|
map.put("5",new ArrayList<>());
|
||||||
|
map.put("6",new ArrayList<>());
|
||||||
|
MydoJob outParam = new MydoJob();
|
||||||
|
outParam.setWarehouseId(warehouseId);
|
||||||
|
outParam.setExitId(type);
|
||||||
|
List<MydoJobScreen> outMydoJobs = mydoJobMapper.selectJobListByWarehouseIdAndType(outParam);
|
||||||
|
if (CollUtil.isNotEmpty(outMydoJobs)){
|
||||||
|
Map<String, List<MydoJobScreen>> collect = outMydoJobs.stream().collect(Collectors.groupingBy(MydoJobScreen::getRoadwayId));
|
||||||
|
for (String roadwayId : collect.keySet()) {
|
||||||
|
if (map.containsKey(roadwayId)){
|
||||||
|
List<MydoJobScreen> mydoJobs = map.get(roadwayId);
|
||||||
|
mydoJobs.addAll(collect.get(roadwayId));
|
||||||
|
map.put(roadwayId,mydoJobs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MydoJob inParam = new MydoJob();
|
||||||
|
inParam.setWarehouseId(warehouseId);
|
||||||
|
inParam.setEntranceId(type);
|
||||||
|
List<MydoJobScreen> inMydoJobs = mydoJobMapper.selectJobListByWarehouseIdAndType(inParam);
|
||||||
|
if (CollUtil.isNotEmpty(inMydoJobs)) {
|
||||||
|
Map<String, List<MydoJobScreen>> collect = inMydoJobs.stream().collect(Collectors.groupingBy(MydoJobScreen::getRoadwayId));
|
||||||
|
for (String roadwayId : collect.keySet()) {
|
||||||
|
if (map.containsKey(roadwayId)){
|
||||||
|
List<MydoJobScreen> mydoJobs = map.get(roadwayId);
|
||||||
|
mydoJobs.addAll(collect.get(roadwayId));
|
||||||
|
map.put(roadwayId,mydoJobs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.put("1",map.get("4"));
|
||||||
|
map.put("2",map.get("5"));
|
||||||
|
map.put("3",map.get("6"));
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
return map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -178,11 +178,14 @@ public class ScheduleThread {
|
|||||||
plcDdj4ReadCustomThread.getThread().start();
|
plcDdj4ReadCustomThread.getThread().start();
|
||||||
|
|
||||||
}
|
}
|
||||||
/*plcDdj2ReadCustomThread.getThread().start();
|
if (plcDdj5ReadCustomThread!=null){
|
||||||
plcDdj3ReadCustomThread.getThread().start();
|
plcDdj5ReadCustomThread.getThread().start();
|
||||||
plcDdj4ReadCustomThread.getThread().start();
|
|
||||||
plcDdj5ReadCustomThread.getThread().start();
|
}
|
||||||
plcDdj6ReadCustomThread.getThread().start();*/
|
/*if (plcDdj6ReadCustomThread!=null){
|
||||||
|
plcDdj6ReadCustomThread.getThread().start();
|
||||||
|
|
||||||
|
}*/
|
||||||
isRun = true;
|
isRun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,11 +210,14 @@ public class ScheduleThread {
|
|||||||
ddj4CustomThread.thread.start();
|
ddj4CustomThread.thread.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
/*ddj2CustomThread.thread.start();
|
if (ddj5CustomThread!=null){
|
||||||
ddj3CustomThread.thread.start();
|
ddj5CustomThread.thread.start();
|
||||||
ddj4CustomThread.thread.start();
|
|
||||||
ddj5CustomThread.thread.start();
|
}
|
||||||
ddj6CustomThread.thread.start();*/
|
/*if (ddj6CustomThread!=null){
|
||||||
|
ddj6CustomThread.thread.start();
|
||||||
|
|
||||||
|
}*/
|
||||||
isRun2 = true;
|
isRun2 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,11 +230,15 @@ public class ScheduleThread {
|
|||||||
plcDdj1ReadCustomThread.runnable.isRun = false;
|
plcDdj1ReadCustomThread.runnable.isRun = false;
|
||||||
plcDdj1ReadCustomThread.thread.interrupt();
|
plcDdj1ReadCustomThread.thread.interrupt();
|
||||||
plcDdj2ReadCustomThread.runnable.isRun = false;
|
plcDdj2ReadCustomThread.runnable.isRun = false;
|
||||||
|
plcDdj2ReadCustomThread.thread.interrupt();
|
||||||
plcDdj3ReadCustomThread.runnable.isRun = false;
|
plcDdj3ReadCustomThread.runnable.isRun = false;
|
||||||
|
plcDdj3ReadCustomThread.thread.interrupt();
|
||||||
plcDdj4ReadCustomThread.runnable.isRun = false;
|
plcDdj4ReadCustomThread.runnable.isRun = false;
|
||||||
plcDdj4ReadCustomThread.thread.interrupt();
|
plcDdj4ReadCustomThread.thread.interrupt();
|
||||||
plcDdj5ReadCustomThread.runnable.isRun = false;
|
plcDdj5ReadCustomThread.runnable.isRun = false;
|
||||||
plcDdj6ReadCustomThread.runnable.isRun = false;
|
plcDdj5ReadCustomThread.thread.interrupt();
|
||||||
|
/*plcDdj6ReadCustomThread.runnable.isRun = false;
|
||||||
|
plcDdj6ReadCustomThread.thread.interrupt();*/
|
||||||
plcReadInit();
|
plcReadInit();
|
||||||
isRun = false;
|
isRun = false;
|
||||||
}
|
}
|
||||||
@@ -239,8 +249,18 @@ public class ScheduleThread {
|
|||||||
public void stopAllThread2() {
|
public void stopAllThread2() {
|
||||||
monitoringCustomThread.runnable.isRun = false;
|
monitoringCustomThread.runnable.isRun = false;
|
||||||
monitoringCustomThread.thread.interrupt();
|
monitoringCustomThread.thread.interrupt();
|
||||||
|
ddj1CustomThread.runnable.isRun = false;
|
||||||
|
ddj1CustomThread.thread.interrupt();
|
||||||
|
ddj2CustomThread.runnable.isRun = false;
|
||||||
|
ddj2CustomThread.thread.interrupt();
|
||||||
|
ddj3CustomThread.runnable.isRun = false;
|
||||||
|
ddj3CustomThread.thread.interrupt();
|
||||||
ddj4CustomThread.runnable.isRun = false;
|
ddj4CustomThread.runnable.isRun = false;
|
||||||
ddj4CustomThread.thread.interrupt();
|
ddj4CustomThread.thread.interrupt();
|
||||||
|
ddj5CustomThread.runnable.isRun = false;
|
||||||
|
ddj5CustomThread.thread.interrupt();
|
||||||
|
/*ddj6CustomThread.runnable.isRun = false;
|
||||||
|
ddj6CustomThread.thread.interrupt();*/
|
||||||
scheduleInit();
|
scheduleInit();
|
||||||
isRun2 = false;
|
isRun2 = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,20 +43,32 @@ public class Ddj5Thread extends BaseDdjThread {
|
|||||||
ssjList.put("outSsj2", outSsj2);
|
ssjList.put("outSsj2", outSsj2);
|
||||||
|
|
||||||
//初始化巷道口 排 列 层
|
//初始化巷道口 排 列 层
|
||||||
roadwayMap.put("L1003", Arrays.asList(1, 1, 1));
|
roadwayMap.put("L1003", Arrays.asList(1, 0, 1));
|
||||||
roadwayMap.put("L1004", Arrays.asList(2, 1, 1));
|
roadwayMap.put("L1004", Arrays.asList(2, 0, 1));
|
||||||
|
//未扫码 回退任务号 无入库任务在此基础+100
|
||||||
roadwayRollback.put("L1003", 94);
|
roadwayRollback.put("L1003", 94);
|
||||||
roadwayRollback.put("L1004", 95);
|
roadwayRollback.put("L1004", 95);
|
||||||
|
|
||||||
|
//初始化称重设备连接ip port
|
||||||
|
czRoadwayMap.put("L1003", "172.19.40.216:4001");
|
||||||
|
czRoadwayMap.put("L1004", "172.19.40.217:4001");
|
||||||
|
|
||||||
|
/*czOverMap.put("L1003", "DB502.12");
|
||||||
|
czOverMap.put("L1004", "DB502.26");*/
|
||||||
|
|
||||||
|
outJobMap.put("L1003", "DB502.38");
|
||||||
|
outJobMap.put("L1004", "DB502.52");
|
||||||
|
|
||||||
log.info("Ddj5Thread init");
|
log.info("Ddj5Thread init");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<String, Object> getParamMap(String trayCode,Integer height,double weight) {
|
public HashMap<String, Object> getParamMap(String trayCode,Integer height,double weight) {
|
||||||
HashMap<String, Object> paramMap = new HashMap<>();
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
paramMap.put("trayCode", trayCode);
|
paramMap.put("trayCode", trayCode);
|
||||||
paramMap.put("warehouseId",WAREHOUSE_02);
|
paramMap.put("warehouseId",WAREHOUSE_02);
|
||||||
paramMap.put("roadwayId",ROADWAY_ID_02);
|
paramMap.put("roadwayId",ROADWAY_ID_05);
|
||||||
paramMap.put("height",height);
|
paramMap.put("height",height);
|
||||||
paramMap.put("weight",weight);
|
paramMap.put("weight",weight);
|
||||||
return paramMap;
|
return paramMap;
|
||||||
@@ -66,7 +78,7 @@ public class Ddj5Thread extends BaseDdjThread {
|
|||||||
public MydoJob getOutJobParam() {
|
public MydoJob getOutJobParam() {
|
||||||
MydoJob mydoJob = new MydoJob();
|
MydoJob mydoJob = new MydoJob();
|
||||||
mydoJob.setWarehouseId(WAREHOUSE_02);
|
mydoJob.setWarehouseId(WAREHOUSE_02);
|
||||||
mydoJob.setRoadwayId(String.valueOf(ROADWAY_ID_02));
|
mydoJob.setRoadwayId(String.valueOf(ROADWAY_ID_05));
|
||||||
mydoJob.setStatus("1");
|
mydoJob.setStatus("1");
|
||||||
|
|
||||||
return mydoJob;
|
return mydoJob;
|
||||||
|
|||||||
@@ -43,11 +43,22 @@ public class Ddj6Thread extends BaseDdjThread {
|
|||||||
ssjList.put("outSsj2", outSsj2);
|
ssjList.put("outSsj2", outSsj2);
|
||||||
|
|
||||||
//初始化巷道口 排 列 层
|
//初始化巷道口 排 列 层
|
||||||
roadwayMap.put("L1005", Arrays.asList(1, 1, 1));
|
roadwayMap.put("L1005", Arrays.asList(1, 0, 1));
|
||||||
roadwayMap.put("L1006", Arrays.asList(2, 1, 1));
|
roadwayMap.put("L1006", Arrays.asList(2, 0, 1));
|
||||||
|
//未扫码 回退任务号 无入库任务在此基础+100
|
||||||
roadwayRollback.put("L1005", 96);
|
roadwayRollback.put("L1005", 96);
|
||||||
roadwayRollback.put("L1006", 97);
|
roadwayRollback.put("L1006", 97);
|
||||||
|
|
||||||
|
//初始化称重设备连接ip port
|
||||||
|
czRoadwayMap.put("L1005", "172.19.40.218:4001");
|
||||||
|
czRoadwayMap.put("L1006", "172.19.40.219:4001");
|
||||||
|
|
||||||
|
/*czOverMap.put("L1003", "DB502.12");
|
||||||
|
czOverMap.put("L1004", "DB502.26");*/
|
||||||
|
|
||||||
|
outJobMap.put("L1005", "DB502.66");
|
||||||
|
outJobMap.put("L1006", "DB502.80");
|
||||||
|
|
||||||
log.info("Ddj6Thread init");
|
log.info("Ddj6Thread init");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,10 +68,9 @@ public class Ddj6Thread extends BaseDdjThread {
|
|||||||
HashMap<String, Object> paramMap = new HashMap<>();
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
paramMap.put("trayCode", trayCode);
|
paramMap.put("trayCode", trayCode);
|
||||||
paramMap.put("warehouseId",WAREHOUSE_02);
|
paramMap.put("warehouseId",WAREHOUSE_02);
|
||||||
paramMap.put("roadwayId",ROADWAY_ID_03);
|
paramMap.put("roadwayId",ROADWAY_ID_06);
|
||||||
paramMap.put("height",height);
|
paramMap.put("height",height);
|
||||||
paramMap.put("weight",weight);
|
paramMap.put("weight",weight);
|
||||||
|
|
||||||
return paramMap;
|
return paramMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +78,7 @@ public class Ddj6Thread extends BaseDdjThread {
|
|||||||
public MydoJob getOutJobParam() {
|
public MydoJob getOutJobParam() {
|
||||||
MydoJob mydoJob = new MydoJob();
|
MydoJob mydoJob = new MydoJob();
|
||||||
mydoJob.setWarehouseId(WAREHOUSE_02);
|
mydoJob.setWarehouseId(WAREHOUSE_02);
|
||||||
mydoJob.setRoadwayId(String.valueOf(ROADWAY_ID_03));
|
mydoJob.setRoadwayId(String.valueOf(ROADWAY_ID_06));
|
||||||
mydoJob.setStatus("1");
|
mydoJob.setStatus("1");
|
||||||
|
|
||||||
return mydoJob;
|
return mydoJob;
|
||||||
@@ -86,4 +96,5 @@ public class Ddj6Thread extends BaseDdjThread {
|
|||||||
return "1";
|
return "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.ruoyi.schedule.util;
|
package com.ruoyi.schedule.util;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -39,41 +38,6 @@ public class CheckWeight {
|
|||||||
return zhi;
|
return zhi;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 用 Hutool 找出数组中出现次数最多的字符串
|
|
||||||
* @param strArray 目标字符串数组
|
|
||||||
* @return 出现次数最多的字符串(空数组返回 null,多最大值返回第一个)
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 兼容所有 Hutool 版本:找出数组中出现次数最多的字符串
|
|
||||||
* @param strArray 目标字符串数组
|
|
||||||
* @return 出现次数最多的字符串(空数组返回 null,多最大值返回第一个)
|
|
||||||
*/
|
|
||||||
public static String getMostFrequentByHutool(String[] strArray) {
|
|
||||||
// 1. 空值校验 + 数组转 List
|
|
||||||
if (strArray == null || strArray.length == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<String> strList = CollUtil.newArrayList(strArray);
|
|
||||||
|
|
||||||
// 2. 用 Hutool 统计频次(所有版本都支持)
|
|
||||||
Map<String, Integer> countMap = CollUtil.countMap(strList);
|
|
||||||
|
|
||||||
// 3. 手动遍历找最大值(替代不存在的 getMaxKey 方法)
|
|
||||||
String mostFrequent = null;
|
|
||||||
int maxCount = 0;
|
|
||||||
// 遍历 Map 条目,Hutool 5.x 及以上都支持 entrySet 遍历
|
|
||||||
for (Map.Entry<String, Integer> entry : countMap.entrySet()) {
|
|
||||||
if (entry.getValue() > maxCount) {
|
|
||||||
maxCount = entry.getValue();
|
|
||||||
mostFrequent = entry.getKey();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mostFrequent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将byte数组按指定编码转为char数组
|
* 将byte数组按指定编码转为char数组
|
||||||
* @param byteArr 输入的byte数组
|
* @param byteArr 输入的byte数组
|
||||||
@@ -91,10 +55,7 @@ public class CheckWeight {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
CheckWeight checkWeight = new CheckWeight();
|
CheckWeight checkWeight = new CheckWeight();
|
||||||
while (true){
|
System.out.println(checkWeight.sendWeight("172.19.50.75", 4001));
|
||||||
System.out.println(checkWeight.sendWeight("172.19.50.80", 4001));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
#主数据信息
|
#主数据信息
|
||||||
master:
|
master:
|
||||||
url: jdbc:sqlserver://172.19.1.119:1433;databaseName=FT541-wcs-2;
|
url: jdbc:sqlserver://172.19.1.119:1433;databaseName=FT541-wcs;
|
||||||
username: sa
|
username: sa
|
||||||
password: Flrd0914.
|
password: Flrd0914.
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
|
|||||||
Reference in New Issue
Block a user