优化
This commit is contained in:
@@ -5,6 +5,8 @@ import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackResponse;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -22,6 +24,8 @@ public class AgvController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IApiService apiService;
|
||||
@Autowired
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
/**
|
||||
* agv执行状态返回接口
|
||||
@@ -50,4 +54,26 @@ public class AgvController extends BaseController {
|
||||
return apiService.receiveAgvMoveJob(param);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteAgvTray")
|
||||
public AjaxResult deleteAgvTray(@RequestBody Map<String, String> param) {
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(param.get("taskCode"));
|
||||
if(agvQueue==null){
|
||||
return AjaxResult.error("AGV任务队列不存在!");
|
||||
}else{
|
||||
return apiService.deleteAgvTray(agvQueue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/continueTask")
|
||||
public AjaxResult continueTask(@RequestBody Map<String, String> param) {
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(param.get("taskCode"));
|
||||
if(agvQueue==null){
|
||||
return AjaxResult.error("AGV任务队列不存在!");
|
||||
}else{
|
||||
return apiService.continueTask(agvQueue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,22 +41,22 @@ public class ScreenController extends BaseController {
|
||||
static {
|
||||
// 1区域输送机编号
|
||||
AREA_SSJ_CODES.put(1, Arrays.asList(
|
||||
"L2007","L2008","L2005","L2006","L2013"
|
||||
"L2007", "L2008", "L2005", "L2006", "L2013"
|
||||
));
|
||||
|
||||
// 2区域输送机编号
|
||||
AREA_SSJ_CODES.put(2, Arrays.asList(
|
||||
"L2003","L2004","L2012","L2001","L2002"
|
||||
"L2003", "L2004", "L2012", "L2001", "L2002"
|
||||
));
|
||||
|
||||
// 3区域输送机编号
|
||||
AREA_SSJ_CODES.put(3, Arrays.asList(
|
||||
"L1001","L1002","L1011"
|
||||
"L1001", "L1002", "L1011"
|
||||
));
|
||||
|
||||
// 4区域输送机编号
|
||||
AREA_SSJ_CODES.put(4, Arrays.asList(
|
||||
"L1003","L1004","L1012"
|
||||
"L1003", "L1004", "L1012"
|
||||
));
|
||||
}
|
||||
|
||||
@@ -95,20 +95,39 @@ public class ScreenController extends BaseController {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", ssj.getDeviceCode());
|
||||
map.put("name", ssj.getName());
|
||||
map.put("kx", String.valueOf(ssj.getKx()));
|
||||
map.put("dw", String.valueOf(ssj.getDw()));
|
||||
map.put("sbzt", ssj.getException());
|
||||
map.put("kx", getSsjKx(ssj.getKx()));
|
||||
map.put("dw", getSsjDw(ssj.getDw()));
|
||||
map.put("sbzt", getSSzt(ssj.getSszt()));
|
||||
// map.put("trayCode", ssj.getTrayCode());
|
||||
map.put("allowPut", String.valueOf(ssj.getAllowPut()));
|
||||
map.put("traySize", String.valueOf(ssj.getTraySize()));
|
||||
map.put("exception", String.valueOf(ssj.getException()));
|
||||
map.put("exception", getSSzt(ssj.getSszt()));
|
||||
map.put("taskNo", ssj.getTaskNo());
|
||||
resultList.add(map);
|
||||
|
||||
// 如果taskNo大于0,查询对应的作业信息
|
||||
if (ssj.getTaskNo()> 0) {
|
||||
MydoJob job = mydoJobService.selectMydoJobByTaskNo(Long.valueOf(ssj.getTaskNo()));
|
||||
if (ssj.getTaskNo() > 0) {
|
||||
MydoJob job = mydoJobService.selectJobByTaskNo(String.valueOf(ssj.getTaskNo()));
|
||||
if (job != null) {
|
||||
if("1".equals(job.getInOrOut())){
|
||||
job.setInOrOut("生产入库");
|
||||
job.setExitId(job.getEntranceId());
|
||||
}else if("2".equals(job.getInOrOut())){
|
||||
job.setInOrOut("退货入库");
|
||||
job.setExitId(job.getEntranceId());
|
||||
}else if("3".equals(job.getInOrOut())){
|
||||
job.setInOrOut("其他入库");
|
||||
job.setExitId(job.getEntranceId());
|
||||
}else if("5".equals(job.getInOrOut())){
|
||||
job.setInOrOut("盘点入库");
|
||||
job.setExitId(job.getEntranceId());
|
||||
}else if("21".equals(job.getInOrOut())){
|
||||
job.setInOrOut("物资出库");
|
||||
}else if("26".equals(job.getInOrOut())){
|
||||
job.setInOrOut("盘点出库");
|
||||
}
|
||||
|
||||
|
||||
jobList.add(job);
|
||||
}
|
||||
}
|
||||
@@ -121,4 +140,86 @@ public class ScreenController extends BaseController {
|
||||
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
private String getSsjDw(int dw) {
|
||||
if(dw == 1){
|
||||
return "到位";
|
||||
}else{
|
||||
return "未到位";
|
||||
}
|
||||
}
|
||||
|
||||
private String getSsjKx(int kx) {
|
||||
if(kx == 1){
|
||||
return "空闲";
|
||||
}else{
|
||||
return "不空闲";
|
||||
}
|
||||
}
|
||||
|
||||
private String getSSzt(int sszt) {
|
||||
String msg = "";
|
||||
switch (sszt) {
|
||||
case 1:
|
||||
msg = "手动";
|
||||
break;
|
||||
case 2:
|
||||
msg = "自动";
|
||||
break;
|
||||
case 3:
|
||||
msg = "运行";
|
||||
break;
|
||||
case 4:
|
||||
msg = "输送超时";
|
||||
break;
|
||||
case 5:
|
||||
msg = "断路器跳闸";
|
||||
break;
|
||||
case 6:
|
||||
msg = "变频器报警";
|
||||
break;
|
||||
case 7:
|
||||
msg = "开关任务异常";
|
||||
break;
|
||||
case 8:
|
||||
msg = "急停";
|
||||
break;
|
||||
case 9:
|
||||
msg = "输送超界";
|
||||
break;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
private String getBjxx(int bjxx) {
|
||||
String msg = "";
|
||||
switch (bjxx) {
|
||||
case 1:
|
||||
msg = "前超长";
|
||||
break;
|
||||
case 2:
|
||||
msg = "后超长";
|
||||
break;
|
||||
case 3:
|
||||
msg = "左超宽";
|
||||
break;
|
||||
case 4:
|
||||
msg = "右超宽";
|
||||
break;
|
||||
case 5:
|
||||
msg = "超高";
|
||||
break;
|
||||
case 6:
|
||||
msg = "无任务";
|
||||
break;
|
||||
case 7:
|
||||
msg = "未扫到条码";
|
||||
break;
|
||||
case 8:
|
||||
msg = "称重异常";
|
||||
break;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,5 +16,5 @@ public class ReceiveJob {
|
||||
private String inOrOut;
|
||||
private String jobId;
|
||||
private String roadwayId;
|
||||
|
||||
private String departmentId;
|
||||
}
|
||||
|
||||
@@ -134,4 +134,6 @@ public interface IApiService
|
||||
AjaxResult receiveInMydoJob(ReceiveJob receiveInJob);
|
||||
|
||||
AjaxResult selectMydoJobByTrayCodeAndEntranceId(HashMap<String, Object> paramMap);
|
||||
|
||||
AjaxResult deleteAgvTray(AgvQueue agvQueue);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.api.domain.InterfaceReceive;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackRequest;
|
||||
@@ -73,15 +74,17 @@ public class ApiServiceImpl implements IApiService {
|
||||
public GenAgvSchedulingTaskResponse genAgvSchedulingTask(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(GEN_AGV_SCHEDULING_TASK, "生成AGV任务", JSONUtil.toJsonStr(genAgvSchedulingTaskRequest));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return BeanUtil.toBean(requestLog.getResponseBody(), GenAgvSchedulingTaskResponse.class);
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(genAgvSchedulingTaskRequest.getTaskCode());
|
||||
if(agvQueue != null){
|
||||
agvQueue.setStatus("1");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
}
|
||||
return JSON.parseObject(requestLog.getResponseBody(), GenAgvSchedulingTaskResponse.class);
|
||||
} else {
|
||||
//todo 需要调试
|
||||
GenAgvSchedulingTaskResponse response = new GenAgvSchedulingTaskResponse();
|
||||
response.setCode(500);
|
||||
response.setMessage("请求失败");
|
||||
//todo 需要调试小车请求
|
||||
response.setCode(0);
|
||||
response.setMessage("模拟测试");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -125,13 +128,16 @@ public class ApiServiceImpl implements IApiService {
|
||||
String endPoint = param.get("endPoint");
|
||||
String traySize = param.get("traySize");
|
||||
String wmsTaskNo = param.get("wmsTaskNo");
|
||||
|
||||
AgvQueue agvQueue = createAgvQueue(startPoint, endPoint, param.get("trayCode"), param.get("taskNo"), "1", traySize, wmsTaskNo);
|
||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = requestAgvQueue(agvQueue);
|
||||
if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
||||
return AjaxResult.success();
|
||||
GenAgvSchedulingTaskResponse response = new GenAgvSchedulingTaskResponse();
|
||||
AgvQueue queue = agvQueueService.selectAgvQueueByTaskCode(param.get("taskCode"));
|
||||
if(queue == null){
|
||||
AgvQueue agvQueue = createAgvQueue(startPoint, endPoint, param.get("trayCode"), param.get("taskCode"), "1", traySize, wmsTaskNo);
|
||||
response = requestAgvQueue(agvQueue);
|
||||
if (response.getCode() == 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
return AjaxResult.error(genAgvSchedulingTaskResponse.getMessage());
|
||||
return AjaxResult.error(response.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@@ -158,7 +164,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
String method = request.getMethod();
|
||||
switch (method) {
|
||||
case "applyin":
|
||||
agvQueue.setStatus("1");
|
||||
agvQueue.setStatus("2");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
log.info("【AGV请求取货】任务号:{}", request.getTaskCode());
|
||||
break;
|
||||
@@ -178,7 +184,6 @@ public class ApiServiceImpl implements IApiService {
|
||||
log.info("【AGV请求放货】任务号:{}", request.getTaskCode());
|
||||
break;
|
||||
case "end":
|
||||
|
||||
agvQueue.setStatus("7");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
log.info("【AGV任务结束】任务号:{}", request.getTaskCode());
|
||||
@@ -256,7 +261,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
|
||||
/**
|
||||
* 生成agv队列
|
||||
* 生成agv队列----临时修改起终点
|
||||
*
|
||||
* @param code1 起点
|
||||
* @param code2 终点
|
||||
@@ -270,14 +275,13 @@ public class ApiServiceImpl implements IApiService {
|
||||
//生成ctu执行队列
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
String reqCode = IdUtil.fastSimpleUUID();
|
||||
// String taskCode = IdUtil.fastSimpleUUID();
|
||||
agvQueue.setReqCode(reqCode);
|
||||
agvQueue.setReqTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
agvQueue.setAgvType("AGV");
|
||||
agvQueue.setPositionCode1(code1);
|
||||
agvQueue.setPositionCode2(code2);
|
||||
agvQueue.setTaskType("F01");
|
||||
agvQueue.setCtnrType(traySize);
|
||||
agvQueue.setTaskType("A24");
|
||||
agvQueue.setCtnrType("1");
|
||||
agvQueue.setCtnrCode("0");
|
||||
agvQueue.setCtnrNum("0");
|
||||
agvQueue.setTaskMode("0");
|
||||
@@ -337,18 +341,13 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest = new GenAgvSchedulingTaskRequest();
|
||||
genAgvSchedulingTaskRequest.setReqCode(agvQueue.getReqCode());
|
||||
genAgvSchedulingTaskRequest.setTaskMode("0");
|
||||
genAgvSchedulingTaskRequest.setPriority("10");
|
||||
genAgvSchedulingTaskRequest.setTaskTyp("F01");
|
||||
genAgvSchedulingTaskRequest.setCtnrCode("0");
|
||||
genAgvSchedulingTaskRequest.setCtnrNum("0");
|
||||
genAgvSchedulingTaskRequest.setTaskMode("0");
|
||||
genAgvSchedulingTaskRequest.setTaskTyp(agvQueue.getTaskType());
|
||||
genAgvSchedulingTaskRequest.setCtnrTyp(agvQueue.getCtnrType());
|
||||
genAgvSchedulingTaskRequest.setTaskCode(agvQueue.getTaskCode());
|
||||
genAgvSchedulingTaskRequest.setAgvTyp("AGV");
|
||||
genAgvSchedulingTaskRequest.setPositionSelStrategy("0");
|
||||
List<PositionCodeData> positionCodePath = new ArrayList<>();
|
||||
positionCodePath.add(new PositionCodeData(agvQueue.getPositionCode1(), "0"));
|
||||
positionCodePath.add(new PositionCodeData(agvQueue.getPositionCode2(), "0"));
|
||||
positionCodePath.add(new PositionCodeData(agvQueue.getPositionCode1(), "05"));
|
||||
positionCodePath.add(new PositionCodeData(agvQueue.getPositionCode2(), "05"));
|
||||
genAgvSchedulingTaskRequest.setPositionCodePath(positionCodePath);
|
||||
return genAgvSchedulingTask(genAgvSchedulingTaskRequest);
|
||||
}
|
||||
@@ -378,6 +377,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
mydoJob.setRoadwayId(receiveOutJob.getRoadwayId());
|
||||
mydoJob.setCreateTime(DateUtils.getNowDate());
|
||||
mydoJob.setExecutionPhase(TASK_EP_CREATE);
|
||||
mydoJob.setTraySize(receiveOutJob.getDepartmentId());
|
||||
int i = mydoJobService.insertMydoJob(mydoJob);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success();
|
||||
@@ -403,6 +403,24 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult deleteAgvTray(AgvQueue agvQueue) {
|
||||
Map<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("reqCode", IdUtil.fastSimpleUUID());
|
||||
paramMap.put("ctnrTyp", agvQueue.getCtnrType());
|
||||
paramMap.put("binName", agvQueue.getPositionCode2());
|
||||
paramMap.put("indBind", "0");
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(DELETE_BIN_URL, "AGV解绑容器", JSONUtil.toJsonStr(paramMap));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
log.info("站点:"+agvQueue.getPositionCode2()+"{}AGV容器解绑成功!");
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
log.info("站点:"+agvQueue.getPositionCode2()+"{}AGV容器解绑失败!");
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult selectMydoJobByNoTrayCode(Map<String, Object> param) {
|
||||
|
||||
@@ -131,7 +131,7 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
String resStr = HttpUtil.post(url, param);
|
||||
requestLog.setResponseBody(resStr);
|
||||
InterfaceReceive bean = JSONUtil.toBean(resStr, InterfaceReceive.class);
|
||||
if (bean.getCode() == 200) {
|
||||
if (bean.getCode() == 0) {
|
||||
requestLog.setResponseTime(DateUtil.format(responseTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
requestLog.setResponseStatus("1");
|
||||
requestLog.setDuration(Convert.toStr(DateUtil.between(requestTime, responseTime, DateUnit.MS)));
|
||||
|
||||
@@ -3,14 +3,15 @@ package com.ruoyi.common;
|
||||
|
||||
public class Constant {
|
||||
|
||||
public static final String WMS_BASE_URL = "http://localhost:8082/api2wms/";
|
||||
public static final String RCS_BASE_URL = "http://127.0.0.1:8081/rcms-dps/rest/";
|
||||
public static final String WMS_BASE_URL = "http://192.168.58.10:8082/api2wms/";
|
||||
public static final String RCS_BASE_URL = "http://192.168.58.101:8182/rcms/services/rest/hikRpcService/";
|
||||
|
||||
public static final String GEN_AGV_SCHEDULING_TASK = RCS_BASE_URL+"genAgvSchedulingTask";
|
||||
public static final String CANCEL_TASK_URL = RCS_BASE_URL+"cancelTask";
|
||||
public static final String CONTINUE_TASK_URL = RCS_BASE_URL+"continueTask";
|
||||
public static final String DELETE_BIN_URL = RCS_BASE_URL+"bindCtnrAndBin";
|
||||
|
||||
public static final String JOB_FINISH_URL = WMS_BASE_URL+"jobFinish";
|
||||
public static final String CONTINUE_TASK_URL = RCS_BASE_URL+"continueTask";
|
||||
public static final String CANCEL_TASK_URL = RCS_BASE_URL+"queryAgvStatus";;
|
||||
public static final String GEN_AGV_SCHEDULING_TASK = RCS_BASE_URL+"genAgvSchedulingTask";;
|
||||
public static final String CREATE_IN_MYDO_JOB_URL = WMS_BASE_URL+"requestEnterByTrayCode";
|
||||
public static final String REQUEST_MYDO_JOB_URL = WMS_BASE_URL+"requestByNoTrayCode";
|
||||
public static final String RE_ASSIGN_URL = WMS_BASE_URL+"reAssign";
|
||||
|
||||
@@ -85,4 +85,6 @@ public class DeviceSsj extends BaseEntity
|
||||
|
||||
private int sszt;
|
||||
|
||||
private int taskNo2;
|
||||
|
||||
}
|
||||
|
||||
@@ -81,4 +81,8 @@ public interface MydoJobMapper
|
||||
List<MydoJob> selectMydoJobFinishList(MydoJob mydoJob);
|
||||
|
||||
MydoJob selectRunningMydoJobByExitList(@Param("exitList") List<String> exitList);
|
||||
|
||||
List<MydoJob> getInJobByEntrance(@Param("exitList") List<String> exitList);
|
||||
|
||||
MydoJob selectJobByTaskNo(String taskNo);
|
||||
}
|
||||
|
||||
@@ -76,4 +76,8 @@ public interface IMydoJobService
|
||||
List<MydoJob> selectMydoJobFinishList(MydoJob mydoJob);
|
||||
|
||||
MydoJob selectRunningMydoJobByExitList(List<String> strings);
|
||||
|
||||
List<MydoJob> getInJobByEntrance(List<String> exitList);
|
||||
|
||||
MydoJob selectJobByTaskNo(String taskNo);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.job.service.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@@ -157,4 +158,15 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
public MydoJob selectRunningMydoJobByExitList(List<String> exitList) {
|
||||
return mydoJobMapper.selectRunningMydoJobByExitList(exitList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MydoJob> getInJobByEntrance(List<String> exitList) {
|
||||
return mydoJobMapper.getInJobByEntrance(exitList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MydoJob selectJobByTaskNo(String taskNo) {
|
||||
return mydoJobMapper.selectJobByTaskNo(taskNo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.queue.agv.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
/**
|
||||
* AGV任务队列Mapper接口
|
||||
@@ -67,4 +68,6 @@ public interface AgvQueueMapper
|
||||
AgvQueue selectAgvQueueByTaskCode(String taskCode);
|
||||
|
||||
void insertHistory(String reqCode);
|
||||
|
||||
AgvQueue selectAgvQueueByWmsTask(@Param("wmsTaskNo") int wmsTaskNo);
|
||||
}
|
||||
|
||||
@@ -71,4 +71,6 @@ public interface IAgvQueueService
|
||||
* @param reqCode
|
||||
*/
|
||||
void insertHistory(String reqCode);
|
||||
|
||||
AgvQueue selectAgvQueueByWmsTask(int taskNo);
|
||||
}
|
||||
|
||||
@@ -100,4 +100,9 @@ public class AgvQueueServiceImpl implements IAgvQueueService
|
||||
public void insertHistory(String reqCode) {
|
||||
agvQueueMapper.insertHistory(reqCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvQueue selectAgvQueueByWmsTask(int wmsTaskNo) {
|
||||
return agvQueueMapper.selectAgvQueueByWmsTask(wmsTaskNo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.ruoyi.schedule.plcRead.ddj.PlcDdj1Read;
|
||||
import com.ruoyi.schedule.plcRead.ddj.PlcDdj2Read;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import com.ruoyi.common.domain.CustomThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ddj.Ddj1Thread;
|
||||
import com.ruoyi.schedule.scheduleTask.ddj.DdjThread;
|
||||
import com.ruoyi.schedule.scheduleTask.monit.MonitoringThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ssj.floor1.Floor1BothWayInSsjThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ssj.floor1.Floor1BothWayOutSsjThread;
|
||||
@@ -23,6 +23,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -42,7 +48,7 @@ public class ScheduleThread {
|
||||
public CustomThread<Floor2RoadWaySsjThread> floor2OutSsjCustomThread;
|
||||
public CustomThread<LineSsjThread> lineSsjCustomThread;
|
||||
public CustomThread<MonitoringThread> monitoringCustomThread;
|
||||
public CustomThread<Ddj1Thread> ddj1CustomThread;
|
||||
public CustomThread<DdjThread> ddj1CustomThread;
|
||||
@Autowired
|
||||
private IDeviceSsjService deviceSsjService;
|
||||
@Autowired
|
||||
@@ -89,8 +95,8 @@ public class ScheduleThread {
|
||||
Floor2RoadWaySsjThread floor2OutSsjThread = new Floor2RoadWaySsjThread();
|
||||
floor2OutSsjCustomThread = new CustomThread<Floor2RoadWaySsjThread>(new Thread(floor2OutSsjThread), floor2OutSsjThread);
|
||||
|
||||
Ddj1Thread ddj1Thread = new Ddj1Thread();
|
||||
ddj1CustomThread = new CustomThread<Ddj1Thread>(new Thread(ddj1Thread), ddj1Thread);
|
||||
DdjThread ddj1Thread = new DdjThread();
|
||||
ddj1CustomThread = new CustomThread<DdjThread>(new Thread(ddj1Thread), ddj1Thread);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,9 +154,9 @@ public class ScheduleThread {
|
||||
*/
|
||||
public void startAllThread2() {
|
||||
monitoringCustomThread.thread.start();
|
||||
// floor1BothWayInSsjCustomThread.thread.start();
|
||||
// floor1BothWayOutSsjCustomThread.thread.start();
|
||||
// floor1SingleSsjCustomThread.thread.start();
|
||||
floor1BothWayInSsjCustomThread.thread.start();
|
||||
floor1BothWayOutSsjCustomThread.thread.start();
|
||||
floor1SingleSsjCustomThread.thread.start();
|
||||
floor2InSsjCustomThread.thread.start();
|
||||
lineSsjCustomThread.thread.start();
|
||||
floor2OutSsjCustomThread.thread.start();
|
||||
@@ -194,4 +200,75 @@ public class ScheduleThread {
|
||||
map.put("isRun2",isRun2);
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Socket socket = new Socket();
|
||||
// OutputStream out = null;
|
||||
// InputStream in = null;
|
||||
// try {
|
||||
//// socket.connect(new InetSocketAddress("192.168.56.32", 2002), 1000);
|
||||
//// in = socket.getInputStream();
|
||||
//// out = socket.getOutputStream();
|
||||
//
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
|
||||
// String code = sendWeight("192.168.56.33", 2002);
|
||||
// System.err.println(code);
|
||||
String pp = "MODEL:EX-1203 COLOR:9005 SERIAL:QT25C1879 V:220 Hz:50 PH:1 N.W.:207kg G.W.:238kg @:9781C52TQ$S0T0T0T3T0U7T0$7005280MA0A@";
|
||||
String ss = "MODEL:TR-360 COLOR:7016 SERIAL:QT25C1899 V:380 Hz:50 PH:3 N.W.:231kg G.W.:261kg @:9981C52TQ$S0T0U5RDS2S3S6T0T3T0U7T0$4105230IF0A@";
|
||||
System.err.println(pp);
|
||||
System.err.println(pp.length());
|
||||
System.err.println(ss.length());
|
||||
}
|
||||
|
||||
public static String sendWeight(String ip, int por) {
|
||||
|
||||
String zhi="";
|
||||
Socket socket = null;
|
||||
OutputStream os = null;
|
||||
InputStream is = null;
|
||||
try {
|
||||
//新建客户端并请求服务端的ip为localhost 端口为8088
|
||||
socket = new Socket(ip,por);
|
||||
// System.out.println("socket end ="+System.currentTimeMillis());
|
||||
//休眠3秒
|
||||
Thread.sleep(1000);
|
||||
char[] charArray = new char[500];
|
||||
//获取客户端发送的数据的输入流
|
||||
is = socket.getInputStream();
|
||||
//读取输入流
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(is);
|
||||
// System.out.println("read begin =" + System.currentTimeMillis());
|
||||
int readLength = inputStreamReader.read(charArray);
|
||||
System.out.println("readLength:"+readLength);
|
||||
if (readLength != -1) {
|
||||
String newString = new String(charArray, 0, readLength);
|
||||
// System.out.println("newString:"+newString+"长度"+newString.length());
|
||||
// newString=newString.replaceAll("\r|\n", "");
|
||||
// if(newString.length()==8&&!newString.equals("=0000000")){
|
||||
// newString=newString.substring(1,8);
|
||||
// newString=newString.replaceAll("^(0+)", "");
|
||||
// zhi=newString;
|
||||
// }
|
||||
zhi = newString;
|
||||
readLength = inputStreamReader.read(charArray);
|
||||
}
|
||||
// System.out.println("read end =" + System.currentTimeMillis());
|
||||
inputStreamReader.close();
|
||||
is.close();
|
||||
socket.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
socket.close();
|
||||
is.close();
|
||||
os.close();
|
||||
} catch (IOException e1)
|
||||
{ e1.printStackTrace(); }
|
||||
}
|
||||
|
||||
return zhi;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PlcDdj1Read extends Thread {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
readPlcDdj(msgDdj);
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(800);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PlcDdj2Read extends Thread {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
readPlcDdj(msgDdj);
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(800);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class PlcSsjRead implements Runnable {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(800);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
@@ -156,27 +156,27 @@ public class PlcSsjRead implements Runnable {
|
||||
String allot="";
|
||||
switch (ssjDevice.getDeviceCode()){
|
||||
case "G1005":
|
||||
trayCodeReadAddress = "DB5023.0";
|
||||
allot = "DB802.0";
|
||||
trayCodeReadAddress = "DB503.0";
|
||||
allot = "DB802.24";
|
||||
break;
|
||||
case "L2004":
|
||||
trayCodeReadAddress = "DB503.200";
|
||||
trayCodeReadAddress = "DB503.600";
|
||||
break;
|
||||
case "L2006":
|
||||
trayCodeReadAddress = "DB503.400";
|
||||
trayCodeReadAddress = "DB503.800";
|
||||
break;
|
||||
case "L1001":
|
||||
trayCodeReadAddress = "DB503.600";
|
||||
allot = "DB802.12";
|
||||
trayCodeReadAddress = "DB503.200";
|
||||
allot = "DB802.0";
|
||||
break;
|
||||
case "L1003":
|
||||
trayCodeReadAddress = "DB503.800";
|
||||
allot = "DB802.24";
|
||||
trayCodeReadAddress = "DB503.400";
|
||||
allot = "DB802.12";
|
||||
break;
|
||||
}
|
||||
|
||||
if(!"".equals(allot)){
|
||||
OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("12"));
|
||||
OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(allot, Short.parseShort("2"));
|
||||
if (agvSsj.IsSuccess){
|
||||
//去除bytes中
|
||||
ddsx1 = SoftBasic.ByteToHexString(agvSsj.Content);
|
||||
@@ -184,11 +184,27 @@ public class PlcSsjRead implements Runnable {
|
||||
}
|
||||
}
|
||||
if(!"".equals(trayCodeReadAddress)){
|
||||
OperateResultExOne<byte[]> trayCodeRead = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("220"));
|
||||
OperateResultExOne<byte[]> trayCodeRead = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("200"));
|
||||
if (trayCodeRead.IsSuccess){
|
||||
byte[] content = trayCodeRead.Content;
|
||||
//去除bytes中
|
||||
ssjDevice.setTrayCode(ParseUtil.filterAndConvert(trayCodeRead.Content));
|
||||
// if("L2004".equals(ssjDevice.getDeviceCode())){
|
||||
// ssjDevice.setTrayCode("gMODEL:1 COLOR:1 SERIAL:2 V:1 Hz:1 PH:1 N.W.:1 G.W.:1 ITEM_CODE:12345 @:1$S0T0S1T0S1T0S1T0$40001015202@");
|
||||
// }else{
|
||||
// ssjDevice.setTrayCode("gMODEL:1 COLOR:1 SERIAL:1 V:1 Hz:1 PH:1 N.W.:1 G.W.:1 ITEM_CODE:123456 @:1$S0T0S1T0S1T0S1T0$40001015202@");
|
||||
// }
|
||||
}
|
||||
}
|
||||
OperateResultExOne<byte[]> agvSsjTask = readWriteNet.Read("DB501.280", Short.parseShort("8"));
|
||||
String ddsx2 = "0";
|
||||
if (agvSsjTask.IsSuccess) {
|
||||
ddsx2 = SoftBasic.ByteToHexString(agvSsjTask.Content);
|
||||
if("L1001".equals(ssjDevice.getDeviceCode())){
|
||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(0, ddsx2));
|
||||
}
|
||||
if("L1003".equals(ssjDevice.getDeviceCode())){
|
||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(4, ddsx2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Tools implements Serializable {
|
||||
|
||||
public static void main(String[] arg) {
|
||||
int jym = getJYM(1, 2, 3);
|
||||
System.out.println(jym);
|
||||
//System.out.println(jym);
|
||||
}
|
||||
|
||||
/*4、CRC-16校验码计算方法:
|
||||
@@ -58,7 +58,7 @@ public class Tools implements Serializable {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
int s = j + i * 4;
|
||||
ints1[s] = son[j];
|
||||
System.out.println(Arrays.toString(ints1));
|
||||
//System.out.println(Arrays.toString(ints1));
|
||||
}
|
||||
}
|
||||
int a = 0;
|
||||
@@ -225,10 +225,10 @@ public class Tools implements Serializable {
|
||||
ints[22] = binaryTints8(printBits(a23));
|
||||
ints[23] = binaryTints8(printBits(a24));
|
||||
ints[24] = binaryTints8(printBits(a25));
|
||||
for (int anInt : ints) {
|
||||
System.out.print(anInt + " ");
|
||||
}
|
||||
System.out.println();
|
||||
// for (int anInt : ints) {
|
||||
// System.out.print(anInt + " ");
|
||||
// }
|
||||
// System.out.println();
|
||||
return BytesToInt(ints);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class Ddj1Thread implements Runnable {
|
||||
public class DdjThread implements Runnable {
|
||||
|
||||
public HashMap<String, List<String>> ddjCodeList;
|
||||
|
||||
@@ -133,7 +133,7 @@ public class Ddj1Thread implements Runnable {
|
||||
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));
|
||||
AjaxResult ajaxResult = apiService.reAssign(new JobParam(mydoJob.getJobId(), null, null));
|
||||
if (ajaxResult.isSuccess()){
|
||||
mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
mydoJob.setFaultFlag("2");
|
||||
@@ -141,19 +141,23 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
}
|
||||
|
||||
private void dispatch2(DeviceSsj ssj) {
|
||||
if (ssj.getDw() == 1 && ssj.getTaskNo() > 0 && ssj.getTaskNo() < 1000 && ssj.getTraySize() != 0) {
|
||||
if (ssj.getRkqq() == 1 && ssj.getTaskNo() > 0 && ssj.getTaskNo() < 1000 ) {
|
||||
//先检测有没有出库作业,有出库作业直接退回
|
||||
MydoJob outMydoJob = mydoJobService.selectRunningMydoJobByExitList(Collections.singletonList(ssj.getDeviceCode()));
|
||||
if (ObjUtil.isNotNull(outMydoJob) || StrUtil.isEmpty(ssj.getTrayCode())) {
|
||||
// || StrUtil.isEmpty(ssj.getTrayCode())
|
||||
if (ObjUtil.isNotNull(outMydoJob)) {
|
||||
//下发去向 和任务号
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "0", 2, 1);
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", 2, 2);
|
||||
if (i == 1) {
|
||||
log.info("未检测到托盘码下发回退 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode());
|
||||
log.info("当前输送机有出库任务下发退回 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 2, ssj.getTrayCode());
|
||||
}
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(ssj.getTrayCode())) {
|
||||
MydoJob param = new MydoJob();
|
||||
param.setEntranceId(ssj.getDeviceCode());
|
||||
String[] split = ssj.getTrayCode().split(" ");
|
||||
String serial = split[2].substring(7);
|
||||
param.setTrayCode(serial);
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
||||
MydoJob inJob = null;
|
||||
if (CollUtil.isNotEmpty(mydoJobs)) {
|
||||
@@ -162,7 +166,7 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
//根据托盘码请求入库作业
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("trayCode", ssj.getTrayCode());
|
||||
paramMap.put("size", ssj.getTraySize());
|
||||
//paramMap.put("size", ssj.getTraySize());
|
||||
paramMap.put("floor", "1");
|
||||
paramMap.put("entranceId",ssj.getDeviceCode());
|
||||
AjaxResult result = apiService.selectMydoJobByTrayCodeAndEntranceId(paramMap);
|
||||
@@ -170,9 +174,15 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
inJob = BeanUtil.toBean(result.get("data"), MydoJob.class);
|
||||
inJob.setStatus(TASK_STATUS_CREATE);
|
||||
inJob.setExecutionPhase(TASK_EP_CREATE);
|
||||
inJob.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(inJob);
|
||||
} else {
|
||||
log.info("未检测到托盘码请求入库作业 rwh:{},trayCode:{}", ssj.getTaskNo(), ssj.getTrayCode());
|
||||
log.info("托盘码请求作业成功, rwh:{},trayCode:{}", ssj.getTaskNo(), ssj.getTrayCode());
|
||||
}else{
|
||||
//下发去向 和任务号
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", 2, 2);
|
||||
if (i == 1) {
|
||||
log.info("托盘码请求作业失败, rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 2, ssj.getTrayCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inJob != null) {
|
||||
@@ -184,7 +194,13 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
inJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
inJob.setTargetRoadwayId(Convert.toStr(1));
|
||||
mydoJobService.updateMydoJob(inJob);
|
||||
log.info("入库请求下发任务号加去向 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode());
|
||||
log.info("托盘码请求作业成功,下发任务号 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode());
|
||||
}
|
||||
}else{
|
||||
//下发去向 和任务号
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", 2, 2);
|
||||
if (i == 1) {
|
||||
log.info("托盘码请求作业失败,下发回退 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 2, ssj.getTrayCode());
|
||||
}
|
||||
}
|
||||
}else {
|
||||
@@ -204,42 +220,37 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
if (i == 1) {
|
||||
mydoJob.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("{}已重复下发任务号{}:",ssj.getDeviceCode(),mydoJob.getTaskNo());
|
||||
log.info("{}无条码请求作业,二次下发任务号{}:",ssj.getDeviceCode(),mydoJob.getTaskNo());
|
||||
}
|
||||
}else {
|
||||
//不存在扫不到托盘码的任务
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("size", ssj.getTraySize());
|
||||
// paramMap.put("size", ssj.getTraySize());
|
||||
paramMap.put("entranceId",ssj.getDeviceCode());
|
||||
AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
mydoJob2.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob2);
|
||||
log.info("{}已下发任务号{}:",ssj.getDeviceCode(),mydoJob2.getTaskNo());
|
||||
log.info("{}无条码请求作业成功,下发任务号{}:",ssj.getDeviceCode(),mydoJob2.getTaskNo());
|
||||
}
|
||||
} else if (ajaxResult.isError()) {
|
||||
//超大,给plc下发错误信息,等待人工处理
|
||||
//托盘大小对不上,给plc下发错误信息,等待人工处理
|
||||
//码不对,给plc下发错误信息,等待人工处理
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "0", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("{}下发错误信号{}:",ssj.getDeviceCode(),Integer.parseInt(ajaxResult.get("code").toString()));
|
||||
log.info("{}无条码请求作业失败,下发退回{}:",ssj.getDeviceCode(),Integer.parseInt(ajaxResult.get("code").toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ public class Floor1BothWayOutSsjThread implements Runnable {
|
||||
|
||||
private void dispatch1(List<DeviceSsj> ssjList) {
|
||||
for (DeviceSsj ssj : ssjList) {
|
||||
|
||||
if (ssj.getDw()==1 && ssj.getTaskNo()>0){
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(ssj.getTaskNo()));
|
||||
if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) {
|
||||
|
||||
@@ -75,10 +75,8 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
try {
|
||||
@@ -102,15 +100,22 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
//不允许放货 等着
|
||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 0 && "L1001".equals(inSsjDevice.getDeviceCode())) {
|
||||
//下发输送线切换导向 DB未知
|
||||
int i = writeToSsjQH("inSsjDevice.getPlcDbWriteAddress()", Integer.parseInt(agvQueues.get(0).getCtnrType()));
|
||||
int i = writeToSsjQH("DB802.106", Integer.parseInt(agvQueues.get(0).getCtnrType()));
|
||||
if (i == 1) {
|
||||
log.info("输送机{}下发切换导向{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getCtnrType());
|
||||
}
|
||||
}
|
||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 0 && "L1003".equals(inSsjDevice.getDeviceCode())) {
|
||||
//下发输送线切换导向 DB未知
|
||||
int i = writeToSsjQH("DB802.118", Integer.parseInt(agvQueues.get(0).getCtnrType()));
|
||||
if (i == 1) {
|
||||
log.info("输送机{}下发切换导向{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getCtnrType());
|
||||
}
|
||||
}
|
||||
|
||||
//允许放货
|
||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 1) {
|
||||
log.info("设备:{} 位置:{} 任务号:{} 请求放货成功", inSsjDevice.getDeviceCode(), "输送线", agvQueues.get(0).getTaskCode());
|
||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 2) {
|
||||
log.info("设备:{} 位置:{} 任务号:{} 请求放货成功", inSsjDevice.getDeviceCode(), "输送线", agvQueues.get(0).getWmsTaskNo());
|
||||
AjaxResult ajaxResult = apiService.continueTask(agvQueues.get(0));
|
||||
if (ajaxResult.isSuccess()) {
|
||||
log.info("下发agv允许放货成功" + agvQueues.get(0).getWmsTaskNo());
|
||||
@@ -127,25 +132,37 @@ 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);
|
||||
if (i == 1) {
|
||||
log.info("输送机{}下发任务号{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getWmsTaskNo());
|
||||
apiService.deleteAgvTray(agvQueues.get(0));
|
||||
if("L1001".equals(inSsjDevice.getDeviceCode())) {
|
||||
int i = writeToSsj("DB802.100", agvQueues.get(0).getWmsTaskNo(), 2,Integer.parseInt(agvQueues.get(0).getCtnrType()));
|
||||
if (i == 1) {
|
||||
log.info("输送机{}AGV放货完成下发任务号{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getWmsTaskNo());
|
||||
|
||||
}
|
||||
}
|
||||
if("L1003".equals(inSsjDevice.getDeviceCode())) {
|
||||
int i = writeToSsj("DB802.112", agvQueues.get(0).getWmsTaskNo(), 2,Integer.parseInt(agvQueues.get(0).getCtnrType()));
|
||||
if (i == 1) {
|
||||
log.info("输送机{}AGV放货完成下发任务号{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getWmsTaskNo());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(inSsjDevice.getKx() == 0 && inSsjDevice.getTaskNo() > 0){
|
||||
if(inSsjDevice.getKx() == 0 && inSsjDevice.getTaskNo2() > 0){
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
agvQueue.setStatus("7"); //end
|
||||
//todo 与agv对点
|
||||
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
|
||||
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueue);
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(agvQueues.get(0).getTaskCode());
|
||||
mydoJob.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
agvQueueService.insertHistory(agvQueues.get(0).getReqCode());
|
||||
agvQueueService.deleteAgvQueueByReqCode(agvQueues.get(0).getReqCode());
|
||||
if(agvQueues.size() > 0){
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(agvQueues.get(0).getTaskCode());
|
||||
mydoJob.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
agvQueueService.insertHistory(agvQueues.get(0).getReqCode());
|
||||
agvQueueService.deleteAgvQueueByReqCode(agvQueues.get(0).getReqCode());
|
||||
}
|
||||
}
|
||||
//出库到位
|
||||
if (inSsjDevice.getDw() == 1 && inSsjDevice.getTaskNo() > 0) {
|
||||
@@ -178,7 +195,7 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
List<MydoJob> outMydoJobList = mydoJobService.selectInOrOutMydoJobList(mydoJobParam);
|
||||
if(!outMydoJobList.isEmpty()){
|
||||
//todo 去向不明朗
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"0",2,2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"99",2,2);
|
||||
if (i == 1) {
|
||||
log.info(ssjDevice.getDeviceCode()+"有正执行的出库作业退回" );
|
||||
}
|
||||
@@ -214,6 +231,7 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
mydoJob2.setStatus("1");
|
||||
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
@@ -224,7 +242,7 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
}
|
||||
}else{
|
||||
//todo 去向不明朗
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"0",2,2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"99",2,2);
|
||||
if (i == 1) {
|
||||
log.info(ssjDevice.getDeviceCode()+"输送机没取到作业下发输送线" );
|
||||
}
|
||||
@@ -263,6 +281,7 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
mydoJob2.setStatus("1");
|
||||
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
@@ -272,9 +291,9 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:" + mydoJob2.getTaskNo());
|
||||
}
|
||||
}else{
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(), "0", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(), "99", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
log.info(ssjDevice.getDeviceCode()+"输送机下发错误信息成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,43 +138,49 @@ public class Floor2RoadWaySsjThread implements Runnable {
|
||||
if("L1004".equals(roadSsjDevice.getDeviceCode())){
|
||||
exitList.add("l1003");
|
||||
}
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList(exitList);
|
||||
if (ObjUtil.isNotNull(mydoJob)) {
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
if (ObjUtil.isNull(basCargoSpace)) {
|
||||
log.error("货位不存在 cargoSpaceId{}", mydoJob.getCargoSpaceId());
|
||||
} else {
|
||||
//生成队列
|
||||
List<DdjDeviceExecutionQueue> list = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_2, Convert.toInt(mydoJob.getRoadwayId()));
|
||||
List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());
|
||||
if (CollUtil.isEmpty(list) && CollUtil.isNotEmpty(pclList)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(mydoJob.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName(mydoJob.getRoadwayId());
|
||||
ddjDeviceExecutionQueue.setDevId(Convert.toInt(mydoJob.getRoadwayId()));
|
||||
ddjDeviceExecutionQueue.setRwzt(0);
|
||||
ddjDeviceExecutionQueue.setYph(Convert.toInt(basCargoSpace.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setYlh(Convert.toInt(basCargoSpace.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setYch(Convert.toInt(basCargoSpace.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setMbph(pclList.get(0));
|
||||
ddjDeviceExecutionQueue.setMblh(pclList.get(1));
|
||||
ddjDeviceExecutionQueue.setMbch(pclList.get(2));
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setMlfs(5);
|
||||
ddjDeviceExecutionQueue.setSpare1(mydoJob.getTraySize());
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_1);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
List<MydoJob> inList = mydoJobService.getInJobByEntrance(exitList);
|
||||
if(inList.size() == 0){
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList(exitList);
|
||||
if (ObjUtil.isNotNull(mydoJob)) {
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
if (ObjUtil.isNull(basCargoSpace)) {
|
||||
log.error("货位不存在 cargoSpaceId{}", mydoJob.getCargoSpaceId());
|
||||
} else {
|
||||
//生成队列
|
||||
List<DdjDeviceExecutionQueue> list = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_2, Convert.toInt(mydoJob.getRoadwayId()));
|
||||
List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());
|
||||
if (CollUtil.isEmpty(list) && CollUtil.isNotEmpty(pclList)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(mydoJob.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName(mydoJob.getRoadwayId());
|
||||
ddjDeviceExecutionQueue.setDevId(Convert.toInt(mydoJob.getRoadwayId()));
|
||||
ddjDeviceExecutionQueue.setRwzt(0);
|
||||
ddjDeviceExecutionQueue.setYph(Convert.toInt(basCargoSpace.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setYlh(Convert.toInt(basCargoSpace.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setYch(Convert.toInt(basCargoSpace.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setMbph(pclList.get(0));
|
||||
ddjDeviceExecutionQueue.setMblh(pclList.get(1));
|
||||
ddjDeviceExecutionQueue.setMbch(pclList.get(2));
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setMlfs(5);
|
||||
ddjDeviceExecutionQueue.setSpare1(mydoJob.getTraySize());
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_1);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
|
||||
//修改作业状态
|
||||
mydoJob.setStatus(TASK_STATUS_RUNNING);
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ);
|
||||
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
//修改作业状态
|
||||
mydoJob.setStatus(TASK_STATUS_RUNNING);
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ);
|
||||
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
log.info("当前出口"+ exitList+"存在入库任务,无法出库!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ruoyi.common.TaskStatusCode.*;
|
||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.deviceSsjMap;
|
||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
|
||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.*;
|
||||
|
||||
/**
|
||||
* 生产线输送机
|
||||
@@ -92,7 +91,8 @@ public class LineSsjThread implements Runnable {
|
||||
|
||||
public void inDispatch(DeviceSsj SsjDevice) {
|
||||
//如果到位,扫到条码,托盘大小,执行阶段卡控一下(下发输送机后改执行阶段)
|
||||
if (SsjDevice.getDw() == 1 && StrUtil.isNotBlank(SsjDevice.getTrayCode()) && SsjDevice.getTraySize() != 0 && SsjDevice.getTaskNo() < 1000) {
|
||||
if (SsjDevice.getRkqq() == 1 && StrUtil.isNotBlank(SsjDevice.getTrayCode())
|
||||
&& SsjDevice.getTraySize() != 0 && SsjDevice.getTaskNo() < 1000) {
|
||||
log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}", SsjDevice.getDeviceCode(), "产线到位", SsjDevice.getTrayCode(), SsjDevice.getTraySize());
|
||||
|
||||
//查作业,入如果已经有了,直接下发输送线
|
||||
@@ -107,14 +107,14 @@ public class LineSsjThread implements Runnable {
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectInOrOutMydoJobList(mydoJob);
|
||||
//有作业,下发输送机任务号,覆盖任务号
|
||||
if (!mydoJobs.isEmpty()) {
|
||||
//永远有且只有一条
|
||||
//永远有且只有一条
|
||||
mydoJob = mydoJobs.get(0);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), 1, 1);
|
||||
if (i == 1) {
|
||||
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("G1005产线输送机下发任务号成功:" + mydoJob.getTaskNo());
|
||||
}
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), Integer.parseInt(mydoJob.getTraySize()), 1);
|
||||
if (i == 1) {
|
||||
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("G1005产线输送机下发任务号成功:" + mydoJob.getTaskNo());
|
||||
}
|
||||
} else {
|
||||
|
||||
//请求wms生成入库作业
|
||||
@@ -127,17 +127,18 @@ public class LineSsjThread implements Runnable {
|
||||
AjaxResult ajaxResult = apiService.createInMydoJob(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
//拿到正常作业,插到wcs作业表,下发给输送机任务号,覆盖任务号
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class) ;
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||
mydoJob2.setStatus("1");
|
||||
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJob2.setTraySize(Convert.toStr(SsjDevice.getTraySize()));
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob2.getTaskNo(), Integer.parseInt(mydoJob2.getTraySize()), 1);
|
||||
if (i == 1) {
|
||||
mydoJob2.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob2);
|
||||
log.info("G1005产线输送机下发任务号成功:{}" , mydoJob2.getTaskNo());
|
||||
log.info("G1005产线输送机下发任务号成功:{}", mydoJob2.getTaskNo());
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
@@ -152,18 +153,24 @@ public class LineSsjThread implements Runnable {
|
||||
* 9, "创建工艺入库单失败!"
|
||||
*/
|
||||
//超大,给plc下发错误信息,AGV搬到缓存区 其余人工处理
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "0", (Integer) ajaxResult.get("code"), 2);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
if((Integer) ajaxResult.get("code") == 5){
|
||||
if ((Integer) ajaxResult.get("code") == 5) {
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "2222", 1, 1);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
createMoveToPort(SsjDevice);
|
||||
} else {
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "99", Integer.parseInt(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.getRkqq() == 1 && StrUtil.isBlank(SsjDevice.getTrayCode()) &&
|
||||
SsjDevice.getTraySize() != 0 && SsjDevice.getTaskNo() < 1000) {
|
||||
|
||||
log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}", SsjDevice.getDeviceCode(), "产线", SsjDevice.getTrayCode(), SsjDevice.getTraySize());
|
||||
//查wcs有没作业,有下发给输送机任务号,覆盖任务号
|
||||
@@ -177,11 +184,11 @@ public class LineSsjThread implements Runnable {
|
||||
if (!mydoJobs.isEmpty()) {
|
||||
mydoJob = mydoJobs.get(0);
|
||||
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), 1, 1);
|
||||
if (i == 1) {
|
||||
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("G1005产线输送机下发任务号成功:" + mydoJob.getTaskNo());
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), 1, 1);
|
||||
if (i == 1) {
|
||||
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("G1005产线输送机下发任务号成功:" + mydoJob.getTaskNo());
|
||||
|
||||
}
|
||||
} else {
|
||||
@@ -196,8 +203,9 @@ public class LineSsjThread implements Runnable {
|
||||
mydoJob2.setExecutionPhase("0");
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJob2.setTraySize(Convert.toStr(SsjDevice.getTraySize()));
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob2.getTaskNo(), 1, 1);
|
||||
if (i == 1) {
|
||||
mydoJob2.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob2);
|
||||
@@ -207,13 +215,18 @@ public class LineSsjThread implements Runnable {
|
||||
//超大,给plc下发错误信息,等待人工处理
|
||||
//托盘大小对不上,给plc下发错误信息,等待人工处理
|
||||
//码不对,给plc下发错误信息,等待人工处理
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "0", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
//7是报工单失败,不处理
|
||||
if(!"9".equals(Integer.parseInt(ajaxResult.get("code").toString()))){
|
||||
|
||||
if ((Integer) ajaxResult.get("code") == 5) {
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "2222", 1, 1);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
createMoveToPort(SsjDevice);
|
||||
} else {
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "99", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,24 +257,27 @@ public class LineSsjThread implements Runnable {
|
||||
if (outMydoJobList.isEmpty() && kx == 1) {
|
||||
//查是否有队列,如果有了请求放货修改为允许放货
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(mydoJob.getJobId());
|
||||
if (agvQueue != null){
|
||||
if ("3".equals(mydoJob.getStatus()) && "1".equals(agvQueue.getStatus()) && SsjDevice.getAllowPut() == 1){
|
||||
if (agvQueue != null) {
|
||||
if ("3".equals(mydoJob.getStatus()) && "2".equals(agvQueue.getStatus()) && SsjDevice.getAllowPut() == 1) {
|
||||
AjaxResult ajaxResult = apiService.continueTask(agvQueue);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
log.info("给agv下发允许取货继续任务成功"+agvQueue.getWmsTaskNo());
|
||||
log.info("给agv下发允许取货继续任务成功" + agvQueue.getWmsTaskNo());
|
||||
agvQueue.setStatus("2");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if ("1".equals(mydoJob.getStatus())){
|
||||
if("0".equals(agvQueue.getStatus())){
|
||||
apiService.requestAgvQueue(agvQueue);
|
||||
}
|
||||
} else {
|
||||
if ("1".equals(mydoJob.getStatus())) {
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
// paramMap.put("trayCode", mydoJob.getTrayCode());
|
||||
paramMap.put("taskNo", mydoJob.getJobId());
|
||||
paramMap.put("trayCode", mydoJob.getTrayCode());
|
||||
paramMap.put("taskCode",mydoJobParam.getJobId());
|
||||
//todo 与agv对点
|
||||
paramMap.put("startPoint", "G1005");
|
||||
paramMap.put("endPoint", deviceCode);
|
||||
paramMap.put("traySize",mydoJob.getTraySize());
|
||||
paramMap.put("traySize", mydoJob.getTraySize());
|
||||
paramMap.put("wmsTaskNo", mydoJob.getTaskNo());
|
||||
AjaxResult ajaxResult = apiService.receiveAgvMoveJob(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
@@ -272,17 +288,37 @@ public class LineSsjThread implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (SsjDevice.getDw() == 1 && SsjDevice.getTaskNo() == 2222 && SsjDevice.getTraySize() == 4) {
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByWmsTask(SsjDevice.getTaskNo());
|
||||
if (agvQueue != null) {
|
||||
if ("2".equals(agvQueue.getStatus()) && SsjDevice.getAllowPut() == 1) {
|
||||
AjaxResult ajaxResult = apiService.continueTask(agvQueue);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
log.info("给agv下发允许取货继续任务成功" + agvQueue.getWmsTaskNo());
|
||||
agvQueue.setStatus("2");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SsjDevice.getDw() == 0 && SsjDevice.getTaskNo() > 1000 && SsjDevice.getTraySize() > 0) {
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByWmsTask(SsjDevice.getTaskNo());
|
||||
if (agvQueue != null) {
|
||||
if ("4".equals(agvQueue.getStatus())) {
|
||||
int i = writeToSsjQH("DB802.122", 1);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发取货完成成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void createMoveToPort(DeviceSsj SsjDevice){
|
||||
|
||||
void createMoveToPort(DeviceSsj SsjDevice) {
|
||||
WcsPort wcsPort = new WcsPort();
|
||||
wcsPort.setStatus("1");
|
||||
List<WcsPort> wcsPorts = wcsPortService.selectWcsPortList(wcsPort);
|
||||
@@ -294,29 +330,23 @@ public class LineSsjThread implements Runnable {
|
||||
.map(WcsPort::getPortCode)
|
||||
.anyMatch(portCode -> portCode.equals(positionCode2)));
|
||||
|
||||
if(hasMatchingPort==false){
|
||||
if (hasMatchingPort == false) {
|
||||
|
||||
if(!wcsPorts.isEmpty()){
|
||||
if (!wcsPorts.isEmpty()) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
// map.put("trayCode", mydoJob.getTrayCode());
|
||||
map.put("taskNo", StrUtil.uuid());
|
||||
//todo 与agv对点
|
||||
map.put("startPoint", "G1005");
|
||||
map.put("endPoint", wcsPorts.get(0).getPortCode());
|
||||
// map.put("traySize",String.valueOf(SsjDevice.getTraySize()));
|
||||
map.put("traySize", "5");
|
||||
// map.put("wmsTaskNo", mydoJob.getTaskNo());
|
||||
AjaxResult ajaxResult1 = apiService.receiveAgvMoveJob(map);
|
||||
if(ajaxResult1.isSuccess()){
|
||||
log.info("G1005产线生成作业失败,AGV下发搬运至缓存点任务成功:{}" , ajaxResult1.get("data"));
|
||||
if (ajaxResult1.isSuccess()) {
|
||||
log.info("G1005产线生成作业失败,AGV下发搬运至缓存点任务成功:{}", ajaxResult1.get("data"));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ spring:
|
||||
# url: jdbc:sqlserver://172.16.2.170:1433;databaseName=FT517-WCS;
|
||||
# username: sa
|
||||
# password: Flrd0914.
|
||||
url: jdbc:sqlserver://192.168.56.212:1433;databaseName=FT517-wcs;
|
||||
url: jdbc:sqlserver://192.168.58.10:1433;databaseName=FT517-wcs;
|
||||
username: sa
|
||||
password: www.123.com
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ ruoyi:
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8081
|
||||
port: 8084
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
@@ -68,7 +68,7 @@ spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 192.168.56.212
|
||||
host: 192.168.58.10
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
|
||||
@@ -62,6 +62,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where task_code = #{taskCode}
|
||||
</select>
|
||||
|
||||
<select id="selectAgvQueueByWmsTask" parameterType="Integer" resultMap="AgvQueueResult">
|
||||
<include refid="selectAgvQueueVo"/>
|
||||
where wms_task_no = #{wmsTaskNo}
|
||||
</select>
|
||||
|
||||
<insert id="insertAgvQueue" parameterType="AgvQueue">
|
||||
insert into agv_queue
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
@@ -105,6 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="exception != null">exception = #{exception},</if>
|
||||
<if test="traySize != null">tray_size = #{traySize},</if>
|
||||
<if test="allowPut != null">allow_put = #{allowPut},</if>
|
||||
<if test="sszt != null">sszt = #{sszt},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -72,10 +72,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where job_id = #{jobId}
|
||||
</select>
|
||||
|
||||
<select id="selectMydoJobByTaskNo" parameterType="String" resultMap="MydoJobResult">
|
||||
<include refid="selectMydoJobVo"/>
|
||||
where task_no = #{taskNo}
|
||||
<select id="selectJobByTaskNo" parameterType="String" resultMap="MydoJobResult">
|
||||
select job_id, a.status, task_no, a.roadway_id, b.cargo_space_name as cargo_space_id, target_roadway_id,
|
||||
target_cargo_space_id, priority, execution_phase, in_or_out, create_time,
|
||||
start_time, finish_time, entrance_id, exit_id, a.warehouse_id, fault_flag,
|
||||
flag,a.tray_code,tray_size
|
||||
from mydo_job_wcs a,bas_cargo_space b
|
||||
where a.cargo_space_id = b.cargo_space_id
|
||||
and task_no = #{taskNo}
|
||||
</select>
|
||||
|
||||
<select id="selectMydoJobByTaskNo" parameterType="String" resultMap="MydoJobResult">
|
||||
<include refid="selectMydoJobVo"/>
|
||||
where task_no = #{taskNo}
|
||||
</select>
|
||||
|
||||
<select id="ddjTaskFinish" parameterType="java.util.Map" statementType="CALLABLE">
|
||||
{call proc_mydojob_finish(
|
||||
#{v_rwh,mode=IN,jdbcType=INTEGER},
|
||||
@@ -98,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<foreach item="item" index="index" collection="exitList" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and in_or_out > 20
|
||||
and in_or_out > 20
|
||||
and status = 1 and execution_phase= 0
|
||||
order by priority desc,create_time
|
||||
</select>
|
||||
@@ -257,8 +268,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<foreach item="item" index="index" collection="exitList" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and in_or_out > 20
|
||||
and in_or_out > 20
|
||||
and status = 3
|
||||
order by priority desc,create_time
|
||||
</select>
|
||||
|
||||
<select id="getInJobByEntrance" resultMap="MydoJobResult">
|
||||
select job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag,tray_size,tray_code from mydo_job_wcs
|
||||
where entrance_id in
|
||||
<foreach item="item" index="index" collection="exitList" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and in_or_out < 20
|
||||
and status in (1,3)
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -9,10 +9,10 @@ const CompressionPlugin = require('compression-webpack-plugin')
|
||||
|
||||
const name = process.env.VUE_APP_TITLE || 'FORTUCKY WCS SYSTEM' // 网页标题
|
||||
|
||||
const baseUrl = 'http://localhost:8081' // 后端接口地址(你的后端端口是8081)
|
||||
|
||||
const port = process.env.port || process.env.npm_config_port || 80 // 前端端口
|
||||
const baseUrl = 'http://localhost:8084' // 后端接口地址(你的后端端口是8081)
|
||||
|
||||
// const port = process.env.port || process.env.npm_config_port || 80 // 前端端口
|
||||
const port = 8083
|
||||
module.exports = {
|
||||
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
|
||||
outputDir: 'dist',
|
||||
|
||||
Reference in New Issue
Block a user