编辑设备类型和出入库调度
This commit is contained in:
@@ -15,6 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@EnableAsync
|
@EnableAsync
|
||||||
|
@MapperScan("com.**.mapper")
|
||||||
public class RuoYiApplication
|
public class RuoYiApplication
|
||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
|
|||||||
@@ -39,25 +39,29 @@ public class ScreenController extends BaseController {
|
|||||||
|
|
||||||
// 静态初始化输送机编号数组
|
// 静态初始化输送机编号数组
|
||||||
static {
|
static {
|
||||||
// 1区域输送机编号
|
// 区域输送机编号
|
||||||
AREA_SSJ_CODES.put(1, Arrays.asList(
|
AREA_SSJ_CODES.put(1, Arrays.asList(
|
||||||
"L2007", "L2008", "L2005", "L2006", "L2013"
|
"L1001", "G1004"
|
||||||
));
|
|
||||||
|
|
||||||
// 2区域输送机编号
|
|
||||||
AREA_SSJ_CODES.put(2, Arrays.asList(
|
|
||||||
"L2003", "L2004", "L2012", "L2001", "L2002"
|
|
||||||
));
|
|
||||||
|
|
||||||
// 3区域输送机编号
|
|
||||||
AREA_SSJ_CODES.put(3, Arrays.asList(
|
|
||||||
"L1001", "L1002", "L1011"
|
|
||||||
));
|
|
||||||
|
|
||||||
// 4区域输送机编号
|
|
||||||
AREA_SSJ_CODES.put(4, Arrays.asList(
|
|
||||||
"L1003", "L1004", "L1012"
|
|
||||||
));
|
));
|
||||||
|
// // 1区域输送机编号
|
||||||
|
// AREA_SSJ_CODES.put(1, Arrays.asList(
|
||||||
|
// "L2007", "L2008", "L2005", "L2006", "L2013"
|
||||||
|
// ));
|
||||||
|
//
|
||||||
|
// // 2区域输送机编号
|
||||||
|
// AREA_SSJ_CODES.put(2, Arrays.asList(
|
||||||
|
// "L2003", "L2004", "L2012", "L2001", "L2002"
|
||||||
|
// ));
|
||||||
|
//
|
||||||
|
// // 3区域输送机编号
|
||||||
|
// AREA_SSJ_CODES.put(3, Arrays.asList(
|
||||||
|
// "L1001", "L1002", "L1011"
|
||||||
|
// ));
|
||||||
|
//
|
||||||
|
// // 4区域输送机编号
|
||||||
|
// AREA_SSJ_CODES.put(4, Arrays.asList(
|
||||||
|
// "L1003", "L1004", "L1012"
|
||||||
|
// ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class Wcs2WmsController {
|
|||||||
private IWcsPortService wcsPortService;
|
private IWcsPortService wcsPortService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接收出库任务
|
* 接收wms出库任务
|
||||||
*
|
*
|
||||||
* @param receiveOutJob
|
* @param receiveOutJob
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -8,7 +8,20 @@ import lombok.NoArgsConstructor;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class JobParam {
|
public class JobParam {
|
||||||
|
/**
|
||||||
|
* 作业号
|
||||||
|
*/
|
||||||
private String jobId;
|
private String jobId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 托盘号
|
||||||
|
*/
|
||||||
private String trayCode;
|
private String trayCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务号
|
||||||
|
*/
|
||||||
private String taskNo;
|
private String taskNo;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,48 @@ import lombok.NoArgsConstructor;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class ReceiveJob {
|
public class ReceiveJob {
|
||||||
|
/**
|
||||||
|
* 任务号
|
||||||
|
*/
|
||||||
private String taskNo;
|
private String taskNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货位
|
||||||
|
*/
|
||||||
private String cargoSpaceId;
|
private String cargoSpaceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出口
|
||||||
|
*/
|
||||||
private String exitId;
|
private String exitId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 托盘号
|
||||||
|
*/
|
||||||
private String trayCode;
|
private String trayCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入口
|
||||||
|
*/
|
||||||
private String entranceId;
|
private String entranceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务类型
|
||||||
|
*/
|
||||||
private String inOrOut;
|
private String inOrOut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作业号
|
||||||
|
*/
|
||||||
private String jobId;
|
private String jobId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 巷道号
|
||||||
|
*/
|
||||||
private String roadwayId;
|
private String roadwayId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
private String departmentId;
|
private String departmentId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.ruoyi.api.domain.wcs2wms.exception;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TaskExceptionRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务号
|
||||||
|
*/
|
||||||
|
private String taskNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常类型
|
||||||
|
*/
|
||||||
|
private int exceptionType;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.api.domain.wcs2wms.stockin;
|
||||||
|
|
||||||
|
public class StockinReceive {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wms下发任务号
|
||||||
|
*/
|
||||||
|
private String taskNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WMS分配的目标库位编号
|
||||||
|
*/
|
||||||
|
private String cargoSpaceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 巷道编号
|
||||||
|
*/
|
||||||
|
private String roadwayId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作业单ID
|
||||||
|
*/
|
||||||
|
private String jobId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入出库标识
|
||||||
|
*/
|
||||||
|
private String inOrOut;
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.ruoyi.api.domain.wcs2wms.stockin;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库请求参数
|
||||||
|
* (扫码失败、超重、超高时,WCS 仍调用此接口传递异常信息,WMS 记录异常但不返回任务号)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class StockinRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 托盘号
|
||||||
|
*/
|
||||||
|
private String trayCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重量
|
||||||
|
*/
|
||||||
|
private int weight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货物高度
|
||||||
|
*/
|
||||||
|
private int height;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常信息
|
||||||
|
*/
|
||||||
|
private String errorInfo;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.api.domain.wcs2wms.taskFinish;
|
||||||
|
|
||||||
|
public class TaskFinishRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务号
|
||||||
|
*/
|
||||||
|
private String taskNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作业单ID
|
||||||
|
*/
|
||||||
|
private String jobId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成类型枚举值
|
||||||
|
* 1-入库完成 2-出库完成
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.ruoyi.api.domain.wcs2wms.taskFinish;
|
||||||
|
|
||||||
|
public class taskFinishReceive {
|
||||||
|
}
|
||||||
@@ -11,8 +11,10 @@ import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRequest
|
|||||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||||
|
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionRequest;
|
||||||
import com.ruoyi.bas.port.domain.WcsPort;
|
import com.ruoyi.bas.port.domain.WcsPort;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.exception.job.TaskException;
|
||||||
import com.ruoyi.job.domain.MydoJob;
|
import com.ruoyi.job.domain.MydoJob;
|
||||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||||
import org.aspectj.weaver.loadtime.Aj;
|
import org.aspectj.weaver.loadtime.Aj;
|
||||||
@@ -42,12 +44,12 @@ public interface IApiService
|
|||||||
*/
|
*/
|
||||||
public AgvQueue createAgvQueue(String code1,String code2,String wmsTrayCode,String taskCode,String wmsTaskType,String traySize,String wmsTaskNo);
|
public AgvQueue createAgvQueue(String code1,String code2,String wmsTrayCode,String taskCode,String wmsTaskType,String traySize,String wmsTaskNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消AGV任务
|
* 取消AGV任务
|
||||||
*
|
*
|
||||||
* @param cancelTaskRequest
|
* @param cancelTaskRequest
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public CancelTaskResponse cancelTask(CancelTaskRequest cancelTaskRequest);
|
public CancelTaskResponse cancelTask(CancelTaskRequest cancelTaskRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,6 +117,13 @@ public interface IApiService
|
|||||||
*/
|
*/
|
||||||
AjaxResult reAssign(JobParam jobParam);
|
AjaxResult reAssign(JobParam jobParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 放货有货 (参数类型TaskExceptionRequest)
|
||||||
|
* @param taskExceptionRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult reAssign(TaskExceptionRequest taskExceptionRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取货无货,重新分配单据
|
* 取货无货,重新分配单据
|
||||||
* @param jobParam
|
* @param jobParam
|
||||||
@@ -122,6 +131,13 @@ public interface IApiService
|
|||||||
*/
|
*/
|
||||||
AjaxResult reMaterial(JobParam jobParam);
|
AjaxResult reMaterial(JobParam jobParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取货无货(参数类型TaskExceptionRequest)
|
||||||
|
* @param taskExceptionRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult reMaterial(TaskExceptionRequest taskExceptionRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库请求生成作业
|
* 入库请求生成作业
|
||||||
*/
|
*/
|
||||||
@@ -138,4 +154,9 @@ public interface IApiService
|
|||||||
AjaxResult deleteAgvTray(AgvQueue agvQueue);
|
AjaxResult deleteAgvTray(AgvQueue agvQueue);
|
||||||
|
|
||||||
AjaxResult requestWmsSpace(MydoJob mydoJob);
|
AjaxResult requestWmsSpace(MydoJob mydoJob);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRespons
|
|||||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.PositionCodeData;
|
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.PositionCodeData;
|
||||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||||
|
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionRequest;
|
||||||
import com.ruoyi.api.service.IApiService;
|
import com.ruoyi.api.service.IApiService;
|
||||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||||
import com.ruoyi.bas.port.domain.WcsPort;
|
import com.ruoyi.bas.port.domain.WcsPort;
|
||||||
@@ -210,6 +211,7 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消ctu任务
|
* 取消ctu任务
|
||||||
*
|
*
|
||||||
@@ -236,6 +238,11 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常重分(参数类型JobParam)
|
||||||
|
* @param jobParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult reAssign(JobParam jobParam) {
|
public AjaxResult reAssign(JobParam jobParam) {
|
||||||
RequestLog requestLog = requestLogService.getRequestLog(RE_ASSIGN_URL, "重新分配货位", JSONUtil.toJsonStr(jobParam));
|
RequestLog requestLog = requestLogService.getRequestLog(RE_ASSIGN_URL, "重新分配货位", JSONUtil.toJsonStr(jobParam));
|
||||||
@@ -250,6 +257,30 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常重分(参数类型TaskExceptionRequest)
|
||||||
|
* @param taskExceptionRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult reAssign(TaskExceptionRequest taskExceptionRequest) {
|
||||||
|
RequestLog requestLog = requestLogService.getRequestLog(WMS_TASK_EXCEPTION, "入库异常-重新分配货位", JSONUtil.toJsonStr(taskExceptionRequest));
|
||||||
|
if ("1".equals(requestLog.getIsSuccessful())){
|
||||||
|
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
|
||||||
|
MydoJob wmsMydoJob = BeanUtil.toBean(bean.getData(), MydoJob.class);
|
||||||
|
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(wmsMydoJob.getJobId());
|
||||||
|
mydoJob.setCargoSpaceId(wmsMydoJob.getCargoSpaceId());
|
||||||
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库异常作废(参数类型jobParam)
|
||||||
|
* @param jobParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult reMaterial(JobParam jobParam) {
|
public AjaxResult reMaterial(JobParam jobParam) {
|
||||||
RequestLog requestLog = requestLogService.getRequestLog(RE_MATERIAL_URL, "重新分配物料", JSONUtil.toJsonStr(jobParam));
|
RequestLog requestLog = requestLogService.getRequestLog(RE_MATERIAL_URL, "重新分配物料", JSONUtil.toJsonStr(jobParam));
|
||||||
@@ -259,6 +290,22 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库异常作废(参数类型TaskExceptionRequest)
|
||||||
|
* @param taskExceptionRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult reMaterial(TaskExceptionRequest taskExceptionRequest) {
|
||||||
|
RequestLog requestLog = requestLogService.getRequestLog(WMS_TASK_EXCEPTION, "出库无货异常-任务作废", JSONUtil.toJsonStr(taskExceptionRequest));
|
||||||
|
if ("1".equals(requestLog.getIsSuccessful())){
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成agv队列----临时修改起终点
|
* 生成agv队列----临时修改起终点
|
||||||
@@ -288,11 +335,11 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
agvQueue.setTaskType("A22");
|
agvQueue.setTaskType("A22");
|
||||||
agvQueue.setCtnrType("1");
|
agvQueue.setCtnrType("1");
|
||||||
//rcslite开启托盘自动调整位置后 - 测试一巷道放货区分托盘类型
|
//rcslite开启托盘自动调整位置后 - 测试一巷道放货区分托盘类型
|
||||||
// if (traySize == "2" || traySize == "3") {
|
if (traySize == "2" || traySize == "3") {
|
||||||
// agvQueue.setCtnrType("3");
|
agvQueue.setCtnrType("3");
|
||||||
// }else{
|
}else{
|
||||||
// agvQueue.setCtnrType("1");
|
agvQueue.setCtnrType("1");
|
||||||
// }
|
}
|
||||||
|
|
||||||
agvQueue.setCtnrCode(traySize);
|
agvQueue.setCtnrCode(traySize);
|
||||||
agvQueue.setCtnrNum("0");
|
agvQueue.setCtnrNum("0");
|
||||||
@@ -308,6 +355,7 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
return agvQueue;
|
return agvQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消AGV任务
|
* 取消AGV任务
|
||||||
*
|
*
|
||||||
@@ -321,6 +369,7 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 继续agv任务
|
* 继续agv任务
|
||||||
*
|
*
|
||||||
@@ -365,9 +414,15 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
return genAgvSchedulingTask(genAgvSchedulingTaskRequest);
|
return genAgvSchedulingTask(genAgvSchedulingTaskRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求wms获取入库任务参数
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult createInMydoJob(Map<String, Object> param) {
|
public AjaxResult createInMydoJob(Map<String, Object> param) {
|
||||||
RequestLog requestLog = requestLogService.getRequestLog(CREATE_IN_MYDO_JOB_URL, "入库请求生成作业", JSONUtil.toJsonStr(param));
|
RequestLog requestLog = requestLogService.getRequestLog(WMS_STOCKIN_MYDOJOB, "入库请求生成作业", JSONUtil.toJsonStr(param));
|
||||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||||
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
|
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
|
||||||
return AjaxResult.success(bean.getData());
|
return AjaxResult.success(bean.getData());
|
||||||
@@ -379,17 +434,23 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob) {
|
public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob) {
|
||||||
|
|
||||||
|
//检查任务是否存在,避免重复生成
|
||||||
|
MydoJob job = new MydoJob();
|
||||||
|
job.setTaskNo(receiveOutJob.getTaskNo());
|
||||||
|
List<MydoJob> tasks = mydoJobService.selectMydoJobList(job);
|
||||||
|
|
||||||
|
if (tasks.size() != 0) {
|
||||||
|
log.info("【请求异常】wms下发出库任务失败,该任务已存在,任务号:{}", receiveOutJob.getTaskNo());
|
||||||
|
return AjaxResult.error("【请求异常】wms下发出库任务失败,该任务已存在,任务号:" + receiveOutJob.getTaskNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
//生成出库作业
|
||||||
MydoJob mydoJob = new MydoJob();
|
MydoJob mydoJob = new MydoJob();
|
||||||
mydoJob.setJobId(receiveOutJob.getJobId());
|
mydoJob.setJobId(receiveOutJob.getJobId());
|
||||||
mydoJob.setTaskNo(receiveOutJob.getTaskNo());
|
mydoJob.setTaskNo(receiveOutJob.getTaskNo());
|
||||||
mydoJob.setCargoSpaceId(receiveOutJob.getCargoSpaceId());
|
mydoJob.setCargoSpaceId(receiveOutJob.getCargoSpaceId());
|
||||||
|
mydoJob.setExitId("G1004");
|
||||||
if("L2002".equals(receiveOutJob.getExitId()) || "L2008".equals(receiveOutJob.getExitId())
|
|
||||||
|| "L2004".equals(receiveOutJob.getExitId()) || "L2006".equals(receiveOutJob.getExitId())) {
|
|
||||||
mydoJob.setExitId("1");
|
|
||||||
}else{
|
|
||||||
mydoJob.setExitId(receiveOutJob.getExitId());
|
|
||||||
}
|
|
||||||
mydoJob.setInOrOut(receiveOutJob.getInOrOut());
|
mydoJob.setInOrOut(receiveOutJob.getInOrOut());
|
||||||
mydoJob.setStatus("1");
|
mydoJob.setStatus("1");
|
||||||
mydoJob.setPriority(Long.valueOf(10));
|
mydoJob.setPriority(Long.valueOf(10));
|
||||||
@@ -397,10 +458,11 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
mydoJob.setRoadwayId(receiveOutJob.getRoadwayId());
|
mydoJob.setRoadwayId(receiveOutJob.getRoadwayId());
|
||||||
mydoJob.setCreateTime(DateUtils.getNowDate());
|
mydoJob.setCreateTime(DateUtils.getNowDate());
|
||||||
mydoJob.setExecutionPhase(TASK_EP_CREATE);
|
mydoJob.setExecutionPhase(TASK_EP_CREATE);
|
||||||
mydoJob.setTraySize(receiveOutJob.getDepartmentId());
|
// mydoJob.setTraySize(receiveOutJob.getDepartmentId());
|
||||||
int i = mydoJobService.insertMydoJob(mydoJob);
|
int i = mydoJobService.insertMydoJob(mydoJob);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success(
|
||||||
|
"【请求成功】wms下发出库作业,作业单号:" + receiveOutJob.getJobId() + ",任务号:" + receiveOutJob.getTaskNo() + ",出库货位:" + receiveOutJob.getCargoSpaceId());
|
||||||
}else{
|
}else{
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
@@ -423,6 +485,12 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//todo 新增agv站点
|
//todo 新增agv站点
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AGV站点映射
|
||||||
|
* @param agvQueue
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult deleteAgvTray(AgvQueue agvQueue) {
|
public AjaxResult deleteAgvTray(AgvQueue agvQueue) {
|
||||||
Map<String, String> paramMap = new HashMap<>();
|
Map<String, String> paramMap = new HashMap<>();
|
||||||
@@ -492,4 +560,5 @@ public class ApiServiceImpl implements IApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public class RequestLogServiceImpl implements IRequestLogService
|
|||||||
* @return requestLog
|
* @return requestLog
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public RequestLog getRequestLog(String url, String endPoint,String param) {
|
public RequestLog getRequestLog(String url, String endPoint, String param) {
|
||||||
RequestLog requestLog = new RequestLog();
|
RequestLog requestLog = new RequestLog();
|
||||||
Date requestTime = new Date();
|
Date requestTime = new Date();
|
||||||
requestLog.setRequestTime(DateUtil.format(requestTime, "yyyy-MM-dd HH:mm:ss"));
|
requestLog.setRequestTime(DateUtil.format(requestTime, "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ public class Constant {
|
|||||||
public static final String WMS_BASE_URL = "http://192.168.58.10:8082/api2wms/";
|
public static final String WMS_BASE_URL = "http://192.168.58.10:8082/api2wms/";
|
||||||
public static final String RCS_BASE_URL = "http://192.168.58.101:8182/rcms/services/rest/hikRpcService/";
|
public static final String RCS_BASE_URL = "http://192.168.58.101:8182/rcms/services/rest/hikRpcService/";
|
||||||
|
|
||||||
|
//#region AGV接口url
|
||||||
public static final String GEN_AGV_SCHEDULING_TASK = RCS_BASE_URL+"genAgvSchedulingTask";
|
public static final String GEN_AGV_SCHEDULING_TASK = RCS_BASE_URL+"genAgvSchedulingTask";
|
||||||
public static final String CANCEL_TASK_URL = RCS_BASE_URL+"cancelTask";
|
public static final String CANCEL_TASK_URL = RCS_BASE_URL+"cancelTask";
|
||||||
public static final String CONTINUE_TASK_URL = RCS_BASE_URL+"continueTask";
|
public static final String CONTINUE_TASK_URL = RCS_BASE_URL+"continueTask";
|
||||||
@@ -19,6 +20,23 @@ public class Constant {
|
|||||||
public static final String REQUEST_ENTER_URL = WMS_BASE_URL+"requestEnterByTrayCodeAndEntranceId";
|
public static final String REQUEST_ENTER_URL = WMS_BASE_URL+"requestEnterByTrayCodeAndEntranceId";
|
||||||
public static final String REQUEST_IN_SPACE_URL = WMS_BASE_URL+"requestInSpace";
|
public static final String REQUEST_IN_SPACE_URL = WMS_BASE_URL+"requestInSpace";
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向wms请求入库url
|
||||||
|
*/
|
||||||
|
public static final String WMS_STOCKIN_MYDOJOB = WMS_BASE_URL + "wcs/inbound/info";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向wms请求任务回传url
|
||||||
|
*/
|
||||||
|
public static final String WMS_TASK_FINISH = WMS_BASE_URL + "wcs/task/complete";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常信息回传url
|
||||||
|
*/
|
||||||
|
public static final String WMS_TASK_EXCEPTION = WMS_BASE_URL + "wcs/exception/report";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常任务
|
||||||
|
*/
|
||||||
|
public class TaskExceptionType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务异常 - 入库放货有货
|
||||||
|
*/
|
||||||
|
public static final int TASK_EXCEPTION_STOCKIN_OCCUPIED = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务异常 - 出库取货无货
|
||||||
|
*/
|
||||||
|
public static final int TASK_EXCEPTION_STOCKOUT_EMPTY = 2;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -87,6 +87,19 @@ public class DeviceSsj extends BaseEntity
|
|||||||
|
|
||||||
private int taskNo2;
|
private int taskNo2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入库模式
|
||||||
|
*/
|
||||||
private int inOrOut;
|
private int inOrOut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 托盘高度
|
||||||
|
*/
|
||||||
|
private int height;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 称重
|
||||||
|
*/
|
||||||
|
private int weight;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,8 @@ import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
|||||||
import com.ruoyi.common.domain.CustomThread;
|
import com.ruoyi.common.domain.CustomThread;
|
||||||
import com.ruoyi.schedule.scheduleTask.ddj.DdjThread;
|
import com.ruoyi.schedule.scheduleTask.ddj.DdjThread;
|
||||||
import com.ruoyi.schedule.scheduleTask.monit.MonitoringThread;
|
import com.ruoyi.schedule.scheduleTask.monit.MonitoringThread;
|
||||||
import com.ruoyi.schedule.scheduleTask.ssj.floor1.Floor1BothWayInSsjThread;
|
import com.ruoyi.schedule.scheduleTask.ssj.PortConvThread;
|
||||||
import com.ruoyi.schedule.scheduleTask.ssj.floor1.Floor1BothWayOutSsjThread;
|
import com.ruoyi.schedule.scheduleTask.ssj.RoadConvThread;
|
||||||
import com.ruoyi.schedule.scheduleTask.ssj.floor1.Floor1SingleSsjThread;
|
|
||||||
import com.ruoyi.schedule.scheduleTask.ssj.floor2.Floor2InOutSsjThread;
|
|
||||||
import com.ruoyi.schedule.scheduleTask.ssj.floor2.Floor2RoadWaySsjThread;
|
|
||||||
import com.ruoyi.schedule.scheduleTask.ssj.floor2.LineSsjThread;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -27,7 +23,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,14 +34,11 @@ public class ScheduleThread {
|
|||||||
|
|
||||||
public CustomThread<PlcSsjRead> plcSsjReadCustomThread;
|
public CustomThread<PlcSsjRead> plcSsjReadCustomThread;
|
||||||
public CustomThread<PlcDdj1Read> plcDdj1ReadCustomThread;
|
public CustomThread<PlcDdj1Read> plcDdj1ReadCustomThread;
|
||||||
public CustomThread<PlcDdj2Read> plcDdj2ReadCustomThread;
|
// public CustomThread<PlcDdj2Read> plcDdj2ReadCustomThread;
|
||||||
|
|
||||||
|
public CustomThread<PortConvThread> portConvCustomThread;
|
||||||
|
public CustomThread<RoadConvThread> roadConvCustomThread;
|
||||||
|
|
||||||
public CustomThread<Floor1BothWayInSsjThread> floor1BothWayInSsjCustomThread;
|
|
||||||
public CustomThread<Floor1BothWayOutSsjThread> floor1BothWayOutSsjCustomThread;
|
|
||||||
public CustomThread<Floor1SingleSsjThread> floor1SingleSsjCustomThread;
|
|
||||||
public CustomThread<Floor2InOutSsjThread> floor2InSsjCustomThread;
|
|
||||||
public CustomThread<Floor2RoadWaySsjThread> floor2OutSsjCustomThread;
|
|
||||||
public CustomThread<LineSsjThread> lineSsjCustomThread;
|
|
||||||
public CustomThread<MonitoringThread> monitoringCustomThread;
|
public CustomThread<MonitoringThread> monitoringCustomThread;
|
||||||
public CustomThread<DdjThread> ddj1CustomThread;
|
public CustomThread<DdjThread> ddj1CustomThread;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -80,23 +72,11 @@ public class ScheduleThread {
|
|||||||
MonitoringThread monitoringThread = new MonitoringThread();
|
MonitoringThread monitoringThread = new MonitoringThread();
|
||||||
monitoringCustomThread = new CustomThread<MonitoringThread>(new Thread(monitoringThread), monitoringThread);
|
monitoringCustomThread = new CustomThread<MonitoringThread>(new Thread(monitoringThread), monitoringThread);
|
||||||
|
|
||||||
Floor1BothWayInSsjThread floor1BothWayInSsjThread = new Floor1BothWayInSsjThread();
|
PortConvThread portConvThread = new PortConvThread();
|
||||||
floor1BothWayInSsjCustomThread = new CustomThread<Floor1BothWayInSsjThread>(new Thread(floor1BothWayInSsjThread), floor1BothWayInSsjThread);
|
portConvCustomThread = new CustomThread<PortConvThread>(new Thread(portConvThread), portConvThread);
|
||||||
|
|
||||||
Floor1BothWayOutSsjThread floor1BothWayOutSsjThread = new Floor1BothWayOutSsjThread();
|
RoadConvThread roadConvThread = new RoadConvThread();
|
||||||
floor1BothWayOutSsjCustomThread = new CustomThread<Floor1BothWayOutSsjThread>(new Thread(floor1BothWayOutSsjThread), floor1BothWayOutSsjThread);
|
roadConvCustomThread = new CustomThread<RoadConvThread>(new Thread(roadConvThread), roadConvThread);
|
||||||
|
|
||||||
Floor1SingleSsjThread floor1SingleSsjThread = new Floor1SingleSsjThread();
|
|
||||||
floor1SingleSsjCustomThread = new CustomThread<Floor1SingleSsjThread>(new Thread(floor1SingleSsjThread), floor1SingleSsjThread);
|
|
||||||
|
|
||||||
Floor2InOutSsjThread floor2InSsjThread = new Floor2InOutSsjThread();
|
|
||||||
floor2InSsjCustomThread = new CustomThread<Floor2InOutSsjThread>(new Thread(floor2InSsjThread), floor2InSsjThread);
|
|
||||||
|
|
||||||
LineSsjThread lineSsjThread = new LineSsjThread();
|
|
||||||
lineSsjCustomThread = new CustomThread<LineSsjThread>(new Thread(lineSsjThread), lineSsjThread);
|
|
||||||
|
|
||||||
Floor2RoadWaySsjThread floor2OutSsjThread = new Floor2RoadWaySsjThread();
|
|
||||||
floor2OutSsjCustomThread = new CustomThread<Floor2RoadWaySsjThread>(new Thread(floor2OutSsjThread), floor2OutSsjThread);
|
|
||||||
|
|
||||||
DdjThread ddj1Thread = new DdjThread();
|
DdjThread ddj1Thread = new DdjThread();
|
||||||
ddj1CustomThread = new CustomThread<DdjThread>(new Thread(ddj1Thread), ddj1Thread);
|
ddj1CustomThread = new CustomThread<DdjThread>(new Thread(ddj1Thread), ddj1Thread);
|
||||||
@@ -119,7 +99,7 @@ public class ScheduleThread {
|
|||||||
|
|
||||||
//获取堆垛机
|
//获取堆垛机
|
||||||
ConcurrentHashMap<String, MsgDdj> ddj1List = new ConcurrentHashMap<>();
|
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());
|
List<MsgDdj> msgDdjs = msgDdjService.selectMsgDdjList(new MsgDdj());
|
||||||
for (MsgDdj msgDdj : msgDdjs) {
|
for (MsgDdj msgDdj : msgDdjs) {
|
||||||
msgDdj.setPlcDbReadAddress(msgDdj.getPlcDbReadAddress());
|
msgDdj.setPlcDbReadAddress(msgDdj.getPlcDbReadAddress());
|
||||||
@@ -131,13 +111,13 @@ public class ScheduleThread {
|
|||||||
ddj1List.put("ddj1", msgDdj);
|
ddj1List.put("ddj1", msgDdj);
|
||||||
PlcDdj1Read.deviceDdjMap = ddj1List;
|
PlcDdj1Read.deviceDdjMap = ddj1List;
|
||||||
break;
|
break;
|
||||||
case 2:
|
// case 2:
|
||||||
PlcDdj2Read plcDdj2Read = new PlcDdj2Read(msgDdj, new PlcConnectInfo(msgDdj.getIp(), Convert.toInt(msgDdj.getPort())));
|
// PlcDdj2Read plcDdj2Read = new PlcDdj2Read(msgDdj, new PlcConnectInfo(msgDdj.getIp(), Convert.toInt(msgDdj.getPort())));
|
||||||
Thread plcDdj2ReadThread = new Thread(plcDdj2Read);
|
// Thread plcDdj2ReadThread = new Thread(plcDdj2Read);
|
||||||
plcDdj2ReadCustomThread = new CustomThread<PlcDdj2Read>(plcDdj2ReadThread, plcDdj2Read);
|
// plcDdj2ReadCustomThread = new CustomThread<PlcDdj2Read>(plcDdj2ReadThread, plcDdj2Read);
|
||||||
ddj2List.put("ddj2", msgDdj);
|
// ddj2List.put("ddj2", msgDdj);
|
||||||
PlcDdj2Read.deviceDdjMap = ddj2List;
|
// PlcDdj2Read.deviceDdjMap = ddj2List;
|
||||||
break;
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,7 +128,7 @@ public class ScheduleThread {
|
|||||||
public void startAllThread() {
|
public void startAllThread() {
|
||||||
plcSsjReadCustomThread.getThread().start();
|
plcSsjReadCustomThread.getThread().start();
|
||||||
plcDdj1ReadCustomThread.getThread().start();
|
plcDdj1ReadCustomThread.getThread().start();
|
||||||
plcDdj2ReadCustomThread.getThread().start();
|
// plcDdj2ReadCustomThread.getThread().start();
|
||||||
isRun = true;
|
isRun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,12 +137,8 @@ public class ScheduleThread {
|
|||||||
*/
|
*/
|
||||||
public void startAllThread2() {
|
public void startAllThread2() {
|
||||||
monitoringCustomThread.thread.start();
|
monitoringCustomThread.thread.start();
|
||||||
floor1BothWayInSsjCustomThread.thread.start();
|
portConvCustomThread.thread.start();
|
||||||
floor1BothWayOutSsjCustomThread.thread.start();
|
roadConvCustomThread.thread.start();
|
||||||
floor1SingleSsjCustomThread.thread.start();
|
|
||||||
floor2InSsjCustomThread.thread.start();
|
|
||||||
lineSsjCustomThread.thread.start();
|
|
||||||
floor2OutSsjCustomThread.thread.start();
|
|
||||||
ddj1CustomThread.thread.start();
|
ddj1CustomThread.thread.start();
|
||||||
isRun2 = true;
|
isRun2 = true;
|
||||||
}
|
}
|
||||||
@@ -173,7 +149,7 @@ public class ScheduleThread {
|
|||||||
public void stopAllThread() {
|
public void stopAllThread() {
|
||||||
plcSsjReadCustomThread.runnable.isRun = false;
|
plcSsjReadCustomThread.runnable.isRun = false;
|
||||||
plcDdj1ReadCustomThread.runnable.isRun = false;
|
plcDdj1ReadCustomThread.runnable.isRun = false;
|
||||||
plcDdj2ReadCustomThread.runnable.isRun = false;
|
// plcDdj2ReadCustomThread.runnable.isRun = false;
|
||||||
plcReadInit();
|
plcReadInit();
|
||||||
isRun = false;
|
isRun = false;
|
||||||
}
|
}
|
||||||
@@ -183,12 +159,9 @@ public class ScheduleThread {
|
|||||||
*/
|
*/
|
||||||
public void stopAllThread2() {
|
public void stopAllThread2() {
|
||||||
monitoringCustomThread.runnable.isRun = false;
|
monitoringCustomThread.runnable.isRun = false;
|
||||||
floor1BothWayInSsjCustomThread.runnable.isRun = false;
|
portConvCustomThread.runnable.isRun = false;
|
||||||
floor1BothWayOutSsjCustomThread.runnable.isRun = false;
|
roadConvCustomThread.runnable.isRun = false;
|
||||||
floor1SingleSsjCustomThread.runnable.isRun = false;
|
|
||||||
floor2InSsjCustomThread.runnable.isRun = false;
|
|
||||||
lineSsjCustomThread.runnable.isRun = false;
|
|
||||||
floor2OutSsjCustomThread.runnable.isRun = false;
|
|
||||||
ddj1CustomThread.runnable.isRun = false;
|
ddj1CustomThread.runnable.isRun = false;
|
||||||
scheduleInit();
|
scheduleInit();
|
||||||
isRun2 = false;
|
isRun2 = false;
|
||||||
@@ -219,11 +192,11 @@ public class ScheduleThread {
|
|||||||
|
|
||||||
// String code = sendWeight("192.168.56.33", 2002);
|
// String code = sendWeight("192.168.56.33", 2002);
|
||||||
// System.err.println(code);
|
// System.err.println(code);
|
||||||
String pp = "MODEL:EX-1203 COLOR:9005 SERIAL:QT25C1879 V:220 Hz:50 PH:1 N.W.:207kg G.W.:238kg @:9781C52TQ$S0T0T0T3T0U7T0$7005280MA0A@";
|
// String pp = "MODEL:EX-1203 COLOR:9005 SERIAL:QT25C1879 V:220 Hz:50 PH:1 N.W.:207kg G.W.:238kg @:9781C52TQ$S0T0T0T3T0U7T0$7005280MA0A@";
|
||||||
String ss = "MODEL:TR-360 COLOR:7016 SERIAL:QT25C1899 V:380 Hz:50 PH:3 N.W.:231kg G.W.:261kg @:9981C52TQ$S0T0U5RDS2S3S6T0T3T0U7T0$4105230IF0A@";
|
// String ss = "MODEL:TR-360 COLOR:7016 SERIAL:QT25C1899 V:380 Hz:50 PH:3 N.W.:231kg G.W.:261kg @:9981C52TQ$S0T0U5RDS2S3S6T0T3T0U7T0$4105230IF0A@";
|
||||||
System.err.println(pp);
|
// System.err.println(pp);
|
||||||
System.err.println(pp.length());
|
// System.err.println(pp.length());
|
||||||
System.err.println(ss.length());
|
// System.err.println(ss.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String sendWeight(String ip, int por) {
|
public static String sendWeight(String ip, int por) {
|
||||||
|
|||||||
@@ -53,16 +53,10 @@ public class PlcSsjRead implements Runnable {
|
|||||||
DeviceSsj ssjDevice = deviceSsjMap.get(ssjCode);
|
DeviceSsj ssjDevice = deviceSsjMap.get(ssjCode);
|
||||||
switch (ssjDevice.getType()) {
|
switch (ssjDevice.getType()) {
|
||||||
case "1":
|
case "1":
|
||||||
readPlcSmSsj(ssjDevice);
|
readPlcInOutSsj(ssjDevice);//出入口输送机
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
readPlcInOutSsj(ssjDevice);
|
readPlcRoadWaySsj(ssjDevice);//巷道输送机
|
||||||
break;
|
|
||||||
case "3":
|
|
||||||
readPlcOtherSsj(ssjDevice);
|
|
||||||
break;
|
|
||||||
case "4":
|
|
||||||
readPlcRoadWaySsj(ssjDevice);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,6 +75,7 @@ public class PlcSsjRead implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他输送机
|
* 其他输送机
|
||||||
*
|
*
|
||||||
@@ -97,22 +92,6 @@ public class PlcSsjRead implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 巷道输送机
|
|
||||||
*
|
|
||||||
* @param ssjDevice
|
|
||||||
*/
|
|
||||||
private void readPlcRoadWaySsj(DeviceSsj ssjDevice) {
|
|
||||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("10"));
|
|
||||||
String ddsx1 = "0";
|
|
||||||
if (read2.IsSuccess) {
|
|
||||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
|
||||||
ssjDevice.setDw(ParseUtil.optInt(0, ddsx1));
|
|
||||||
ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
|
||||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
|
||||||
ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入出库输送机
|
* 入出库输送机
|
||||||
@@ -134,13 +113,14 @@ public class PlcSsjRead implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产线输送机
|
* 巷道输送机
|
||||||
*
|
*
|
||||||
* @param ssjDevice
|
* @param ssjDevice
|
||||||
*/
|
*/
|
||||||
private void readPlcSmSsj(DeviceSsj ssjDevice) {
|
private void readPlcRoadWaySsj(DeviceSsj ssjDevice) {
|
||||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("30"));
|
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("10"));
|
||||||
String ddsx1 = "0";
|
String ddsx1 = "0";
|
||||||
if (read2.IsSuccess) {
|
if (read2.IsSuccess) {
|
||||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||||
@@ -148,76 +128,82 @@ public class PlcSsjRead implements Runnable {
|
|||||||
ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
||||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||||
ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1));
|
ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1));
|
||||||
ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
|
||||||
ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1));
|
|
||||||
ssjDevice.setInOrOut(ParseUtil.optInt(24, ddsx1));
|
|
||||||
ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
|
|
||||||
|
|
||||||
String trayCodeReadAddress="";
|
|
||||||
String allot="";
|
|
||||||
switch (ssjDevice.getDeviceCode()){
|
|
||||||
case "G1005":
|
|
||||||
trayCodeReadAddress = "DB503.0";
|
|
||||||
allot = "DB802.24";
|
|
||||||
break;
|
|
||||||
case "L2004":
|
|
||||||
trayCodeReadAddress = "DB503.600";
|
|
||||||
break;
|
|
||||||
case "L2006":
|
|
||||||
trayCodeReadAddress = "DB503.800";
|
|
||||||
break;
|
|
||||||
case "L1001":
|
|
||||||
trayCodeReadAddress = "DB503.200";
|
|
||||||
allot = "DB802.0";
|
|
||||||
break;
|
|
||||||
case "L1003":
|
|
||||||
trayCodeReadAddress = "DB503.400";
|
|
||||||
allot = "DB802.12";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!"".equals(allot)){
|
|
||||||
OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(allot, Short.parseShort("2"));
|
|
||||||
if (agvSsj.IsSuccess){
|
|
||||||
//去除bytes中
|
|
||||||
ddsx1 = SoftBasic.ByteToHexString(agvSsj.Content);
|
|
||||||
ssjDevice.setAllowPut(ParseUtil.optInt(0, ddsx1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!"".equals(trayCodeReadAddress)){
|
|
||||||
OperateResultExOne<byte[]> trayCodeRead = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("200"));
|
|
||||||
if (trayCodeRead.IsSuccess){
|
|
||||||
byte[] content = trayCodeRead.Content;
|
|
||||||
//去除bytes中
|
|
||||||
ssjDevice.setTrayCode(ParseUtil.filterAndConvert(trayCodeRead.Content));
|
|
||||||
// if("L2004".equals(ssjDevice.getDeviceCode())){
|
|
||||||
// ssjDevice.setTrayCode("gMODEL:1 COLOR:1 SERIAL:2 V:1 Hz:1 PH:1 N.W.:1 G.W.:1 ITEM_CODE:12345 @:1$S0T0S1T0S1T0S1T0$40001015202@");
|
|
||||||
// }else{
|
|
||||||
// ssjDevice.setTrayCode("gMODEL:1 COLOR:1 SERIAL:1 V:1 Hz:1 PH:1 N.W.:1 G.W.:1 ITEM_CODE:123456 @:1$S0T0S1T0S1T0S1T0$40001015202@");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
OperateResultExOne<byte[]> agvSsjTask = readWriteNet.Read("DB501.280", Short.parseShort("16"));
|
|
||||||
String ddsx2 = "0";
|
|
||||||
if (agvSsjTask.IsSuccess) {
|
|
||||||
ddsx2 = SoftBasic.ByteToHexString(agvSsjTask.Content);
|
|
||||||
if("L1001".equals(ssjDevice.getDeviceCode())){
|
|
||||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(0, ddsx2));
|
|
||||||
}
|
|
||||||
if("L1003".equals(ssjDevice.getDeviceCode())){
|
|
||||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(4, ddsx2));
|
|
||||||
}
|
|
||||||
if("L2004".equals(ssjDevice.getDeviceCode())){
|
|
||||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(8, ddsx2));
|
|
||||||
}
|
|
||||||
if("L2006".equals(ssjDevice.getDeviceCode())){
|
|
||||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(12, ddsx2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产线输送机
|
||||||
|
*
|
||||||
|
* @param ssjDevice
|
||||||
|
*/
|
||||||
|
// private void readPlcSmSsj(DeviceSsj ssjDevice) {
|
||||||
|
// OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("30"));
|
||||||
|
// String ddsx1 = "0";
|
||||||
|
// if (read2.IsSuccess) {
|
||||||
|
// ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||||
|
// ssjDevice.setDw(ParseUtil.optInt(0, ddsx1));
|
||||||
|
// ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
||||||
|
// ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||||
|
// ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1));
|
||||||
|
// ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
||||||
|
// ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1));
|
||||||
|
// ssjDevice.setInOrOut(ParseUtil.optInt(24, ddsx1));
|
||||||
|
// ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
|
||||||
|
//
|
||||||
|
// String trayCodeReadAddress="";
|
||||||
|
// String allot="";
|
||||||
|
// switch (ssjDevice.getDeviceCode()){
|
||||||
|
// case "G1005":
|
||||||
|
// trayCodeReadAddress = "DB503.0";
|
||||||
|
// allot = "DB802.24";
|
||||||
|
// break;
|
||||||
|
// case "L2004":
|
||||||
|
// trayCodeReadAddress = "DB503.600";
|
||||||
|
// break;
|
||||||
|
// case "L2006":
|
||||||
|
// trayCodeReadAddress = "DB503.800";
|
||||||
|
// break;
|
||||||
|
// case "L1001":
|
||||||
|
// trayCodeReadAddress = "DB503.200";
|
||||||
|
// allot = "DB802.0";
|
||||||
|
// break;
|
||||||
|
// case "L1003":
|
||||||
|
// trayCodeReadAddress = "DB503.400";
|
||||||
|
// allot = "DB802.12";
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(!"".equals(allot)){
|
||||||
|
// OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(allot, Short.parseShort("2"));
|
||||||
|
// if (agvSsj.IsSuccess){
|
||||||
|
// //去除bytes中
|
||||||
|
// ddsx1 = SoftBasic.ByteToHexString(agvSsj.Content);
|
||||||
|
// ssjDevice.setAllowPut(ParseUtil.optInt(0, ddsx1));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// OperateResultExOne<byte[]> agvSsjTask = readWriteNet.Read("DB501.280", Short.parseShort("16"));
|
||||||
|
// String ddsx2 = "0";
|
||||||
|
// if (agvSsjTask.IsSuccess) {
|
||||||
|
// ddsx2 = SoftBasic.ByteToHexString(agvSsjTask.Content);
|
||||||
|
// if("L1001".equals(ssjDevice.getDeviceCode())){
|
||||||
|
// ssjDevice.setTaskNo2(ParseUtil.optDInt(0, ddsx2));
|
||||||
|
// }
|
||||||
|
// if("L1003".equals(ssjDevice.getDeviceCode())){
|
||||||
|
// ssjDevice.setTaskNo2(ParseUtil.optDInt(4, ddsx2));
|
||||||
|
// }
|
||||||
|
// if("L2004".equals(ssjDevice.getDeviceCode())){
|
||||||
|
// ssjDevice.setTaskNo2(ParseUtil.optDInt(8, ddsx2));
|
||||||
|
// }
|
||||||
|
// if("L2006".equals(ssjDevice.getDeviceCode())){
|
||||||
|
// ssjDevice.setTaskNo2(ParseUtil.optDInt(12, ddsx2));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConnectServer() {
|
void ConnectServer() {
|
||||||
siemensS7Net = new SiemensS7Net(SiemensPLCS.S1500);
|
siemensS7Net = new SiemensS7Net(SiemensPLCS.S1500);
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
package com.ruoyi.schedule.scheduleTask.ddj;
|
package com.ruoyi.schedule.scheduleTask.ddj;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||||
|
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionRequest;
|
||||||
import com.ruoyi.api.service.IApiService;
|
import com.ruoyi.api.service.IApiService;
|
||||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||||
|
import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
||||||
import com.ruoyi.job.domain.MydoJob;
|
import com.ruoyi.job.domain.MydoJob;
|
||||||
import com.ruoyi.job.service.IMydoJobService;
|
import com.ruoyi.job.service.IMydoJobService;
|
||||||
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
|
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
|
||||||
@@ -25,6 +28,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ruoyi.common.TaskExceptionType.TASK_EXCEPTION_STOCKIN_OCCUPIED;
|
||||||
|
import static com.ruoyi.common.TaskExceptionType.TASK_EXCEPTION_STOCKOUT_EMPTY;
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DdjThread implements Runnable {
|
public class DdjThread implements Runnable {
|
||||||
@@ -37,6 +43,7 @@ public class DdjThread implements Runnable {
|
|||||||
private IMydoJobService mydoJobService;
|
private IMydoJobService mydoJobService;
|
||||||
private IBasCargoSpaceService basCargoSpaceService;
|
private IBasCargoSpaceService basCargoSpaceService;
|
||||||
|
|
||||||
|
|
||||||
public boolean isRun = true;
|
public boolean isRun = true;
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +52,7 @@ public class DdjThread implements Runnable {
|
|||||||
ddjCodeList = new HashMap<>();
|
ddjCodeList = new HashMap<>();
|
||||||
ArrayList<String> ddjCodes = new ArrayList<>();
|
ArrayList<String> ddjCodes = new ArrayList<>();
|
||||||
ddjCodes.add("ddj1");
|
ddjCodes.add("ddj1");
|
||||||
ddjCodes.add("ddj2");
|
// ddjCodes.add("ddj2");
|
||||||
ddjCodeList.put("ddj", ddjCodes);
|
ddjCodeList.put("ddj", ddjCodes);
|
||||||
|
|
||||||
apiService = SpringUtils.getBean(IApiService.class);
|
apiService = SpringUtils.getBean(IApiService.class);
|
||||||
@@ -69,9 +76,9 @@ public class DdjThread implements Runnable {
|
|||||||
ddjTask(PlcDdj1Read.deviceDdjMap.get(ddjCode));
|
ddjTask(PlcDdj1Read.deviceDdjMap.get(ddjCode));
|
||||||
}
|
}
|
||||||
//PlcDdj2Read.deviceDdjMap.containsKey(ddjCode)
|
//PlcDdj2Read.deviceDdjMap.containsKey(ddjCode)
|
||||||
if ("ddj2".equals(ddjCode)) {
|
// if ("ddj2".equals(ddjCode)) {
|
||||||
ddjTask(PlcDdj2Read.deviceDdjMap.get(ddjCode));
|
// ddjTask(PlcDdj2Read.deviceDdjMap.get(ddjCode));
|
||||||
}
|
// }
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@@ -89,16 +96,21 @@ public class DdjThread implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ddjTask(MsgDdj ddj) {
|
private void ddjTask(MsgDdj ddj) {
|
||||||
/*
|
/* --------------------------------------【1 处理已经完成的作业】--------------------------------------
|
||||||
第一部分
|
|
||||||
堆垛机线程进来后第一件事先进行堆垛机正执行任务的账务处理
|
堆垛机线程进来后第一件事先进行堆垛机正执行任务的账务处理
|
||||||
以防存在漏处理,没处理的情况发生
|
以防存在漏处理,没处理的情况发生
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// 检查当前堆垛机参数 - 是否有执行中的作业
|
||||||
|
// 1.联机自动【5】 2.设备状态【0】 3.执行阶段【0】【5】(无执行中的任务)
|
||||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 0 && (ddj.getJdbz() == 5 || ddj.getJdbz() == 0)) {
|
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 0 && (ddj.getJdbz() == 5 || ddj.getJdbz() == 0)) {
|
||||||
Long rwh = ddj.getRwh();
|
Long rwh = ddj.getRwh();
|
||||||
|
|
||||||
//完成作业
|
//完成作业
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||||
|
|
||||||
|
//满足上述条件,表示该任务已完成-执行任务回传
|
||||||
if (mydoJob != null && ddjDeviceExecutionQueue != null) {
|
if (mydoJob != null && ddjDeviceExecutionQueue != null) {
|
||||||
//回传完成信号
|
//回传完成信号
|
||||||
ddjTaskFinish(rwh, ddj.getId());
|
ddjTaskFinish(rwh, ddj.getId());
|
||||||
@@ -106,10 +118,9 @@ public class DdjThread implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
//-------------------------------------- 【2 更新执行阶段】 --------------------------------------
|
||||||
第二部分
|
|
||||||
跟踪队列执行阶段
|
// 1.联机自动【5】 2.设备状态 - 运行中【1】 3.执行阶段【2】
|
||||||
*/
|
|
||||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1 && ddj.getJdbz() == 2) {
|
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1 && ddj.getJdbz() == 2) {
|
||||||
//根据堆垛机上任务号,修改任务执行阶段
|
//根据堆垛机上任务号,修改任务执行阶段
|
||||||
Long rwh = ddj.getRwh();
|
Long rwh = ddj.getRwh();
|
||||||
@@ -122,23 +133,37 @@ public class DdjThread implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* -------------------------------------- 【3 放货有货,重新分配货位】-------------------------------------- */
|
||||||
第三部分
|
|
||||||
放货有货,重新分配货位
|
// 1.联机自动【5】 2.设备状态-放货有货【1052】 3.执行阶段【0】【5】(无执行中的任务)
|
||||||
*/
|
|
||||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1052 && ddj.getJdbz() < 5 && ddj.getYxxf() == 1) {
|
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1052 && ddj.getJdbz() < 5 && ddj.getYxxf() == 1) {
|
||||||
//判断堆垛机上任务是否已重分,若未重分,则调用接口,请求重分货位
|
|
||||||
|
// 判断堆垛机上任务是否已重分,若未重分,则调用接口,请求重分货位
|
||||||
Long rwh = ddj.getRwh();
|
Long rwh = ddj.getRwh();
|
||||||
|
|
||||||
|
//获取堆垛机正在执行中的任务和队列
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||||
|
|
||||||
|
//更新异常类型【FaultFlag】-1
|
||||||
if ("0".equals(mydoJob.getFaultFlag()) && "1".equals(ddjDeviceExecutionQueue.getSpare1())) {
|
if ("0".equals(mydoJob.getFaultFlag()) && "1".equals(ddjDeviceExecutionQueue.getSpare1())) {
|
||||||
mydoJob.setStatus("1");
|
mydoJob.setStatus("1");
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
AjaxResult ajaxResult = apiService.reAssign(new JobParam(mydoJob.getJobId(), mydoJob.getTrayCode(), mydoJob.getTaskNo()));
|
|
||||||
|
//向wms请求重分接口
|
||||||
|
// todo-在此商定每种异常类型对应的值
|
||||||
|
AjaxResult ajaxResult = apiService.reAssign(new TaskExceptionRequest(mydoJob.getTaskNo(),TASK_EXCEPTION_STOCKIN_OCCUPIED));
|
||||||
if (ajaxResult.isSuccess()){
|
if (ajaxResult.isSuccess()){
|
||||||
|
//获取返回的新货位
|
||||||
|
MydoJob mydoJobReAssign = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||||
|
|
||||||
|
//更新任务参数
|
||||||
mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||||
|
mydoJob.setCargoSpaceId(mydoJobReAssign.getCargoSpaceId());
|
||||||
mydoJob.setFaultFlag("2");
|
mydoJob.setFaultFlag("2");
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
|
|
||||||
|
//获取重分的货位重新向堆垛机下发任务
|
||||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||||
ddjDeviceExecutionQueue.setMbph(basCargoSpace.getThePlatoon());
|
ddjDeviceExecutionQueue.setMbph(basCargoSpace.getThePlatoon());
|
||||||
ddjDeviceExecutionQueue.setMblh(basCargoSpace.getTheColumn());
|
ddjDeviceExecutionQueue.setMblh(basCargoSpace.getTheColumn());
|
||||||
@@ -149,18 +174,21 @@ public class DdjThread implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
第四部分
|
// -------------------------------------- 4 取货无货,作废当前任务,重新分配单据 --------------------------------------
|
||||||
取货无货,重新分配单据
|
|
||||||
*/
|
// 1.联机自动【5】 2.设备状态-取货无货【1053】 3.执行阶段【<5】(任务执行中)
|
||||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1053 && ddj.getJdbz() < 5) {
|
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1053 && ddj.getJdbz() < 5) {
|
||||||
Long rwh = ddj.getRwh();
|
Long rwh = ddj.getRwh();
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||||
|
|
||||||
//无货异常处理
|
//无货异常处理
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||||
|
|
||||||
//找到对应任务 调用api接口 取货无货,重新分配单据
|
//找到对应任务 调用api接口 取货无货,重新分配单据
|
||||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) {
|
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) {
|
||||||
AjaxResult ajaxResult = apiService.reMaterial(new JobParam(mydoJob.getJobId(), mydoJob.getTrayCode(), mydoJob.getTaskNo()));
|
//向wms返回异常信息
|
||||||
|
AjaxResult ajaxResult = apiService.reMaterial(new TaskExceptionRequest(mydoJob.getTaskNo(),TASK_EXCEPTION_STOCKOUT_EMPTY));
|
||||||
if (ajaxResult.isSuccess()) {
|
if (ajaxResult.isSuccess()) {
|
||||||
//作废作业
|
//作废作业
|
||||||
InvalidMydoJob(rwh, ddj.getId());
|
InvalidMydoJob(rwh, ddj.getId());
|
||||||
@@ -168,18 +196,22 @@ public class DdjThread implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// -------------------------------------- 5 下发堆垛机任务 --------------------------------------
|
||||||
第五部分
|
|
||||||
堆垛机任务下发
|
//重分货位后重下
|
||||||
*/
|
|
||||||
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5 && ddj.getSbzt() == 1052) {
|
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5 && ddj.getSbzt() == 1052) {
|
||||||
Long rwh = ddj.getRwh();
|
Long rwh = ddj.getRwh();
|
||||||
//查询作业
|
|
||||||
|
//查询执行中的作业
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||||
|
|
||||||
|
//该任务存在且【FaultFlag】为 2-已重分完成
|
||||||
if (ObjUtil.isNotNull(mydoJob) && "2".equals(mydoJob.getFaultFlag())) {
|
if (ObjUtil.isNotNull(mydoJob) && "2".equals(mydoJob.getFaultFlag())) {
|
||||||
|
|
||||||
//判断任务是否重分完成
|
//判断任务是否重分完成
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue) && "0".equals(ddjDeviceExecutionQueue.getDdjxf())) {
|
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue) && "0".equals(ddjDeviceExecutionQueue.getDdjxf())) {
|
||||||
|
|
||||||
//重新下发堆垛机任务
|
//重新下发堆垛机任务
|
||||||
int i = issuedDDJTask(ddj.getId(), ddjDeviceExecutionQueue);
|
int i = issuedDDJTask(ddj.getId(), ddjDeviceExecutionQueue);
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
@@ -196,8 +228,14 @@ public class DdjThread implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//正常下发
|
//正常下发
|
||||||
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5 && ddj.getSbzt() == 0 ) {
|
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5 && ddj.getSbzt() == 0 ) {
|
||||||
|
|
||||||
|
//todo 输送机入出库模式限制任务下发
|
||||||
|
|
||||||
|
|
||||||
|
//检查是否有正在执行的堆垛机队列
|
||||||
Long rwh = ddj.getRwh();
|
Long rwh = ddj.getRwh();
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueueRunningParam = new DdjDeviceExecutionQueue();
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueueRunningParam = new DdjDeviceExecutionQueue();
|
||||||
ddjDeviceExecutionQueueRunningParam.setDdjxf("1");
|
ddjDeviceExecutionQueueRunningParam.setDdjxf("1");
|
||||||
@@ -214,6 +252,7 @@ public class DdjThread implements Runnable {
|
|||||||
ddjDeviceExecutionQueueParam.setDdjxf("0");
|
ddjDeviceExecutionQueueParam.setDdjxf("0");
|
||||||
ddjDeviceExecutionQueueParam.setDevId(ddj.getId());
|
ddjDeviceExecutionQueueParam.setDevId(ddj.getId());
|
||||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueueParam);
|
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueueParam);
|
||||||
|
|
||||||
//取堆垛机队列中,生成时间最早的执行队列下发
|
//取堆垛机队列中,生成时间最早的执行队列下发
|
||||||
if (CollUtil.isNotEmpty(ddjDeviceExecutionQueues)) {
|
if (CollUtil.isNotEmpty(ddjDeviceExecutionQueues)) {
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueues.get(0);
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueues.get(0);
|
||||||
@@ -279,4 +318,6 @@ public class DdjThread implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,46 +87,46 @@ public class MonitoringThread implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String ddjCode : PlcDdj2Read.deviceDdjMap.keySet()) {
|
// for (String ddjCode : PlcDdj2Read.deviceDdjMap.keySet()) {
|
||||||
MsgDdj msgDdj = PlcDdj2Read.deviceDdjMap.get(ddjCode);
|
// MsgDdj msgDdj = PlcDdj2Read.deviceDdjMap.get(ddjCode);
|
||||||
msgDdjService.updateMsgDdj(msgDdj);
|
// msgDdjService.updateMsgDdj(msgDdj);
|
||||||
|
//
|
||||||
if (msgDdj.getSbzt() > 1000) {
|
// if (msgDdj.getSbzt() > 1000) {
|
||||||
BasFaultRecord param = new BasFaultRecord();
|
// BasFaultRecord param = new BasFaultRecord();
|
||||||
param.setTaskNo(msgDdj.getRwh() + "");
|
// param.setTaskNo(msgDdj.getRwh() + "");
|
||||||
param.setDeviceId(String.valueOf(msgDdj.getId()));
|
// param.setDeviceId(String.valueOf(msgDdj.getId()));
|
||||||
param.setDeviceType("DDJ");
|
// param.setDeviceType("DDJ");
|
||||||
param.setFault(msgDdj.getSbzt() + "");
|
// param.setFault(msgDdj.getSbzt() + "");
|
||||||
param.setJobId("0");
|
// param.setJobId("0");
|
||||||
List<BasFaultRecord> basFaultRecords = basFaultRecordService.selectBasFaultRecordList(param);
|
// List<BasFaultRecord> basFaultRecords = basFaultRecordService.selectBasFaultRecordList(param);
|
||||||
if (CollUtil.isEmpty(basFaultRecords)) {
|
// if (CollUtil.isEmpty(basFaultRecords)) {
|
||||||
BasFaultRecord faultRecord = new BasFaultRecord();
|
// BasFaultRecord faultRecord = new BasFaultRecord();
|
||||||
faultRecord.setId(IdUtil.fastSimpleUUID());
|
// faultRecord.setId(IdUtil.fastSimpleUUID());
|
||||||
faultRecord.setDeviceId(String.valueOf(msgDdj.getId()));
|
// faultRecord.setDeviceId(String.valueOf(msgDdj.getId()));
|
||||||
faultRecord.setDeviceName(msgDdj.getName());
|
// faultRecord.setDeviceName(msgDdj.getName());
|
||||||
faultRecord.setDeviceType("DDJ");
|
// faultRecord.setDeviceType("DDJ");
|
||||||
faultRecord.setJobId("0");
|
// faultRecord.setJobId("0");
|
||||||
faultRecord.setTaskNo(msgDdj.getRwh() + "");
|
// faultRecord.setTaskNo(msgDdj.getRwh() + "");
|
||||||
faultRecord.setFault(msgDdj.getSbzt() + "");
|
// faultRecord.setFault(msgDdj.getSbzt() + "");
|
||||||
faultRecord.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
// faultRecord.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||||
//faultRecord.setWarehouseId(mydoJob.getWarehouseId());
|
// //faultRecord.setWarehouseId(mydoJob.getWarehouseId());
|
||||||
basFaultRecordService.insertBasFaultRecord(faultRecord);
|
// basFaultRecordService.insertBasFaultRecord(faultRecord);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (msgDdj.getSbzt() < 1000 && msgDdj.getCzfs() == 5){
|
// if (msgDdj.getSbzt() < 1000 && msgDdj.getCzfs() == 5){
|
||||||
BasFaultRecord param = new BasFaultRecord();
|
// BasFaultRecord param = new BasFaultRecord();
|
||||||
param.setDeviceId(String.valueOf(msgDdj.getId()));
|
// param.setDeviceId(String.valueOf(msgDdj.getId()));
|
||||||
param.setDeviceType("DDJ");
|
// param.setDeviceType("DDJ");
|
||||||
param.setJobId("0");
|
// param.setJobId("0");
|
||||||
List<BasFaultRecord> basFaultRecords = basFaultRecordService.selectBasFaultRecordList(param);
|
// List<BasFaultRecord> basFaultRecords = basFaultRecordService.selectBasFaultRecordList(param);
|
||||||
if (CollUtil.isNotEmpty(basFaultRecords)) {
|
// if (CollUtil.isNotEmpty(basFaultRecords)) {
|
||||||
BasFaultRecord faultRecord = basFaultRecords.get(0);
|
// BasFaultRecord faultRecord = basFaultRecords.get(0);
|
||||||
faultRecord.setJobId("1");
|
// faultRecord.setJobId("1");
|
||||||
faultRecord.setFinishTime(DateUtil.formatDateTime(DateUtil.date()));
|
// faultRecord.setFinishTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||||
basFaultRecordService.updateBasFaultRecord(faultRecord);
|
// basFaultRecordService.updateBasFaultRecord(faultRecord);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|||||||
@@ -1,21 +1,17 @@
|
|||||||
package com.ruoyi.schedule.scheduleTask.ssj.floor2;
|
package com.ruoyi.schedule.scheduleTask.ssj;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.ruoyi.api.service.IApiService;
|
import com.ruoyi.api.service.IApiService;
|
||||||
import com.ruoyi.bas.port.domain.WcsPort;
|
|
||||||
import com.ruoyi.bas.port.service.IWcsPortService;
|
import com.ruoyi.bas.port.service.IWcsPortService;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.domain.SendData;
|
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||||
import com.ruoyi.job.domain.MydoJob;
|
import com.ruoyi.job.domain.MydoJob;
|
||||||
import com.ruoyi.job.service.IMydoJobService;
|
import com.ruoyi.job.service.IMydoJobService;
|
||||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
|
||||||
import com.ruoyi.schedule.plcRead.util.Tools;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -31,7 +27,7 @@ import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.*;
|
|||||||
* 生产线线程 检测到位+托盘条码+托盘大小 请求wms生成入库作业 。 循环作业表,检测有没有出库作业 ,生成agv搬运作业。
|
* 生产线线程 检测到位+托盘条码+托盘大小 请求wms生成入库作业 。 循环作业表,检测有没有出库作业 ,生成agv搬运作业。
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class LineSsjThread implements Runnable {
|
public class LineConvThread implements Runnable {
|
||||||
public HashMap<String, List<String>> ssjCodeList;
|
public HashMap<String, List<String>> ssjCodeList;
|
||||||
|
|
||||||
private IApiService apiService;
|
private IApiService apiService;
|
||||||
@@ -0,0 +1,290 @@
|
|||||||
|
package com.ruoyi.schedule.scheduleTask.ssj;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.ruoyi.api.service.IApiService;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
|
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||||
|
import com.ruoyi.job.domain.JobCallBack;
|
||||||
|
import com.ruoyi.job.domain.MydoJob;
|
||||||
|
import com.ruoyi.job.service.IJobCallBackService;
|
||||||
|
import com.ruoyi.job.service.IMydoJobService;
|
||||||
|
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||||
|
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||||
|
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static com.ruoyi.common.TaskStatusCode.*;
|
||||||
|
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
|
||||||
|
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsjQH;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入口输送线线程
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class PortConvThread implements Runnable {
|
||||||
|
|
||||||
|
public HashMap<String, List<String>> ssjCodeList;
|
||||||
|
|
||||||
|
private IApiService apiService;
|
||||||
|
private IAgvQueueService agvQueueService;
|
||||||
|
private IMydoJobService mydoJobService;
|
||||||
|
private IJobCallBackService jobCallBackService;
|
||||||
|
|
||||||
|
public boolean isRun = true;
|
||||||
|
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
ssjCodeList = new HashMap<>();
|
||||||
|
ArrayList<String> ssjCodes = new ArrayList<>();
|
||||||
|
ssjCodes.add("G1004");
|
||||||
|
// ssjCodes.add("L1003");
|
||||||
|
ssjCodeList.put("portConv", ssjCodes);
|
||||||
|
apiService = SpringUtils.getBean(IApiService.class);
|
||||||
|
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
||||||
|
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
||||||
|
jobCallBackService = SpringUtils.getBean(IJobCallBackService.class);
|
||||||
|
log.info("初始化服务 {},{}", apiService, agvQueueService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
init();
|
||||||
|
while (isRun) {
|
||||||
|
for (String type : ssjCodeList.keySet()) {
|
||||||
|
switch (type) {
|
||||||
|
case "portConv":
|
||||||
|
//入库口
|
||||||
|
for (String ssjCode : ssjCodeList.get(type)) {
|
||||||
|
try {
|
||||||
|
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||||
|
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||||
|
// inDispatch1(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||||
|
} else {
|
||||||
|
log.error("设备不存在 ssjCode:{}", ssjCode);
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(1500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void inDispatch(DeviceSsj inSsjDevice) {
|
||||||
|
switch (inSsjDevice.getInOrOut()) {
|
||||||
|
//---------------------------入库模式---------------------------
|
||||||
|
case 1:
|
||||||
|
//---------------------------入口取输送机(叉车取放货位置)---------------------------
|
||||||
|
//【不空闲】、【输送到位】、【条码不为空】
|
||||||
|
if (inSsjDevice.getKx() != 1 && inSsjDevice.getDw() == 1 && inSsjDevice.getTrayCode() != "") {
|
||||||
|
|
||||||
|
//todo 外形校验
|
||||||
|
|
||||||
|
|
||||||
|
//todo 称重校验
|
||||||
|
|
||||||
|
|
||||||
|
//todo 条码校验 异常入库退回
|
||||||
|
|
||||||
|
|
||||||
|
//请求参数
|
||||||
|
//todo 核对请求wms接口参数数量
|
||||||
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
|
//托盘条码
|
||||||
|
paramMap.put("trayCode", inSsjDevice.getTrayCode());
|
||||||
|
int height = inSsjDevice.getHeight();
|
||||||
|
int weight = inSsjDevice.getWeight();
|
||||||
|
//重量
|
||||||
|
paramMap.put("weight", weight);
|
||||||
|
//高度
|
||||||
|
paramMap.put("height", height);
|
||||||
|
paramMap.put("errorInfo", null);
|
||||||
|
|
||||||
|
//请求生成wcs任务
|
||||||
|
AjaxResult ajaxResult = apiService.createInMydoJob(paramMap);
|
||||||
|
if (ajaxResult.isSuccess()) {
|
||||||
|
//获取wms下发的任务号和分配货位
|
||||||
|
MydoJob mydoJob = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||||
|
|
||||||
|
//todo wms分配的货位(排列层)校验
|
||||||
|
if (mydoJob.getCargoSpaceId() == null) {
|
||||||
|
log.info("【请求参数异常】分配货位:null,托盘条码:{}",inSsjDevice.getTrayCode());
|
||||||
|
return;
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
mydoJob.setStatus("1");
|
||||||
|
mydoJob.setInOrOut("1");
|
||||||
|
mydoJob.setExecutionPhase(TASK_EP_CREATE);
|
||||||
|
mydoJob.setCreateTime(new Date());
|
||||||
|
// mydoJob.setTraySize(Convert.toStr(inSsjDevice.getTraySize()));
|
||||||
|
mydoJob.setFaultFlag("0");
|
||||||
|
mydoJob.setPriority(Long.valueOf(10));
|
||||||
|
|
||||||
|
//拿到正常作业,插到wcs作业表,下发给输送机任务号,覆盖任务号
|
||||||
|
mydoJobService.insertMydoJob(mydoJob);
|
||||||
|
|
||||||
|
log.info("请求生成wcs作业成功,wms下发任务单号:{}, 任务号:{},托盘条码:{},分配货位:{}", mydoJob.getJobId(), mydoJob.getTaskNo(), mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
|
||||||
|
|
||||||
|
//向输送机下发任务号
|
||||||
|
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), Integer.parseInt(mydoJob.getTraySize()), 1);
|
||||||
|
if (i == 1) {
|
||||||
|
//写入成功则更新执行阶段
|
||||||
|
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||||
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
|
log.info("G1004入口输送机下发任务号成功:{}", mydoJob.getTaskNo());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//todo 向输送机下发退回
|
||||||
|
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 99, 1);
|
||||||
|
|
||||||
|
//todo 接口调用失败处理
|
||||||
|
log.info("【请求入库】请求生成wcs作业失败退回,请重试");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//---------------------------出库模式---------------------------
|
||||||
|
case 2:
|
||||||
|
//出库到位
|
||||||
|
if (inSsjDevice.getDw() == 1 && inSsjDevice.getTaskNo() > 0) {
|
||||||
|
//查询该出库任务
|
||||||
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(inSsjDevice.getTaskNo()));
|
||||||
|
if (mydoJob != null && Integer.parseInt(mydoJob.getInOrOut()) > 20) {
|
||||||
|
log.info("设备:{} 位置:{} 任务号:{} 出库到位", "输送线:", inSsjDevice.getDeviceCode(), mydoJob.getTaskNo());
|
||||||
|
mydoJobService.insertHistory(mydoJob.getJobId());
|
||||||
|
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
|
||||||
|
JobCallBack jobCallBack = new JobCallBack();
|
||||||
|
jobCallBack.setType("2");
|
||||||
|
jobCallBack.setMydojobId(mydoJob.getJobId());
|
||||||
|
jobCallBack.setStatus("0");
|
||||||
|
jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo()));
|
||||||
|
jobCallBack.setCreateTime(new Date());
|
||||||
|
jobCallBack.setSpare1("0");
|
||||||
|
jobCallBackService.insertJobCallBack(jobCallBack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void inDispatch1(DeviceSsj ssjDevice) {
|
||||||
|
//有入库请求就肯定是电气的任务号的作业
|
||||||
|
if(StrUtil.isNotBlank(ssjDevice.getTrayCode()) && ssjDevice.getRkqq()==1 && ssjDevice.getTaskNo()<1000){
|
||||||
|
//,如果有正执行的出库作业退回
|
||||||
|
MydoJob mydoJobParam = new MydoJob();
|
||||||
|
mydoJobParam.setInOut("2");
|
||||||
|
mydoJobParam.setStatus("3");
|
||||||
|
mydoJobParam.setExitId(ssjDevice.getDeviceCode());
|
||||||
|
List<MydoJob> outMydoJobList = mydoJobService.selectInOrOutMydoJobList(mydoJobParam);
|
||||||
|
if(!outMydoJobList.isEmpty()){
|
||||||
|
//todo 去向不明朗
|
||||||
|
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"99",2,2);
|
||||||
|
if (i == 1) {
|
||||||
|
log.info(ssjDevice.getDeviceCode()+"有正执行的出库作业退回" );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MydoJob mydoJob = new MydoJob();
|
||||||
|
mydoJob.setInOrOut("1");
|
||||||
|
// mydoJob.setStatus("1");
|
||||||
|
String trayCode = ssjDevice.getTrayCode();
|
||||||
|
//String[] split = trayCode.split("\\s+");
|
||||||
|
String serial = findFirst(PATTERNS.get("SERIAL"), trayCode);
|
||||||
|
mydoJob.setTrayCode(serial);
|
||||||
|
mydoJob.setEntranceId(ssjDevice.getDeviceCode());
|
||||||
|
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(mydoJob);
|
||||||
|
if(!mydoJobs.isEmpty()){
|
||||||
|
MydoJob mydoJob1 = mydoJobs.get(0);
|
||||||
|
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob1.getTaskNo(),1,1);
|
||||||
|
if (i == 1) {
|
||||||
|
mydoJob1.setExecutionPhase(TASK_EP_SSJ);
|
||||||
|
mydoJob1.setStatus("3");
|
||||||
|
mydoJobService.updateMydoJob(mydoJob1);
|
||||||
|
log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:{}" , mydoJob1.getTaskNo());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("trayCode",ssjDevice.getTrayCode());
|
||||||
|
map.put("entranceId",ssjDevice.getDeviceCode());
|
||||||
|
map.put("floor", "2");
|
||||||
|
AjaxResult ajaxResult = apiService.selectMydoJobByTrayCodeAndEntranceId(map);
|
||||||
|
if(ajaxResult.isSuccess()){
|
||||||
|
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||||
|
mydoJob2.setStatus("1");
|
||||||
|
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
||||||
|
mydoJob2.setCreateTime(new Date());
|
||||||
|
mydoJob2.setFaultFlag("0");
|
||||||
|
mydoJob2.setPriority(Long.valueOf(10));
|
||||||
|
mydoJobService.insertMydoJob(mydoJob2);
|
||||||
|
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||||
|
if (i == 1) {
|
||||||
|
mydoJob2.setExecutionPhase(TASK_EP_SSJ);
|
||||||
|
mydoJob2.setStatus("3");
|
||||||
|
mydoJobService.updateMydoJob(mydoJob2);
|
||||||
|
log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:{}" , mydoJob2.getTaskNo());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//todo 去向不明朗
|
||||||
|
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"99",2,2);
|
||||||
|
if (i == 1) {
|
||||||
|
log.info(ssjDevice.getDeviceCode()+"输送机没取到作业下发输送线" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<String, Pattern> PATTERNS = createPatterns();
|
||||||
|
|
||||||
|
private static Map<String, Pattern> createPatterns() {
|
||||||
|
Map<String, Pattern> map = new LinkedHashMap<>();
|
||||||
|
map.put("MODEL", Pattern.compile("MODEL:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
||||||
|
map.put("COLOR", Pattern.compile("COLOR:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
||||||
|
map.put("SERIAL", Pattern.compile("SERIAL:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
||||||
|
map.put("V", Pattern.compile("V:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
||||||
|
map.put("Hz", Pattern.compile("Hz:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
||||||
|
map.put("PH", Pattern.compile("PH:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
||||||
|
map.put("NW", Pattern.compile("N\\.W\\.:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
||||||
|
map.put("GW", Pattern.compile("G\\.W\\.:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
||||||
|
map.put("ITEM_CODE", Pattern.compile("ITEM_CODE:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
||||||
|
map.put("@", Pattern.compile("@:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String findFirst(Pattern pattern, String input) {
|
||||||
|
if (pattern == null || input == null) return null;
|
||||||
|
Matcher m = pattern.matcher(input);
|
||||||
|
return m.find() ? m.group(1) : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.schedule.scheduleTask.ssj.floor2;
|
package com.ruoyi.schedule.scheduleTask.ssj;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
@@ -11,11 +11,10 @@ import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
|||||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.job.domain.JobCallBack;
|
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||||
import com.ruoyi.job.domain.MydoJob;
|
import com.ruoyi.job.domain.MydoJob;
|
||||||
import com.ruoyi.job.service.IMydoJobService;
|
import com.ruoyi.job.service.IMydoJobService;
|
||||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
|
||||||
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
|
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
|
||||||
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueService;
|
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueService;
|
||||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||||
@@ -24,14 +23,13 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.ruoyi.common.TaskStatusCode.*;
|
import static com.ruoyi.common.TaskStatusCode.*;
|
||||||
import static com.ruoyi.common.TaskType.*;
|
import static com.ruoyi.common.TaskType.DDJ_RWLX_1;
|
||||||
import static com.ruoyi.common.TaskType.DDJ_RWLX_2;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 二楼出库线程 检测当前巷道有没有入库作业,没有作业,生成堆垛机出库队列
|
* 巷道口输送机(堆垛机取放位)线程 检测当前巷道有没有入库作业,没有作业,生成堆垛机出库队列
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class Floor2RoadWaySsjThread implements Runnable {
|
public class RoadConvThread implements Runnable {
|
||||||
|
|
||||||
public HashMap<String, List<String>> ssjCodeList;
|
public HashMap<String, List<String>> ssjCodeList;
|
||||||
private final Map<String, List<Integer>> roadwayMap = new HashMap<>();
|
private final Map<String, List<Integer>> roadwayMap = new HashMap<>();
|
||||||
@@ -46,17 +44,17 @@ public class Floor2RoadWaySsjThread implements Runnable {
|
|||||||
public void init() {
|
public void init() {
|
||||||
ssjCodeList = new HashMap<>();
|
ssjCodeList = new HashMap<>();
|
||||||
ArrayList<String> ssjCodes = new ArrayList<>();
|
ArrayList<String> ssjCodes = new ArrayList<>();
|
||||||
ssjCodes.add("L1002");
|
// ssjCodes.add("L1002");
|
||||||
ssjCodes.add("L1004");
|
ssjCodes.add("L1001");
|
||||||
ssjCodeList.put("roadwaySsj", ssjCodes);
|
ssjCodeList.put("roadConv", ssjCodes);
|
||||||
apiService = SpringUtils.getBean(IApiService.class);
|
apiService = SpringUtils.getBean(IApiService.class);
|
||||||
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
||||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
||||||
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
|
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
|
||||||
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
|
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
|
||||||
//初始化巷道口 排 列 层
|
//初始化巷道口 排 列 层
|
||||||
roadwayMap.put("L1002", Arrays.asList(2, 0, 1));
|
roadwayMap.put("L1001", Arrays.asList(2, 0, 1));
|
||||||
roadwayMap.put("L1004", Arrays.asList(4, 0, 1));
|
// roadwayMap.put("L1004", Arrays.asList(4, 0, 1));
|
||||||
log.info("初始化服务 {},{}", apiService, agvQueueService);
|
log.info("初始化服务 {},{}", apiService, agvQueueService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,9 +63,8 @@ public class Floor2RoadWaySsjThread implements Runnable {
|
|||||||
init();
|
init();
|
||||||
while (isRun){
|
while (isRun){
|
||||||
for (String type : ssjCodeList.keySet()) {
|
for (String type : ssjCodeList.keySet()) {
|
||||||
|
switch (type){
|
||||||
switch ( type){
|
case "roadConv":
|
||||||
case "roadwaySsj":
|
|
||||||
//生产线入库
|
//生产线入库
|
||||||
for (String ssjCode : ssjCodeList.get(type)) {
|
for (String ssjCode : ssjCodeList.get(type)) {
|
||||||
try {
|
try {
|
||||||
@@ -94,7 +91,7 @@ public class Floor2RoadWaySsjThread implements Runnable {
|
|||||||
|
|
||||||
|
|
||||||
public void inDispatch(DeviceSsj roadSsjDevice) {
|
public void inDispatch(DeviceSsj roadSsjDevice) {
|
||||||
//如果到位,且任务号大于0
|
//巷道口到位,且任务号大于1000
|
||||||
if (roadSsjDevice.getDw()==1 && roadSsjDevice.getTaskNo()>1000) {
|
if (roadSsjDevice.getDw()==1 && roadSsjDevice.getTaskNo()>1000) {
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(roadSsjDevice.getTaskNo()));
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(roadSsjDevice.getTaskNo()));
|
||||||
if(ObjUtil.isNotNull(mydoJob)){
|
if(ObjUtil.isNotNull(mydoJob)){
|
||||||
@@ -1,270 +0,0 @@
|
|||||||
package com.ruoyi.schedule.scheduleTask.ssj.floor1;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.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.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
|
||||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
|
||||||
import com.ruoyi.job.domain.MydoJob;
|
|
||||||
import com.ruoyi.job.service.IMydoJobService;
|
|
||||||
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
|
|
||||||
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueService;
|
|
||||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import static com.ruoyi.common.TaskStatusCode.*;
|
|
||||||
import static com.ruoyi.common.TaskType.DDJ_RWLX_3;
|
|
||||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一楼双向线体入库线程 条码+到位+无出库作业 下发去向+任务号 有出库作业就下发退回
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class Floor1BothWayInSsjThread implements Runnable {
|
|
||||||
|
|
||||||
public HashMap<String, DeviceSsj> ssjCodeList;
|
|
||||||
|
|
||||||
private IApiService apiService;
|
|
||||||
private IMydoJobService mydoJobService;
|
|
||||||
private IBasCargoSpaceService basCargoSpaceService;
|
|
||||||
private IDdjDeviceExecutionQueueService ddjDeviceExecutionQueueService;
|
|
||||||
private final Map<String, List<Integer>> roadwayMap = new HashMap<>();
|
|
||||||
private final Map<String, String> exitRoadwayMap = new HashMap<>();
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isRun = true;
|
|
||||||
|
|
||||||
|
|
||||||
public void init() {
|
|
||||||
ssjCodeList = new HashMap<>();
|
|
||||||
ssjCodeList.put("roadway1", PlcSsjRead.deviceSsjMap.get("L2003"));
|
|
||||||
ssjCodeList.put("roadway2", PlcSsjRead.deviceSsjMap.get("L2005"));
|
|
||||||
ssjCodeList.put("in1", PlcSsjRead.deviceSsjMap.get("L2004"));
|
|
||||||
ssjCodeList.put("in2", PlcSsjRead.deviceSsjMap.get("L2006"));
|
|
||||||
|
|
||||||
|
|
||||||
apiService = SpringUtils.getBean(IApiService.class);
|
|
||||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
|
||||||
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
|
|
||||||
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
|
|
||||||
|
|
||||||
|
|
||||||
//初始化巷道口 排 列 层
|
|
||||||
roadwayMap.put("L2003", Arrays.asList(2, 47, 1));
|
|
||||||
roadwayMap.put("L2005", Arrays.asList(3, 70, 1));
|
|
||||||
|
|
||||||
exitRoadwayMap.put("L2003", "L2004");
|
|
||||||
exitRoadwayMap.put("L2005", "L2006");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
init();
|
|
||||||
while (isRun) {
|
|
||||||
|
|
||||||
for (String type : ssjCodeList.keySet()) {
|
|
||||||
switch (type) {
|
|
||||||
case "roadway1":
|
|
||||||
case "roadway2":
|
|
||||||
dispatch1(ssjCodeList.get(type));
|
|
||||||
break;
|
|
||||||
case "in1":
|
|
||||||
case "in2":
|
|
||||||
dispatch2(ssjCodeList.get(type));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Thread.sleep(1500);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dispatch1(DeviceSsj ssj) {
|
|
||||||
if (ssj.getDw() == 1 && ssj.getTaskNo() > 1000) {
|
|
||||||
int taskNo = ssj.getTaskNo();
|
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(taskNo));
|
|
||||||
if(ObjUtil.isNotNull(mydoJob) && Convert.toInt(mydoJob.getInOrOut()) < 20){
|
|
||||||
if (TASK_STATUS_CREATE.equals(mydoJob.getStatus())
|
|
||||||
&& TASK_EP_SSJ.equals(mydoJob.getExecutionPhase())) {
|
|
||||||
//修改作业执行状态
|
|
||||||
mydoJob.setStatus(TASK_STATUS_RUNNING);
|
|
||||||
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
}
|
|
||||||
if(mydoJob.getCargoSpaceId() == null || "".equals(mydoJob.getCargoSpaceId())){
|
|
||||||
AjaxResult ajaxResult = apiService.requestWmsSpace(mydoJob);
|
|
||||||
if(ajaxResult.isSuccess()){
|
|
||||||
BasCargoSpace space = BeanUtil.toBean(ajaxResult.get("data"), BasCargoSpace.class);
|
|
||||||
String cargoSpaceId = space.getCargoSpaceId();
|
|
||||||
mydoJob.setCargoSpaceId(cargoSpaceId);
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mydoJob.getCargoSpaceId()!=null && !"".equals(mydoJob.getCargoSpaceId())){
|
|
||||||
if(mydoJob.getExecutionPhase().equals(TASK_EP_SSJ)){
|
|
||||||
mydoJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ);
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)){
|
|
||||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_3, Convert.toInt(mydoJob.getRoadwayId()));
|
|
||||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
|
||||||
List<Integer> pclList = roadwayMap.get(ssj.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(Convert.toInt(mydoJob.getRoadwayId()));
|
|
||||||
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);
|
|
||||||
|
|
||||||
mydoJob.setExecutionPhase(TASK_EP_DDJ);
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dispatch2(DeviceSsj ssj) {
|
|
||||||
if (ssj.getRkqq() == 1 && ssj.getTaskNo() > 0 && ssj.getTaskNo() < 1000 && StrUtil.isEmpty(ssj.getTrayCode())) {
|
|
||||||
//先检测有没有出库作业,有出库作业直接退回
|
|
||||||
MydoJob outMydoJob = mydoJobService.selectRunningMydoJobByExitList(Collections.singletonList(ssj.getDeviceCode()));
|
|
||||||
if (ObjUtil.isNotNull(outMydoJob)) {
|
|
||||||
//下发去向 和任务号
|
|
||||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", 2, 2);
|
|
||||||
if (i == 1) {
|
|
||||||
log.info("当前输送机有出库任务下发退回 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 2, ssj.getTrayCode());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (StrUtil.isNotBlank(ssj.getTrayCode())) {
|
|
||||||
MydoJob param = new MydoJob();
|
|
||||||
param.setEntranceId(ssj.getDeviceCode());
|
|
||||||
String[] split = ssj.getTrayCode().split(" ");
|
|
||||||
String serial = split[2].substring(7);
|
|
||||||
param.setTrayCode(serial);
|
|
||||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
|
||||||
MydoJob inJob = null;
|
|
||||||
if (CollUtil.isNotEmpty(mydoJobs)) {
|
|
||||||
inJob = mydoJobs.get(0);
|
|
||||||
} else {
|
|
||||||
//根据托盘码请求入库作业
|
|
||||||
HashMap<String, Object> paramMap = new HashMap<>();
|
|
||||||
paramMap.put("trayCode", ssj.getTrayCode());
|
|
||||||
paramMap.put("floor", "1");
|
|
||||||
paramMap.put("entranceId",ssj.getDeviceCode());
|
|
||||||
AjaxResult result = apiService.selectMydoJobByTrayCodeAndEntranceId(paramMap);
|
|
||||||
if (result.isSuccess()) {
|
|
||||||
inJob = BeanUtil.toBean(result.get("data"), MydoJob.class);
|
|
||||||
inJob.setStatus(TASK_STATUS_CREATE);
|
|
||||||
inJob.setExecutionPhase(TASK_EP_CREATE);
|
|
||||||
inJob.setFaultFlag("0");
|
|
||||||
inJob.setPriority(Long.valueOf(10));
|
|
||||||
mydoJobService.insertMydoJob(inJob);
|
|
||||||
log.info("托盘码请求作业成功, rwh:{},trayCode:{}", ssj.getTaskNo(), ssj.getTrayCode());
|
|
||||||
}else{
|
|
||||||
//下发去向 和任务号
|
|
||||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", 2, 2);
|
|
||||||
if (i == 1) {
|
|
||||||
log.info("托盘码请求作业失败, rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 2, ssj.getTrayCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (inJob != null) {
|
|
||||||
//下发去向 和任务号
|
|
||||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), inJob.getTaskNo(), 1, 1);
|
|
||||||
if (i == 1) {
|
|
||||||
inJob.setStatus(TASK_STATUS_RUNNING);
|
|
||||||
inJob.setExecutionPhase(TASK_EP_SSJ);
|
|
||||||
inJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
|
||||||
inJob.setTargetRoadwayId(Convert.toStr(1));
|
|
||||||
mydoJobService.updateMydoJob(inJob);
|
|
||||||
log.info("托盘码请求作业成功,下发任务号 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
//下发去向 和任务号
|
|
||||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", 2, 2);
|
|
||||||
if (i == 1) {
|
|
||||||
log.info("托盘码请求作业失败,下发回退 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 2, ssj.getTrayCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// else {
|
|
||||||
// //查询下发的任务
|
|
||||||
// MydoJob param = new MydoJob();
|
|
||||||
// ArrayList<String> epList = new ArrayList<>();
|
|
||||||
// epList.add(TASK_EP_CREATE);
|
|
||||||
// epList.add(TASK_EP_SSJ);
|
|
||||||
// param.setEpList(epList);
|
|
||||||
// param.setStatus(TASK_STATUS_CREATE);
|
|
||||||
// param.setEntranceId(ssj.getDeviceCode());
|
|
||||||
// List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
|
||||||
// if (CollUtil.isNotEmpty(mydoJobs)){
|
|
||||||
// //已请求wms,生成任务,二次下发
|
|
||||||
// MydoJob mydoJob = mydoJobs.get(0);
|
|
||||||
// int i = writeToSsj(ssj.getPlcDbWriteAddress(),mydoJob.getTaskNo(),1,1);
|
|
||||||
// if (i == 1) {
|
|
||||||
// mydoJob.setExecutionPhase(TASK_EP_SSJ);
|
|
||||||
// mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
// log.info("{}无条码请求作业,二次下发任务号{}:",ssj.getDeviceCode(),mydoJob.getTaskNo());
|
|
||||||
// }
|
|
||||||
// }else {
|
|
||||||
// //不存在扫不到托盘码的任务
|
|
||||||
// HashMap<String, Object> paramMap = new HashMap<>();
|
|
||||||
// paramMap.put("entranceId",ssj.getDeviceCode());
|
|
||||||
// AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
|
|
||||||
// if (ajaxResult.isSuccess()) {
|
|
||||||
// MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
|
||||||
// mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
|
||||||
// mydoJob2.setFaultFlag("0");
|
|
||||||
// mydoJobService.insertMydoJob(mydoJob2);
|
|
||||||
// int i = writeToSsj(ssj.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
|
||||||
// if (i == 1) {
|
|
||||||
// mydoJob2.setExecutionPhase(TASK_EP_SSJ);
|
|
||||||
// mydoJobService.updateMydoJob(mydoJob2);
|
|
||||||
// log.info("{}无条码请求作业成功,下发任务号{}:",ssj.getDeviceCode(),mydoJob2.getTaskNo());
|
|
||||||
// }
|
|
||||||
// } else if (ajaxResult.isError()) {
|
|
||||||
// //超大,给plc下发错误信息,等待人工处理
|
|
||||||
// //托盘大小对不上,给plc下发错误信息,等待人工处理
|
|
||||||
// //码不对,给plc下发错误信息,等待人工处理
|
|
||||||
// int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
|
||||||
// if (i == 1) {
|
|
||||||
// log.info("{}无条码请求作业失败,下发退回{}:",ssj.getDeviceCode(),Integer.parseInt(ajaxResult.get("code").toString()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
package com.ruoyi.schedule.scheduleTask.ssj.floor1;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
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 com.ruoyi.api.service.IApiService;
|
|
||||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
|
||||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
|
||||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
|
||||||
import com.ruoyi.job.domain.JobCallBack;
|
|
||||||
import com.ruoyi.job.domain.MydoJob;
|
|
||||||
import com.ruoyi.job.service.IJobCallBackService;
|
|
||||||
import com.ruoyi.job.service.IMydoJobService;
|
|
||||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
|
||||||
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
|
|
||||||
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueService;
|
|
||||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import static com.ruoyi.common.TaskStatusCode.*;
|
|
||||||
import static com.ruoyi.common.TaskType.DDJ_RWLX_2;
|
|
||||||
import static com.ruoyi.common.TaskType.DDJ_RWLX_3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一楼双向线体出库线程 循环盘点出库作业+巷道口空闲+出库线体全部空闲+无入库作业 生成堆垛机出库队列
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class Floor1BothWayOutSsjThread implements Runnable {
|
|
||||||
|
|
||||||
public HashMap<String, List<DeviceSsj>> ssjCodeList;
|
|
||||||
|
|
||||||
private IMydoJobService mydoJobService;
|
|
||||||
private IBasCargoSpaceService basCargoSpaceService;
|
|
||||||
private IDdjDeviceExecutionQueueService ddjDeviceExecutionQueueService;
|
|
||||||
private final Map<String, List<Integer>> roadwayMap = new HashMap<>();
|
|
||||||
private IJobCallBackService jobCallBackService;
|
|
||||||
|
|
||||||
public boolean isRun = true;
|
|
||||||
|
|
||||||
|
|
||||||
public void init() {
|
|
||||||
ssjCodeList = new HashMap<>();
|
|
||||||
ArrayList<DeviceSsj> roadway1 = new ArrayList<>();
|
|
||||||
roadway1.add(PlcSsjRead.deviceSsjMap.get("L2003"));
|
|
||||||
ssjCodeList.put("roadway1", roadway1);
|
|
||||||
ArrayList<DeviceSsj> roadway2 = new ArrayList<>();
|
|
||||||
roadway2.add(PlcSsjRead.deviceSsjMap.get("L2005"));
|
|
||||||
ssjCodeList.put("roadway2", roadway2);
|
|
||||||
|
|
||||||
ArrayList<DeviceSsj> out1 = new ArrayList<>();
|
|
||||||
out1.add(PlcSsjRead.deviceSsjMap.get("L2004"));
|
|
||||||
ssjCodeList.put("out1", out1);
|
|
||||||
ArrayList<DeviceSsj> out2 = new ArrayList<>();
|
|
||||||
out2.add(PlcSsjRead.deviceSsjMap.get("L2006"));
|
|
||||||
ssjCodeList.put("out2", out2);
|
|
||||||
|
|
||||||
ArrayList<DeviceSsj> roadway1Both = new ArrayList<>();
|
|
||||||
roadway1Both.add(PlcSsjRead.deviceSsjMap.get("L2001"));
|
|
||||||
ssjCodeList.put("roadway1Both", roadway1Both);
|
|
||||||
|
|
||||||
ArrayList<DeviceSsj> roadway2Both = new ArrayList<>();
|
|
||||||
roadway2Both.add(PlcSsjRead.deviceSsjMap.get("L2007"));
|
|
||||||
ssjCodeList.put("roadway2Both", roadway2Both);
|
|
||||||
|
|
||||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
|
||||||
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
|
|
||||||
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
|
|
||||||
jobCallBackService = SpringUtils.getBean(IJobCallBackService.class);
|
|
||||||
|
|
||||||
|
|
||||||
//初始化巷道口 排 列 层
|
|
||||||
roadwayMap.put("L2003", Arrays.asList(2, 47, 1));
|
|
||||||
roadwayMap.put("L2005", Arrays.asList(3, 70, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
init();
|
|
||||||
while (isRun) {
|
|
||||||
for (String type : ssjCodeList.keySet()) {
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case "roadway1":
|
|
||||||
dispatch(ssjCodeList.get(type));
|
|
||||||
break;
|
|
||||||
case "roadway2":
|
|
||||||
dispatch(ssjCodeList.get(type));
|
|
||||||
break;
|
|
||||||
case "out1":
|
|
||||||
dispatch1(ssjCodeList.get(type));
|
|
||||||
break;
|
|
||||||
case "out2":
|
|
||||||
dispatch1(ssjCodeList.get(type));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Thread.sleep(1500);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dispatch1(List<DeviceSsj> ssjList) {
|
|
||||||
for (DeviceSsj ssj : ssjList) {
|
|
||||||
|
|
||||||
if (ssj.getTaskNo2() > 0) {
|
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(ssj.getTaskNo2()));
|
|
||||||
if(mydoJob != null && Convert.toInt(mydoJob.getInOrOut()) > 20){
|
|
||||||
if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) {
|
|
||||||
mydoJob.setExecutionPhase(TASK_EP_SSJ);
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
}
|
|
||||||
if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_SSJ)) {
|
|
||||||
JobCallBack jobCallBack = new JobCallBack();
|
|
||||||
jobCallBack.setType("2");
|
|
||||||
jobCallBack.setMydojobId(mydoJob.getJobId());
|
|
||||||
jobCallBack.setStatus("0");
|
|
||||||
jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo()));
|
|
||||||
jobCallBack.setCreateTime(new Date());
|
|
||||||
jobCallBack.setSpare1("0");
|
|
||||||
jobCallBackService.insertJobCallBack(jobCallBack);
|
|
||||||
|
|
||||||
log.info("完成任务 taskNo{} ", mydoJob.getTaskNo());
|
|
||||||
mydoJob.setStatus(TASK_STATUS_FINISH);
|
|
||||||
mydoJob.setExecutionPhase(TASK_EP_WMS_FINISH);
|
|
||||||
mydoJob.setFinishTime(DateUtil.formatDateTime(new Date()));
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
mydoJobService.insertHistory(mydoJob.getJobId());
|
|
||||||
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出库堆垛机队列生成
|
|
||||||
*/
|
|
||||||
public void dispatch(List<DeviceSsj> ssjList) {
|
|
||||||
DeviceSsj deviceSsj = ssjList.get(0);
|
|
||||||
DeviceSsj ssj = new DeviceSsj();
|
|
||||||
DeviceSsj inOutSsj = new DeviceSsj();
|
|
||||||
String roadwayId = "";
|
|
||||||
String entrance_id = "";
|
|
||||||
if ("L2003".equals(deviceSsj.getDeviceCode())) {
|
|
||||||
roadwayId = "1";
|
|
||||||
ssj = ssjCodeList.get("roadway1Both").get(0);
|
|
||||||
entrance_id = "L2004";
|
|
||||||
inOutSsj = PlcSsjRead.deviceSsjMap.get("L2004");
|
|
||||||
|
|
||||||
}
|
|
||||||
if("L2005".equals(deviceSsj.getDeviceCode())) {
|
|
||||||
roadwayId = "2";
|
|
||||||
ssj = ssjCodeList.get("roadway2Both").get(0);
|
|
||||||
entrance_id = "L2006";
|
|
||||||
inOutSsj = PlcSsjRead.deviceSsjMap.get("L2006");
|
|
||||||
}
|
|
||||||
|
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList1("1", roadwayId);
|
|
||||||
MydoJob inJob = mydoJobService.selectMydoJobByEntranceList1(entrance_id);
|
|
||||||
// log.info("输送线"+deviceSsj.getDeviceCode()+"空闲:"+ deviceSsj.getKx()+"任务号:"+deviceSsj.getTaskNo());
|
|
||||||
// log.info("输送线"+inOutSsj.getDeviceCode()+"入出库模式:"+ inOutSsj.getInOrOut());
|
|
||||||
if (ObjUtil.isNotNull(mydoJob) && deviceSsj.getKx() == 1 && ssj.getKx() == 0
|
|
||||||
&& ObjUtil.isNull(inJob) && inOutSsj.getInOrOut() == 1 && deviceSsj.getTaskNo() == 0) {
|
|
||||||
//所有线体为空闲 并且存在出库作业 并且不存在入库作业
|
|
||||||
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(ssjList.get(0).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()));
|
|
||||||
mydoJob.setExitId(entrance_id);
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
package com.ruoyi.schedule.scheduleTask.ssj.floor1;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
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 com.ruoyi.api.service.IApiService;
|
|
||||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
|
||||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
|
||||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
|
||||||
import com.ruoyi.job.domain.JobCallBack;
|
|
||||||
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.service.IDdjDeviceExecutionQueueService;
|
|
||||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import static com.ruoyi.common.TaskStatusCode.*;
|
|
||||||
import static com.ruoyi.common.TaskType.DDJ_RWLX_2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一楼单向出库线程 循环出库作业+巷道口空闲 生成堆垛机出库队列
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class Floor1SingleSsjThread implements Runnable {
|
|
||||||
|
|
||||||
public HashMap<String, List<String>> ssjCodeList;
|
|
||||||
private IMydoJobService mydoJobService;
|
|
||||||
public boolean isRun = true;
|
|
||||||
private final Map<String, String> exitRoadwayMap = new HashMap<>();
|
|
||||||
private IDdjDeviceExecutionQueueService ddjDeviceExecutionQueueService;
|
|
||||||
private IBasCargoSpaceService basCargoSpaceService;
|
|
||||||
private final Map<String, List<Integer>> roadwayMap = new HashMap<>();
|
|
||||||
private IJobCallBackService jobCallBackService;
|
|
||||||
|
|
||||||
|
|
||||||
public void init() {
|
|
||||||
//设置要循环的输送机
|
|
||||||
ssjCodeList = new HashMap<>();
|
|
||||||
ArrayList<String> outRoadwaySsjList = new ArrayList<>();
|
|
||||||
outRoadwaySsjList.add("L2001");
|
|
||||||
outRoadwaySsjList.add("L2007");
|
|
||||||
ssjCodeList.put("outRoadwaySsj", outRoadwaySsjList);
|
|
||||||
ArrayList<String> outSsjList = new ArrayList<>();
|
|
||||||
outSsjList.add("L2002");
|
|
||||||
outSsjList.add("L2008");
|
|
||||||
ssjCodeList.put("outSsj", outSsjList);
|
|
||||||
|
|
||||||
|
|
||||||
//初始化服务
|
|
||||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
|
||||||
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
|
|
||||||
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
|
|
||||||
jobCallBackService = SpringUtils.getBean(IJobCallBackService.class);
|
|
||||||
|
|
||||||
|
|
||||||
//初始化出口和巷道口映射关系
|
|
||||||
exitRoadwayMap.put("L2001", "L2002");
|
|
||||||
exitRoadwayMap.put("L2007", "L2008");
|
|
||||||
|
|
||||||
//初始化巷道口 排 列 层
|
|
||||||
roadwayMap.put("L2001", Arrays.asList(1, 47, 1));
|
|
||||||
roadwayMap.put("L2007", Arrays.asList(4, 70, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
init();
|
|
||||||
while (isRun) {
|
|
||||||
try {
|
|
||||||
if (PlcSsjRead.deviceSsjMap.containsKey("L2001")) {
|
|
||||||
dispatch(PlcSsjRead.deviceSsjMap.get("L2001"));
|
|
||||||
} else {
|
|
||||||
log.error("设备不存在 ssjCode{}", "L2001");
|
|
||||||
}
|
|
||||||
if (PlcSsjRead.deviceSsjMap.containsKey("L2007")) {
|
|
||||||
dispatch(PlcSsjRead.deviceSsjMap.get("L2007"));
|
|
||||||
} else {
|
|
||||||
log.error("设备不存在 ssjCode{}", "L2007");
|
|
||||||
}
|
|
||||||
if (PlcSsjRead.deviceSsjMap.containsKey("L2002")) {
|
|
||||||
dispatch2(PlcSsjRead.deviceSsjMap.get("L2002"));
|
|
||||||
} else {
|
|
||||||
log.error("设备不存在 ssjCode{}", "L2002");
|
|
||||||
}
|
|
||||||
if (PlcSsjRead.deviceSsjMap.containsKey("L2008")) {
|
|
||||||
dispatch2(PlcSsjRead.deviceSsjMap.get("L2008"));
|
|
||||||
} else {
|
|
||||||
log.error("设备不存在 ssjCode{}", "L2008");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(1500);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一楼单向出库口调度
|
|
||||||
*
|
|
||||||
* @param ssj 输送机
|
|
||||||
*/
|
|
||||||
private void dispatch2(DeviceSsj ssj) {
|
|
||||||
if (ssj.getTaskNo() > 0) {
|
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(ssj.getTaskNo()));
|
|
||||||
if (ObjUtil.isNotNull(mydoJob) && Convert.toInt(mydoJob.getInOrOut()) > 20) {
|
|
||||||
mydoJob.setExecutionPhase(TASK_EP_SSJ);
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
JobCallBack jobCallBack = new JobCallBack();
|
|
||||||
jobCallBack.setType("2");
|
|
||||||
jobCallBack.setMydojobId(mydoJob.getJobId());
|
|
||||||
jobCallBack.setStatus("0");
|
|
||||||
jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo()));
|
|
||||||
jobCallBack.setCreateTime(new Date());
|
|
||||||
jobCallBack.setSpare1("0");
|
|
||||||
jobCallBackService.insertJobCallBack(jobCallBack);
|
|
||||||
log.info("完成任务 taskNo{} ", mydoJob.getTaskNo());
|
|
||||||
mydoJob.setStatus(TASK_STATUS_FINISH);
|
|
||||||
mydoJob.setFinishTime(DateUtil.formatDateTime(new Date()));
|
|
||||||
mydoJob.setExecutionPhase(TASK_EP_WMS_FINISH);
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
mydoJobService.insertHistory(mydoJob.getJobId());
|
|
||||||
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一楼单向巷道口调度
|
|
||||||
*
|
|
||||||
* @param ssj 输送机
|
|
||||||
*/
|
|
||||||
public void dispatch(DeviceSsj ssj) {
|
|
||||||
//如果入库请求1 并且 托盘码不为空
|
|
||||||
if (ssj.getKx() == 1 && ssj.getTaskNo() == 0) {
|
|
||||||
|
|
||||||
String roadwayId = "";
|
|
||||||
String entrance_id = "";
|
|
||||||
if("L2001".equals(ssj.getDeviceCode())){
|
|
||||||
roadwayId = "1";
|
|
||||||
entrance_id = "L2002";
|
|
||||||
|
|
||||||
}
|
|
||||||
if("L2007".equals(ssj.getDeviceCode())){
|
|
||||||
roadwayId = "2";
|
|
||||||
entrance_id = "L2008";
|
|
||||||
}
|
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList1("1",roadwayId);
|
|
||||||
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(ssj.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()));
|
|
||||||
mydoJob.setExitId(entrance_id);
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,350 +0,0 @@
|
|||||||
package com.ruoyi.schedule.scheduleTask.ssj.floor2;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.ruoyi.api.service.IApiService;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
|
||||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
|
||||||
import com.ruoyi.job.domain.JobCallBack;
|
|
||||||
import com.ruoyi.job.domain.MydoJob;
|
|
||||||
import com.ruoyi.job.service.IJobCallBackService;
|
|
||||||
import com.ruoyi.job.service.IMydoJobService;
|
|
||||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
|
||||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
|
||||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import static com.ruoyi.common.TaskStatusCode.*;
|
|
||||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
|
|
||||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsjQH;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二楼出入口输送线线程
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class Floor2InOutSsjThread implements Runnable {
|
|
||||||
|
|
||||||
public HashMap<String, List<String>> ssjCodeList;
|
|
||||||
|
|
||||||
private IApiService apiService;
|
|
||||||
private IAgvQueueService agvQueueService;
|
|
||||||
private IMydoJobService mydoJobService;
|
|
||||||
private IJobCallBackService jobCallBackService;
|
|
||||||
|
|
||||||
public boolean isRun = true;
|
|
||||||
|
|
||||||
|
|
||||||
public void init() {
|
|
||||||
ssjCodeList = new HashMap<>();
|
|
||||||
ArrayList<String> ssjCodes = new ArrayList<>();
|
|
||||||
ssjCodes.add("L1001");
|
|
||||||
ssjCodes.add("L1003");
|
|
||||||
ssjCodeList.put("inout", ssjCodes);
|
|
||||||
apiService = SpringUtils.getBean(IApiService.class);
|
|
||||||
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
|
||||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
|
||||||
jobCallBackService = SpringUtils.getBean(IJobCallBackService.class);
|
|
||||||
log.info("初始化服务 {},{}", apiService, agvQueueService);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
init();
|
|
||||||
while (isRun) {
|
|
||||||
for (String type : ssjCodeList.keySet()) {
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case "inout":
|
|
||||||
//入库口
|
|
||||||
for (String ssjCode : ssjCodeList.get(type)) {
|
|
||||||
try {
|
|
||||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
|
||||||
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
|
||||||
inDispatch1(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
|
||||||
} else {
|
|
||||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
|
||||||
}
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Thread.sleep(1500);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void inDispatch(DeviceSsj inSsjDevice) {
|
|
||||||
//如果输送机空闲
|
|
||||||
if (inSsjDevice.getKx() == 1) {
|
|
||||||
AgvQueue agvQueue = new AgvQueue();
|
|
||||||
|
|
||||||
//临时处理 收到AGV取货完成,给放货输送机下发切换导向
|
|
||||||
agvQueue.setStatus("5");//请求放货
|
|
||||||
//agvQueue.setStatus("4");
|
|
||||||
//todo 与agv对点
|
|
||||||
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
|
|
||||||
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList1(agvQueue);
|
|
||||||
//不允许放货 等着
|
|
||||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 0 && "L1001".equals(inSsjDevice.getDeviceCode())) {
|
|
||||||
//下发输送线切换导向 DB未知
|
|
||||||
int i = writeToSsjQH("DB802.106", Integer.parseInt(agvQueues.get(0).getCtnrCode()));
|
|
||||||
if (i == 1) {
|
|
||||||
log.info("输送机{}下发切换导向{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getCtnrCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 0 && "L1003".equals(inSsjDevice.getDeviceCode())) {
|
|
||||||
//下发输送线切换导向 DB未知
|
|
||||||
int i = writeToSsjQH("DB802.118", Integer.parseInt(agvQueues.get(0).getCtnrCode()));
|
|
||||||
if (i == 1) {
|
|
||||||
log.info("输送机{}下发切换导向{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getCtnrCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//允许放货
|
|
||||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 2) {
|
|
||||||
log.info("设备:{} 位置:{} 任务号:{} 请求放货成功", inSsjDevice.getDeviceCode(), "输送线", agvQueues.get(0).getWmsTaskNo());
|
|
||||||
AjaxResult ajaxResult = apiService.continueTask(agvQueues.get(0));
|
|
||||||
if (ajaxResult.isSuccess()) {
|
|
||||||
log.info("下发agv允许放货成功" + agvQueues.get(0).getWmsTaskNo());
|
|
||||||
agvQueues.get(0).setStatus("6");
|
|
||||||
agvQueueService.updateAgvQueue(agvQueues.get(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//入库下发输送线
|
|
||||||
if (inSsjDevice.getKx() == 0 && inSsjDevice.getTaskNo2() == 0) {
|
|
||||||
AgvQueue agvQueue = new AgvQueue();
|
|
||||||
agvQueue.setStatus("7"); //end
|
|
||||||
//todo 与agv对点
|
|
||||||
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
|
|
||||||
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList1(agvQueue);
|
|
||||||
if (!agvQueues.isEmpty()) {
|
|
||||||
//解绑AGV容器
|
|
||||||
AjaxResult ajaxResult = apiService.deleteAgvTray(agvQueues.get(0));
|
|
||||||
if(ajaxResult.isSuccess()) {
|
|
||||||
AgvQueue agvQueue1 = agvQueues.get(0);
|
|
||||||
agvQueue1.setStatus("8");
|
|
||||||
agvQueueService.updateAgvQueue(agvQueue1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if("L1001".equals(inSsjDevice.getDeviceCode())) {
|
|
||||||
int i = writeToSsj("DB802.100", agvQueues.get(0).getWmsTaskNo(), 2,Integer.parseInt(agvQueues.get(0).getCtnrCode()));
|
|
||||||
if (i == 1) {
|
|
||||||
log.info("输送机{}AGV放货完成下发任务号{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getWmsTaskNo());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if("L1003".equals(inSsjDevice.getDeviceCode())) {
|
|
||||||
int i = writeToSsj("DB802.112", agvQueues.get(0).getWmsTaskNo(), 2,Integer.parseInt(agvQueues.get(0).getCtnrCode()));
|
|
||||||
if (i == 1) {
|
|
||||||
log.info("输送机{}AGV放货完成下发任务号{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getWmsTaskNo());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
AgvQueue agvQueue2 = new AgvQueue();
|
|
||||||
agvQueue2.setStatus("8"); //end
|
|
||||||
//todo 与agv对点
|
|
||||||
agvQueue2.setPositionCode2(inSsjDevice.getDeviceCode());
|
|
||||||
List<AgvQueue> queueList = agvQueueService.selectAgvQueueList1(agvQueue2);
|
|
||||||
if (!queueList.isEmpty()) {
|
|
||||||
if("L1001".equals(inSsjDevice.getDeviceCode())) {
|
|
||||||
int i = writeToSsj("DB802.100", queueList.get(0).getWmsTaskNo(), 2,Integer.parseInt(queueList.get(0).getCtnrCode()));
|
|
||||||
if (i == 1) {
|
|
||||||
log.info("输送机{}AGV放货完成下发任务号{}成功", inSsjDevice.getDeviceCode(), queueList.get(0).getWmsTaskNo());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if("L1003".equals(inSsjDevice.getDeviceCode())) {
|
|
||||||
int i = writeToSsj("DB802.112", queueList.get(0).getWmsTaskNo(), 2,Integer.parseInt(queueList.get(0).getCtnrCode()));
|
|
||||||
if (i == 1) {
|
|
||||||
log.info("输送机{}AGV放货完成下发任务号{}成功", inSsjDevice.getDeviceCode(), queueList.get(0).getWmsTaskNo());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(inSsjDevice.getKx() == 0 && inSsjDevice.getTaskNo2() > 0){
|
|
||||||
AgvQueue agvQueue = new AgvQueue();
|
|
||||||
agvQueue.setStatus("8"); //end
|
|
||||||
//todo 与agv对点
|
|
||||||
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
|
|
||||||
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList1(agvQueue);
|
|
||||||
if(agvQueues.size() > 0){
|
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(agvQueues.get(0).getTaskCode());
|
|
||||||
mydoJob.setExecutionPhase(TASK_EP_SSJ);
|
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
|
||||||
agvQueueService.insertHistory(agvQueues.get(0).getReqCode());
|
|
||||||
agvQueueService.deleteAgvQueueByReqCode(agvQueues.get(0).getReqCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//出库到位
|
|
||||||
if (inSsjDevice.getDw() == 1 && inSsjDevice.getTaskNo() > 0) {
|
|
||||||
|
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(inSsjDevice.getTaskNo()));
|
|
||||||
if (mydoJob != null && Integer.parseInt(mydoJob.getInOrOut()) > 20) {
|
|
||||||
log.info("设备:{} 位置:{} 任务号:{} 出库到位", "输送线", inSsjDevice.getDeviceCode(), mydoJob.getTaskNo());
|
|
||||||
mydoJobService.insertHistory(mydoJob.getJobId());
|
|
||||||
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
|
|
||||||
JobCallBack jobCallBack = new JobCallBack();
|
|
||||||
jobCallBack.setType("2");
|
|
||||||
jobCallBack.setMydojobId(mydoJob.getJobId());
|
|
||||||
jobCallBack.setStatus("0");
|
|
||||||
jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo()));
|
|
||||||
jobCallBack.setCreateTime(new Date());
|
|
||||||
jobCallBack.setSpare1("0");
|
|
||||||
jobCallBackService.insertJobCallBack(jobCallBack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void inDispatch1(DeviceSsj ssjDevice) {
|
|
||||||
//有入库请求就肯定是电气的任务号的作业
|
|
||||||
if(StrUtil.isNotBlank(ssjDevice.getTrayCode()) && ssjDevice.getRkqq()==1 && ssjDevice.getTaskNo()<1000){
|
|
||||||
//,如果有正执行的出库作业退回
|
|
||||||
MydoJob mydoJobParam = new MydoJob();
|
|
||||||
mydoJobParam.setInOut("2");
|
|
||||||
mydoJobParam.setStatus("3");
|
|
||||||
mydoJobParam.setExitId(ssjDevice.getDeviceCode());
|
|
||||||
List<MydoJob> outMydoJobList = mydoJobService.selectInOrOutMydoJobList(mydoJobParam);
|
|
||||||
if(!outMydoJobList.isEmpty()){
|
|
||||||
//todo 去向不明朗
|
|
||||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"99",2,2);
|
|
||||||
if (i == 1) {
|
|
||||||
log.info(ssjDevice.getDeviceCode()+"有正执行的出库作业退回" );
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MydoJob mydoJob = new MydoJob();
|
|
||||||
mydoJob.setInOrOut("1");
|
|
||||||
// mydoJob.setStatus("1");
|
|
||||||
String trayCode = ssjDevice.getTrayCode();
|
|
||||||
//String[] split = trayCode.split("\\s+");
|
|
||||||
String serial = findFirst(PATTERNS.get("SERIAL"), trayCode);
|
|
||||||
mydoJob.setTrayCode(serial);
|
|
||||||
mydoJob.setEntranceId(ssjDevice.getDeviceCode());
|
|
||||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(mydoJob);
|
|
||||||
if(!mydoJobs.isEmpty()){
|
|
||||||
MydoJob mydoJob1 = mydoJobs.get(0);
|
|
||||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob1.getTaskNo(),1,1);
|
|
||||||
if (i == 1) {
|
|
||||||
mydoJob1.setExecutionPhase(TASK_EP_SSJ);
|
|
||||||
mydoJob1.setStatus("3");
|
|
||||||
mydoJobService.updateMydoJob(mydoJob1);
|
|
||||||
log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:{}" , mydoJob1.getTaskNo());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
map.put("trayCode",ssjDevice.getTrayCode());
|
|
||||||
map.put("entranceId",ssjDevice.getDeviceCode());
|
|
||||||
map.put("floor", "2");
|
|
||||||
AjaxResult ajaxResult = apiService.selectMydoJobByTrayCodeAndEntranceId(map);
|
|
||||||
if(ajaxResult.isSuccess()){
|
|
||||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
|
||||||
mydoJob2.setStatus("1");
|
|
||||||
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
|
||||||
mydoJob2.setCreateTime(new Date());
|
|
||||||
mydoJob2.setFaultFlag("0");
|
|
||||||
mydoJob2.setPriority(Long.valueOf(10));
|
|
||||||
mydoJobService.insertMydoJob(mydoJob2);
|
|
||||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
|
||||||
if (i == 1) {
|
|
||||||
mydoJob2.setExecutionPhase(TASK_EP_SSJ);
|
|
||||||
mydoJob2.setStatus("3");
|
|
||||||
mydoJobService.updateMydoJob(mydoJob2);
|
|
||||||
log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:{}" , mydoJob2.getTaskNo());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
//todo 去向不明朗
|
|
||||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"99",2,2);
|
|
||||||
if (i == 1) {
|
|
||||||
log.info(ssjDevice.getDeviceCode()+"输送机没取到作业下发输送线" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(StrUtil.isBlank(ssjDevice.getTrayCode()) && ssjDevice.getRkqq()==1 && ssjDevice.getTaskNo()<1000){
|
|
||||||
//
|
|
||||||
// MydoJob mydoJob1 = new MydoJob();
|
|
||||||
// mydoJob1.setInOrOut("1");
|
|
||||||
// mydoJob1.setEntranceId(ssjDevice.getDeviceCode());
|
|
||||||
//// mydoJob1.setStatus("1");
|
|
||||||
// List<MydoJob> mydoJobs = mydoJobService.selectInOrOutMydoJobList(mydoJob1);
|
|
||||||
// if(!mydoJobs.isEmpty()){
|
|
||||||
// MydoJob mydoJob2 = mydoJobs.get(0);
|
|
||||||
// int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
|
||||||
// if (i == 1) {
|
|
||||||
// mydoJob2.setExecutionPhase(TASK_EP_SSJ);
|
|
||||||
// mydoJob2.setStatus("3");
|
|
||||||
// mydoJobService.updateMydoJob(mydoJob2);
|
|
||||||
// log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:" + mydoJob2.getTaskNo());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }else{
|
|
||||||
// HashMap<String, Object> paramMap = new HashMap<>();
|
|
||||||
// paramMap.put("size", ssjDevice.getTraySize());
|
|
||||||
// paramMap.put("entranceId", ssjDevice.getDeviceCode());
|
|
||||||
// AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
|
|
||||||
// if(ajaxResult.isSuccess()){
|
|
||||||
// MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class) ;
|
|
||||||
// mydoJob2.setStatus("1");
|
|
||||||
// mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
|
||||||
// mydoJob2.setCreateTime(new Date());
|
|
||||||
// mydoJob2.setFaultFlag("0");
|
|
||||||
// mydoJobService.insertMydoJob(mydoJob2);
|
|
||||||
// int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
|
||||||
// if (i == 1) {
|
|
||||||
// mydoJob2.setExecutionPhase(TASK_EP_SSJ);
|
|
||||||
// mydoJob2.setStatus("3");
|
|
||||||
// mydoJobService.updateMydoJob(mydoJob2);
|
|
||||||
// log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:" + mydoJob2.getTaskNo());
|
|
||||||
// }
|
|
||||||
// }else{
|
|
||||||
// int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(), "99", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
|
||||||
// if (i == 1) {
|
|
||||||
// log.info(ssjDevice.getDeviceCode()+"输送机下发错误信息成功");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<String, Pattern> PATTERNS = createPatterns();
|
|
||||||
private static Map<String, Pattern> createPatterns() {
|
|
||||||
Map<String, Pattern> map = new LinkedHashMap<>();
|
|
||||||
map.put("MODEL", Pattern.compile("MODEL:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
|
||||||
map.put("COLOR", Pattern.compile("COLOR:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
|
||||||
map.put("SERIAL", Pattern.compile("SERIAL:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
|
||||||
map.put("V", Pattern.compile("V:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
|
||||||
map.put("Hz", Pattern.compile("Hz:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
|
||||||
map.put("PH", Pattern.compile("PH:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
|
||||||
map.put("NW", Pattern.compile("N\\.W\\.:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
|
||||||
map.put("GW", Pattern.compile("G\\.W\\.:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
|
||||||
map.put("ITEM_CODE", Pattern.compile("ITEM_CODE:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
|
||||||
map.put("@", Pattern.compile("@:([^\\s]+)", Pattern.CASE_INSENSITIVE));
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
private static String findFirst(Pattern pattern, String input) {
|
|
||||||
if (pattern == null || input == null) return null;
|
|
||||||
Matcher m = pattern.matcher(input);
|
|
||||||
return m.find() ? m.group(1) : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,12 +6,20 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
#主数据信息
|
#主数据信息
|
||||||
master:
|
master:
|
||||||
# url: jdbc:sqlserver://172.16.2.170:1433;databaseName=FT517-WCS;
|
# 本地工控机
|
||||||
|
# url: jdbc:sqlserver://172.16.4.12:1433;databaseName=FT517-WCS;encrypt=true;trustServerCertificate=true;
|
||||||
# username: sa
|
# username: sa
|
||||||
# password: Flrd0914.
|
# password: Flrd0914.
|
||||||
url: jdbc:sqlserver://192.168.58.10:1433;databaseName=FT517-wcs;;encrypt=true;trustServerCertificate=true;
|
|
||||||
|
# 本机
|
||||||
|
url: jdbc:sqlserver://localhost:1433;databaseName=FT568-wcs;encrypt=true;trustServerCertificate=true;
|
||||||
username: sa
|
username: sa
|
||||||
password: www.123.com
|
password: 123456
|
||||||
|
|
||||||
|
# 生产
|
||||||
|
# url: jdbc:sqlserver://192.168.58.10:1433;databaseName=FT568-wcs;encrypt=true;trustServerCertificate=true;
|
||||||
|
# username: sa
|
||||||
|
# password: www.123.com
|
||||||
|
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ spring:
|
|||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 192.168.58.10
|
# host: 192.168.58.10
|
||||||
|
host: 172.16.4.12
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
|
|||||||
Reference in New Issue
Block a user