调度代码修改

This commit is contained in:
liuhanqing
2025-10-10 09:51:10 +08:00
parent 07e23f19d1
commit 40bc52c7b2
4 changed files with 14 additions and 24 deletions

View File

@@ -42,9 +42,6 @@ public class Floor1BothWayInSsjThread implements Runnable {
private final Map<String, List<Integer>> roadwayMap = new HashMap<>();
private final Map<String, String> exitRoadwayMap = new HashMap<>();
private final String l2005WriteAddress = "DB501.20";
private final String l2012WriteAddress = "DB501.30";
public boolean isRun = true;
@@ -140,15 +137,17 @@ public class Floor1BothWayInSsjThread implements Runnable {
if (ssj.getDw() == 1 && ssj.getTaskNo() > 0 && ssj.getTaskNo() < 1000 && ssj.getRkqq() == 1) {
//先检测有没有出库作业,有出库作业直接退回
MydoJob outMydoJob = mydoJobService.selectMydoJobByExitList(Collections.singletonList(exitRoadwayMap.get(ssj.getDeviceCode())));
String l2005WriteAddress = "DB501.20";
String l2012WriteAddress = "DB501.30";
if (ObjUtil.isNotNull(outMydoJob) || StrUtil.isEmpty(ssj.getTrayCode())) {
int i = 0;
//下发去向 和任务号
switch (ssj.getDeviceCode()) {
case "L2005":
i = writeToSsj(l2005WriteAddress,"0",2,1);
i = writeToSsj(l2005WriteAddress,"0",2);
break;
case "L2012":
i = writeToSsj(l2012WriteAddress,"0",2,1);
i = writeToSsj(l2012WriteAddress,"0",2);
break;
}
if (i == 1) {
@@ -183,10 +182,10 @@ public class Floor1BothWayInSsjThread implements Runnable {
//下发去向 和任务号
switch (ssj.getDeviceCode()) {
case "L2005":
i = writeToSsj(l2005WriteAddress,inJob.getTaskNo(),1,1);
i = writeToSsj(l2005WriteAddress,inJob.getTaskNo(),1);
break;
case "L2012":
i = writeToSsj(l2012WriteAddress,inJob.getTaskNo(),1,1);
i = writeToSsj(l2012WriteAddress,inJob.getTaskNo(),1);
break;
}
if (i == 1) {
@@ -205,16 +204,15 @@ public class Floor1BothWayInSsjThread implements Runnable {
}
private static int writeToSsj(String address, String taskNo, int qx, int completed) {
private static int writeToSsj(String address, String taskNo, int qx) {
int jym = Tools.getJYM(Integer.parseInt(taskNo), qx, 1);
SendData taskNoSendData = new SendData(Tools.INT, taskNo);
SendData qxSendData = new SendData(Tools.INT, qx);
SendData completedSendData = new SendData(Tools.INT, completed);
SendData completedSendData = new SendData(Tools.INT, 1);
SendData jymSendData = new SendData(Tools.INT, jym);
byte[] bytes = Tools.sendData(taskNoSendData, qxSendData, completedSendData, jymSendData);
int i = PlcSsjRead.WriteToSSJ(address, bytes);
return i;
return PlcSsjRead.WriteToSSJ(address, bytes);
}

View File

@@ -34,8 +34,6 @@ public class Floor1BothWayOutSsjThread implements Runnable {
public HashMap<String, List<DeviceSsj>> ssjCodeList;
private IApiService apiService;
private IAgvQueueService agvQueueService;
private IMydoJobService mydoJobService;
private IBasCargoSpaceService basCargoSpaceService;
private IDdjDeviceExecutionQueueService ddjDeviceExecutionQueueService;
@@ -67,8 +65,6 @@ public class Floor1BothWayOutSsjThread implements Runnable {
apiService = SpringUtils.getBean(IApiService.class);
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
@@ -139,7 +135,6 @@ public class Floor1BothWayOutSsjThread implements Runnable {
/**
* 出库堆垛机队列生成
* @param ssjList
*/
public void dispatch(List<DeviceSsj> ssjList) {
DeviceSsj deviceSsj = ssjList.get(ssjList.size() - 1);

View File

@@ -31,7 +31,6 @@ import static com.ruoyi.common.TaskType.DDJ_RWLX_2;
public class Floor1SingleSsjThread implements Runnable {
public HashMap<String, List<String>> ssjCodeList;
private IApiService apiService;
private IMydoJobService mydoJobService;
public boolean isRun = true;
private final Map<String, String> exitRoadwayMap = new HashMap<>();
@@ -55,7 +54,6 @@ public class Floor1SingleSsjThread implements Runnable {
//初始化服务
apiService = SpringUtils.getBean(IApiService.class);
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);

View File

@@ -96,7 +96,7 @@ public class Floor2InOutSsjThread implements Runnable {
//不允许放货
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 0) {
//如果有这个输送机口的agv队列并请求放货(状态为6)
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "0", Integer.parseInt(agvQueues.get(0).getCtnrType()), 1);
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "0", Integer.parseInt(agvQueues.get(0).getCtnrType()));
if (i == 1) {
log.info(inSsjDevice.getDeviceCode() + "输送机下发请求放货成功");
}
@@ -120,7 +120,7 @@ public class Floor2InOutSsjThread implements Runnable {
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueue);
if (!agvQueues.isEmpty()) {
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), agvQueues.get(0).getWmsTaskNo(), 1, 1);
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), agvQueues.get(0).getWmsTaskNo(), 1);
if (i == 1) {
log.info(inSsjDevice.getDeviceCode() + "输送机下发任务号成功");
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(agvQueues.get(0).getTaskCode());
@@ -151,16 +151,15 @@ public class Floor2InOutSsjThread implements Runnable {
}
}
private static int writeToSsj(String address, String taskNo, int qx, int completed) {
private static int writeToSsj(String address, String taskNo, int qx) {
int jym = Tools.getJYM(Integer.parseInt(taskNo), qx, 1);
SendData taskNoSendData = new SendData(Tools.INT, taskNo);
SendData qxSendData = new SendData(Tools.INT, qx);
SendData completedSendData = new SendData(Tools.INT, completed);
SendData completedSendData = new SendData(Tools.INT, 1);
SendData jymSendData = new SendData(Tools.INT, jym);
byte[] bytes = Tools.sendData(taskNoSendData, qxSendData, completedSendData, jymSendData);
int i = PlcSsjRead.WriteToSSJ(address, bytes);
return i;
return PlcSsjRead.WriteToSSJ(address, bytes);
}
}