现场调试修改
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.job.service.IMydoJobService;
|
||||
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
|
||||
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueueFinish;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class AgvController extends BaseController {
|
||||
//取消rcs中指定的agv任务
|
||||
CancelTaskResponse cancelTaskResponse = apiService.cancelTask(cancelTaskRequest);
|
||||
|
||||
if(cancelTaskResponse.getCode() == 0 && "成功".equals(cancelTaskResponse.getMessage()) && cancelTaskResponse.getReqCode() == cancelTaskRequest.getReqCode()){
|
||||
if(cancelTaskResponse.getCode() == 0 && "成功".equals(cancelTaskResponse.getMsg()) && cancelTaskResponse.getReqCode() == cancelTaskRequest.getReqCode()){
|
||||
return AjaxResult.success("AGV任务队列取消成功!", cancelTaskResponse);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.api.domain.wcs2wms.stockout.StockoutReceive;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.api.service.IRequestLogService;
|
||||
import com.ruoyi.bas.port.domain.WcsPort;
|
||||
import com.ruoyi.bas.port.service.IWcsPortService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
@@ -20,6 +23,8 @@ public class Wcs2WmsController {
|
||||
private IApiService apiService;
|
||||
@Autowired
|
||||
private IWcsPortService wcsPortService;
|
||||
@Autowired
|
||||
IRequestLogService requestLogService;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public class ResponseBase {
|
||||
/**
|
||||
* 返回消息
|
||||
*/
|
||||
private String message;
|
||||
private String msg;
|
||||
/**
|
||||
* 自定义返回
|
||||
*/
|
||||
|
||||
@@ -3,12 +3,18 @@ package com.ruoyi.api.domain.wcs2wms;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import reactor.util.annotation.Nullable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ReceiveJob {
|
||||
|
||||
/**
|
||||
* 请求码
|
||||
*/
|
||||
private String reqCode;
|
||||
|
||||
/**
|
||||
* 作业号
|
||||
*/
|
||||
@@ -25,16 +31,19 @@ public class ReceiveJob {
|
||||
private String cargoSpaceId;
|
||||
|
||||
/** 货位(移库使用) */
|
||||
@Nullable
|
||||
private String targetCargoSpaceId;
|
||||
|
||||
/**
|
||||
* 入口
|
||||
*/
|
||||
@Nullable
|
||||
private String entranceId;
|
||||
|
||||
/**
|
||||
* 出口
|
||||
*/
|
||||
@Nullable
|
||||
private String exitId;
|
||||
|
||||
/**
|
||||
@@ -50,6 +59,7 @@ public class ReceiveJob {
|
||||
/**
|
||||
* 巷道号
|
||||
*/
|
||||
@Nullable
|
||||
private String roadwayId;
|
||||
|
||||
|
||||
|
||||
@@ -7,12 +7,6 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 入库请求返回
|
||||
*
|
||||
* 【常见错误】
|
||||
* 任务类型不可为空 未传 taskTypeCode
|
||||
* 该任务类型未配置 taskTypeCode 在系统中不存在
|
||||
* 该任务类型无点位配置信息 任务类型缺少点位模板
|
||||
* 该任务类型未开启 任务类型状态为禁用
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@@ -44,5 +38,10 @@ public class StockinReceive {
|
||||
*/
|
||||
private String cargoSpaceId;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private String inOrOut;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -76,16 +76,16 @@ public interface IApiService
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 入库请求生成作业
|
||||
*/
|
||||
AjaxResult createInMydoJob(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* @@@ FT568 入库请求生成作业 处理了请求响应,适应wms的自定义响应格式
|
||||
*/
|
||||
AjaxResult createMydoJobForStockin(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 入库请求wms参数 - 作业号、货位
|
||||
*/
|
||||
// AjaxResult requestMydoJobParamForWms(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 入库请求作业异常反馈(扫码失败、外形、称重等异常)
|
||||
*/
|
||||
@@ -93,12 +93,32 @@ public interface IApiService
|
||||
|
||||
AjaxResult selectMydoJobByNoTrayCode(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 接受出库作业
|
||||
* @param receiveJob
|
||||
* @return
|
||||
*/
|
||||
AjaxResult receiveOutMydoJob(ReceiveJob receiveJob);
|
||||
|
||||
/**
|
||||
* 接受入库作业
|
||||
* @param receiveJob
|
||||
* @return
|
||||
*/
|
||||
AjaxResult receiveInMydoJob(ReceiveJob receiveJob);
|
||||
|
||||
/**
|
||||
* 接受移库作业
|
||||
* @param receiveJob
|
||||
* @return
|
||||
*/
|
||||
AjaxResult receiveMoveMydoJob(ReceiveJob receiveJob);
|
||||
|
||||
/**
|
||||
* 接收盘点作业
|
||||
* @param receiveInventoryJob
|
||||
* @return
|
||||
*/
|
||||
AjaxResult receiveInventoryMydoJob(ReceiveJob receiveInventoryJob);
|
||||
|
||||
AjaxResult selectMydoJobByTrayCodeAndEntranceId(HashMap<String, Object> paramMap);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.api.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* 接口记录Service接口
|
||||
@@ -83,6 +84,16 @@ public interface IRequestLogService
|
||||
public RequestLog getRequestLog(String param, String endPoint);
|
||||
|
||||
|
||||
/**
|
||||
* 接收接口记录
|
||||
*
|
||||
* @param param
|
||||
* @param remark
|
||||
* @return
|
||||
*/
|
||||
public RequestLog getRequestLog(String param, String remark, AjaxResult ajaxResult);
|
||||
|
||||
|
||||
RequestLog getRequestLog2(String url, String param, String endPoint);
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.api.domain.InterfaceReceive;
|
||||
@@ -18,7 +20,6 @@ import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRespons
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.PositionCodeData;
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.api.domain.wcs2wms.ResponseResult;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
@@ -42,7 +43,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.ruoyi.common.Constant.*;
|
||||
import static com.ruoyi.common.ConvType.ROADWAY1_EXIT;
|
||||
import static com.ruoyi.common.ConvType.*;
|
||||
import static com.ruoyi.common.TaskStatusCode.TASK_EP_CREATED;
|
||||
import static com.ruoyi.common.TaskStatusCode.TASK_STATUS_CREATED;
|
||||
|
||||
@@ -115,24 +116,9 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求wms获取入库任务参数
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult createInMydoJob(Map<String, Object> param) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WMS_STOCKIN_MYDOJOB, "入库请求生成作业", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
|
||||
return AjaxResult.success(bean.getData());
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @@@ FT568 请求wms获取入库任务参数 - 适应wms的自定义请求响应格式
|
||||
* 请求wms获取入库任务参数
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@@ -140,13 +126,15 @@ public class ApiServiceImpl implements IApiService {
|
||||
public AjaxResult createMydoJobForStockin(Map<String, Object> param) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WMS_STOCKIN_MYDOJOB, "入库请求生成作业", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
ResponseResult bean = JSONUtil.toBean(requestLog.getResponseBody(), ResponseResult.class);
|
||||
return AjaxResult.success(bean.getResult());
|
||||
// ResponseResult bean = JSONUtil.toBean(requestLog.getResponseBody(), ResponseResult.class);
|
||||
// return AjaxResult.success(bean.getResult());
|
||||
return AjaxResult.success(requestLog.getResponseBody());
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @@@ FT568 入库请求作业异常反馈(扫码失败、外形、称重等异常)
|
||||
* @param param
|
||||
@@ -176,49 +164,39 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
// -------------------------检查推送的任务参数-------------------------
|
||||
log.info(
|
||||
"【wms推送出库】作业号:{},wms任务号:{},推送出库货位:{},推送类型:出库【{}】",stockoutReceive.getJobId(), stockoutReceive.getTaskNo(), stockoutReceive.getCargoSpaceId(), stockoutReceive.getInOrOut()
|
||||
"【wms推送出库】作业号:{},推送出库货位:{},推送类型:出库【{}】",stockoutReceive.getJobId(), stockoutReceive.getCargoSpaceId(), stockoutReceive.getInOrOut()
|
||||
);
|
||||
|
||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stockoutReceive.getCargoSpaceId());
|
||||
|
||||
// 0.检查货位参数是否合法
|
||||
if(stockoutReceive.getCargoSpaceId() == null || stockoutReceive.getCargoSpaceId() == ""){
|
||||
if(StrUtil.isBlank(stockoutReceive.getCargoSpaceId())){
|
||||
log.info("【请求错误】wms推送出库任务失败,参数错误,推送作业号:{},推送出库货位:{}", stockoutReceive.getJobId(), stockoutReceive.getCargoSpaceId());
|
||||
return AjaxResult.error("【请求错误】wms推送出库任务失败,参数错误,推送作业号:{}" + stockoutReceive.getJobId() + ",推送出库货位:" + stockoutReceive.getCargoSpaceId());
|
||||
}else{
|
||||
//排号检查
|
||||
if (cargoSpace.getThePlatoon() > 2 || cargoSpace.getThePlatoon() < 0){
|
||||
log.info("【请求错误】wms推送出库任务失败,参数错误,推送作业号:{},推送排:{}", stockoutReceive.getJobId(), cargoSpace.getThePlatoon());
|
||||
return AjaxResult.error("【请求错误】wms推送出库任务失败,错误,推送任务号:" + stockoutReceive.getJobId() + ",推送出库排号:" + cargoSpace.getThePlatoon() + ",仓库中不存在该位置!");
|
||||
}
|
||||
|
||||
//列号检查
|
||||
if (cargoSpace.getTheColumn() > 33 || cargoSpace.getTheColumn() < 0){
|
||||
log.info("【请求错误】wms推送出库任务失败,参数错误,推送作业号:{},推送列:{}", stockoutReceive.getJobId(), cargoSpace.getTheColumn());
|
||||
return AjaxResult.error("【请求错误】wms推送出库任务失败,错误,推送任务号:" + stockoutReceive.getJobId() + ",推送出库列号:" + cargoSpace.getTheColumn() + ",仓库中不存在该位置!");
|
||||
}
|
||||
|
||||
//层号检查
|
||||
if (cargoSpace.getTheFloor() > 6 || cargoSpace.getTheFloor() < 0){
|
||||
log.info("【请求错误】wms推送出库任务失败,参数错误,推送作业号:{},推送层:{}", stockoutReceive.getJobId(), cargoSpace.getThePlatoon());
|
||||
return AjaxResult.error("【请求错误】wms推送出库任务失败,错误,推送任务号:" + stockoutReceive.getJobId() + ",推送出库层号:" + cargoSpace.getThePlatoon() + ",仓库中不存在该位置!");
|
||||
}
|
||||
return AjaxResult.error("【请求错误】wms推送出库任务失败,参数错误,推送作业号:" + stockoutReceive.getJobId() + ",推送出库货位:" + stockoutReceive.getCargoSpaceId());
|
||||
}
|
||||
|
||||
// 1.wms推送的作业号是否重复
|
||||
MydoJob job = new MydoJob().builder().jobId(stockoutReceive.getJobId()).build();
|
||||
List<MydoJob> tasks = mydoJobService.selectMydoJobList(job);
|
||||
if (tasks.size() != 0) {
|
||||
log.info("【请求错误】wms下发出库任务失败,该任务已存在,推送作业号号:{},推送出库货位:{}", stockoutReceive.getJobId(), stockoutReceive.getCargoSpaceId());
|
||||
return AjaxResult.error("【请求错误】wms下发出库任务失败,该任务已存在,推送作业号:{}" + stockoutReceive.getJobId() + ",推送出库货位:" + stockoutReceive.getCargoSpaceId());
|
||||
log.info("【提示】wms下发出库任务失败,该任务已存在,wms作业号:{}", stockoutReceive.getJobId());
|
||||
return AjaxResult.error("【提示】wms下发出库任务失败,该任务已存在,wms作业号:{}" + stockoutReceive.getJobId());
|
||||
}
|
||||
|
||||
// 2.wms推送的出库货位是否已经有任务
|
||||
job = new MydoJob().builder().cargoSpaceId(stockoutReceive.getCargoSpaceId()).build();
|
||||
tasks = mydoJobService.selectMydoJobList(job);
|
||||
if (tasks.size() != 0) {
|
||||
log.info("【请求错误】wms下发出库任务失败,已经存在该货位的出库任务,推送任务号:{},推送出库货位:{}", stockoutReceive.getJobId(), stockoutReceive.getCargoSpaceId());
|
||||
return AjaxResult.error("【请求错误】wms下发出库任务失败,已经存在该货位的出库任务,推送任务号:{}" + stockoutReceive.getJobId() + ",推送出库货位:" + stockoutReceive.getCargoSpaceId());
|
||||
log.info("【提示】wms下发出库任务失败,已经存在该货位的出库任务,wms作业号:{},推送出库货位:{}", stockoutReceive.getJobId(), stockoutReceive.getCargoSpaceId());
|
||||
return AjaxResult.error("【提示】wms下发出库任务失败,已经存在该货位的出库任务,wms作业号:{}" + stockoutReceive.getJobId() + ",推送出库货位:" + stockoutReceive.getCargoSpaceId());
|
||||
}
|
||||
|
||||
// 3.wms推送的出托盘号是否已经有任务
|
||||
job = new MydoJob().builder().cargoSpaceId(stockoutReceive.getTrayCode()).build();
|
||||
tasks = mydoJobService.selectMydoJobList(job);
|
||||
if (tasks.size() != 0) {
|
||||
log.info("【提示】wms下发出库任务失败,已经存在该托盘的出库任务,wms作业号:{},推送托盘号:{}", stockoutReceive.getJobId(), stockoutReceive.getTrayCode());
|
||||
return AjaxResult.error("【提示】wms下发出库任务失败,已经存在该货位的出库任务,wms作业号:{}" + stockoutReceive.getJobId() + ",推送托盘号:" + stockoutReceive.getTrayCode());
|
||||
}
|
||||
|
||||
//生成出库作业
|
||||
@@ -226,27 +204,29 @@ public class ApiServiceImpl implements IApiService {
|
||||
mydoJob = BeanUtil.copyProperties(stockoutReceive, MydoJob.class);
|
||||
// mydoJob.setJobId(stockoutReceive.getJobId());
|
||||
// mydoJob.setTaskNo(stockoutReceive.getTaskNo());
|
||||
//// mydoJob.setWmsTaskNo(stockoutReceive.getTaskCode());
|
||||
// mydoJob.setWmsTaskNo(stockoutReceive.getTaskCode());
|
||||
// mydoJob.setCargoSpaceId(stockoutReceive.getCargoSpaceId());
|
||||
mydoJob.setInOrOut(stockoutReceive.getInOrOut());
|
||||
//
|
||||
mydoJob.setTraySize(GoodsType.TYPE_DEFAULT);//默认
|
||||
mydoJob.setStatus(TASK_STATUS_CREATED);
|
||||
mydoJob.setPriority(Long.valueOf(10));
|
||||
//todo 可能需要查本地库存信息获取条码?
|
||||
// mydoJob.setTrayCode(receiveOutJob.getTrayCode());
|
||||
mydoJob.setRoadwayId(
|
||||
basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stockoutReceive.getCargoSpaceId()).getRoadwayId()
|
||||
);
|
||||
mydoJob.setExitId(ROADWAY1_EXIT);//todo 需要判断两个双向输送口是否空闲
|
||||
mydoJob.setInOrOut(stockoutReceive.getInOrOut());
|
||||
mydoJob.setTraySize(mydoJobService.getTraytypeByTrayCode(mydoJob.getTrayCode()));
|
||||
mydoJob.setStatus(TASK_STATUS_CREATED);
|
||||
mydoJob.setPriority(10);
|
||||
mydoJob.setRoadwayId(cargoSpace.getRoadwayId());
|
||||
String exitId;
|
||||
if (cargoSpace.getCargoAreaId().equals("02")){
|
||||
exitId = ROADWAY2_PORTCONV_2;
|
||||
}else if (cargoSpace.getCargoAreaId().equals("03")){
|
||||
exitId = ROADWAY2_PORTCONV_3;
|
||||
}else if (cargoSpace.getCargoAreaId().equals("04")){
|
||||
exitId = ROADWAY3_EXIT;
|
||||
}else{
|
||||
// exitId = ROADWAY1_EXIT;
|
||||
exitId = ROADWAY1_ENTRANCE;
|
||||
}
|
||||
mydoJob.setExitId(exitId);
|
||||
mydoJob.setCreateTime(DateUtils.getNowDate());
|
||||
mydoJob.setExecutionPhase(TASK_EP_CREATED);
|
||||
// mydoJob.setTraySize(receiveOutJob.getDepartmentId());
|
||||
|
||||
if (mydoJobService.selectMydoJobByJobId(mydoJob.getJobId()) != null){
|
||||
log.info("【任务警告】生成作业失败,已存在的作业号:{}", mydoJob.getJobId() + "(此条可忽略)");
|
||||
return AjaxResult.error("【请求警告】生成作业失败,已存在的作业号:{}" + mydoJob.getJobId() + "(此条可忽略)");
|
||||
}
|
||||
|
||||
int i = mydoJobService.insertMydoJob(mydoJob);
|
||||
// boolean success = mydoJobService.saveOrUpdate(mydoJob);
|
||||
@@ -305,7 +285,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
// mydoJob.setTraySize(GoodsType.TYPE_DEFAULT);
|
||||
// mydoJob.setInOrOut("1");
|
||||
mydoJob.setStatus(TASK_STATUS_CREATED);
|
||||
mydoJob.setPriority(Long.valueOf(10));
|
||||
mydoJob.setPriority(10);
|
||||
mydoJob.setCreateTime(DateUtils.getNowDate());
|
||||
mydoJob.setExecutionPhase(TASK_EP_CREATED);
|
||||
// mydoJob.setTraySize(receiveOutJob.getDepartmentId());
|
||||
@@ -372,7 +352,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
// mydoJob.setTraySize(GoodsType.TYPE_DEFAULT);
|
||||
// mydoJob.setInOrOut("1");
|
||||
mydoJob.setStatus(TASK_STATUS_CREATED);
|
||||
mydoJob.setPriority(Long.valueOf(10));
|
||||
mydoJob.setPriority(0);
|
||||
mydoJob.setCreateTime(DateUtils.getNowDate());
|
||||
mydoJob.setExecutionPhase(TASK_EP_CREATED);
|
||||
// mydoJob.setTraySize(receiveOutJob.getDepartmentId());
|
||||
@@ -440,7 +420,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
// mydoJob.setTraySize(GoodsType.TYPE_DEFAULT);
|
||||
mydoJob.setInOrOut("3");
|
||||
mydoJob.setStatus(TASK_STATUS_CREATED);
|
||||
mydoJob.setPriority(Long.valueOf(10));
|
||||
mydoJob.setPriority(10);
|
||||
//todo 可能需要查本地库存信息获取条码?
|
||||
|
||||
mydoJob.setCreateTime(DateUtils.getNowDate());
|
||||
@@ -599,11 +579,12 @@ public class ApiServiceImpl implements IApiService {
|
||||
//todo 需要调试
|
||||
GenAgvSchedulingTaskResponse response = new GenAgvSchedulingTaskResponse();
|
||||
response.setCode(500);
|
||||
response.setMessage("请求失败");
|
||||
response.setMsg("请求失败");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* agv执行状态返回接口
|
||||
*
|
||||
@@ -653,7 +634,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
return AjaxResult.error(response.getMessage());
|
||||
return AjaxResult.error(response.getMsg());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.InterfaceReceive;
|
||||
import com.ruoyi.api.domain.wcs2wms.ResponseResult;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -249,7 +250,7 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
// String resStr = HttpUtil.post(url, param, header, 3000);
|
||||
String resStr = HttpRequest.post(url)
|
||||
.body(param)
|
||||
.header("X-Service-Secret", HEADER_TOKEN) // 向wms请求头必需添加的token
|
||||
// .header("X-Service-Secret", HEADER_TOKEN) // 向wms请求头必需添加的token
|
||||
.execute()
|
||||
.body();
|
||||
requestLog.setResponseBody(resStr);
|
||||
@@ -302,6 +303,32 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入请求日志
|
||||
*
|
||||
* @return requestLog
|
||||
*/
|
||||
@Override
|
||||
public RequestLog getRequestLog(String param, String remark,AjaxResult ajaxResult) {
|
||||
RequestLog requestLog = new RequestLog();
|
||||
requestLog.setRequestTime(DateUtil.formatDateTime(new Date()));
|
||||
requestLog.setRequestBody(param);
|
||||
requestLog.setSourceSystem("wcs");
|
||||
requestLog.setTargetSystem("wms");
|
||||
requestLog.setEndpoint(remark);
|
||||
requestLog.setRequestMethod("post");
|
||||
requestLog.setResponseTime(DateUtil.formatDateTime(new Date()));
|
||||
requestLog.setDuration(Convert.toStr(DateUtil.between(Convert.toDate(requestLog.getRequestTime()), Convert.toDate(requestLog.getResponseTime()), DateUnit.MS)));
|
||||
requestLog.setResponseStatus("1");
|
||||
if (ajaxResult.isSuccess()){
|
||||
requestLog.setIsSuccessful("1");
|
||||
}else {
|
||||
requestLog.setIsSuccessful("0");
|
||||
}
|
||||
requestLog.setResponseBody(Convert.toStr(ajaxResult.get("msg")));
|
||||
return requestLog;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @@@ FT568 将wms自定义的响应格式解析为本地响应格式(减少其他改动)
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.ruoyi.common;
|
||||
|
||||
public class Constant {
|
||||
|
||||
public static final String LOCAL_URL = "http://127.0.0.1:8084/api2wms";
|
||||
public static final String WMS_BASE_URL = "http://127.0.0.1:8083/api/external";
|
||||
public static final String LOCAL_URL = "http://127.0.0.1:8084/api/wmsService/wcs/";
|
||||
public static final String WMS_BASE_URL = "http://127.0.0.1:8084/api/external";
|
||||
public static final String RCS_BASE_URL = "http://192.168.58.101:8182/rcms/services/rest/hikRpcService/";
|
||||
|
||||
public static final String HEADER_TOKEN = "fed3d1511a5a474b9e1f9c56246cb1ec";
|
||||
@@ -21,17 +21,17 @@ public class Constant {
|
||||
/**
|
||||
* 任务完成回传
|
||||
*/
|
||||
public static final String WMS_JOB_FINISH_URL = LOCAL_URL+"jobFinish";
|
||||
public static final String WMS_JOB_FINISH_URL = LOCAL_URL + "jobFinish";
|
||||
|
||||
/**
|
||||
* 请求创建入库任务
|
||||
*/
|
||||
public static final String WMS_CREATE_IN_MYDO_JOB_URL = LOCAL_URL+"requestMydoJobByTrayCode";
|
||||
public static final String WMS_REQUEST_MYDO_JOB_URL = LOCAL_URL+"requestMydoJobByNoTrayCode";
|
||||
public static final String WMS_RE_ASSIGN_URL = LOCAL_URL+"reAssign";
|
||||
public static final String WMS_RE_MATERIAL_URL = LOCAL_URL+"reMaterial";
|
||||
public static final String WMS_REQUEST_ENTER_URL = LOCAL_URL+"requestMydoJobByTrayCodeAndEntranceId";
|
||||
public static final String WMS_REQUEST_IN_SPACE_URL = LOCAL_URL+"requestInSpace";
|
||||
public static final String WMS_CREATE_IN_MYDO_JOB_URL = LOCAL_URL + "requestMydoJobByTrayCode";
|
||||
public static final String WMS_REQUEST_MYDO_JOB_URL = LOCAL_URL + "requestMydoJobByNoTrayCode";
|
||||
public static final String WMS_RE_ASSIGN_URL = LOCAL_URL + "reAssign";
|
||||
public static final String WMS_RE_MATERIAL_URL = LOCAL_URL + "reMaterial";
|
||||
public static final String WMS_REQUEST_ENTER_URL = LOCAL_URL + "requestMydoJobByTrayCodeAndEntranceId";
|
||||
public static final String WMS_REQUEST_IN_SPACE_URL = LOCAL_URL + "requestInSpace";
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Constant {
|
||||
/**
|
||||
* 向wms请求入库url
|
||||
*/
|
||||
public static final String WMS_STOCKIN_MYDOJOB = LOCAL_URL + "/api/external/taskIssue";
|
||||
public static final String WMS_STOCKIN_MYDOJOB = LOCAL_URL + "requestMydoJobByTrayCode";
|
||||
|
||||
/**
|
||||
* 出入库回传url
|
||||
|
||||
@@ -10,32 +10,42 @@ public class ConvType {
|
||||
/**
|
||||
* 1#巷道出库输送机(出口到位位置)
|
||||
*/
|
||||
public static final String ROADWAY1_EXIT = "L1008";
|
||||
public static final String ROADWAY1_EXIT = "L1001";
|
||||
|
||||
/**
|
||||
* 1#巷道入库输送机(入口源位置)
|
||||
*/
|
||||
public static final String ROADWAY1_ENTRANCE = "L1009";
|
||||
public static final String ROADWAY1_ENTRANCE = "L1003";
|
||||
|
||||
/**
|
||||
* 2#巷道输送口-2(双向输送机到位位置)
|
||||
* 2#巷道输送口-1(双向输送机巷道位置)
|
||||
*/
|
||||
public static final String ROADWAY2_PORTCONV_2 = "L1006";
|
||||
public static final String ROADWAY2_PORTCONV_2 = "L1004";
|
||||
|
||||
/**
|
||||
* 2#巷道输送口-1(双向输送机到位位置)
|
||||
* 2#巷道输送口-3(双向输送机出入口位置)
|
||||
*/
|
||||
public static final String ROADWAY2_PORTCONV_1 = "L1004";
|
||||
public static final String ROADWAY2_ROADCONV_2 = "L1005";
|
||||
|
||||
/**
|
||||
* 2#巷道输送口-3(双向输送机巷道位置)
|
||||
*/
|
||||
public static final String ROADWAY2_PORTCONV_3 = "L1006";
|
||||
|
||||
/**
|
||||
* 2#巷道输送口-4(双向输送机出入口位置)
|
||||
*/
|
||||
public static final String ROADWAY2_ROADCONV_4 = "L1007";
|
||||
|
||||
/**
|
||||
* 3#巷道出库输送机(出口到位位置)
|
||||
*/
|
||||
public static final String ROADWAY3_EXIT = "L1001";
|
||||
public static final String ROADWAY3_EXIT = "L1008";
|
||||
|
||||
/**
|
||||
* 3#巷道入库输送机(入口源位置)
|
||||
*/
|
||||
public static final String ROADWAY3_ENTRANCE = "L1002";
|
||||
public static final String ROADWAY3_ENTRANCE = "L1010";
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +54,7 @@ public class ConvType {
|
||||
/**
|
||||
* 输送机对应巷道
|
||||
*/
|
||||
public static final Map<String,Object> CONV_ROAD = new HashMap<>(Map.ofEntries(
|
||||
public static final Map<String,Object> CONV_ROAD_ROADWAY = new HashMap<>(Map.ofEntries(
|
||||
entry("L1001", 1),
|
||||
entry("L1002", 1),
|
||||
entry("L1003", 1),
|
||||
@@ -57,5 +67,33 @@ public class ConvType {
|
||||
entry("L1010", 3)
|
||||
));
|
||||
|
||||
/**
|
||||
* 输送机对应区域
|
||||
*/
|
||||
public static final Map<String,Object> CONV_ROAD_AREA = new HashMap<>(Map.ofEntries(
|
||||
entry("L1001", "01"),
|
||||
entry("L1002", "01"),
|
||||
entry("L1003", "01"),
|
||||
entry("L1004", "02"),
|
||||
entry("L1005", "02"),
|
||||
entry("L1006", "03"),
|
||||
entry("L1007", "03"),
|
||||
entry("L1008", "04"),
|
||||
entry("L1009", "04"),
|
||||
entry("L1010", "04")
|
||||
));
|
||||
|
||||
/**
|
||||
* 巷道对应入口货位
|
||||
*/
|
||||
public static final Map<String,String> CONV_ROAD_CARGO = new HashMap<>(Map.ofEntries(
|
||||
entry("L1001", "010200001"),
|
||||
entry("L1003", "010300001"),
|
||||
entry("L1005", "010500001"),
|
||||
entry("L1007", "010700001"),
|
||||
entry("L1010", "011000001"),
|
||||
entry("L1008", "011100001")
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,15 +8,15 @@ public class GoodsType {
|
||||
/**
|
||||
* 默认
|
||||
*/
|
||||
public static final String TYPE_DEFAULT = "0";
|
||||
public static final Integer TYPE_DEFAULT = 0;
|
||||
|
||||
/**
|
||||
* 高度1
|
||||
*/
|
||||
public static final String TYPE_HEIGHT_1 = "1";
|
||||
public static final Integer TYPE_HEIGHT_1 = 4;
|
||||
|
||||
/**
|
||||
* 高度2
|
||||
*/
|
||||
public static final String TYPE_HEIGHT_2 = "2";
|
||||
public static final Integer TYPE_HEIGHT_2 = 6;
|
||||
}
|
||||
|
||||
@@ -67,34 +67,44 @@ public class TaskStatusCode {
|
||||
public static final String TASK_EP_ROADWAY_SSJ = "4";
|
||||
|
||||
/**
|
||||
* 任务执行阶段 堆垛机执行
|
||||
* 任务执行阶段 堆垛机入库取货完成(仅取货)
|
||||
*/
|
||||
public static final String TASK_EP_DDJ = "5";
|
||||
public static final String TASK_EP_DDJ_PICK = "5";
|
||||
|
||||
/**
|
||||
* 任务执行阶段 堆垛机入库放货(仅放货)
|
||||
*/
|
||||
// public static final String TASK_EP_DDJ_PUT = "6";
|
||||
|
||||
/**
|
||||
* 任务执行阶段 堆垛机执行(入库放货/出库取放)
|
||||
*/
|
||||
public static final String TASK_EP_DDJ = "6";
|
||||
|
||||
/**
|
||||
* 任务执行阶段 堆垛机入库放货完成
|
||||
*/
|
||||
public static final String TASK_EP_DDJ_FINISH = "6";
|
||||
public static final String TASK_EP_DDJ_FINISH = "7";
|
||||
|
||||
/**
|
||||
* 任务执行阶段 输送机出库输送机到位-出库完成
|
||||
*/
|
||||
public static final String TASK_EP_SSJ_STOCKOUT_FINISH = "6";
|
||||
public static final String TASK_EP_SSJ_STOCKOUT_FINISH = "7";
|
||||
|
||||
/**
|
||||
* 任务执行阶段 任务自动完成 (如果不想区分出入库完成可以直接统一使用【自动完成】)
|
||||
*/
|
||||
public static final String TASK_EP_FINISH = "6";
|
||||
public static final String TASK_EP_FINISH = "7";
|
||||
|
||||
/**
|
||||
* 任务执行阶段 输送机出库到位-盘点出库阶段完成
|
||||
*/
|
||||
public static final String TASK_EP_SSJ_INVENTORY_STOCKOUT_FINISH = "7";
|
||||
public static final String TASK_EP_SSJ_INVENTORY_STOCKOUT_FINISH = "8";
|
||||
|
||||
/**
|
||||
* 任务执行阶段 堆垛机入库放货完成-盘点回库阶段完成
|
||||
*/
|
||||
public static final String TASK_EP_SSJ_INVENTORY_STOCKIN_FINISH = "8";
|
||||
public static final String TASK_EP_SSJ_INVENTORY_STOCKIN_FINISH = "9";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,12 @@ public class TaskType {
|
||||
public static final int TASKTYPE_STOCKIN = 1;
|
||||
public static final String TASKTYPE_STOCKIN_STR = "1";
|
||||
|
||||
/**
|
||||
* 常规入库
|
||||
*/
|
||||
public static final int TASKTYPE_MOVE = 4;
|
||||
public static final String TASKTYPE_MOVE_STR = "4";
|
||||
|
||||
|
||||
/**
|
||||
* 拣选回流
|
||||
@@ -36,6 +42,24 @@ public class TaskType {
|
||||
public static final int TASKTYPE_STOCKOUT_PICK = 21;
|
||||
public static final String TASKTYPE_STOCKOUT_PICK_STR = "21";
|
||||
|
||||
/**
|
||||
* 空容器出库
|
||||
*/
|
||||
public static final int TASKTYPE_STOCKOUT_EMPTY_TRAY = 22;
|
||||
public static final String TASKTYPE_STOCKOUT_EMPTY_TRAY_STR = "22";
|
||||
|
||||
/**
|
||||
* 指定货位出库
|
||||
*/
|
||||
public static final int TASKTYPE_STOCKOUT_MANUAL = 23;
|
||||
public static final String TASKTYPE_STOCKOUT_MANUAL_STR = "23";
|
||||
|
||||
/**
|
||||
* 有托盘余位的容器出库
|
||||
*/
|
||||
public static final int TASKTYPE_STOCKOUT_CONTAINER = 27;
|
||||
public static final String TASKTYPE_STOCKOUT_CONTAINER_STR = "27";
|
||||
|
||||
/**
|
||||
* 盘点出库
|
||||
*/
|
||||
|
||||
@@ -100,6 +100,10 @@ public class MsgDdj extends BaseEntity
|
||||
@Excel(name = "货叉状态")
|
||||
private Integer hczt;
|
||||
|
||||
/** 载货高度 */
|
||||
@Excel(name = "载货高度")
|
||||
private Integer height;
|
||||
|
||||
// /** 备用字段1 */
|
||||
// @Excel(name = "备用字段1")
|
||||
// private Integer spare1;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MydoJob extends BaseEntity
|
||||
|
||||
/** 优先级 */
|
||||
@Excel(name = "优先级")
|
||||
private Long priority;
|
||||
private Integer priority;
|
||||
|
||||
/** 执行阶段 */
|
||||
@Excel(name = "执行阶段")
|
||||
@@ -98,7 +98,7 @@ public class MydoJob extends BaseEntity
|
||||
|
||||
private String flag;
|
||||
|
||||
private String traySize;
|
||||
private Integer traySize;
|
||||
|
||||
private List<String> epList;
|
||||
|
||||
|
||||
@@ -107,6 +107,8 @@ public interface IMydoJobService
|
||||
MydoJob selectMydoJobByWmsTaskNo(String wmsTaskNo);
|
||||
|
||||
|
||||
/** 根据条码获取托盘类型(尺寸) */
|
||||
Integer getTraytypeByTrayCode(String trayCode);
|
||||
|
||||
/**
|
||||
* 获取本地生成作业号
|
||||
|
||||
@@ -115,6 +115,7 @@ public class JobCallBackServiceImpl implements IJobCallBackService
|
||||
param.put("jobId", jobCallBack.getMydoJobId());
|
||||
param.put("taskNo", jobCallBack.getTaskNo());
|
||||
param.put("wmsType", jobCallBack.getType());
|
||||
// param.put("trayCode", jobCallBack.getType());
|
||||
|
||||
//请求回传
|
||||
RequestLog requestLog = apiService.finishMydoJob(param);
|
||||
@@ -129,26 +130,5 @@ public class JobCallBackServiceImpl implements IJobCallBackService
|
||||
jobCallBackMapper.updateJobCallBack(jobCallBack);
|
||||
}
|
||||
|
||||
// List<JobCallBack> list = jobCallBackMapper.getTopJobCallBack();
|
||||
// if(list != null && list.size() > 0){
|
||||
// JobCallBack jobCallBack = list.get(0);
|
||||
// Map<String, Object> param = new HashMap<>();
|
||||
// param.put("jobId", jobCallBack.getMydojobId());
|
||||
// param.put("taskNo", jobCallBack.getTaskNo());
|
||||
// param.put("wmsType", jobCallBack.getType());
|
||||
// RequestLog requestLog = apiService.finishMydoJob(param);
|
||||
// if ("0".equals(requestLog.getIsSuccessful())){
|
||||
// jobCallBack.setStatus("1");
|
||||
// jobCallBackMapper.updateJobCallBack(jobCallBack);
|
||||
// }else{
|
||||
// if(Integer.parseInt(jobCallBack.getSpare1()) < 2){
|
||||
// jobCallBack.setSpare1(String.valueOf(Integer.parseInt(jobCallBack.getSpare1())+1));
|
||||
// jobCallBackMapper.updateJobCallBack(jobCallBack);
|
||||
// }else{
|
||||
// jobCallBack.setStatus("2");
|
||||
// jobCallBackMapper.updateJobCallBack(jobCallBack);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
@Override
|
||||
public int updateMydoJob(MydoJob mydoJob)
|
||||
{
|
||||
long priority = mydoJob.getPriority();
|
||||
mydoJob.setPriority(Math.abs(priority));
|
||||
Integer priority = mydoJob.getPriority();
|
||||
mydoJob.setPriority(priority);
|
||||
return mydoJobMapper.updateMydoJob(mydoJob);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
|
||||
//插入回传表
|
||||
JobCallBack jobCallBack = new JobCallBack();
|
||||
jobCallBack.setType(Integer.valueOf(task.getInOrOut()) < 20 ? "1" : "2");
|
||||
jobCallBack.setType(task.getInOrOut());
|
||||
jobCallBack.setMydoJobId(task.getJobId());
|
||||
jobCallBack.setStatus("0");
|
||||
jobCallBack.setTaskNo(Convert.toLong(task.getTaskNo()));
|
||||
@@ -286,6 +286,7 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
if (queue != null){
|
||||
DdjDeviceExecutionQueueFinish queueFinish = BeanUtil.copyProperties(queue, DdjDeviceExecutionQueueFinish.class);
|
||||
ddjDeviceExecutionQueueServiceFinishService.insertDdjDeviceExecutionQueueFinish(queueFinish);
|
||||
ddjDeviceExecutionQueueService.deleteDdjDeviceExecutionQueueByTaskNo(mydoJob.getTaskNo());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("【人工操作】手动完成操作失败:{}", e.getMessage());
|
||||
@@ -337,6 +338,7 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
if (queue != null){
|
||||
DdjDeviceExecutionQueueFinish queueFinish = BeanUtil.copyProperties(queue, DdjDeviceExecutionQueueFinish.class);
|
||||
ddjDeviceExecutionQueueServiceFinishService.insertDdjDeviceExecutionQueueFinish(queueFinish);
|
||||
ddjDeviceExecutionQueueService.deleteDdjDeviceExecutionQueueByTaskNo(mydoJob.getTaskNo());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("【人工操作】手动完成操作失败:{}", e.getMessage());
|
||||
@@ -389,6 +391,7 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
if (queue != null){
|
||||
DdjDeviceExecutionQueueFinish queueFinish = BeanUtil.copyProperties(queue, DdjDeviceExecutionQueueFinish.class);
|
||||
ddjDeviceExecutionQueueServiceFinishService.insertDdjDeviceExecutionQueueFinish(queueFinish);
|
||||
ddjDeviceExecutionQueueService.deleteDdjDeviceExecutionQueueByTaskNo(mydoJob.getTaskNo());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("【人工操作】手动作废操作失败:{}", e.getMessage());
|
||||
@@ -413,6 +416,7 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
return AjaxResult.success("操作成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 手动作废指定【任务号】的作业(数组类型参数)
|
||||
* @param JobIds
|
||||
@@ -440,6 +444,7 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
if (queue != null){
|
||||
DdjDeviceExecutionQueueFinish queueFinish = BeanUtil.copyProperties(queue, DdjDeviceExecutionQueueFinish.class);
|
||||
ddjDeviceExecutionQueueServiceFinishService.insertDdjDeviceExecutionQueueFinish(queueFinish);
|
||||
ddjDeviceExecutionQueueService.deleteDdjDeviceExecutionQueueByTaskNo(mydoJob.getTaskNo());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("【人工操作】手动作废操作失败:{}", e.getMessage());
|
||||
@@ -515,7 +520,21 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
}
|
||||
|
||||
|
||||
/** 根据条码获取托盘类型(尺寸) */
|
||||
@Override
|
||||
public Integer getTraytypeByTrayCode(String trayCode){
|
||||
|
||||
if (trayCode.startsWith("A")){
|
||||
return 1;
|
||||
}else if (trayCode.startsWith("B")){
|
||||
return 2;
|
||||
}else if (trayCode.startsWith("C")){
|
||||
return 3;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.ruoyi.queue.ddj.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.*;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
@@ -19,6 +16,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@ToString
|
||||
@Builder
|
||||
public class DdjDeviceExecutionQueue extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -86,11 +84,11 @@ public class DdjDeviceExecutionQueue extends BaseEntity
|
||||
@Excel(name = "结束时间")
|
||||
private String jssj;
|
||||
|
||||
/** 命令方式 */
|
||||
/** 命令方式 3-取货 4-放货 5-取放 */
|
||||
@Excel(name = "命令方式")
|
||||
private Integer mlfs;
|
||||
|
||||
/** $column.columnComment */
|
||||
/** $column.columnComment @@@FT577-托盘尺寸 */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String spare1;
|
||||
|
||||
|
||||
@@ -7,9 +7,12 @@ import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
||||
import com.ruoyi.common.domain.PlcConnectInfo;
|
||||
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.DdjThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ddj.DdjThread_1;
|
||||
import com.ruoyi.schedule.scheduleTask.ddj.DdjThread_2;
|
||||
import com.ruoyi.schedule.scheduleTask.monit.MonitoringThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ssj.PortConvThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ssj.RoadConvThread;
|
||||
@@ -33,19 +36,22 @@ public class ScheduleThread {
|
||||
|
||||
public CustomThread<PlcSsjRead> plcSsjReadCustomThread;
|
||||
public CustomThread<PlcDdj1Read> plcDdj1ReadCustomThread;
|
||||
// public CustomThread<PlcDdj2Read> plcDdj2ReadCustomThread;
|
||||
public CustomThread<PlcDdj2Read> plcDdj2ReadCustomThread;
|
||||
|
||||
public CustomThread<PortConvThread> portConvCustomThread;
|
||||
public CustomThread<RoadConvThread> roadConvCustomThread;
|
||||
|
||||
public CustomThread<MonitoringThread> monitoringCustomThread;
|
||||
public CustomThread<DdjThread> ddj1CustomThread;
|
||||
public CustomThread<DdjThread> ddjCustomThread;
|
||||
public CustomThread<DdjThread_1> ddj1CustomThread;
|
||||
public CustomThread<DdjThread_2> ddj2CustomThread;
|
||||
@Autowired
|
||||
private IDeviceSsjService deviceSsjService;
|
||||
@Autowired
|
||||
private IMsgDdjService msgDdjService;
|
||||
|
||||
private boolean isRun = false;
|
||||
// private boolean isRun1 = false;
|
||||
private boolean isRun2 = false;
|
||||
|
||||
/**
|
||||
@@ -77,8 +83,10 @@ public class ScheduleThread {
|
||||
RoadConvThread roadConvThread = new RoadConvThread();
|
||||
roadConvCustomThread = new CustomThread<RoadConvThread>(new Thread(roadConvThread), roadConvThread);
|
||||
|
||||
DdjThread ddj1Thread = new DdjThread();
|
||||
ddj1CustomThread = new CustomThread<DdjThread>(new Thread(ddj1Thread), ddj1Thread);
|
||||
DdjThread_1 ddj1Thread = new DdjThread_1();
|
||||
DdjThread_2 ddj2Thread = new DdjThread_2();
|
||||
ddj1CustomThread = new CustomThread<DdjThread_1>(new Thread(ddj1Thread), ddj1Thread);
|
||||
ddj2CustomThread = new CustomThread<DdjThread_2>(new Thread(ddj2Thread), ddj2Thread);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +106,7 @@ public class ScheduleThread {
|
||||
|
||||
//获取堆垛机
|
||||
ConcurrentHashMap<String, MsgDdj> ddj1List = new ConcurrentHashMap<>();
|
||||
// ConcurrentHashMap<String, MsgDdj> ddj2List = new ConcurrentHashMap<>();
|
||||
ConcurrentHashMap<String, MsgDdj> ddj2List = new ConcurrentHashMap<>();
|
||||
List<MsgDdj> msgDdjs = msgDdjService.selectMsgDdjList(new MsgDdj());
|
||||
for (MsgDdj msgDdj : msgDdjs) {
|
||||
msgDdj.setPlcDbReadAddress(msgDdj.getPlcDbReadAddress());
|
||||
@@ -110,13 +118,13 @@ public class ScheduleThread {
|
||||
ddj1List.put("ddj1", msgDdj);
|
||||
PlcDdj1Read.deviceDdjMap = ddj1List;
|
||||
break;
|
||||
// case 2:
|
||||
// PlcDdj2Read plcDdj2Read = new PlcDdj2Read(msgDdj, new PlcConnectInfo(msgDdj.getIp(), Convert.toInt(msgDdj.getPort())));
|
||||
// Thread plcDdj2ReadThread = new Thread(plcDdj2Read);
|
||||
// plcDdj2ReadCustomThread = new CustomThread<PlcDdj2Read>(plcDdj2ReadThread, plcDdj2Read);
|
||||
// ddj2List.put("ddj2", msgDdj);
|
||||
// PlcDdj2Read.deviceDdjMap = ddj2List;
|
||||
// break;
|
||||
case 2:
|
||||
PlcDdj2Read plcDdj2Read = new PlcDdj2Read(msgDdj, new PlcConnectInfo(msgDdj.getIp(), Convert.toInt(msgDdj.getPort())));
|
||||
Thread plcDdj2ReadThread = new Thread(plcDdj2Read);
|
||||
plcDdj2ReadCustomThread = new CustomThread<PlcDdj2Read>(plcDdj2ReadThread, plcDdj2Read);
|
||||
ddj2List.put("ddj2", msgDdj);
|
||||
PlcDdj2Read.deviceDdjMap = ddj2List;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,7 +135,7 @@ public class ScheduleThread {
|
||||
public void startAllThread() {
|
||||
plcSsjReadCustomThread.getThread().start();
|
||||
plcDdj1ReadCustomThread.getThread().start();
|
||||
// plcDdj2ReadCustomThread.getThread().start();
|
||||
plcDdj2ReadCustomThread.getThread().start();
|
||||
isRun = true;
|
||||
}
|
||||
|
||||
@@ -139,6 +147,7 @@ public class ScheduleThread {
|
||||
portConvCustomThread.thread.start();
|
||||
roadConvCustomThread.thread.start();
|
||||
ddj1CustomThread.thread.start();
|
||||
ddj2CustomThread.thread.start();
|
||||
isRun2 = true;
|
||||
}
|
||||
|
||||
@@ -148,7 +157,7 @@ public class ScheduleThread {
|
||||
public void stopAllThread() {
|
||||
plcSsjReadCustomThread.runnable.isRun = false;
|
||||
plcDdj1ReadCustomThread.runnable.isRun = false;
|
||||
// plcDdj2ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj2ReadCustomThread.runnable.isRun = false;
|
||||
plcReadInit();
|
||||
isRun = false;
|
||||
}
|
||||
@@ -162,6 +171,7 @@ public class ScheduleThread {
|
||||
roadConvCustomThread.runnable.isRun = false;
|
||||
|
||||
ddj1CustomThread.runnable.isRun = false;
|
||||
ddj2CustomThread.runnable.isRun = false;
|
||||
scheduleInit();
|
||||
isRun2 = false;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,9 @@ public class PlcDdj1Read extends Thread {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
readPlcDdj(msgDdj);
|
||||
Thread.sleep(800);
|
||||
Thread.sleep(1000);
|
||||
} else {
|
||||
Thread.sleep(2000);
|
||||
reConnect();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
@@ -54,7 +55,7 @@ public class PlcDdj1Read extends Thread {
|
||||
}
|
||||
|
||||
private void readPlcDdj(MsgDdj msgDdj) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(msgDdj.getPlcDbReadAddress(), Convert.toShort("38"));
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(msgDdj.getPlcDbReadAddress(), Convert.toShort("32"));
|
||||
String ddsx = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx = SoftBasic.ByteToHexString(read2.Content);
|
||||
@@ -71,6 +72,7 @@ public class PlcDdj1Read extends Thread {
|
||||
msgDdj.setMbch(ParseUtil.optInt(22, ddsx));
|
||||
msgDdj.setYxxf(ParseUtil.optInt(24, ddsx));
|
||||
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setHeight(ParseUtil.optInt(30, ddsx));
|
||||
|
||||
msgDdj.setCurrentRow(ParseUtil.optInt(12, ddsx));
|
||||
msgDdj.setCurrentColumn(ParseUtil.optInt(14, ddsx));
|
||||
|
||||
@@ -39,8 +39,9 @@ public class PlcDdj2Read extends Thread {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
readPlcDdj(msgDdj);
|
||||
Thread.sleep(800);
|
||||
Thread.sleep(1000);
|
||||
} else {
|
||||
Thread.sleep(2000);
|
||||
reConnect();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
@@ -54,7 +55,7 @@ public class PlcDdj2Read extends Thread {
|
||||
}
|
||||
|
||||
private void readPlcDdj(MsgDdj msgDdj) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(msgDdj.getPlcDbReadAddress(), Convert.toShort("38"));
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(msgDdj.getPlcDbReadAddress(), Convert.toShort("34"));
|
||||
String ddsx = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx = SoftBasic.ByteToHexString(read2.Content);
|
||||
@@ -71,10 +72,12 @@ public class PlcDdj2Read extends Thread {
|
||||
msgDdj.setMbch(ParseUtil.optInt(22, ddsx));
|
||||
msgDdj.setYxxf(ParseUtil.optInt(24, ddsx));
|
||||
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setDqxd(ParseUtil.optInt(30, ddsx));
|
||||
msgDdj.setHeight(ParseUtil.optInt(32, ddsx));
|
||||
|
||||
msgDdj.setCurrentRow(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setCurrentColumn(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setCurrentFloor(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setCurrentRow(ParseUtil.optInt(12, ddsx));
|
||||
msgDdj.setCurrentColumn(ParseUtil.optInt(14, ddsx));
|
||||
msgDdj.setCurrentFloor(ParseUtil.optInt(16, ddsx));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,15 +53,16 @@ public class PlcSsjRead implements Runnable {
|
||||
DeviceSsj ssjDevice = deviceSsjMap.get(ssjCode);
|
||||
switch (ssjDevice.getType()) {
|
||||
case "1":
|
||||
readPlcInOutSsj(ssjDevice);//出入口输送机
|
||||
readPlcInSsj(ssjDevice);//出库输送机
|
||||
break;
|
||||
case "2":
|
||||
readPlcRoadWaySsj(ssjDevice);//巷道输送机
|
||||
readPlcRoadWaySsj(ssjDevice);//巷道输送机(入库)
|
||||
break;
|
||||
}
|
||||
}
|
||||
Thread.sleep(800);
|
||||
Thread.sleep(1000);
|
||||
} else {
|
||||
Thread.sleep(2000);
|
||||
reConnect();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
@@ -77,29 +78,30 @@ public class PlcSsjRead implements Runnable {
|
||||
|
||||
|
||||
/**
|
||||
* 其他输送机
|
||||
* 出库输送机 1001 1004 1006 1008
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcOtherSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("10"));
|
||||
private void readPlcInSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("12"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setKx(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setDw(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setSszt(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setDw(ParseUtil.optInt(4, ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 入出库输送机
|
||||
* 入库输送机 1003 1005 1007 1010
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcInOutSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("30"));
|
||||
private void readPlcRoadWaySsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("26"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
@@ -110,19 +112,19 @@ public class PlcSsjRead implements Runnable {
|
||||
ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
||||
ssjDevice.setHeight(ParseUtil.optInt(12, ddsx1));
|
||||
ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1)); //此处不修改device_ssj表,把托盘尺寸值当作高度使用
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(14, ddsx1).replaceAll("\\s", ""));
|
||||
ssjDevice.setMode(ParseUtil.optInt(24, ddsx1));//todo 输送机操作模式
|
||||
ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
|
||||
ssjDevice.setException(ParseUtil.optInt(14, ddsx1));
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(18, ddsx1).replaceAll("\\s", ""));
|
||||
// ssjDevice.setMode(ParseUtil.optInt(24, ddsx1));//todo 输送机操作模式
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 巷道输送机
|
||||
* 出入口输送机
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcRoadWaySsj(DeviceSsj ssjDevice) {
|
||||
private void readPlcInOutSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("10"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ParseUtil {
|
||||
*/
|
||||
|
||||
public static String optString(int start, String data) {
|
||||
byte[] bytes = SoftBasic.HexStringToBytes(data.substring(start * 2, (start + 7) * 2));
|
||||
byte[] bytes = SoftBasic.HexStringToBytes(data.substring(start * 2, (start + 8) * 2));
|
||||
return Tools.bytetostringtool(bytes);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,51 @@
|
||||
package com.ruoyi.schedule.scheduleTask;
|
||||
|
||||
import HslCommunication.Profinet.Siemens.SiemensPLCS;
|
||||
import HslCommunication.Profinet.Siemens.SiemensS7Net;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.api.domain.agv.ResponseBase;
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.domain.wcs2wms.ResponseResult;
|
||||
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionReceive;
|
||||
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionRequest;
|
||||
import com.ruoyi.api.domain.wcs2wms.stockin.StockinReceive;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.api.service.IRequestLogService;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.common.ConvType;
|
||||
import com.ruoyi.common.TaskStatusCode;
|
||||
import com.ruoyi.common.TaskType;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||
import com.ruoyi.device.ddj.service.IMsgDdjService;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.job.service.IJobCallBackService;
|
||||
import com.ruoyi.job.service.IMydoJobService;
|
||||
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
|
||||
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueueFinish;
|
||||
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueFinishService;
|
||||
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ruoyi.common.TaskExceptionType.TASK_EXCEPTION_STOCKIN_OCCUPIED;
|
||||
import static com.ruoyi.common.TaskStatusCode.*;
|
||||
import static com.ruoyi.common.WmsTaskTypeCode.WMS_TASK_TYPE_EXCEPTION;
|
||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
|
||||
|
||||
/**
|
||||
* 处理wcs执行作业的定时任务类
|
||||
@@ -43,6 +64,15 @@ public class TaskHandler {
|
||||
private IApiService apiService;
|
||||
@Autowired
|
||||
private IDdjDeviceExecutionQueueService ddjDeviceExecutionQueueService;
|
||||
@Autowired
|
||||
IDdjDeviceExecutionQueueFinishService ddjDeviceExecutionQueueFinishService;
|
||||
@Autowired
|
||||
IMsgDdjService ddjService;
|
||||
@Autowired
|
||||
IRequestLogService requestLogService;
|
||||
|
||||
|
||||
// private SiemensS7Net siemens = new SiemensS7Net(SiemensPLCS.S1500, "192.168.56.60");
|
||||
|
||||
|
||||
private static final int TIMEINTERVAL_DEFAULT = 2000;
|
||||
@@ -62,7 +92,11 @@ public class TaskHandler {
|
||||
);
|
||||
if (!jobs.isEmpty()) {
|
||||
for (MydoJob job : jobs) {
|
||||
mydoJobService.taskFinish(Long.valueOf(job.getTaskNo()));
|
||||
if (!job.getInOrOut().equals(TaskType.TASKTYPE_STOCKOUT) &&
|
||||
!job.getInOrOut().equals(TaskType.TASKTYPE_STOCKOUT_PICK) &&
|
||||
!job.getInOrOut().equals(TaskType.TASKTYPE_STOCKOUT_MANUAL)) {
|
||||
mydoJobService.taskFinish(Long.valueOf(job.getTaskNo()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +139,7 @@ public class TaskHandler {
|
||||
/**
|
||||
* 【超时自动完成】 - 处理未正常移除的【堆垛机执行完成】或【出库到位】的遗留任务
|
||||
*/
|
||||
@Scheduled(fixedDelay = TIMEINTERVAL_10000)
|
||||
// @Scheduled(fixedDelay = TIMEINTERVAL_10000)
|
||||
public void finishMydoJobTimeout(){
|
||||
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
|
||||
new MydoJob().builder().status(TASK_EP_DDJ_FINISH_TIMEOUT).build()
|
||||
@@ -241,41 +275,310 @@ public class TaskHandler {
|
||||
|
||||
if (!jobs.isEmpty()) {
|
||||
for (MydoJob job : jobs) {
|
||||
stackerTask(job);
|
||||
//获取重分的货位重新向堆垛机下发任务
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(job.getCargoSpaceId());
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue =
|
||||
ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Long.valueOf(job.getTaskNo()), Integer.valueOf(job.getRoadwayId()));
|
||||
ddjDeviceExecutionQueue.setMbph(basCargoSpace.getThePlatoon());
|
||||
ddjDeviceExecutionQueue.setMblh(basCargoSpace.getTheColumn());
|
||||
ddjDeviceExecutionQueue.setMbch(basCargoSpace.getTheFloor());
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新堆垛机任务队列 - 异常盘点重新下发
|
||||
* @param mydoJob
|
||||
* 【更新作业状态】 - 巷道口到位生成堆垛机【取货】作业
|
||||
*/
|
||||
public void stackerTask(MydoJob mydoJob) {
|
||||
//获取重分的货位重新向堆垛机下发任务
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue =
|
||||
ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Long.valueOf(mydoJob.getTaskNo()), Integer.valueOf(mydoJob.getRoadwayId()));
|
||||
ddjDeviceExecutionQueue.setMbph(basCargoSpace.getThePlatoon());
|
||||
ddjDeviceExecutionQueue.setMblh(basCargoSpace.getTheColumn());
|
||||
ddjDeviceExecutionQueue.setMbch(basCargoSpace.getTheFloor());
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
@Scheduled(fixedDelay = TIMEINTERVAL_DEFAULT)
|
||||
public void updateStackerPickStatus() {
|
||||
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
|
||||
new MydoJob().builder().status(TASK_STATUS_RUNNING).executionPhase(TASK_EP_ROADWAY_SSJ).build()
|
||||
);
|
||||
|
||||
if (jobs.isEmpty()) return;
|
||||
|
||||
for (MydoJob job : jobs) {
|
||||
|
||||
// 生成堆垛机取货队列
|
||||
if (Convert.toInt(job.getInOrOut()) >= 20) continue;
|
||||
|
||||
//弯轨堆垛机设备编号使用货位区域编号对应
|
||||
int devId = 2;
|
||||
if (job.getRoadwayId().equals("1")) {
|
||||
devId = 1;
|
||||
}
|
||||
//检查堆垛机是否在正在执行中/已经有执行队列
|
||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(
|
||||
new DdjDeviceExecutionQueue().builder().devId(devId).build()
|
||||
);
|
||||
|
||||
//取货位置
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(
|
||||
ConvType.CONV_ROAD_CARGO.get(job.getEntranceId())
|
||||
);
|
||||
|
||||
MsgDdj msgDdj = ddjService.selectMsgDdjById(Long.valueOf(devId));
|
||||
|
||||
//生成堆垛机执行队列
|
||||
//生成取货作业时货叉必须有货 - 即【货叉状态】不为0
|
||||
if (CollUtil.isEmpty(ddjDeviceExecutionQueues) && msgDdj.getHczt() == 0) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(job.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName(job.getRoadwayId());
|
||||
ddjDeviceExecutionQueue.setDevId(devId);
|
||||
ddjDeviceExecutionQueue.setRwzt(0);
|
||||
ddjDeviceExecutionQueue.setYph(Convert.toInt(basCargoSpace.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setYlh(Convert.toInt(basCargoSpace.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setYch(Convert.toInt(basCargoSpace.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setMbph(Convert.toInt(basCargoSpace.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setMblh(1);
|
||||
ddjDeviceExecutionQueue.setMbch(1);
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setMlfs(3);//3-取货
|
||||
// ddjDeviceExecutionQueue.setSpare1(job.getTraySize().toString());//货物高度
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
// ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_3);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
|
||||
log.info("【堆垛机执行】{}#堆垛机生成入库<取货>队列,任务号:{}", devId, job.getTaskNo());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询正在执行的堆垛机队列是否为遗留记录 - 清理遗留队列数据
|
||||
* 【更新作业状态】 - 取货完成--→请求wms并生成堆垛机放货任务
|
||||
*/
|
||||
// @Scheduled(fixedDelay = 30000)
|
||||
public void clearStackerQueue(){
|
||||
// ddjDeviceExecutionQueueService.se
|
||||
}
|
||||
@Scheduled(fixedDelay = TIMEINTERVAL_DEFAULT)
|
||||
public void updateStackerPutStatus(){
|
||||
|
||||
@PostConstruct
|
||||
public void mpTest(){
|
||||
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
|
||||
new MydoJob().builder().status(TASK_STATUS_RUNNING).executionPhase(TASK_EP_DDJ_PICK).build()
|
||||
);
|
||||
|
||||
if (jobs.isEmpty()) return;
|
||||
|
||||
for (MydoJob job : jobs) {
|
||||
|
||||
DdjDeviceExecutionQueue queue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByTaskNo(job.getTaskNo());
|
||||
DdjDeviceExecutionQueueFinish queueFinish = new DdjDeviceExecutionQueueFinish();
|
||||
if (ObjUtil.isNotNull(queue)){
|
||||
BeanUtils.copyProperties(queue, queueFinish);
|
||||
//插入历史
|
||||
ddjDeviceExecutionQueueFinishService.insertDdjDeviceExecutionQueueFinish(queueFinish);
|
||||
//移除队列
|
||||
ddjDeviceExecutionQueueService.deleteDdjDeviceExecutionQueueByTaskNo(job.getTaskNo());
|
||||
|
||||
log.info("【堆垛机执行】移除堆垛机入库取货队列,任务号:{}", job.getTaskNo());
|
||||
}
|
||||
|
||||
Long ddjId = Convert.toInt(job.getRoadwayId()) == 1 ? 1L : 2L;
|
||||
|
||||
MsgDdj msgDdj = ddjService.selectMsgDdjById(ddjId);
|
||||
|
||||
if (msgDdj.getYxxf() != 1) continue;
|
||||
|
||||
if (msgDdj.getSbzt() != 0) continue;
|
||||
|
||||
if (msgDdj.getCzfs() != 5) continue;
|
||||
|
||||
if (msgDdj.getHeight() == 0) continue;
|
||||
|
||||
if (msgDdj.getHczt() == 0) continue;//货叉有货才能继续请求货位
|
||||
|
||||
|
||||
//请求wms获取作业号和货位
|
||||
//初始化请求wms参数
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("reqCode", UUID.randomUUID().toString());//请求码
|
||||
paramMap.put("trayCode", job.getTrayCode().trim());//容器编号
|
||||
paramMap.put("entranceId", job.getEntranceId());//入口输送机编号
|
||||
paramMap.put("roadwayId", job.getRoadwayId());//入口输送机编号对应巷道/区域
|
||||
paramMap.put("cargoAreaId", ConvType.CONV_ROAD_AREA.get(job.getEntranceId()));//入口输送机编号对应巷道/区域
|
||||
paramMap.put("height", msgDdj.getHeight());//高度
|
||||
// paramMap.put("remark", errorMessage);
|
||||
|
||||
AjaxResult ajaxResult;
|
||||
String errorMessage = "";
|
||||
|
||||
|
||||
/*-----------------请求生成wcs任务----------------- */
|
||||
ajaxResult = apiService.createMydoJobForStockin(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
|
||||
if (job.getExecutionPhase().equals(TASK_EP_DDJ_PICK)){
|
||||
job.setExecutionPhase(TASK_EP_DDJ);
|
||||
mydoJobService.updateMydoJob(job);
|
||||
}
|
||||
|
||||
//解析wms下发的响应参数(任务号和货位)
|
||||
ResponseBase res = JSON.parseObject(ajaxResult.get("msg").toString(), ResponseBase.class);
|
||||
StockinReceive result = BeanUtil.toBean(res.getData(), StockinReceive.class);
|
||||
|
||||
//校验:wms分配的货位(排列层)是否合法
|
||||
if (ObjUtil.isNull(basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(result.getCargoSpaceId()))) {
|
||||
errorMessage = "wms下发货位错误,任务生成失败!";
|
||||
paramMap.put("remark", errorMessage);
|
||||
// apiService.createInMydoJobException(paramMap);
|
||||
log.info("【响应参数异常】异常货位:{},无法生成作业,托盘条码:{}", result.getCargoSpaceId(), job.getTrayCode());
|
||||
return;
|
||||
}
|
||||
|
||||
job.setJobId(result.getJobId());
|
||||
job.setInOrOut(result.getInOrOut());
|
||||
job.setCargoSpaceId(result.getCargoSpaceId());
|
||||
mydoJobService.updateMydoJob(job);
|
||||
|
||||
log.info(
|
||||
"【堆垛机入库请求】请求wms分配货位成功,wms作业号:{}, wcs任务号:{},分配货位:{}", job.getJobId(), job.getTaskNo(), job.getCargoSpaceId()
|
||||
);
|
||||
|
||||
//生成堆垛机<放货>队列
|
||||
// 检查任务属性:【任务已存在】、执行阶段-【巷道口输送机到位】、任务类型-【入库】 → 下发堆垛机执行队列
|
||||
if (Convert.toInt(job.getInOrOut()) < 20) {
|
||||
//弯轨堆垛机设备编号使用货位区域编号对应
|
||||
int devId = 2;
|
||||
if (basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(job.getCargoSpaceId()).getCargoAreaId().equals("01")){
|
||||
devId = 1;
|
||||
}
|
||||
//检查堆垛机是否在正在执行中/已经有执行队列
|
||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(
|
||||
new DdjDeviceExecutionQueue().builder().devId(devId).build()
|
||||
);
|
||||
|
||||
//目标位置
|
||||
BasCargoSpace basCargoSpacePut = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(job.getCargoSpaceId());
|
||||
|
||||
//取货位置
|
||||
BasCargoSpace basCargoSpacePick = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(
|
||||
ConvType.CONV_ROAD_CARGO.get(job.getEntranceId())
|
||||
);
|
||||
|
||||
//生成堆垛机执行队列
|
||||
if (CollUtil.isEmpty(ddjDeviceExecutionQueues) && ObjUtil.isNotNull(basCargoSpacePut) && msgDdj.getHczt() != 0) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(job.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName("ddj" + devId);
|
||||
ddjDeviceExecutionQueue.setDevId(devId);
|
||||
ddjDeviceExecutionQueue.setRwzt(0);
|
||||
ddjDeviceExecutionQueue.setYph(basCargoSpacePick.getThePlatoon());
|
||||
ddjDeviceExecutionQueue.setYlh(basCargoSpacePick.getTheColumn());
|
||||
ddjDeviceExecutionQueue.setYch(basCargoSpacePick.getTheFloor());
|
||||
ddjDeviceExecutionQueue.setMbph(Convert.toInt(basCargoSpacePut.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setMblh(Convert.toInt(basCargoSpacePut.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setMbch(Convert.toInt(basCargoSpacePut.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setMlfs(4);//4-放货
|
||||
// ddjDeviceExecutionQueue.setSpare1(job.getTraySize().toString());//货物高度
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
// ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_3);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
|
||||
log.info("【堆垛机执行】{}#堆垛机生成入库放货作业,wcs任务号:{}", Long.valueOf(job.getRoadwayId()), job.getTaskNo());
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
// 接口调用失败处理
|
||||
log.info("【入库请求】请求分配货位失败,请检查网络或请求参数,请求内容:{}", JSON.toJSONString(paramMap));
|
||||
log.info("【错误信息】{}", requestLogService.selectRequestLogByLatestTask().getErrorDetails());
|
||||
|
||||
// 请求生成wcs任务失败
|
||||
//todo 向堆垛机下发退回
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 【移库作业】 - 取放
|
||||
*/
|
||||
@Scheduled(fixedDelay = TIMEINTERVAL_DEFAULT)
|
||||
public void sendStackerMoveJob() {
|
||||
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
|
||||
new MydoJob().builder().status(TASK_STATUS_CREATED).executionPhase(TASK_EP_CREATED).inOrOut(TaskType.TASKTYPE_MOVE_STR).build()
|
||||
);
|
||||
|
||||
if (jobs.isEmpty()) return;
|
||||
|
||||
for (MydoJob job : jobs) {
|
||||
|
||||
//弯轨堆垛机设备编号使用货位区域编号对应
|
||||
int devId = 2;
|
||||
if (job.getRoadwayId().equals("1")) {
|
||||
devId = 1;
|
||||
}
|
||||
//检查堆垛机是否在正在执行中/已经有执行队列
|
||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(
|
||||
new DdjDeviceExecutionQueue().builder().devId(devId).build()
|
||||
);
|
||||
|
||||
//取货位置
|
||||
BasCargoSpace basCargoSpacePick = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(
|
||||
job.getCargoSpaceId()
|
||||
);
|
||||
|
||||
//放货位置
|
||||
BasCargoSpace basCargoSpacePut = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(
|
||||
job.getTargetCargoSpaceId()
|
||||
);
|
||||
|
||||
MsgDdj msgDdj = ddjService.selectMsgDdjById(Long.valueOf(devId));
|
||||
|
||||
//生成堆垛机执行队列
|
||||
//生成取货作业时货叉必须有货 - 即【货叉状态】不为0
|
||||
if (CollUtil.isEmpty(ddjDeviceExecutionQueues) && msgDdj.getHczt() == 0) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(job.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName(job.getRoadwayId());
|
||||
ddjDeviceExecutionQueue.setDevId(devId);
|
||||
ddjDeviceExecutionQueue.setRwzt(0);
|
||||
ddjDeviceExecutionQueue.setYph(Convert.toInt(basCargoSpacePick.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setYlh(Convert.toInt(basCargoSpacePick.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setYch(Convert.toInt(basCargoSpacePick.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setMbph(Convert.toInt(basCargoSpacePut.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setMblh(Convert.toInt(basCargoSpacePut.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setMbch(Convert.toInt(basCargoSpacePut.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setMlfs(5);//
|
||||
// ddjDeviceExecutionQueue.setSpare1(job.getTraySize().toString());//货物高度
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
// ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_3);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
|
||||
if (job.getExecutionPhase().equals(TASK_EP_CREATED) && job.getStatus().equals(TASK_STATUS_CREATED)){
|
||||
job.setExecutionPhase(TASK_EP_DDJ);
|
||||
job.setExecutionPhase(TASK_STATUS_RUNNING);
|
||||
mydoJobService.updateMydoJob(job);
|
||||
}
|
||||
|
||||
log.info("【堆垛机执行】{}#堆垛机生成移库<取放>队列,任务号:{}", devId, job.getTaskNo());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -68,33 +68,33 @@ public class DdjThread implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
init();
|
||||
while (isRun) {
|
||||
for (String type : ddjCodeList.keySet()) {
|
||||
|
||||
if ("ddj".equals(type)) {
|
||||
for (String ddjCode : ddjCodeList.get(type)) {
|
||||
try {
|
||||
if ("ddj1".equals(ddjCode)) {
|
||||
// ddjTask(PlcDdj1Read.deviceDdjMap.get(ddjCode));
|
||||
}
|
||||
//PlcDdj2Read.deviceDdjMap.containsKey(ddjCode)
|
||||
// if ("ddj2".equals(ddjCode)) {
|
||||
// ddjTask(PlcDdj2Read.deviceDdjMap.get(ddjCode));
|
||||
// init();
|
||||
// while (isRun) {
|
||||
// for (String type : ddjCodeList.keySet()) {
|
||||
//
|
||||
// if ("ddj".equals(type)) {
|
||||
// for (String ddjCode : ddjCodeList.get(type)) {
|
||||
// try {
|
||||
// if ("ddj1".equals(ddjCode)) {
|
||||
//// ddjTask(PlcDdj1Read.deviceDdjMap.get(ddjCode));
|
||||
// }
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
// //PlcDdj2Read.deviceDdjMap.containsKey(ddjCode)
|
||||
//// if ("ddj2".equals(ddjCode)) {
|
||||
//// ddjTask(PlcDdj2Read.deviceDdjMap.get(ddjCode));
|
||||
//// }
|
||||
// } catch (RuntimeException e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// try {
|
||||
// Thread.sleep(3000);
|
||||
// } catch (InterruptedException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -145,11 +145,6 @@ public class DdjThread implements Runnable {
|
||||
}
|
||||
|
||||
/* -------------------------------------- 【3 放货有货,重新分配货位】-------------------------------------- */
|
||||
// ddj.setCzfs(5);
|
||||
// ddj.setSbzt(1052);
|
||||
// ddj.setYxxf(1);
|
||||
// ddj.setJdbz(4);
|
||||
// ddj.setRwh(85015L);
|
||||
// 1.联机自动【5】 2.设备状态-放货有货【1052】 3.执行阶段【0】【5】(无执行中的任务)
|
||||
if (ddj.getSbzt() == 1052 && ddj.getJdbz() < 5 && ddj.getYxxf() == 1) {
|
||||
|
||||
@@ -211,14 +206,6 @@ public class DdjThread implements Runnable {
|
||||
|
||||
|
||||
// -------------------------------------- 4 取货无货,作废当前任务,重新分配单据 --------------------------------------
|
||||
|
||||
//测试数据
|
||||
// ddj.setCzfs(5);
|
||||
// ddj.setSbzt(1053);
|
||||
// ddj.setYxxf(1);
|
||||
// ddj.setJdbz(3);
|
||||
// ddj.setRwh(20021L);
|
||||
// ddj.setId(1);
|
||||
// 1.联机自动【5】 2.设备状态-取货无货【1053】 3.执行阶段【<5】(任务执行中)
|
||||
if (ddj.getSbzt() == 1053 && ddj.getJdbz() < 5) {
|
||||
Long rwh = ddj.getRwh();
|
||||
@@ -292,7 +279,7 @@ public class DdjThread implements Runnable {
|
||||
}
|
||||
|
||||
//正常下发
|
||||
if (ddj.getYxxf() == 1 && ddj.getSbzt() == 0 ) {
|
||||
if (ddj.getYxxf() == 1 && ddj.getSbzt() == 0) {
|
||||
//检查是否有正在执行的堆垛机队列
|
||||
Long rwh = ddj.getRwh();
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueueRunningParam = new DdjDeviceExecutionQueue();
|
||||
|
||||
@@ -76,7 +76,7 @@ public class DdjThread_1 implements Runnable {
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
Thread.sleep(1500);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -100,24 +100,32 @@ public class DdjThread_1 implements Runnable {
|
||||
|
||||
//完成作业
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||
|
||||
//满足上述条件(【有实时任务】且【存在堆垛机执行队列】),表示该任务已完成-标记为已完成状态
|
||||
if (mydoJob != null && ddjDeviceExecutionQueue != null) {
|
||||
if (ddj.getHczt() == 0){
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||
|
||||
//标记为堆垛机执行完成
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ_FINISH);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
//满足上述条件(【有实时任务】且【存在堆垛机执行队列】),表示该任务已完成-标记为已完成状态
|
||||
if (mydoJob != null && ddjDeviceExecutionQueue != null) {
|
||||
|
||||
//执行wms回传 - 方法在存储过程【proc_mydojob_finish】中
|
||||
// ddjTaskFinish(rwh, ddj.getId());
|
||||
log.info("【堆垛机执行】设备编号:" + ddj.getId() + " 执行完成,任务结束,任务号:"+ddj.getRwh());
|
||||
//标记为堆垛机执行完成
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ_FINISH);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
|
||||
log.info("【堆垛机执行】设备编号:" + ddj.getId() + " 执行完成,任务结束,任务号:"+ddj.getRwh());
|
||||
}
|
||||
}else{
|
||||
if (mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)){
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ_PICK);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("【更新状态】{}#堆垛机巷道口取货完成,等待下发放货任务,wcs任务号:{}", Long.valueOf(mydoJob.getRoadwayId()), mydoJob.getTaskNo());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------- 【2 更新执行阶段】 --------------------------------------
|
||||
|
||||
// 1.联机自动【5】 2.设备状态 - 运行中【1】 3.执行阶段【2】
|
||||
//-------------------------------------- 【2 更新执行阶段】 --------------------------------------
|
||||
// 设备状态 - 运行中【1】 执行阶段【2】
|
||||
if (ddj.getSbzt() == 1 && ddj.getJdbz() == 2) {
|
||||
|
||||
//根据堆垛机上任务号,修改任务执行阶段
|
||||
@@ -132,12 +140,8 @@ public class DdjThread_1 implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------- 【3 放货有货,重新分配货位】-------------------------------------- */
|
||||
// ddj.setCzfs(5);
|
||||
// ddj.setSbzt(1052);
|
||||
// ddj.setYxxf(1);
|
||||
// ddj.setJdbz(4);
|
||||
// ddj.setRwh(85015L);
|
||||
// 1.联机自动【5】 2.设备状态-放货有货【1052】 3.执行阶段【0】【5】(无执行中的任务)
|
||||
if (ddj.getSbzt() == 1052 && ddj.getJdbz() < 5 && ddj.getYxxf() == 1) {
|
||||
|
||||
@@ -163,15 +167,7 @@ public class DdjThread_1 implements Runnable {
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------- 4 取货无货,作废当前任务,重新分配单据 --------------------------------------
|
||||
|
||||
//测试数据
|
||||
// ddj.setCzfs(5);
|
||||
// ddj.setSbzt(1053);
|
||||
// ddj.setYxxf(1);
|
||||
// ddj.setJdbz(3);
|
||||
// ddj.setRwh(20021L);
|
||||
// ddj.setId(1);
|
||||
// -------------------------------------- 【4 取货无货,作废当前任务,重新分配单据】 --------------------------------------
|
||||
// 1.联机自动【5】 2.设备状态-取货无货【1053】 3.执行阶段【<5】(任务执行中)
|
||||
if (ddj.getSbzt() == 1053 && ddj.getJdbz() < 5) {
|
||||
Long rwh = ddj.getRwh();
|
||||
@@ -211,8 +207,7 @@ public class DdjThread_1 implements Runnable {
|
||||
// }
|
||||
}
|
||||
|
||||
// -------------------------------------- 5 下发堆垛机任务 --------------------------------------
|
||||
|
||||
// -------------------------------------- 【5 下发堆垛机任务】 --------------------------------------
|
||||
//重分货位后重下
|
||||
if (ddj.getYxxf() == 1 && ddj.getSbzt() == 1052) {
|
||||
Long rwh = ddj.getRwh();
|
||||
@@ -244,8 +239,10 @@ public class DdjThread_1 implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//正常下发
|
||||
if (ddj.getYxxf() == 1 && ddj.getSbzt() == 0 ) {
|
||||
|
||||
//检查是否有正在执行的堆垛机队列
|
||||
Long rwh = ddj.getRwh();
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueueRunningParam = new DdjDeviceExecutionQueue();
|
||||
@@ -275,7 +272,7 @@ public class DdjThread_1 implements Runnable {
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
log.info("【堆垛机入库】下发任务成功,任务执行中, 任务号:{}", ddjDeviceExecutionQueue.getRwh());
|
||||
} else {
|
||||
log.error("【堆垛机入库】执行异常, 堆垛机下发任务失败!");
|
||||
log.error("【堆垛机入库】堆垛机下发任务失败,任务号:{},等待重新下发...", ddjDeviceExecutionQueue.getRwh());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,12 +313,12 @@ public class DdjThread_1 implements Runnable {
|
||||
int mbph = Convert.toInt(queue.getMbph());
|
||||
int mblh = Convert.toInt(queue.getMblh());
|
||||
int mbch = Convert.toInt(queue.getMbch());
|
||||
int mlfs = 5;
|
||||
int mlfs = queue.getMlfs();
|
||||
int xfwc = 1;
|
||||
int hwlx = Convert.toInt(queue.getSpare1());
|
||||
// int hwlx = 0;//默认值
|
||||
int jym = Tools.getJYM(taskNo, yph, ylh, ych, mbph, mblh, mbch, mlfs, hwlx);
|
||||
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, hwlx, xfwc, jym);
|
||||
// int hwlx = Convert.toInt(queue.getSpare1());
|
||||
int hwlx = 0;//默认值
|
||||
int jym = Tools.getJYM(taskNo, yph, ylh, ych, mbph, mblh, mbch, mlfs);
|
||||
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, xfwc, jym);
|
||||
if (devId==1){
|
||||
return PlcDdj1Read.WriteToDDJ("DB61.0", sendData);
|
||||
}else {
|
||||
@@ -330,6 +327,4 @@ public class DdjThread_1 implements Runnable {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class DdjThread_2 implements Runnable {
|
||||
for (String ddjCode : ddjCodeList.get(type)) {
|
||||
try {
|
||||
if ("ddj2".equals(ddjCode)) {
|
||||
ddjTask(PlcDdj1Read.deviceDdjMap.get(ddjCode));
|
||||
ddjTask(PlcDdj2Read.deviceDdjMap.get(ddjCode));
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
@@ -76,7 +76,7 @@ public class DdjThread_2 implements Runnable {
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
Thread.sleep(1500);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -100,16 +100,27 @@ public class DdjThread_2 implements Runnable {
|
||||
|
||||
//完成作业
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||
|
||||
//满足上述条件(【有实时任务】且【存在堆垛机执行队列】),表示该任务已完成-执行任务回传
|
||||
if (mydoJob != null && ddjDeviceExecutionQueue != null) {
|
||||
//标记为堆垛机执行完成
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ_FINISH);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
//回传完成信号 - 方法在存储过程【proc_mydojob_finish】中
|
||||
// ddjTaskFinish(rwh, ddj.getId());
|
||||
log.info("【堆垛机入库】堆垛机编号:" + ddj.getId() + " 执行完成,任务结束,任务号:"+ddj.getRwh());
|
||||
if (ddj.getHczt() == 0){
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||
|
||||
//满足上述条件(【有实时任务】且【存在堆垛机执行队列】),表示该任务已完成-标记为已完成状态
|
||||
if (mydoJob != null && ddjDeviceExecutionQueue != null) {
|
||||
|
||||
//标记为堆垛机执行完成
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ_FINISH);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
|
||||
log.info("【堆垛机执行】设备编号:" + ddj.getId() + " 执行完成,任务结束,任务号:"+ddj.getRwh());
|
||||
}
|
||||
}else{
|
||||
|
||||
if (mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)){
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ_PICK);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("【更新状态】{}#堆垛机巷道口取货完成,等待下发放货任务,wcs任务号:{}", Long.valueOf(mydoJob.getRoadwayId()), mydoJob.getTaskNo());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +221,6 @@ public class DdjThread_2 implements Runnable {
|
||||
}
|
||||
|
||||
// -------------------------------------- 5 下发堆垛机任务 --------------------------------------
|
||||
|
||||
//重分货位后重下
|
||||
if (ddj.getYxxf() == 1 && ddj.getSbzt() == 1052) {
|
||||
Long rwh = ddj.getRwh();
|
||||
@@ -273,7 +283,7 @@ public class DdjThread_2 implements Runnable {
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
log.info("【堆垛机入库】下发任务成功,任务执行中, 任务号:{}", ddjDeviceExecutionQueue.getRwh());
|
||||
} else {
|
||||
log.error("【堆垛机入库】执行异常, 堆垛机下发任务失败!");
|
||||
log.error("【堆垛机入库】堆垛机下发任务失败,任务号:{},等待重新下发...", ddjDeviceExecutionQueue.getRwh());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,12 +324,12 @@ public class DdjThread_2 implements Runnable {
|
||||
int mbph = Convert.toInt(queue.getMbph());
|
||||
int mblh = Convert.toInt(queue.getMblh());
|
||||
int mbch = Convert.toInt(queue.getMbch());
|
||||
int mlfs = 5;
|
||||
int mlfs = queue.getMlfs();
|
||||
int xfwc = 1;
|
||||
int hwlx = Convert.toInt(queue.getSpare1());
|
||||
// int hwlx = 0;//默认值
|
||||
int jym = Tools.getJYM(taskNo, yph, ylh, ych, mbph, mblh, mbch, mlfs, hwlx);
|
||||
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, hwlx, xfwc, jym);
|
||||
// int hwlx = Convert.toInt(queue.getSpare1());
|
||||
int hwlx = 0;//默认值
|
||||
int jym = Tools.getJYM(taskNo, yph, ylh, ych, mbph, mblh, mbch, mlfs);
|
||||
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, xfwc, jym);
|
||||
if (devId==1){
|
||||
return PlcDdj1Read.WriteToDDJ("DB61.0", sendData);
|
||||
}else {
|
||||
|
||||
@@ -87,46 +87,46 @@ public class MonitoringThread implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
// for (String ddjCode : PlcDdj2Read.deviceDdjMap.keySet()) {
|
||||
// MsgDdj msgDdj = PlcDdj2Read.deviceDdjMap.get(ddjCode);
|
||||
// msgDdjService.updateMsgDdj(msgDdj);
|
||||
//
|
||||
// if (msgDdj.getSbzt() > 1000) {
|
||||
// BasFaultRecord param = new BasFaultRecord();
|
||||
// param.setTaskNo(msgDdj.getRwh() + "");
|
||||
// param.setDeviceId(String.valueOf(msgDdj.getId()));
|
||||
// param.setDeviceType("DDJ");
|
||||
// param.setFault(msgDdj.getSbzt() + "");
|
||||
// param.setJobId("0");
|
||||
// List<BasFaultRecord> basFaultRecords = basFaultRecordService.selectBasFaultRecordList(param);
|
||||
// if (CollUtil.isEmpty(basFaultRecords)) {
|
||||
// BasFaultRecord faultRecord = new BasFaultRecord();
|
||||
// faultRecord.setId(IdUtil.fastSimpleUUID());
|
||||
// faultRecord.setDeviceId(String.valueOf(msgDdj.getId()));
|
||||
// faultRecord.setDeviceName(msgDdj.getName());
|
||||
// faultRecord.setDeviceType("DDJ");
|
||||
// faultRecord.setJobId("0");
|
||||
// faultRecord.setTaskNo(msgDdj.getRwh() + "");
|
||||
// faultRecord.setFault(msgDdj.getSbzt() + "");
|
||||
// faultRecord.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
// //faultRecord.setWarehouseId(mydoJob.getWarehouseId());
|
||||
// basFaultRecordService.insertBasFaultRecord(faultRecord);
|
||||
// }
|
||||
// }
|
||||
// if (msgDdj.getSbzt() < 1000 && msgDdj.getCzfs() == 5){
|
||||
// BasFaultRecord param = new BasFaultRecord();
|
||||
// param.setDeviceId(String.valueOf(msgDdj.getId()));
|
||||
// param.setDeviceType("DDJ");
|
||||
// param.setJobId("0");
|
||||
// List<BasFaultRecord> basFaultRecords = basFaultRecordService.selectBasFaultRecordList(param);
|
||||
// if (CollUtil.isNotEmpty(basFaultRecords)) {
|
||||
// BasFaultRecord faultRecord = basFaultRecords.get(0);
|
||||
// faultRecord.setJobId("1");
|
||||
// faultRecord.setFinishTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
// basFaultRecordService.updateBasFaultRecord(faultRecord);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
for (String ddjCode : PlcDdj2Read.deviceDdjMap.keySet()) {
|
||||
MsgDdj msgDdj = PlcDdj2Read.deviceDdjMap.get(ddjCode);
|
||||
msgDdjService.updateMsgDdj(msgDdj);
|
||||
|
||||
if (msgDdj.getSbzt() > 1000) {
|
||||
BasFaultRecord param = new BasFaultRecord();
|
||||
param.setTaskNo(msgDdj.getRwh() + "");
|
||||
param.setDeviceId(String.valueOf(msgDdj.getId()));
|
||||
param.setDeviceType("DDJ");
|
||||
param.setFault(msgDdj.getSbzt() + "");
|
||||
param.setJobId("0");
|
||||
List<BasFaultRecord> basFaultRecords = basFaultRecordService.selectBasFaultRecordList(param);
|
||||
if (CollUtil.isEmpty(basFaultRecords)) {
|
||||
BasFaultRecord faultRecord = new BasFaultRecord();
|
||||
faultRecord.setId(IdUtil.fastSimpleUUID());
|
||||
faultRecord.setDeviceId(String.valueOf(msgDdj.getId()));
|
||||
faultRecord.setDeviceName(msgDdj.getName());
|
||||
faultRecord.setDeviceType("DDJ");
|
||||
faultRecord.setJobId("0");
|
||||
faultRecord.setTaskNo(msgDdj.getRwh() + "");
|
||||
faultRecord.setFault(msgDdj.getSbzt() + "");
|
||||
faultRecord.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
//faultRecord.setWarehouseId(mydoJob.getWarehouseId());
|
||||
basFaultRecordService.insertBasFaultRecord(faultRecord);
|
||||
}
|
||||
}
|
||||
if (msgDdj.getSbzt() < 1000 && msgDdj.getCzfs() == 5){
|
||||
BasFaultRecord param = new BasFaultRecord();
|
||||
param.setDeviceId(String.valueOf(msgDdj.getId()));
|
||||
param.setDeviceType("DDJ");
|
||||
param.setJobId("0");
|
||||
List<BasFaultRecord> basFaultRecords = basFaultRecordService.selectBasFaultRecordList(param);
|
||||
if (CollUtil.isNotEmpty(basFaultRecords)) {
|
||||
BasFaultRecord faultRecord = basFaultRecords.get(0);
|
||||
faultRecord.setJobId("1");
|
||||
faultRecord.setFinishTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
basFaultRecordService.updateBasFaultRecord(faultRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1500);
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
@@ -34,7 +34,6 @@ import java.util.regex.Pattern;
|
||||
|
||||
import static com.ruoyi.common.TaskStatusCode.*;
|
||||
import static com.ruoyi.common.TaskType.*;
|
||||
import static com.ruoyi.common.WmsTaskTypeCode.WMS_TASK_TYPE_STOCKIN;
|
||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
|
||||
|
||||
/**
|
||||
@@ -60,7 +59,11 @@ public class PortConvThread implements Runnable {
|
||||
public void init() {
|
||||
ssjCodeList = new HashMap<>();
|
||||
ArrayList<String> ssjCodes = new ArrayList<>();
|
||||
ssjCodes.add("L1001");
|
||||
ssjCodes.add("L1004");
|
||||
ssjCodes.add("L1006");
|
||||
ssjCodes.add("L1008");
|
||||
ssjCodes.add("L1002");
|
||||
ssjCodes.add("L1009");
|
||||
ssjCodeList.put("portConv", ssjCodes);
|
||||
apiService = SpringUtils.getBean(IApiService.class);
|
||||
@@ -107,54 +110,34 @@ public class PortConvThread implements Runnable {
|
||||
public void Schedule(DeviceSsj deviceSsj){
|
||||
|
||||
switch (deviceSsj.getDeviceCode()){
|
||||
//1#巷道入库(单向)
|
||||
case "L1009":
|
||||
//3#巷道入库(单向)
|
||||
case "L1002":
|
||||
// 测试数据
|
||||
// inSsjDevice.setInOrOut(1);
|
||||
// inSsjDevice.setTrayCode("T000004503");
|
||||
// inSsjDevice.setTaskNo(777778);
|
||||
// inSsjDevice.setKx(0);
|
||||
// inSsjDevice.setDw(1);
|
||||
// inSsjDevice.setHeight(1);
|
||||
// inSsjDevice.setWeight("100");
|
||||
// inSsjDevice.setException(0);
|
||||
// inSsjDevice.setRkqq(1);
|
||||
|
||||
//到位校验
|
||||
if (!portConvChecked(deviceSsj)) return;
|
||||
|
||||
//更新入库任务阶段
|
||||
updateMydoJob(deviceSsj);
|
||||
|
||||
//请求wms获取入库任务
|
||||
requestMydoJob(deviceSsj);
|
||||
break;
|
||||
|
||||
//1#巷道出库口(单向)
|
||||
case "L1008":
|
||||
//3#巷道出库口(单向)
|
||||
case "L1001":
|
||||
//出库完成
|
||||
finishStockoutMydoJob(deviceSsj);
|
||||
// finishStockoutMydoJob(deviceSsj);
|
||||
//盘点出库
|
||||
finishInventoryStockoutMydoJob(deviceSsj);
|
||||
break;
|
||||
|
||||
//2#巷道出库口(双向)
|
||||
//1#巷道/区域01出库口(双向)
|
||||
case "L1002":
|
||||
//3#巷道/区域03出库口(双向)
|
||||
case "L1009":
|
||||
//2#巷道/区域02出库口(双向)
|
||||
case "L1004":
|
||||
//2#巷道出库口(双向)
|
||||
//2#巷道/区域03出库口(双向)
|
||||
case "L1006":
|
||||
|
||||
//更新入库任务阶段
|
||||
updateMydoJob(deviceSsj);
|
||||
// updateMydoJob(deviceSsj);
|
||||
|
||||
//出库完成
|
||||
finishStockoutMydoJob(deviceSsj);
|
||||
|
||||
//盘点出库
|
||||
finishInventoryStockoutMydoJob(deviceSsj);
|
||||
// finishInventoryStockoutMydoJob(deviceSsj);
|
||||
break;
|
||||
|
||||
|
||||
@@ -193,7 +176,6 @@ public class PortConvThread implements Runnable {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求wms获取wcs任务参数
|
||||
* @param inSsjDevice
|
||||
@@ -210,7 +192,6 @@ public class PortConvThread implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String errorMessage = "";
|
||||
|
||||
AjaxResult ajaxResult;
|
||||
@@ -220,9 +201,9 @@ public class PortConvThread implements Runnable {
|
||||
paramMap.put("reqCode", UUID.randomUUID().toString());//请求码
|
||||
paramMap.put("trayCode", inSsjDevice.getTrayCode().trim());//容器编号
|
||||
// paramMap.put("entranceId", inSsjDevice.getDeviceCode());//入口输送机编号
|
||||
paramMap.put("roadwayId", ConvType.CONV_ROAD.get(inSsjDevice.getDeviceCode()));//入口输送机编号对应巷道
|
||||
paramMap.put("cargoAreaId", ConvType.CONV_ROAD_AREA.get(inSsjDevice.getDeviceCode()));//入口输送机编号对应巷道/区域
|
||||
int height = inSsjDevice.getHeight();
|
||||
// paramMap.put("trayType", height);//高度
|
||||
paramMap.put("height", height);//高度
|
||||
// paramMap.put("remark", errorMessage);
|
||||
|
||||
|
||||
@@ -259,13 +240,13 @@ public class PortConvThread implements Runnable {
|
||||
.trayCode(result.getTrayCode())
|
||||
.cargoSpaceId(result.getCargoSpaceId())
|
||||
// .wmsTaskNo(mydoJobService.getTaskNo("1"))
|
||||
.traySize(String.valueOf(inSsjDevice.getHeight()))
|
||||
.traySize(inSsjDevice.getHeight())
|
||||
.inOrOut("1")
|
||||
.roadwayId(basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(result.getCargoSpaceId()).getRoadwayId())//获取货位表货位对应的巷道号
|
||||
.entranceId(inSsjDevice.getDeviceCode())
|
||||
.executionPhase(TASK_EP_CREATED)
|
||||
.faultFlag("0")
|
||||
.priority(10L)
|
||||
.priority(10)
|
||||
.build();
|
||||
|
||||
|
||||
@@ -288,6 +269,54 @@ public class PortConvThread implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 入口到位生成wcs本地作业
|
||||
* @param inSsjDevice
|
||||
*/
|
||||
private void generateWcsMydoJob(DeviceSsj inSsjDevice){
|
||||
|
||||
//如果已经生成wcs任务则不继续执行后续请求操作
|
||||
//包括请求成功生成作业和wms推送成功的情况
|
||||
int count = mydoJobService.selectInOrOutMydoJobList(
|
||||
new MydoJob().builder().trayCode(inSsjDevice.getTrayCode()).build()
|
||||
).size();
|
||||
|
||||
if (count > 0) return;
|
||||
|
||||
//-----------------警告校验:条码已有库存-----------------
|
||||
BasCargoSpace cargoSpace = new BasCargoSpace();
|
||||
cargoSpace.setTrayCode(inSsjDevice.getTrayCode());
|
||||
if (!basCargoSpaceService.selectBasCargoSpaceList(cargoSpace).isEmpty()) {
|
||||
log.warn("【警告】该托盘号已有库存,托盘条码:{}",inSsjDevice.getTrayCode());
|
||||
}
|
||||
|
||||
int trayType = mydoJobService.getTraytypeByTrayCode(inSsjDevice.getTrayCode());
|
||||
|
||||
//生成的任务初始化
|
||||
MydoJob mydoJob = new MydoJob().builder()
|
||||
// .jobId(result.getJobId())
|
||||
.taskNo(mydoJobService.getTaskNo("2"))//如果需要用wms下发的任务号作为wcs的任务号使用
|
||||
.status(TASK_STATUS_CREATED)
|
||||
.trayCode(inSsjDevice.getTrayCode())
|
||||
// .cargoSpaceId(result.getCargoSpaceId())
|
||||
// .wmsTaskNo(mydoJobService.getTaskNo("1"))
|
||||
.traySize(inSsjDevice.getHeight())
|
||||
.inOrOut("1")
|
||||
.roadwayId(String.valueOf(ConvType.CONV_ROAD_ROADWAY.get(inSsjDevice.getDeviceCode())))//获取货位表货位对应的巷道号
|
||||
.entranceId(inSsjDevice.getDeviceCode())
|
||||
.executionPhase(TASK_EP_CREATED)
|
||||
.faultFlag("0")
|
||||
.traySize(trayType)
|
||||
.priority(10)
|
||||
.build();
|
||||
|
||||
//如果还没有wcs任务 - 生成一条任务
|
||||
if (mydoJobService.selectInOrOutMydoJobList(mydoJob).isEmpty()) {
|
||||
mydoJobService.insertMydoJob(mydoJob);
|
||||
log.info("【生成入库】本地生成wcs作业成功,wcs任务号:{},托盘条码:{}", mydoJob.getTaskNo(), mydoJob.getTrayCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新入库任务阶段
|
||||
@@ -313,10 +342,10 @@ public class PortConvThread implements Runnable {
|
||||
//写入成功则更新执行阶段
|
||||
mydoJobStockin.setStatus(TASK_STATUS_RUNNING);
|
||||
mydoJobStockin.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJobStockin.setEntranceId(inSsjDevice.getDeviceCode());
|
||||
// mydoJobStockin.setEntranceId(inSsjDevice.getDeviceCode());
|
||||
mydoJobStockin.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(mydoJobStockin);
|
||||
log.info("【更新状态】G1009入口输送机下发成功,任务号:{},入库执行中", mydoJobStockin.getTaskNo());
|
||||
log.info("【更新状态】入口输送机{}下发成功,任务号:{},入库执行中", inSsjDevice.getDeviceCode(), mydoJobStockin.getTaskNo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,14 +370,12 @@ public class PortConvThread implements Runnable {
|
||||
mydoJobStockin.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJobStockin.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(mydoJobStockin);
|
||||
log.info("【更新状态】入口输送机{}下发成功,任务号:{},盘点回库执行中", inSsjDevice.getDeviceCode(), mydoJobStockin.getTaskNo());
|
||||
log.info("【更新状态】入口输送机{}下发成功,任务号:{},盘点回库执行中", inSsjDevice.getDeviceCode(), mydoJobStockin.getTaskNo());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 输送机出库到位 - 任务出库完成
|
||||
* 出库完成在升降位置,即【TD1001】判断完成
|
||||
@@ -359,24 +386,19 @@ public class PortConvThread implements Runnable {
|
||||
if (outSsjDevice.getDw() == 1 && outSsjDevice.getTaskNo() > 0) {
|
||||
//查询该出库任务
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(outSsjDevice.getTaskNo()));
|
||||
if (mydoJob != null && Integer.parseInt(mydoJob.getInOrOut()) == TASKTYPE_STOCKOUT) {
|
||||
log.info("【出库完成】去向:{},出库货位:{},任务号:{},出库到位, 任务结束", outSsjDevice.getDeviceCode(),mydoJob.getCargoSpaceId() , mydoJob.getTaskNo());
|
||||
|
||||
if (ObjUtil.isNull(mydoJob)) return;
|
||||
|
||||
if (Integer.parseInt(mydoJob.getInOrOut()) >= 20 && Integer.parseInt(mydoJob.getInOrOut()) == TASKTYPE_INVENTORY) {
|
||||
log.info("【出库到位】去向:{},出库货位:{},任务号:{},出库完成,等待确认执行回流操作, 任务结束", outSsjDevice.getDeviceCode(),mydoJob.getCargoSpaceId() , mydoJob.getTaskNo());
|
||||
mydoJob.setExecutionPhase(TASK_EP_SSJ_STOCKOUT_FINISH);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
mydoJobService.taskFinish(Long.valueOf(mydoJob.getTaskNo()));
|
||||
}
|
||||
|
||||
//盘点任务出库到位不结束任务
|
||||
if (mydoJob != null && Integer.parseInt(mydoJob.getInOrOut()) == TASKTYPE_STOCKOUT) {
|
||||
log.info("【盘点出库完成】去向:{},出库货位:{},任务号:{},盘点出库到位, 等待盘点回库", outSsjDevice.getDeviceCode(),mydoJob.getCargoSpaceId() , mydoJob.getTaskNo());
|
||||
mydoJob.setExecutionPhase(TASK_EP_SSJ_INVENTORY_STOCKOUT_FINISH);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 输送机出库到位 - 盘点任务出库阶段完成
|
||||
* 出库完成在升降位置,即【TD1001】判断完成
|
||||
@@ -387,89 +409,21 @@ public class PortConvThread implements Runnable {
|
||||
if (outSsjDevice.getDw() == 1 && outSsjDevice.getTaskNo() > 0) {
|
||||
//查询该出库任务
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(outSsjDevice.getTaskNo()));
|
||||
if (mydoJob != null && Integer.parseInt(mydoJob.getInOrOut()) == TASKTYPE_INVENTORY) {
|
||||
log.info("【盘点出库完成】去向:{},出库货位:{},任务号:{},出库到位", "盘点出库完成,等待执行回库", outSsjDevice.getDeviceCode(),mydoJob.getCargoSpaceId() , mydoJob.getTaskNo());
|
||||
|
||||
if (ObjUtil.isNull(mydoJob)) return;
|
||||
|
||||
//盘点任务出库到位不结束任务
|
||||
if (Integer.parseInt(mydoJob.getInOrOut()) == TASKTYPE_INVENTORY) {
|
||||
log.info("【盘点出库完成】去向:{},出库货位:{},任务号:{},出库到位", "盘点出库完成,等待执行回流", outSsjDevice.getDeviceCode(),mydoJob.getCargoSpaceId() , mydoJob.getTaskNo());
|
||||
mydoJob.setExecutionPhase(TASK_EP_SSJ_INVENTORY_STOCKOUT_FINISH);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
// mydoJobService.taskFinish(Long.valueOf(mydoJob.getTaskNo()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ====== 【请按实际修改】======
|
||||
private static final String MOXA_IP = "192.168.1.200"; // NPort 5110 的 IP
|
||||
private static final int MOXA_PORT = 4001; // NPort 配置的 Local Port
|
||||
private static final int RECONNECT_DELAY_SEC = 3; // 断线后重试间隔(秒)
|
||||
private static final int SO_TIMEOUT_MS = 5000; // Socket 读超时(防卡死)
|
||||
private static final Pattern WEIGHT_PATTERN = Pattern.compile(
|
||||
"[+-]?\\d+\\.\\d{1,3}(?=[\\s\\r\\n]|kg|g|lb|$)"); // 匹配如 +12.34、-5.678、345.0kg
|
||||
|
||||
|
||||
/**
|
||||
* 从 MOXA NPort 5110(TCP Server 模式)读取单次称重值
|
||||
* ************测试方法************
|
||||
* ************测试方法************
|
||||
* ************测试方法************
|
||||
*
|
||||
* @param moxaIp MOXA 设备 IP(如 "192.168.1.200")
|
||||
* @param moxaPort MOXA 配置的 TCP 端口(如 4001)
|
||||
* @param timeout 最大等待时间(单位:毫秒),建议 2000~5000
|
||||
* @return 重量(kg),成功时为非 NaN 的 Double;失败(超时/断连/解析失败)返回 null
|
||||
*/
|
||||
public static Double getWeightByMoxa(String moxaIp, int moxaPort, long timeout) {
|
||||
Socket socket = null;
|
||||
try {
|
||||
// 1️⃣ - 建立连接(带连接超时)
|
||||
socket = new Socket();
|
||||
socket.connect(new InetSocketAddress(moxaIp, moxaPort), 3000); // 连接超时 3s
|
||||
socket.setSoTimeout((int) Math.min(timeout, Integer.MAX_VALUE)); // 读超时
|
||||
|
||||
// 2 - 发送请求指令(可选:仅当秤需指令才启用)
|
||||
// OutputStream out = socket.getOutputStream();
|
||||
// out.write("\r\n".getBytes(StandardCharsets.US_ASCII)); // 或 "\r", "W\r\n"
|
||||
// out.flush();
|
||||
|
||||
// 3 - 读响应(使用 BufferedInputStream + 手动读字节,更健壮于无换行场景)
|
||||
InputStream in = socket.getInputStream();
|
||||
byte[] buffer = new byte[128];
|
||||
int len = in.read(buffer);
|
||||
if (len <= 0) return null;
|
||||
|
||||
String response = new String(buffer, 0, len, StandardCharsets.US_ASCII).trim();
|
||||
if (response.isEmpty()) return null;
|
||||
|
||||
// 4 - 解析重量(兼容常见格式:+12.34、-5.678、00012.34kg、123.45\r\n)
|
||||
Pattern p = Pattern.compile("[+-]?\\d*\\.?\\d+(?=[\\s\\r\\n]|kg|g|lb|$)");
|
||||
java.util.regex.Matcher m = p.matcher(response);
|
||||
if (m.find()) {
|
||||
try {
|
||||
double w = Double.parseDouble(m.group());
|
||||
// 过滤明显异常值(可选)
|
||||
if (Double.isFinite(w) && Math.abs(w) < 1e6) {
|
||||
return w;
|
||||
}
|
||||
} catch (NumberFormatException ignored) {}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
} catch (IOException e) {
|
||||
return null; // 连接失败、读超时、解析异常等均返回 null
|
||||
} finally {
|
||||
if (socket != null && !socket.isClosed()) {
|
||||
try { socket.close(); } catch (IOException ignored) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void inDispatch1(DeviceSsj ssjDevice) {
|
||||
|
||||
//有入库请求就肯定是电气的任务号的作业
|
||||
@@ -519,7 +473,7 @@ public class PortConvThread implements Runnable {
|
||||
mydoJob2.setExecutionPhase(TASK_EP_CREATED);
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJob2.setPriority(10L);
|
||||
mydoJob2.setPriority(10);
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
|
||||
@@ -5,9 +5,11 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.common.ConvType;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
@@ -20,9 +22,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.ruoyi.common.ConvType.ROADWAY1_EXIT;
|
||||
import static com.ruoyi.common.TaskStatusCode.*;
|
||||
import static com.ruoyi.common.TaskType.*;
|
||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
|
||||
|
||||
/**
|
||||
* 巷道口输送机(堆垛机取放位)线程 检测当前巷道有没有入库作业,没有作业,生成堆垛机出库队列
|
||||
@@ -43,8 +44,12 @@ public class RoadConvThread implements Runnable {
|
||||
public void init() {
|
||||
ssjCodeList = new HashMap<>();
|
||||
ArrayList<String> ssjCodes = new ArrayList<>();
|
||||
// ssjCodes.add("L1002");
|
||||
ssjCodes.add("L1001");
|
||||
ssjCodes.add("L1003");
|
||||
ssjCodes.add("L1005");
|
||||
ssjCodes.add("L1007");
|
||||
ssjCodes.add("L1010");
|
||||
ssjCodes.add("L1008");
|
||||
ssjCodeList.put("roadConv", ssjCodes);
|
||||
apiService = SpringUtils.getBean(IApiService.class);
|
||||
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
||||
@@ -53,8 +58,12 @@ public class RoadConvThread implements Runnable {
|
||||
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
|
||||
//初始化巷道口 排 列 层
|
||||
//todo 核对堆垛机取放位置的货位编码
|
||||
roadwayMap.put("L1010", Arrays.asList(1, 1, 1));
|
||||
// roadwayMap.put("L1004", Arrays.asList(4, 0, 1));
|
||||
roadwayMap.put("L1001", Arrays.asList(2, 0, 1));
|
||||
roadwayMap.put("L1003", Arrays.asList(3, 0, 1));
|
||||
roadwayMap.put("L1005", Arrays.asList(5, 0, 1));
|
||||
roadwayMap.put("L1007", Arrays.asList(7, 0, 1));
|
||||
roadwayMap.put("L1010", Arrays.asList(10, 0, 1));
|
||||
roadwayMap.put("L1008", Arrays.asList(11, 0, 1));
|
||||
log.info("初始化服务 {},{}", apiService, agvQueueService);
|
||||
}
|
||||
|
||||
@@ -71,7 +80,7 @@ public class RoadConvThread implements Runnable {
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
schedule(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
log.error("设备不存在:ssjCode{}", ssjCode);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(),e);
|
||||
@@ -93,28 +102,58 @@ public class RoadConvThread implements Runnable {
|
||||
public void schedule(DeviceSsj roadSsjDevice) {
|
||||
|
||||
switch (roadSsjDevice.getDeviceCode()){
|
||||
//1#巷道入库(单向)
|
||||
case "L1010":
|
||||
//3#巷道入库(单向)
|
||||
//1#巷道入库(双向)
|
||||
case "L1003":
|
||||
//3#巷道入库(双向)
|
||||
case "L1010":
|
||||
|
||||
//到位校验
|
||||
if (!roadConvChecked(roadSsjDevice)) return;
|
||||
if (roadConvCheckedForStockin(roadSsjDevice)) {
|
||||
//更新入库任务阶段
|
||||
updateMydoJob(roadSsjDevice);
|
||||
|
||||
//更新入库任务阶段
|
||||
sendStackerIn(roadSsjDevice);
|
||||
//生成wcs本地作业
|
||||
generateWcsMydoJob(roadSsjDevice);
|
||||
};
|
||||
|
||||
//请求wms获取入库任务
|
||||
//requestMydoJob(deviceSsj);
|
||||
|
||||
if (roadConvCheckedForStockout(roadSsjDevice)) {
|
||||
sendStackerOut(roadSsjDevice);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//1#巷道出库口(单向) -- FT577项目巷道1和巷道3出库位置为单输送机,故此处【出库完成】的方法移至端口输送机线程【PortConvThread】中执行
|
||||
case "L1008":
|
||||
//3#巷道出库口(单向)
|
||||
//1#巷道出库口(单向)
|
||||
// -- FT577项目巷道1和巷道3出库位置为单输送机,故此处【出库完成】的方法移至端口输送机线程【PortConvThread】中执行
|
||||
//1001和1008作为盘点和手动出库口使用
|
||||
case "L1001":
|
||||
//出库完成
|
||||
// finishStockoutMydoJob(deviceSsj);
|
||||
sendStackerOut(roadSsjDevice);
|
||||
//3#巷道出库口(单向)
|
||||
case "L1008":
|
||||
// if (roadConvCheckedForStockout(roadSsjDevice)) {
|
||||
// sendStackerOut(roadSsjDevice);
|
||||
// }
|
||||
|
||||
break;
|
||||
|
||||
//2#巷道/区域02出库口(双向)
|
||||
case "L1005":
|
||||
//3#巷道/区域03出库口(双向)
|
||||
case "L1007":
|
||||
|
||||
//到位校验
|
||||
if (roadConvCheckedForStockin(roadSsjDevice)) {
|
||||
//更新入库任务阶段
|
||||
updateMydoJob(roadSsjDevice);
|
||||
//生成wcs本地作业
|
||||
generateWcsMydoJob(roadSsjDevice);
|
||||
}
|
||||
|
||||
if (roadConvCheckedForStockout(roadSsjDevice)) {
|
||||
sendStackerOut(roadSsjDevice);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -123,90 +162,147 @@ public class RoadConvThread implements Runnable {
|
||||
|
||||
|
||||
/**
|
||||
* 输送机到位判断校验
|
||||
* 输送机到位判断校验 - 入库
|
||||
* @param inSsjDevice
|
||||
* @return
|
||||
*/
|
||||
private boolean roadConvChecked(DeviceSsj inSsjDevice){
|
||||
private boolean roadConvCheckedForStockin(DeviceSsj inSsjDevice){
|
||||
|
||||
boolean flag = false;
|
||||
//---------------------------巷道口取放货输送机---------------------------
|
||||
//输送机【任务号】和【到位】校验
|
||||
if (inSsjDevice.getTaskNo() == 0 || inSsjDevice.getDw() == 0) return flag;
|
||||
// if (inSsjDevice.getTaskNo() == 0 || inSsjDevice.getDw() == 0) return flag;
|
||||
|
||||
if (inSsjDevice.getRkqq() == 0) return flag;
|
||||
|
||||
//输送机条码不能为空
|
||||
if (StrUtil.isBlank(inSsjDevice.getTrayCode())) return flag;
|
||||
|
||||
String cargoAreaId = String.valueOf(ConvType.CONV_ROAD_AREA.get(inSsjDevice.getDeviceCode()));
|
||||
int trayType = mydoJobService.getTraytypeByTrayCode(inSsjDevice.getTrayCode());
|
||||
if (cargoAreaId.equals("02")){
|
||||
if (trayType != 3){
|
||||
log.warn("【入库异常】托盘类型与货区{}不匹配,请检查条码格式,输送机:{},托盘码:{}", cargoAreaId, inSsjDevice.getDeviceCode(), inSsjDevice.getTrayCode());
|
||||
writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 6, 2);
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
if (trayType == 3){
|
||||
log.warn("【入库异常】托盘类型与货区{}不匹配,请检查条码格式,输送机:{},托盘码:{}", cargoAreaId, inSsjDevice.getDeviceCode(), inSsjDevice.getTrayCode());
|
||||
writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 6, 2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 输送机到位判断校验 - 出库
|
||||
* @param inSsjDevice
|
||||
* @return
|
||||
*/
|
||||
private boolean roadConvCheckedForStockout(DeviceSsj inSsjDevice){
|
||||
|
||||
boolean flag = false;
|
||||
//---------------------------巷道口取放货输送机---------------------------
|
||||
//输送机【任务号】和【到位】校验
|
||||
if (inSsjDevice.getTaskNo() == 0 && inSsjDevice.getDw() == 0) flag = true;
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向堆垛机发送【入库】任务
|
||||
* @param roadSsjDevice
|
||||
* 入口到位生成wcs本地作业
|
||||
* @param inSsjDevice
|
||||
*/
|
||||
private void sendStackerIn(DeviceSsj roadSsjDevice){
|
||||
//模拟数据
|
||||
// roadSsjDevice.setDw(1);
|
||||
// roadSsjDevice.setTaskNo(85012);
|
||||
private void generateWcsMydoJob(DeviceSsj inSsjDevice){
|
||||
|
||||
//---------------------------入库任务---------------------------
|
||||
//巷道口输送机到位,且任务号大于1000
|
||||
if (roadSsjDevice.getDw()==1 && roadSsjDevice.getTaskNo()>1000) {
|
||||
//如果已经生成wcs任务则不继续执行后续请求操作
|
||||
//包括请求成功生成作业和wms推送成功的情况
|
||||
int count = mydoJobService.selectInOrOutMydoJobList(
|
||||
new MydoJob().builder().trayCode(inSsjDevice.getTrayCode()).build()
|
||||
).size();
|
||||
|
||||
//根据输送机【任务号】查找当前执行的入库任务
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(roadSsjDevice.getTaskNo()));
|
||||
if(ObjUtil.isNotNull(mydoJob)){
|
||||
if (count > 0) return;
|
||||
|
||||
//如果任务存在 - 表示该任务已经巷道口输送到位
|
||||
//更新任务阶段【巷道口入库到位】
|
||||
if(mydoJob.getExecutionPhase().equals(TASK_EP_SSJ)){
|
||||
mydoJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
|
||||
// 检查任务属性:【任务已存在】、执行阶段-【巷道口输送机到位】、任务类型-【入库】 → 下发堆垛机执行队列
|
||||
if (mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ) && Convert.toInt(mydoJob.getInOrOut()) < 20) {
|
||||
|
||||
//弯轨堆垛机设备编号使用货位区域编号对应
|
||||
int devId = Convert.toInt(basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId()).getCargoAreaId());
|
||||
|
||||
//检查堆垛机是否在正在执行中/已经有执行队列
|
||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_3, devId);
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());
|
||||
|
||||
//生成堆垛机执行队列
|
||||
if (CollUtil.isEmpty(ddjDeviceExecutionQueues) && ObjUtil.isNotNull(basCargoSpace) && CollUtil.isNotEmpty(pclList)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(mydoJob.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName(mydoJob.getRoadwayId());
|
||||
ddjDeviceExecutionQueue.setDevId(devId);
|
||||
ddjDeviceExecutionQueue.setRwzt(0);
|
||||
ddjDeviceExecutionQueue.setYph(pclList.get(0));
|
||||
ddjDeviceExecutionQueue.setYlh(pclList.get(1));
|
||||
ddjDeviceExecutionQueue.setYch(pclList.get(2));
|
||||
ddjDeviceExecutionQueue.setMbph(Convert.toInt(basCargoSpace.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setMblh(Convert.toInt(basCargoSpace.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setMbch(Convert.toInt(basCargoSpace.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setMlfs(5);
|
||||
ddjDeviceExecutionQueue.setSpare1(mydoJob.getTraySize());//货物高度
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_3);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
|
||||
if (ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueue).size() > 0){
|
||||
//下发后更新任务阶段
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------警告校验:条码已有库存-----------------
|
||||
BasCargoSpace cargoSpace = new BasCargoSpace();
|
||||
cargoSpace.setTrayCode(inSsjDevice.getTrayCode());
|
||||
if (!basCargoSpaceService.selectBasCargoSpaceList(cargoSpace).isEmpty()) {
|
||||
log.warn("【警告】该托盘号已有库存,托盘条码:{}",inSsjDevice.getTrayCode());
|
||||
}
|
||||
|
||||
int trayType = mydoJobService.getTraytypeByTrayCode(inSsjDevice.getTrayCode());
|
||||
|
||||
//生成的任务初始化
|
||||
MydoJob mydoJob = new MydoJob().builder()
|
||||
// .jobId(result.getJobId())
|
||||
.taskNo(mydoJobService.getTaskNo("2"))//如果需要用wms下发的任务号作为wcs的任务号使用
|
||||
.status(TASK_STATUS_CREATED)
|
||||
.trayCode(inSsjDevice.getTrayCode())
|
||||
// .cargoSpaceId(result.getCargoSpaceId())
|
||||
// .wmsTaskNo(mydoJobService.getTaskNo("1"))
|
||||
.traySize(inSsjDevice.getHeight())
|
||||
.inOrOut("1")
|
||||
.roadwayId(String.valueOf(ConvType.CONV_ROAD_ROADWAY.get(inSsjDevice.getDeviceCode())))//获取货位表货位对应的巷道号
|
||||
.entranceId(inSsjDevice.getDeviceCode())
|
||||
.executionPhase(TASK_EP_CREATED)
|
||||
.faultFlag("0")
|
||||
.traySize(trayType)
|
||||
.priority(10)
|
||||
.build();
|
||||
|
||||
//如果还没有这个条码的wcs任务 - 生成一条任务
|
||||
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
|
||||
new MydoJob().builder().trayCode(inSsjDevice.getTrayCode()).build()
|
||||
);
|
||||
if (jobs.isEmpty()) {
|
||||
mydoJobService.insertMydoJob(mydoJob);
|
||||
log.info("【生成入库】本地生成wcs作业成功,wcs任务号:{},托盘条码:{}", mydoJob.getTaskNo(), mydoJob.getTrayCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新入库任务阶段
|
||||
* @param inSsjDevice
|
||||
*/
|
||||
private void updateMydoJob(DeviceSsj inSsjDevice) {
|
||||
|
||||
//-------------------------------------------常规入库-------------------------------------------
|
||||
//检查是否有已经创建成功的任务(请求成功的入库任务) - 更新到下一个执行阶段
|
||||
MydoJob mydoJobStockin = new MydoJob().builder()
|
||||
.trayCode(inSsjDevice.getTrayCode())
|
||||
.status(TASK_STATUS_CREATED)
|
||||
.build();
|
||||
if (mydoJobService.selectMydoJobList(mydoJobStockin).isEmpty()) return;
|
||||
|
||||
//如果已经生成入库任务 - 向输送机下发任务号
|
||||
mydoJobStockin = mydoJobService.selectMydoJobList(mydoJobStockin).get(0);
|
||||
|
||||
//输送机去向值【1】
|
||||
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), mydoJobStockin.getTaskNo(), 1, 1);
|
||||
|
||||
if (i == 1) {
|
||||
//写入成功则更新执行阶段
|
||||
mydoJobStockin.setStatus(TASK_STATUS_RUNNING);
|
||||
mydoJobStockin.setExecutionPhase(TASK_EP_ROADWAY_SSJ);
|
||||
// mydoJobStockin.setEntranceId(inSsjDevice.getDeviceCode());
|
||||
mydoJobStockin.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(mydoJobStockin);
|
||||
log.info("【更新状态】巷道输送机{}下发成功,任务号:{},等待堆垛机取货", inSsjDevice.getDeviceCode(), mydoJobStockin.getTaskNo());
|
||||
}else{
|
||||
log.info("【更新状态】巷道输送机{}下发失败,任务号:{},等待重试中...", inSsjDevice.getDeviceCode(), mydoJobStockin.getTaskNo());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 向堆垛机发送【出库】任务
|
||||
* @param roadSsjDevice
|
||||
@@ -214,59 +310,57 @@ public class RoadConvThread implements Runnable {
|
||||
private void sendStackerOut(DeviceSsj roadSsjDevice){
|
||||
//---------------------------出库任务---------------------------
|
||||
//检查巷道口输送机是否空闲
|
||||
if(roadSsjDevice.getKx()==1 && roadSsjDevice.getTaskNo() == 0){
|
||||
if(roadSsjDevice.getKx() == 1 && roadSsjDevice.getTaskNo() == 0){
|
||||
|
||||
//检查是否有入口是1#巷道的出库任务
|
||||
String exitId = ROADWAY1_EXIT;
|
||||
MydoJob job = mydoJobService.selectMydoJobByExitId(exitId);
|
||||
String exitId = roadSsjDevice.getDeviceCode();
|
||||
|
||||
if(job == null){
|
||||
|
||||
//检查是否有出库任务
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByExitId(exitId);
|
||||
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_2);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
|
||||
//修改作业状态
|
||||
mydoJob.setStatus(TASK_STATUS_RUNNING);
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ);
|
||||
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
//检查是否有出库任务
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByExitId(exitId);
|
||||
if (ObjUtil.isNotNull(mydoJob)) {
|
||||
//如果有出库任务 - 检查货位编码是否合法
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
if (ObjUtil.isNull(basCargoSpace)) {
|
||||
log.error("【任务异常】货位不存在 cargoSpaceId{}", mydoJob.getCargoSpaceId());
|
||||
} else {
|
||||
//生成队列
|
||||
List<DdjDeviceExecutionQueue> list = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(
|
||||
new DdjDeviceExecutionQueue().builder().devId(Convert.toInt(mydoJob.getRoadwayId())).build()
|
||||
);
|
||||
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().toString());//货物高度
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
// ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_2);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
//修改作业状态
|
||||
mydoJob.setStatus(TASK_STATUS_RUNNING);
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ);
|
||||
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
log.info("【出库警告】当前出口"+ exitId +"存在入库任务,无法出库!");
|
||||
// log.info("【出库警告】当前出口"+ exitId +"存在入库任务,无法出库!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ spring:
|
||||
# password: Flrd0914.
|
||||
|
||||
# 本机
|
||||
url: jdbc:sqlserver://127.0.0.1:1433;databaseName=FT568-wcs;encrypt=true;trustServerCertificate=true;
|
||||
url: jdbc:sqlserver://127.0.0.1:1433;databaseName=FT577-wcs;encrypt=true;trustServerCertificate=true;
|
||||
username: sa
|
||||
password: 123456
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ ruoyi:
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8084
|
||||
port: 8081
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
@@ -60,6 +60,11 @@ spring:
|
||||
max-file-size: 10MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
encoding:
|
||||
charset: UTF-8
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
@@ -75,7 +80,7 @@ spring:
|
||||
# 数据库索引
|
||||
database: 2
|
||||
# 密码
|
||||
password: 123456
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
|
||||
@@ -28,10 +28,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="port" column="port" />
|
||||
<result property="plcDbReadAddress" column="plc_db_read_address" />
|
||||
<result property="plcDbWriteAddress" column="plc_db_write_address" />
|
||||
<result property="height" column="height" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMsgDdjVo">
|
||||
select id, name, rwh, jdbz, sbzt, czfs, yxxf, yph, ylh, ych, mbph, mblh, mbch, xtxh, dqxd, hczt, current_row, current_column, current_floor,ip,port,plc_db_read_address,plc_db_write_address from msg_ddj
|
||||
select id, name, rwh, jdbz, sbzt, czfs, yxxf, yph, ylh, ych, mbph, mblh, mbch, xtxh, dqxd, hczt, current_row, current_column, current_floor,ip,port,plc_db_read_address,plc_db_write_address,height from msg_ddj
|
||||
</sql>
|
||||
|
||||
<select id="selectMsgDdjList" parameterType="MsgDdj" resultMap="MsgDdjResult">
|
||||
@@ -55,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="currentRow != null "> and current_row = #{currentRow}</if>
|
||||
<if test="currentColumn != null "> and current_column = #{currentColumn}</if>
|
||||
<if test="currentFloor != null "> and current_floor = #{currentFloor}</if>
|
||||
<if test="height != null "> and height = #{height}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -85,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="currentRow != null">current_row,</if>
|
||||
<if test="currentColumn != null">current_column,</if>
|
||||
<if test="currentFloor != null">current_floor,</if>
|
||||
<if test="height != null">height,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -106,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="currentRow != null">#{currentRow},</if>
|
||||
<if test="currentColumn != null">#{currentColumn},</if>
|
||||
<if test="currentFloor != null">#{currentFloor},</if>
|
||||
<if test="height != null">#{height},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -130,6 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="currentRow != null">current_row = #{currentRow},</if>
|
||||
<if test="currentColumn != null">current_column = #{currentColumn},</if>
|
||||
<if test="currentFloor != null">current_floor = #{currentFloor},</if>
|
||||
<if test="height != null">height = #{height},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -187,6 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="taskNo != null and taskNo != ''">task_no = #{taskNo},</if>
|
||||
<if test="jobId != null and jobId != ''">job_id = #{jobId},</if>
|
||||
<if test="roadwayId != null">roadway_id = #{roadwayId},</if>
|
||||
<if test="cargoSpaceId != null">cargo_space_id = #{cargoSpaceId},</if>
|
||||
<if test="targetRoadwayId != null">target_roadway_id = #{targetRoadwayId},</if>
|
||||
@@ -206,7 +207,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="traySize != null">tray_size = #{traySize},</if>
|
||||
<if test="wmsTaskNo != null">wms_task_no = #{wmsTaskNo},</if>
|
||||
</trim>
|
||||
where job_id = #{jobId}
|
||||
where task_no = #{taskNo}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMydoJobByJobId" parameterType="String">
|
||||
@@ -278,7 +279,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectMydoJobByExitId" parameterType="java.lang.String" resultMap="MydoJobResult">
|
||||
select TOP 1 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, wms_task_no, tray_code, tray_size, flag from mydo_job_wcs
|
||||
where exit_id = #{exitId}
|
||||
and in_or_out = 2
|
||||
and in_or_out >= 20
|
||||
and status = 1 and execution_phase= 0
|
||||
order by priority asc,create_time asc
|
||||
</select>
|
||||
|
||||
@@ -67,14 +67,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where rwh = #{taskNo}
|
||||
</select>
|
||||
|
||||
<select id="selectDdjDeviceExecutionQueueListByRwlx"
|
||||
resultMap="DdjDeviceExecutionQueueResult">
|
||||
<select id="selectDdjDeviceExecutionQueueListByRwlx" resultMap="DdjDeviceExecutionQueueResult">
|
||||
<include refid="selectDdjDeviceExecutionQueueVo"/>
|
||||
where rwlx = #{rwlx} and dev_id = #{devId}
|
||||
|
||||
</select>
|
||||
<select id="selectDdjDeviceExecutionQueueByRwhAndXd"
|
||||
resultMap="DdjDeviceExecutionQueueResult">
|
||||
<select id="selectDdjDeviceExecutionQueueByRwhAndXd" resultMap="DdjDeviceExecutionQueueResult">
|
||||
<include refid="selectDdjDeviceExecutionQueueVo"/>
|
||||
where rwh = #{rwh} and dev_id = #{devId}
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user