产线输送机
This commit is contained in:
@@ -45,7 +45,7 @@ public interface IApiService
|
|||||||
* WMS出库任务推送
|
* WMS出库任务推送
|
||||||
* @param receiveOutJob
|
* @param receiveOutJob
|
||||||
*/
|
*/
|
||||||
public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob);
|
// public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成agv队列
|
* 生成agv队列
|
||||||
@@ -56,7 +56,7 @@ public interface IApiService
|
|||||||
* @param wmsTaskType 1-入库 2-出库 3-agv搬运
|
* @param wmsTaskType 1-入库 2-出库 3-agv搬运
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public AgvQueue createAgvQueue(String code1,String code2,String wmsTrayCode,String wmsTaskNo,String wmsTaskType);
|
public AgvQueue createAgvQueue(String code1,String code2,String wmsTrayCode,String wmsTaskNo,String wmsTaskType,String traySize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消AGV任务
|
* 取消AGV任务
|
||||||
@@ -68,10 +68,10 @@ public interface IApiService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 继续AGV任务
|
* 继续AGV任务
|
||||||
* @param continueTaskRequest
|
* @param agvQueue
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ContinueTaskResponse continueTask(ContinueTaskRequest continueTaskRequest);
|
public AjaxResult continueTask(AgvQueue agvQueue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成AGV生成任务
|
* 生成AGV生成任务
|
||||||
@@ -130,7 +130,7 @@ public interface IApiService
|
|||||||
* WMS流利架入库任务推送
|
* WMS流利架入库任务推送
|
||||||
* @param receiveInJob
|
* @param receiveInJob
|
||||||
*/
|
*/
|
||||||
AjaxResult receiveInMydoJob(ReceiveJob receiveInJob);
|
// AjaxResult receiveInMydoJob(ReceiveJob receiveInJob);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,5 +159,7 @@ public interface IApiService
|
|||||||
*/
|
*/
|
||||||
public AjaxResult createInMydoJob(Map<String, Object> param);
|
public AjaxResult createInMydoJob(Map<String, Object> param);
|
||||||
|
|
||||||
|
public AjaxResult selectMydoJobByNoTrayCode(Map<String, Object> param);
|
||||||
|
|
||||||
public AjaxResult requestEnterByEnterIdAndTrayCode();
|
public AjaxResult requestEnterByEnterIdAndTrayCode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,30 +150,15 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
public AjaxResult receiveAgvMoveJob(Map<String, String> param) {
|
public AjaxResult receiveAgvMoveJob(Map<String, String> param) {
|
||||||
String startPoint = param.get("startPoint");
|
String startPoint = param.get("startPoint");
|
||||||
String endPoint = param.get("endPoint");
|
String endPoint = param.get("endPoint");
|
||||||
//todo 待调试
|
String traySize = param.get("traySize");
|
||||||
WcsPort startWcsPort = wcsPortService.selectWcsPortByPortCode(startPoint);
|
|
||||||
WcsPort endWcsPort = wcsPortService.selectWcsPortByPortCode(endPoint);
|
AgvQueue agvQueue = createAgvQueue(startPoint,endPoint, param.get("trayCode"), param.get("taskNo"), "1",traySize);
|
||||||
if (ObjUtil.isNull(startWcsPort)){
|
|
||||||
return AjaxResult.error("起始点不存在");
|
|
||||||
}
|
|
||||||
if (ObjUtil.isNull(endWcsPort)){
|
|
||||||
return AjaxResult.error("结束点不存在");
|
|
||||||
}
|
|
||||||
if ("1".equals(startWcsPort.getStatus()) && "0".equals(endWcsPort.getStatus())){
|
|
||||||
AgvQueue agvQueue = createAgvQueue(startWcsPort.getSpare2(),endWcsPort.getSpare2(), param.get("containerCode"), param.get("taskNo"), "3");
|
|
||||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = requestAgvQueue(agvQueue);
|
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = requestAgvQueue(agvQueue);
|
||||||
if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
return AjaxResult.error(genAgvSchedulingTaskResponse.getMessage());
|
return AjaxResult.error(genAgvSchedulingTaskResponse.getMessage());
|
||||||
}
|
|
||||||
if ("0".equals(startWcsPort.getStatus())){
|
|
||||||
return AjaxResult.error("起始点位无容器");
|
|
||||||
}
|
|
||||||
if ("1".equals(endWcsPort.getStatus())){
|
|
||||||
return AjaxResult.error("目标点位有容器");
|
|
||||||
}
|
|
||||||
return AjaxResult.error();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -223,6 +208,40 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
* @param request
|
* @param request
|
||||||
*/
|
*/
|
||||||
private void agvCallbackInfo(AgvCallbackRequest request) {
|
private void agvCallbackInfo(AgvCallbackRequest request) {
|
||||||
|
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(request.getTaskCode());
|
||||||
|
if (agvQueue != null ) {
|
||||||
|
String method = request.getMethod();
|
||||||
|
switch (method) {
|
||||||
|
case "applyin":
|
||||||
|
agvQueue.setStatus("1");
|
||||||
|
agvQueueService.updateAgvQueue(agvQueue);
|
||||||
|
log.info("【AGV请求取货】任务号:{}", request.getTaskCode());
|
||||||
|
break;
|
||||||
|
case "start":
|
||||||
|
agvQueue.setStatus("3");
|
||||||
|
agvQueueService.updateAgvQueue(agvQueue);
|
||||||
|
log.info("【AGV任务开始】任务号:{}", request.getTaskCode());
|
||||||
|
break;
|
||||||
|
case "outbin":
|
||||||
|
agvQueue.setStatus("4");
|
||||||
|
agvQueueService.updateAgvQueue(agvQueue);
|
||||||
|
log.info("【AGV走出储位】任务号:{}", request.getTaskCode());
|
||||||
|
break;
|
||||||
|
case "applyout":
|
||||||
|
agvQueue.setStatus("5");
|
||||||
|
agvQueueService.updateAgvQueue(agvQueue);
|
||||||
|
log.info("【AGV请求放货】任务号:{}", request.getTaskCode());
|
||||||
|
break;
|
||||||
|
case "end":
|
||||||
|
agvQueue.setStatus("7");
|
||||||
|
agvQueueService.updateAgvQueue(agvQueue);
|
||||||
|
log.info("【AGV任务结束】任务号:{}", request.getTaskCode());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log.info("未知方法");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -234,30 +253,30 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
* @param receiveOutJob
|
* @param receiveOutJob
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
// @Override
|
||||||
public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob) {
|
// public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob) {
|
||||||
AgvQueue agvQueue = createAgvQueue(receiveOutJob.getCargoSpaceId(),receiveOutJob.getExitId(),receiveOutJob.getTrayCode(),receiveOutJob.getTaskNo(),"2");
|
// AgvQueue agvQueue = createAgvQueue(receiveOutJob.getCargoSpaceId(),receiveOutJob.getExitId(),receiveOutJob.getTrayCode(),receiveOutJob.getTaskNo(),"2");
|
||||||
if (agvQueue != null){
|
// if (agvQueue != null){
|
||||||
return AjaxResult.success();
|
// return AjaxResult.success();
|
||||||
}else {
|
// }else {
|
||||||
return AjaxResult.error("生成agv任务失败");
|
// return AjaxResult.error("生成agv任务失败");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
/**
|
/**
|
||||||
* 接收流利架空料箱入库任务
|
* 接收流利架空料箱入库任务
|
||||||
*
|
*
|
||||||
* @param receiveInJob
|
* @param receiveInJob
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
// @Override
|
||||||
public AjaxResult receiveInMydoJob(ReceiveJob receiveInJob) {
|
// public AjaxResult receiveInMydoJob(ReceiveJob receiveInJob) {
|
||||||
AgvQueue agvQueue = createAgvQueue(receiveInJob.getEntranceId(),receiveInJob.getCargoSpaceId(),receiveInJob.getTrayCode(),receiveInJob.getTaskNo(),"1");
|
// AgvQueue agvQueue = createAgvQueue(receiveInJob.getEntranceId(),receiveInJob.getCargoSpaceId(),receiveInJob.getTrayCode(),receiveInJob.getTaskNo(),"1");
|
||||||
if (agvQueue != null){
|
// if (agvQueue != null){
|
||||||
return AjaxResult.success();
|
// return AjaxResult.success();
|
||||||
}else {
|
// }else {
|
||||||
return AjaxResult.error("生成agv任务失败");
|
// return AjaxResult.error("生成agv任务失败");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消ctu任务
|
* 取消ctu任务
|
||||||
@@ -308,18 +327,18 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AgvQueue createAgvQueue(String code1,String code2,String wmsTrayCode,String wmsTaskNo,String wmsTaskType) {
|
public AgvQueue createAgvQueue(String code1,String code2,String wmsTrayCode,String wmsTaskNo,String wmsTaskType,String traySize) {
|
||||||
//生成ctu执行队列
|
//生成ctu执行队列
|
||||||
AgvQueue agvQueue = new AgvQueue();
|
AgvQueue agvQueue = new AgvQueue();
|
||||||
String reqCode = IdUtil.fastSimpleUUID();
|
String reqCode = IdUtil.fastSimpleUUID();
|
||||||
String taskCode = IdUtil.fastSimpleUUID();
|
String taskCode = IdUtil.fastSimpleUUID();
|
||||||
agvQueue.setReqCode(reqCode);
|
agvQueue.setReqCode(reqCode);
|
||||||
agvQueue.setReqTime(DateUtil.formatDateTime(DateUtil.date()));
|
agvQueue.setReqTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||||
agvQueue.setAgvType("CTU");
|
agvQueue.setAgvType("AGV");
|
||||||
agvQueue.setPositionCode1(code1);
|
agvQueue.setPositionCode1(code1);
|
||||||
agvQueue.setPositionCode2(code2);
|
agvQueue.setPositionCode2(code2);
|
||||||
agvQueue.setTaskType("F01");
|
agvQueue.setTaskType("F01");
|
||||||
agvQueue.setCtnrType("0");
|
agvQueue.setCtnrType(traySize);
|
||||||
agvQueue.setCtnrCode("0");
|
agvQueue.setCtnrCode("0");
|
||||||
agvQueue.setCtnrNum("0");
|
agvQueue.setCtnrNum("0");
|
||||||
agvQueue.setTaskMode("0");
|
agvQueue.setTaskMode("0");
|
||||||
@@ -348,13 +367,22 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 继续agv任务
|
* 继续agv任务
|
||||||
* @param continueTaskRequest
|
* @param agvQueue
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ContinueTaskResponse continueTask(ContinueTaskRequest continueTaskRequest) {
|
public AjaxResult continueTask(AgvQueue agvQueue) {
|
||||||
|
ContinueTaskRequest continueTaskRequest = new ContinueTaskRequest();
|
||||||
|
continueTaskRequest.setReqCode(IdUtil.fastSimpleUUID());
|
||||||
|
continueTaskRequest.setReqTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||||
|
continueTaskRequest.setTaskCode(agvQueue.getTaskCode());
|
||||||
RequestLog requestLog = requestLogService.getRequestLog(CONTINUE_TASK_URL, "继续执行任务", JSONUtil.toJsonStr(continueTaskRequest));
|
RequestLog requestLog = requestLogService.getRequestLog(CONTINUE_TASK_URL, "继续执行任务", JSONUtil.toJsonStr(continueTaskRequest));
|
||||||
return BeanUtil.toBean(requestLog.getResponseBody(), ContinueTaskResponse.class);
|
if ("1".equals(requestLog.getIsSuccessful())){
|
||||||
|
return AjaxResult.success();
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -376,7 +404,7 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
genAgvSchedulingTaskRequest.setCtnrNum("0");
|
genAgvSchedulingTaskRequest.setCtnrNum("0");
|
||||||
genAgvSchedulingTaskRequest.setTaskMode("0");
|
genAgvSchedulingTaskRequest.setTaskMode("0");
|
||||||
genAgvSchedulingTaskRequest.setTaskCode(agvQueue.getWmsTaskNo());
|
genAgvSchedulingTaskRequest.setTaskCode(agvQueue.getWmsTaskNo());
|
||||||
genAgvSchedulingTaskRequest.setAgvTyp("CTU");
|
genAgvSchedulingTaskRequest.setAgvTyp("AGV");
|
||||||
genAgvSchedulingTaskRequest.setPositionSelStrategy("0");
|
genAgvSchedulingTaskRequest.setPositionSelStrategy("0");
|
||||||
genAgvSchedulingTaskRequest.setTaskCode(agvQueue.getTaskCode());
|
genAgvSchedulingTaskRequest.setTaskCode(agvQueue.getTaskCode());
|
||||||
List<PositionCodeData> positionCodePath = new ArrayList<>();
|
List<PositionCodeData> positionCodePath = new ArrayList<>();
|
||||||
@@ -400,4 +428,15 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
public AjaxResult requestEnterByEnterIdAndTrayCode() {
|
public AjaxResult requestEnterByEnterIdAndTrayCode() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult selectMydoJobByNoTrayCode(Map<String, Object> param) {
|
||||||
|
RequestLog requestLog = requestLogService.getRequestLog(REQUEST_MYDO_JOB_URL, "入库请求补码作业", JSONUtil.toJsonStr(param));
|
||||||
|
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||||
|
return AjaxResult.success();
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,5 +28,7 @@ public class Constant {
|
|||||||
public static final String SEND_TASK_STARTED = "http://127.0.0.1:8080/api2wms/startSignal";
|
public static final String SEND_TASK_STARTED = "http://127.0.0.1:8080/api2wms/startSignal";
|
||||||
public static final String TAKE_COMPLETED = "http://127.0.0.1:8080/api2wms/takeCompleted";
|
public static final String TAKE_COMPLETED = "http://127.0.0.1:8080/api2wms/takeCompleted";
|
||||||
public static final String CREATE_IN_MYDO_JOB_URL = "http://127.0.0.1:8080/api2wms/requestEnterByTrayCode";
|
public static final String CREATE_IN_MYDO_JOB_URL = "http://127.0.0.1:8080/api2wms/requestEnterByTrayCode";
|
||||||
|
public static final String REQUEST_MYDO_JOB_URL = "http://127.0.0.1:8080/api2wms/requestByNoTrayCode";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class TaskStatusCode {
|
|||||||
*/
|
*/
|
||||||
public static final String TASK_EP_AGV = "1";
|
public static final String TASK_EP_AGV = "1";
|
||||||
/**
|
/**
|
||||||
* 任务执行阶段 堆垛机
|
* 任务执行阶段 入口输送机
|
||||||
*/
|
*/
|
||||||
public static final String TASK_EP_SSJ = "2";
|
public static final String TASK_EP_SSJ = "2";
|
||||||
/**
|
/**
|
||||||
@@ -42,8 +42,13 @@ public class TaskStatusCode {
|
|||||||
*/
|
*/
|
||||||
public static final String TASK_EP_ROADWAY_SSJ = "3";
|
public static final String TASK_EP_ROADWAY_SSJ = "3";
|
||||||
/**
|
/**
|
||||||
* 任务执行阶段 输送机
|
* 任务执行阶段 堆垛机
|
||||||
*/
|
*/
|
||||||
public static final String TASK_EP_DDJ = "4";
|
public static final String TASK_EP_DDJ = "4";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务执行阶段 回传wms完成
|
||||||
|
*/
|
||||||
|
public static final String TASK_EP_WMS_FINISH = "5";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,32 +99,32 @@ public class Ddj2Thread implements Runnable {
|
|||||||
if (ObjUtil.isNotNull(mydoJob)) {
|
if (ObjUtil.isNotNull(mydoJob)) {
|
||||||
|
|
||||||
//生成agv队列
|
//生成agv队列
|
||||||
AgvQueue agvQueue = apiService.createAgvQueue(inSsjDevice.getName(), mydoJob.getCargoSpaceId(),mydoJob.getTrayCode(),mydoJob.getTaskNo(),"1");
|
// AgvQueue agvQueue = apiService.createAgvQueue(inSsjDevice.getName(), mydoJob.getCargoSpaceId(),mydoJob.getTrayCode(),mydoJob.getTaskNo(),"1");
|
||||||
//请求任务生成
|
//请求任务生成
|
||||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = apiService.requestAgvQueue(agvQueue);
|
// GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = apiService.requestAgvQueue(agvQueue);
|
||||||
//修改wms任务状态
|
// //修改wms任务状态
|
||||||
if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
// if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
||||||
//修改ctu执行状态
|
// //修改ctu执行状态
|
||||||
agvQueue.setStatus("1");
|
// agvQueue.setStatus("1");
|
||||||
agvQueueService.updateAgvQueue(agvQueue);
|
// agvQueueService.updateAgvQueue(agvQueue);
|
||||||
log.info("向CTU下入库库作业");
|
// log.info("向CTU下入库库作业");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
AgvQueue agvQueue = agvQueues.get(0);
|
// AgvQueue agvQueue = agvQueues.get(0);
|
||||||
if ("0".equals(agvQueue.getStatus())){
|
// if ("0".equals(agvQueue.getStatus())){
|
||||||
//请求任务生成
|
// //请求任务生成
|
||||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = apiService.requestAgvQueue(agvQueue);
|
// GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = apiService.requestAgvQueue(agvQueue);
|
||||||
//修改wms任务状态
|
// //修改wms任务状态
|
||||||
if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
// if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
||||||
//修改ctu执行状态
|
// //修改ctu执行状态
|
||||||
agvQueue.setStatus("1");
|
// agvQueue.setStatus("1");
|
||||||
agvQueueService.updateAgvQueue(agvQueue);
|
// agvQueueService.updateAgvQueue(agvQueue);
|
||||||
log.info("向CTU下入库库作业");
|
// log.info("向CTU下入库库作业");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 二楼入口线程 循环agv搬运完成状态的队列,找到作业,下发去向+任务号
|
* 二楼出入口输送线线程
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class Floor2InSsjThread implements Runnable {
|
public class Floor2InSsjThread implements Runnable {
|
||||||
@@ -34,9 +34,9 @@ public class Floor2InSsjThread implements Runnable {
|
|||||||
public void init() {
|
public void init() {
|
||||||
ssjCodeList = new HashMap<>();
|
ssjCodeList = new HashMap<>();
|
||||||
ArrayList<String> ssjCodes = new ArrayList<>();
|
ArrayList<String> ssjCodes = new ArrayList<>();
|
||||||
ssjCodes.add("L1002");
|
ssjCodes.add("L1011");
|
||||||
ssjCodes.add("L1004");
|
ssjCodes.add("L1012");
|
||||||
ssjCodeList.put("in", ssjCodes);
|
ssjCodeList.put("inout", ssjCodes);
|
||||||
apiService = SpringUtils.getBean(IApiService.class);
|
apiService = SpringUtils.getBean(IApiService.class);
|
||||||
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
||||||
log.info("初始化服务 {},{}", apiService, agvQueueService);
|
log.info("初始化服务 {},{}", apiService, agvQueueService);
|
||||||
@@ -49,7 +49,7 @@ public class Floor2InSsjThread implements Runnable {
|
|||||||
for (String type : ssjCodeList.keySet()) {
|
for (String type : ssjCodeList.keySet()) {
|
||||||
|
|
||||||
switch ( type){
|
switch ( type){
|
||||||
case "in":
|
case "inout":
|
||||||
//生产线入库
|
//生产线入库
|
||||||
for (String ssjCode : ssjCodeList.get(type)) {
|
for (String ssjCode : ssjCodeList.get(type)) {
|
||||||
try {
|
try {
|
||||||
@@ -77,13 +77,18 @@ public class Floor2InSsjThread implements Runnable {
|
|||||||
|
|
||||||
|
|
||||||
public void inDispatch(DeviceSsj inSsjDevice) {
|
public void inDispatch(DeviceSsj inSsjDevice) {
|
||||||
//如果入库请求1 并且 托盘码不为空
|
//如果输送机空闲
|
||||||
if (inSsjDevice.getDw() == 1 && inSsjDevice.getTaskNo() > 0 && inSsjDevice.getRkqq() == 1) {
|
if (inSsjDevice.getKx() == 1) {
|
||||||
//查询货位 排列层
|
AgvQueue agvQueue = new AgvQueue();
|
||||||
|
agvQueue.setStatus("6");
|
||||||
|
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
|
||||||
|
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueue);
|
||||||
|
if(agvQueues.size()!=0){
|
||||||
|
//如果有这个输送机口的agv队列并请求放货(状态为6)
|
||||||
|
|
||||||
//查询入口 排列层
|
|
||||||
|
|
||||||
//生成堆垛机队列
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class Floor2OutSsjThread implements Runnable {
|
|||||||
ArrayList<String> ssjCodes = new ArrayList<>();
|
ArrayList<String> ssjCodes = new ArrayList<>();
|
||||||
ssjCodes.add("L1002");
|
ssjCodes.add("L1002");
|
||||||
ssjCodes.add("L1004");
|
ssjCodes.add("L1004");
|
||||||
ssjCodeList.put("in", ssjCodes);
|
ssjCodeList.put("roadwayssj", ssjCodes);
|
||||||
apiService = SpringUtils.getBean(IApiService.class);
|
apiService = SpringUtils.getBean(IApiService.class);
|
||||||
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
||||||
log.info("初始化服务 {},{}", apiService, agvQueueService);
|
log.info("初始化服务 {},{}", apiService, agvQueueService);
|
||||||
@@ -43,7 +43,7 @@ public class Floor2OutSsjThread implements Runnable {
|
|||||||
for (String type : ssjCodeList.keySet()) {
|
for (String type : ssjCodeList.keySet()) {
|
||||||
|
|
||||||
switch ( type){
|
switch ( type){
|
||||||
case "in":
|
case "roadwayssj":
|
||||||
//生产线入库
|
//生产线入库
|
||||||
for (String ssjCode : ssjCodeList.get(type)) {
|
for (String ssjCode : ssjCodeList.get(type)) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ruoyi.schedule.scheduleTask.ssj.floor2;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.ruoyi.api.domain.agv.continueTask.ContinueTaskResponse;
|
||||||
import com.ruoyi.api.service.IApiService;
|
import com.ruoyi.api.service.IApiService;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.domain.SendData;
|
import com.ruoyi.common.domain.SendData;
|
||||||
@@ -9,6 +10,7 @@ import com.ruoyi.common.utils.spring.SpringUtils;
|
|||||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||||
import com.ruoyi.job.domain.MydoJob;
|
import com.ruoyi.job.domain.MydoJob;
|
||||||
import com.ruoyi.job.service.IMydoJobService;
|
import com.ruoyi.job.service.IMydoJobService;
|
||||||
|
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||||
import com.ruoyi.schedule.plcRead.util.Tools;
|
import com.ruoyi.schedule.plcRead.util.Tools;
|
||||||
@@ -18,6 +20,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ruoyi.common.TaskStatusCode.TASK_EP_AGV;
|
||||||
|
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.deviceSsjMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产线输送机
|
* 生产线输送机
|
||||||
* 生产线线程 检测到位+托盘条码+托盘大小 请求wms生成入库作业 。 循环作业表,检测有没有出库作业 ,生成agv搬运作业。
|
* 生产线线程 检测到位+托盘条码+托盘大小 请求wms生成入库作业 。 循环作业表,检测有没有出库作业 ,生成agv搬运作业。
|
||||||
@@ -49,21 +54,21 @@ public class LineSsjThread implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
init();
|
init();
|
||||||
while (isRun){
|
while (isRun) {
|
||||||
for (String type : ssjCodeList.keySet()) {
|
for (String type : ssjCodeList.keySet()) {
|
||||||
|
|
||||||
switch ( type){
|
switch (type) {
|
||||||
case "line":
|
case "line":
|
||||||
//生产线入库
|
//生产线入库
|
||||||
for (String ssjCode : ssjCodeList.get(type)) {
|
for (String ssjCode : ssjCodeList.get(type)) {
|
||||||
try {
|
try {
|
||||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
if (deviceSsjMap.containsKey(ssjCode)) {
|
||||||
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
inDispatch(deviceSsjMap.get(ssjCode));
|
||||||
} else {
|
} else {
|
||||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
log.error(e.getMessage(),e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -82,8 +87,8 @@ public class LineSsjThread implements Runnable {
|
|||||||
|
|
||||||
public void inDispatch(DeviceSsj SsjDevice) {
|
public void inDispatch(DeviceSsj SsjDevice) {
|
||||||
//如果到位,扫到条码,托盘大小,执行阶段卡控一下(下发输送机后改执行阶段)
|
//如果到位,扫到条码,托盘大小,执行阶段卡控一下(下发输送机后改执行阶段)
|
||||||
if (SsjDevice.getDw() == 1 && StrUtil.isNotBlank(SsjDevice.getTrayCode()) && SsjDevice.getTraySize() !=0 && SsjDevice.getTaskNo()<1000) {
|
if (SsjDevice.getDw() == 1 && StrUtil.isNotBlank(SsjDevice.getTrayCode()) && SsjDevice.getTraySize() != 0 && SsjDevice.getTaskNo() < 1000) {
|
||||||
log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}",SsjDevice.getDeviceCode(),"产线到位",SsjDevice.getTrayCode(),SsjDevice.getTraySize());
|
log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}", SsjDevice.getDeviceCode(), "产线到位", SsjDevice.getTrayCode(), SsjDevice.getTraySize());
|
||||||
|
|
||||||
//查作业,入如果已经有了,直接下发输送线
|
//查作业,入如果已经有了,直接下发输送线
|
||||||
MydoJob mydoJob = new MydoJob();
|
MydoJob mydoJob = new MydoJob();
|
||||||
@@ -93,20 +98,18 @@ public class LineSsjThread implements Runnable {
|
|||||||
mydoJob.setExecutionPhase("0");
|
mydoJob.setExecutionPhase("0");
|
||||||
List<MydoJob> mydoJobs = mydoJobService.selectInOrOutMydoJobList(mydoJob);
|
List<MydoJob> mydoJobs = mydoJobService.selectInOrOutMydoJobList(mydoJob);
|
||||||
//有作业,下发输送机任务号,覆盖任务号
|
//有作业,下发输送机任务号,覆盖任务号
|
||||||
if(mydoJobs.size()>0){
|
if (mydoJobs.size() > 0) {
|
||||||
|
|
||||||
mydoJob = mydoJobs.get(0);
|
mydoJob = mydoJobs.get(0);
|
||||||
SendData taskNo = new SendData(Tools.INT, mydoJob.getTaskNo());
|
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob.getTaskNo(),1,1);
|
||||||
byte[] bytes = Tools.sendData(taskNo);
|
if (i == 1) {
|
||||||
int i = PlcSsjRead.WriteToSSJ(SsjDevice.getPlcDbWriteAddress(), bytes);
|
mydoJob.setExecutionPhase(TASK_EP_AGV);
|
||||||
if (i==1){
|
|
||||||
mydoJob.setExecutionPhase("1");
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
log.info("G1005产线输送机下发任务号成功:"+mydoJob.getTaskNo());
|
log.info("G1005产线输送机下发任务号成功:" + mydoJob.getTaskNo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
|
|
||||||
//请求wms生成入库作业
|
//请求wms生成入库作业
|
||||||
HashMap<String, Object> paramMap = new HashMap<>();
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
@@ -117,29 +120,32 @@ public class LineSsjThread implements Runnable {
|
|||||||
AjaxResult ajaxResult = apiService.createInMydoJob(paramMap);
|
AjaxResult ajaxResult = apiService.createInMydoJob(paramMap);
|
||||||
if (ajaxResult.isSuccess()) {
|
if (ajaxResult.isSuccess()) {
|
||||||
//拿到正常作业,插到wcs作业表,下发给输送机任务号,覆盖任务号
|
//拿到正常作业,插到wcs作业表,下发给输送机任务号,覆盖任务号
|
||||||
MydoJob mydoJob2 = (MydoJob) ajaxResult.get("mydoJob");
|
MydoJob mydoJob2 = (MydoJob) ajaxResult.get("data");
|
||||||
mydoJobService.insertMydoJob(mydoJob2);
|
mydoJobService.insertMydoJob(mydoJob2);
|
||||||
SendData taskNo = new SendData(Tools.INT, mydoJob2.getTaskNo());
|
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||||
byte[] bytes = Tools.sendData(taskNo);
|
if (i == 1) {
|
||||||
int i = PlcSsjRead.WriteToSSJ(SsjDevice.getPlcDbWriteAddress(), bytes);
|
|
||||||
if (i==1){
|
|
||||||
mydoJob2.setExecutionPhase("1");
|
mydoJob2.setExecutionPhase("1");
|
||||||
mydoJobService.updateMydoJob(mydoJob2);
|
mydoJobService.updateMydoJob(mydoJob2);
|
||||||
log.info("G1005产线输送机下发任务号成功:"+mydoJob2.getTaskNo());
|
log.info("G1005产线输送机下发任务号成功:" + mydoJob2.getTaskNo());
|
||||||
}
|
}
|
||||||
} else if (ajaxResult.isError()) {
|
} else {
|
||||||
//超大,给plc下发错误信息,等待人工处理
|
//超大,给plc下发错误信息,等待人工处理
|
||||||
//托盘大小对不上,给plc下发错误信息,等待人工处理
|
//托盘大小对不上,给plc下发错误信息,等待人工处理
|
||||||
//码不对,给plc下发错误信息,等待人工处理
|
//码不对,给plc下发错误信息,等待人工处理
|
||||||
|
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),"0",Integer.valueOf(ajaxResult.get("code").toString()),2);
|
||||||
|
if (i == 1) {
|
||||||
|
log.info("G1005产线输送机下发错误信息成功");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SsjDevice.getDw() == 1 && StrUtil.isBlank(SsjDevice.getTrayCode()) && SsjDevice.getTraySize() !=0 && SsjDevice.getTaskNo()<1000) {
|
if (SsjDevice.getDw() == 1 && StrUtil.isBlank(SsjDevice.getTrayCode()) && SsjDevice.getTraySize() != 0 && SsjDevice.getTaskNo() < 1000) {
|
||||||
|
|
||||||
log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}",SsjDevice.getDeviceCode(),"产线",SsjDevice.getTrayCode(),SsjDevice.getTraySize());
|
log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}", SsjDevice.getDeviceCode(), "产线", SsjDevice.getTrayCode(), SsjDevice.getTraySize());
|
||||||
//查wcs有没作业,有下发给输送机任务号,覆盖任务号
|
//查wcs有没作业,有下发给输送机任务号,覆盖任务号
|
||||||
MydoJob mydoJob = new MydoJob();
|
MydoJob mydoJob = new MydoJob();
|
||||||
mydoJob.setInOrOut("1");
|
mydoJob.setInOrOut("1");
|
||||||
@@ -147,16 +153,107 @@ public class LineSsjThread implements Runnable {
|
|||||||
mydoJob.setEntranceId("G1005");
|
mydoJob.setEntranceId("G1005");
|
||||||
mydoJob.setExecutionPhase("0");
|
mydoJob.setExecutionPhase("0");
|
||||||
List<MydoJob> mydoJobs = mydoJobService.selectInOrOutMydoJobList(mydoJob);
|
List<MydoJob> mydoJobs = mydoJobService.selectInOrOutMydoJobList(mydoJob);
|
||||||
//没有,请求错误接口,找作业,返回成功,//拿到正常作业,插到wcs作业表,下发给输送机任务号,覆盖任务号,shibai...
|
if (mydoJobs.size() > 0) {
|
||||||
|
mydoJob = mydoJobs.get(0);
|
||||||
|
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob.getTaskNo(),1,1);
|
||||||
|
if (i == 1) {
|
||||||
|
mydoJob.setExecutionPhase("1");
|
||||||
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
|
log.info("G1005产线输送机下发任务号成功:" + mydoJob.getTaskNo());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//没有,请求错误接口,找作业,返回成功,//拿到正常作业,插到wcs作业表,下发给输送机任务号,覆盖任务号,shibai...
|
||||||
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("traySize", SsjDevice.getTraySize());
|
||||||
|
AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
|
||||||
|
if (ajaxResult.isSuccess()) {
|
||||||
|
MydoJob mydoJob2 = (MydoJob) ajaxResult.get("mydoJob");
|
||||||
|
mydoJobService.insertMydoJob(mydoJob2);
|
||||||
|
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||||
|
if (i == 1) {
|
||||||
|
mydoJob2.setExecutionPhase("1");
|
||||||
|
mydoJobService.updateMydoJob(mydoJob2);
|
||||||
|
log.info("G1005产线输送机下发任务号成功:" + mydoJob2.getTaskNo());
|
||||||
|
}
|
||||||
|
} else if (ajaxResult.isError()) {
|
||||||
|
//超大,给plc下发错误信息,等待人工处理
|
||||||
|
//托盘大小对不上,给plc下发错误信息,等待人工处理
|
||||||
|
//码不对,给plc下发错误信息,等待人工处理
|
||||||
|
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),"0",Integer.valueOf(ajaxResult.get("code").toString()),2);
|
||||||
|
if (i == 1) {
|
||||||
|
log.info("G1005产线输送机下发错误信息成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SsjDevice.getDw() == 1 && SsjDevice.getTraySize() ==0 && SsjDevice.getTaskNo()>1000) {
|
if (SsjDevice.getDw() == 1 && SsjDevice.getTraySize() != 0 && StrUtil.isNotBlank(SsjDevice.getTrayCode()) && SsjDevice.getTaskNo() > 1000) {
|
||||||
|
|
||||||
|
log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}", SsjDevice.getDeviceCode(), "产线", SsjDevice.getTrayCode(), SsjDevice.getTraySize());
|
||||||
|
//任务号查wcs作业,查巷道,看目标输送线是否空闲,查是否有出库作业,生成agv队列
|
||||||
|
|
||||||
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Long.valueOf(SsjDevice.getTaskNo()));
|
||||||
|
String deviceCode = "";
|
||||||
|
if (mydoJob != null) {
|
||||||
|
if ("1".equals(mydoJob.getRoadwayId())) {
|
||||||
|
deviceCode = "L1011";
|
||||||
|
} else {
|
||||||
|
deviceCode = "L1012";
|
||||||
|
}
|
||||||
|
int kx = deviceSsjMap.get(deviceCode).getKx();
|
||||||
|
MydoJob mydoJob1 = new MydoJob();
|
||||||
|
mydoJob1.setInOut("2");
|
||||||
|
mydoJob1.setStatus("3");
|
||||||
|
mydoJob1.setExitId(deviceCode);
|
||||||
|
List<MydoJob> mydoJob2 = mydoJobService.selectInOrOutMydoJobList(mydoJob1);
|
||||||
|
if (mydoJob2.size() == 0 && kx == 1 && "1".equals(mydoJob.getStatus())) {
|
||||||
|
//查是否有队列,如果有了请求放货修改为允许放货
|
||||||
|
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(mydoJob.getJobId());
|
||||||
|
if (agvQueue != null && "1".equals(agvQueue.getStatus())) {
|
||||||
|
AjaxResult ajaxResult = apiService.continueTask(agvQueue);
|
||||||
|
if (ajaxResult.isSuccess()) {
|
||||||
|
agvQueue.setStatus("2");
|
||||||
|
agvQueueService.updateAgvQueue(agvQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("trayCode", mydoJob.getTrayCode());
|
||||||
|
paramMap.put("taskNo", mydoJob.getJobId());
|
||||||
|
paramMap.put("startPoint", "G1005");
|
||||||
|
paramMap.put("endPoint", deviceCode);
|
||||||
|
paramMap.put("traySize",String.valueOf(SsjDevice.getTraySize()));
|
||||||
|
AjaxResult ajaxResult = apiService.receiveAgvMoveJob(paramMap);
|
||||||
|
if (ajaxResult.isSuccess()) {
|
||||||
|
mydoJob.setStatus("3");
|
||||||
|
mydoJob.setExecutionPhase("2");
|
||||||
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}",SsjDevice.getDeviceCode(),"产线",SsjDevice.getTrayCode(),SsjDevice.getTraySize());
|
|
||||||
//任务号查wcs作业,查巷道,看目标输送线是否空闲
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int writeToSsj(String address,String taskNo,int qx,int completed) {
|
||||||
|
|
||||||
|
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 jymSendData = new SendData(Tools.INT, jym);
|
||||||
|
byte[] bytes = Tools.sendData(taskNoSendData, qxSendData, completedSendData, jymSendData);
|
||||||
|
int i = PlcSsjRead.WriteToSSJ(address, bytes);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user