调度修改
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
package com.ruoyi.schedule.scheduleTask.ddj;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||
import com.ruoyi.device.ddj.service.IMsgDdjService;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.job.service.IMydoJobService;
|
||||
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
|
||||
@@ -19,20 +23,23 @@ import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import com.ruoyi.schedule.plcRead.util.Tools;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import static com.ruoyi.common.TaskStatusCode.*;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class Ddj1Thread implements Runnable {
|
||||
|
||||
public HashMap<String, List<String>> ddjCodeList;
|
||||
public HashMap<String, List<MsgDdj>> ddjCodeList;
|
||||
public HashMap<String, List<DeviceSsj>> ssjList;
|
||||
|
||||
private IApiService apiService;
|
||||
private IDdjDeviceExecutionQueueService ddjDeviceExecutionQueueService;
|
||||
private IDdjDeviceExecutionQueueFinishService ddjDeviceExecutionQueueFinishService;
|
||||
private IMsgDdjService msgDdjService;
|
||||
private IMydoJobService mydoJobService;
|
||||
private final Map<String, List<Integer>> roadwayMap = new HashMap<>();
|
||||
|
||||
public boolean isRun = true;
|
||||
|
||||
@@ -40,16 +47,44 @@ public class Ddj1Thread implements Runnable {
|
||||
public void init() {
|
||||
//todo 获取设备编码列表
|
||||
ddjCodeList = new HashMap<>();
|
||||
ArrayList<String> ddjCodes = new ArrayList<>();
|
||||
ddjCodes.add("ddj1");
|
||||
ddjCodes.add("ddj2");
|
||||
ArrayList<MsgDdj> ddjCodes = new ArrayList<>();
|
||||
ddjCodes.add(PlcDdjRead.deviceDdjMap.get("ddj1"));
|
||||
ddjCodeList.put("ddj", ddjCodes);
|
||||
ArrayList<DeviceSsj> roadSsjList = new ArrayList<>();
|
||||
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L1001"));
|
||||
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L1002"));
|
||||
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L1003"));
|
||||
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L1004"));
|
||||
ssjList.put("roadSsjList", roadSsjList);
|
||||
ArrayList<DeviceSsj> outSsj1 = new ArrayList<>();
|
||||
outSsj1.add(PlcSsjRead.deviceSsjMap.get("L1003"));
|
||||
outSsj1.add(PlcSsjRead.deviceSsjMap.get("L1004"));
|
||||
ssjList.put("outSsj1", outSsj1);
|
||||
ArrayList<DeviceSsj> outSsj2 = new ArrayList<>();
|
||||
outSsj2.add(PlcSsjRead.deviceSsjMap.get("L1003"));
|
||||
outSsj2.add(PlcSsjRead.deviceSsjMap.get("L1004"));
|
||||
ssjList.put("outSsj2", outSsj2);
|
||||
ArrayList<DeviceSsj> outSsj3 = new ArrayList<>();
|
||||
outSsj3.add(PlcSsjRead.deviceSsjMap.get("L1003"));
|
||||
outSsj3.add(PlcSsjRead.deviceSsjMap.get("L1004"));
|
||||
ssjList.put("outSsj3", outSsj3);
|
||||
ArrayList<DeviceSsj> outSsj4 = new ArrayList<>();
|
||||
outSsj4.add(PlcSsjRead.deviceSsjMap.get("L1003"));
|
||||
outSsj4.add(PlcSsjRead.deviceSsjMap.get("L1004"));
|
||||
ssjList.put("outSsj4", outSsj4);
|
||||
|
||||
//初始化巷道口 排 列 层
|
||||
roadwayMap.put("L1001", Arrays.asList(1, 1, 1));
|
||||
roadwayMap.put("L1002", Arrays.asList(2, 1, 1));
|
||||
roadwayMap.put("L1003", Arrays.asList(1, 58, 1));
|
||||
roadwayMap.put("L1004", Arrays.asList(2, 58, 1));
|
||||
|
||||
apiService = SpringUtils.getBean(IApiService.class);
|
||||
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
|
||||
ddjDeviceExecutionQueueFinishService = SpringUtils.getBean(IDdjDeviceExecutionQueueFinishService.class);
|
||||
msgDdjService = SpringUtils.getBean(IMsgDdjService.class);
|
||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
||||
log.info("初始化服务 {},{},{},{}", apiService, ddjDeviceExecutionQueueService, ddjDeviceExecutionQueueFinishService,mydoJobService);
|
||||
log.info("初始化服务 {},{},{},{}", apiService, ddjDeviceExecutionQueueService, ddjDeviceExecutionQueueFinishService, mydoJobService);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,19 +93,22 @@ public class Ddj1Thread implements Runnable {
|
||||
while (isRun) {
|
||||
for (String type : ddjCodeList.keySet()) {
|
||||
|
||||
if ("ddj".equals(type)) {
|
||||
for (String ddjCode : ddjCodeList.get(type)) {
|
||||
try {
|
||||
if (PlcDdjRead.deviceDdjMap.containsKey(ddjCode)) {
|
||||
ddjTask(PlcDdjRead.deviceDdjMap.get(ddjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ddjCode);
|
||||
for (MsgDdj msgDdj : ddjCodeList.get(type)) {
|
||||
try {
|
||||
if (ObjUtil.isNotNull(msgDdj)) {
|
||||
if (0 == msgDdj.getSpare1()) {
|
||||
generateInBoundPickQueue(msgDdj);
|
||||
generateInBoundLoadQueue(msgDdj);
|
||||
generateOutBoundQueue(msgDdj);
|
||||
ddjTask(msgDdj);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} else {
|
||||
log.error("堆垛机设备为空");
|
||||
}
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
try {
|
||||
@@ -82,6 +120,142 @@ public class Ddj1Thread implements Runnable {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建出库队列
|
||||
*/
|
||||
private void generateOutBoundQueue(MsgDdj ddj) {
|
||||
MydoJob param = new MydoJob();
|
||||
param.setInOut("2");
|
||||
param.setWarehouseId("01");
|
||||
param.setRoadwayId(Convert.toStr(ddj.getId()));
|
||||
List<MydoJob> outJobList = mydoJobService.selectMydoJobList(param);
|
||||
if (CollUtil.isNotEmpty(outJobList)) {
|
||||
for (MydoJob outJob : outJobList) {
|
||||
String exitId = outJob.getExitId();
|
||||
|
||||
String outSsj = "";
|
||||
switch (exitId) {
|
||||
case "1":
|
||||
List<DeviceSsj> outSsj1 = ssjList.get("outSsj1");
|
||||
if (outSsj1.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getModel() == 2)) {
|
||||
outSsj = outSsj1.get(0).getDeviceCode();
|
||||
break;
|
||||
}
|
||||
List<DeviceSsj> outSsj2 = ssjList.get("outSsj2");
|
||||
if (outSsj2.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getModel() == 2)) {
|
||||
outSsj = outSsj2.get(0).getDeviceCode();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
List<DeviceSsj> outSsj3 = ssjList.get("outSsj3");
|
||||
if (outSsj3.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getModel() == 2)) {
|
||||
outSsj = outSsj3.get(0).getDeviceCode();
|
||||
break;
|
||||
}
|
||||
List<DeviceSsj> outSsj4 = ssjList.get("outSsj4");
|
||||
if (outSsj4.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getModel() == 2)) {
|
||||
outSsj = outSsj4.get(0).getDeviceCode();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log.error("出库任务出口错误");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ("0".equals(outJob.getExecutionPhase()) && StrUtil.isNotEmpty(outSsj)) {
|
||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(outJob.getTaskNo()), ddj.getId());
|
||||
if (ObjUtil.isNull(ddjQueue)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
outJob.setStatus("3");
|
||||
outJob.setStartTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
outJob.setExecutionPhase(TASK_EP_DDJ);
|
||||
mydoJobService.updateMydoJob(outJob);
|
||||
} else {
|
||||
log.info("任务已存在 rwh{}", outJob.getTaskNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建入库放货队列
|
||||
*/
|
||||
private void generateInBoundLoadQueue(MsgDdj ddj) {
|
||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 3) {
|
||||
//允许下发 联机 有货待机
|
||||
if (StrUtil.isNotEmpty(ddj.getTrayCode())) {
|
||||
MydoJob param = new MydoJob();
|
||||
param.setTrayCode(ddj.getTrayCode());
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
||||
MydoJob inJob = null;
|
||||
if (CollUtil.isEmpty(mydoJobs)) {
|
||||
//请求wms获取任务 并生成队列
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("trayCode", ddj.getTrayCode());
|
||||
AjaxResult result = apiService.selectMydoJobByTrayCodeAndEntranceId(paramMap);
|
||||
if (result.isSuccess()) {
|
||||
inJob = BeanUtil.toBean(result.get("data"), MydoJob.class);
|
||||
inJob.setStatus(TASK_STATUS_CREATE);
|
||||
inJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ);
|
||||
mydoJobService.insertMydoJob(inJob);
|
||||
} else {
|
||||
log.error(result.get("msg").toString());
|
||||
}
|
||||
} else {
|
||||
inJob = mydoJobs.get(0);
|
||||
}
|
||||
|
||||
if (ObjUtil.isNotNull(inJob) && inJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) {
|
||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(inJob.getTaskNo()), ddj.getId());
|
||||
if (ObjUtil.isNull(ddjQueue)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
inJob.setStatus("3");
|
||||
inJob.setStartTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
inJob.setExecutionPhase(TASK_EP_DDJ);
|
||||
mydoJobService.updateMydoJob(inJob);
|
||||
} else {
|
||||
log.info("任务已存在 rwh{}", inJob.getTaskNo());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Integer mbph = ddj.getMbph();
|
||||
Integer mblh = ddj.getMblh();
|
||||
Integer mbch = ddj.getMbch();
|
||||
long rwh = ddj.getRwh() + 100;
|
||||
log.error("扫码失败,放回原位 排:{} 列:{} 层:{} 任务号:{}", mbph, mblh, mbch, rwh);
|
||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||
if (ObjUtil.isNull(ddjQueue)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建入库取货队列
|
||||
*/
|
||||
private void generateInBoundPickQueue(MsgDdj ddj) {
|
||||
List<DeviceSsj> roadSsjList = ssjList.get("roadSsjList");
|
||||
for (DeviceSsj ssj : roadSsjList) {
|
||||
if (ssj.getDw() == 1 && ssj.getTaskNo() > 0) {
|
||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(ssj.getTaskNo()), ddj.getId());
|
||||
if (ObjUtil.isNull(ddjQueue)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
} else {
|
||||
log.info("任务已存在 rwh{}", ssj.getTaskNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ddjTask(MsgDdj ddj) {
|
||||
/*
|
||||
第一部分
|
||||
@@ -92,7 +266,7 @@ public class Ddj1Thread implements Runnable {
|
||||
Long rwh = ddj.getRwh();
|
||||
//完成作业
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||
if (mydoJob != null && ddjDeviceExecutionQueue != null) {
|
||||
//回传完成信号
|
||||
ddjTaskFinish(rwh, ddj.getId());
|
||||
@@ -110,6 +284,7 @@ public class Ddj1Thread implements Runnable {
|
||||
if (ddjDeviceExecutionQueue != null) {
|
||||
//修改队列执行阶段
|
||||
ddjDeviceExecutionQueue.setRwzt(ddj.getJdbz());
|
||||
ddjDeviceExecutionQueue.setSpare1("1");
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
}
|
||||
}
|
||||
@@ -122,13 +297,16 @@ public class Ddj1Thread implements Runnable {
|
||||
//判断堆垛机上任务是否已重分,若未重分,则调用接口,请求重分货位
|
||||
Long rwh = ddj.getRwh();
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
if ("0".equals(mydoJob.getFaultFlag())){
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||
if ("0".equals(mydoJob.getFaultFlag()) && "1".equals(ddjDeviceExecutionQueue.getSpare1())) {
|
||||
mydoJob.setStatus("1");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
AjaxResult ajaxResult = apiService.reAssign(new JobParam(rwh.toString(), null, null));
|
||||
if (ajaxResult.isSuccess()){
|
||||
if (ajaxResult.isSuccess()) {
|
||||
mydoJob.setFaultFlag("2");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
ddjDeviceExecutionQueue.setSpare1("0");
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,7 +318,7 @@ public class Ddj1Thread implements Runnable {
|
||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1053 && ddj.getJdbz() < 5) {
|
||||
Long rwh = ddj.getRwh();
|
||||
//无货异常处理
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||
//找到对应任务 调用api接口 取货无货,重新分配单据
|
||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) {
|
||||
AjaxResult ajaxResult = apiService.reMaterial(new JobParam(rwh.toString(), null, null));
|
||||
@@ -161,7 +339,7 @@ public class Ddj1Thread implements Runnable {
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
if (ObjUtil.isNotNull(mydoJob) && "2".equals(mydoJob.getFaultFlag())) {
|
||||
//判断任务是否重分完成
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) {
|
||||
//重新下发堆垛机任务
|
||||
int i = issuedDDJTask(ddj.getId(), ddjDeviceExecutionQueue);
|
||||
@@ -180,32 +358,54 @@ public class Ddj1Thread implements Runnable {
|
||||
}
|
||||
}
|
||||
//正常下发
|
||||
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5 && ddj.getSbzt() == 0) {
|
||||
Long rwh = ddj.getRwh();
|
||||
//对堆垛机执行队列中无已下发队列
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueueParam = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueueParam.setDdjxf("1");
|
||||
ddjDeviceExecutionQueueParam.setDevId(ddj.getId());
|
||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueueParam);
|
||||
//取堆垛机队列中,生成时间最早的执行队列下发
|
||||
if (CollUtil.isEmpty(ddjDeviceExecutionQueues)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueues.get(0);
|
||||
if (ddjDeviceExecutionQueue == null) {
|
||||
return;
|
||||
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5) {
|
||||
if (ddj.getSbzt() == 0) {
|
||||
//无货待机 只查询入库取货扫码或者出库队列
|
||||
ArrayList<Integer> rwlxList = new ArrayList<>();
|
||||
rwlxList.add(1);
|
||||
rwlxList.add(3);
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueueParam = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueueParam.setDdjxf("0");
|
||||
ddjDeviceExecutionQueueParam.setDevId(ddj.getId());
|
||||
ddjDeviceExecutionQueueParam.setRwlxList(rwlxList);
|
||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueueParam);
|
||||
if (CollUtil.isNotEmpty(ddjDeviceExecutionQueues)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueues.get(0);
|
||||
int i = issuedDDJTask(ddj.getId(), ddjDeviceExecutionQueue);
|
||||
if (i == 1) {
|
||||
//更新开始时间,修改ddjxf为已下发1
|
||||
ddjDeviceExecutionQueue.setXfsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
ddjDeviceExecutionQueue.setDdjxf("1");
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
log.info("托盘堆垛机下发任务成功 rwh:{}", ddjDeviceExecutionQueue.getRwh());
|
||||
} else {
|
||||
log.error("托盘堆垛机下发任务失败!!!!!!!");
|
||||
}
|
||||
}
|
||||
int i = issuedDDJTask(ddj.getId(), ddjDeviceExecutionQueue);
|
||||
if (i == 1) {
|
||||
//更新开始时间,修改ddjxf为已下发1
|
||||
ddjDeviceExecutionQueue.setXfsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
ddjDeviceExecutionQueue.setDdjxf("1");
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
log.info("托盘堆垛机下发任务成功 rwh:{}", rwh);
|
||||
} else {
|
||||
log.error("托盘堆垛机下发任务失败!!!!!!!");
|
||||
} else if (ddj.getSbzt() == 3) {
|
||||
//有货待机 只查询入库放货队列
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueueParam = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueueParam.setDdjxf("0");
|
||||
ddjDeviceExecutionQueueParam.setDevId(ddj.getId());
|
||||
ddjDeviceExecutionQueueParam.setRwlx(2);
|
||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueueParam);
|
||||
if (CollUtil.isNotEmpty(ddjDeviceExecutionQueues)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueues.get(0);
|
||||
int i = issuedDDJTask(ddj.getId(), ddjDeviceExecutionQueue);
|
||||
if (i == 1) {
|
||||
//更新开始时间,修改ddjxf为已下发1
|
||||
ddjDeviceExecutionQueue.setXfsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
ddjDeviceExecutionQueue.setDdjxf("1");
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
log.info("托盘堆垛机下发任务成功 rwh:{}", ddjDeviceExecutionQueue.getRwh());
|
||||
} else {
|
||||
log.error("托盘堆垛机下发任务失败!!!!!!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -242,13 +442,20 @@ public class Ddj1Thread implements Runnable {
|
||||
int mbph = Convert.toInt(queue.getMbph());
|
||||
int mblh = Convert.toInt(queue.getMblh());
|
||||
int mbch = Convert.toInt(queue.getMbch());
|
||||
int mlfs = 5;
|
||||
int mlfs;
|
||||
if (queue.getRwlx() == 1 || queue.getRwlx() == 3) {
|
||||
mlfs = 5;
|
||||
} else if (queue.getRwlx() == 2) {
|
||||
mlfs = 4;
|
||||
} else {
|
||||
throw new RuntimeException("任务类型错误");
|
||||
}
|
||||
int xfwc = 1;
|
||||
int jym = Tools.getJYM(taskNo, yph, ylh, ych, mbph, mblh, mbch, mlfs, xfwc);
|
||||
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, xfwc, jym);
|
||||
if (devId==1){
|
||||
if (devId == 1) {
|
||||
return PlcDdjRead.WriteToDDJ("DB61.0", sendData);
|
||||
}else {
|
||||
} else {
|
||||
return PlcDdjRead.WriteToDDJ("DB61.0", sendData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user