wcs调度系统基本框架
This commit is contained in:
@@ -96,6 +96,11 @@
|
||||
<version>0.9.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.dathlin</groupId>
|
||||
<artifactId>HslCommunication</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackRequest;
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackResponse;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRequest;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* Agv操作请求
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/agv/api")
|
||||
@Slf4j
|
||||
public class AgvController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IApiService apiService;
|
||||
|
||||
/**
|
||||
* agv执行状态返回接口
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/agvCallback")
|
||||
public AgvCallbackResponse agvCallback(@RequestBody AgvCallbackRequest request) {
|
||||
return apiService.agvCallback(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送AGV任务
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/pushOutMydoJob")
|
||||
public AjaxResult PushOutMydoJob(@RequestBody MydoJob mydoJob) {
|
||||
return apiService.PushOutMydoJob(mydoJob);
|
||||
}
|
||||
|
||||
/**
|
||||
* agv搬运作业
|
||||
* @param genAgvSchedulingTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/agvMoveJob")
|
||||
public AjaxResult agvMoveJob(@RequestBody GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest) {
|
||||
return apiService.agvMoveJob(genAgvSchedulingTaskRequest);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.api.controller;
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -16,8 +16,8 @@ import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.device.api.domain.RequestLog;
|
||||
import com.ruoyi.device.api.service.IRequestLogService;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
import com.ruoyi.api.service.IRequestLogService;
|
||||
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
|
||||
import com.ruoyi.device.DeviceCar.service.IDeviceCarService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/wcs2Wms/api")
|
||||
public class Wcs2WmsController {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.api.domain;
|
||||
package com.ruoyi.api.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.api.domain;
|
||||
package com.ruoyi.api.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.ruoyi.device.agv.domain;
|
||||
package com.ruoyi.api.domain.agv;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class ResponseBase {
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.agv.domain.agvCallback;
|
||||
package com.ruoyi.api.domain.agv.agvCallback;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.ruoyi.device.agv.domain.agvCallback;
|
||||
package com.ruoyi.api.domain.agv.agvCallback;
|
||||
|
||||
import com.ruoyi.device.agv.domain.ResponseBase;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgvCallbackResponse {
|
||||
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.agv.domain.cancelTask;
|
||||
package com.ruoyi.api.domain.agv.cancelTask;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.device.agv.domain.cancelTask;
|
||||
package com.ruoyi.api.domain.agv.cancelTask;
|
||||
|
||||
import com.ruoyi.device.agv.domain.ResponseBase;
|
||||
import com.ruoyi.api.domain.agv.ResponseBase;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.agv.domain.continueTask;
|
||||
package com.ruoyi.api.domain.agv.continueTask;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.device.agv.domain.continueTask;
|
||||
package com.ruoyi.api.domain.agv.continueTask;
|
||||
|
||||
import com.ruoyi.device.agv.domain.ResponseBase;
|
||||
import com.ruoyi.api.domain.agv.ResponseBase;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.agv.domain.continueTask;
|
||||
package com.ruoyi.api.domain.agv.continueTask;
|
||||
|
||||
public class NextPositionCodeData {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.agv.domain.genAgvSchedulingTask;
|
||||
package com.ruoyi.api.domain.agv.genAgvSchedulingTask;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.ruoyi.device.agv.domain.genAgvSchedulingTask;
|
||||
package com.ruoyi.api.domain.agv.genAgvSchedulingTask;
|
||||
|
||||
import com.ruoyi.device.agv.domain.ResponseBase;
|
||||
import com.ruoyi.api.domain.agv.ResponseBase;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class GenAgvSchedulingTaskResponse extends ResponseBase {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.agv.domain.genAgvSchedulingTask;
|
||||
package com.ruoyi.api.domain.agv.genAgvSchedulingTask;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.agv.domain.queryAgvStatus;
|
||||
package com.ruoyi.api.domain.agv.queryAgvStatus;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.agv.domain.queryAgvStatus;
|
||||
package com.ruoyi.api.domain.agv.queryAgvStatus;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.device.agv.domain.queryAgvStatus;
|
||||
package com.ruoyi.api.domain.agv.queryAgvStatus;
|
||||
|
||||
import com.ruoyi.device.agv.domain.ResponseBase;
|
||||
import com.ruoyi.api.domain.agv.ResponseBase;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.agv.domain.queryTaskStatus;
|
||||
package com.ruoyi.api.domain.agv.queryTaskStatus;
|
||||
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import lombok.Data;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.device.agv.domain.queryTaskStatus;
|
||||
package com.ruoyi.api.domain.agv.queryTaskStatus;
|
||||
|
||||
import com.ruoyi.device.agv.domain.ResponseBase;
|
||||
import com.ruoyi.api.domain.agv.ResponseBase;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.agv.domain.queryTaskStatus;
|
||||
package com.ruoyi.api.domain.agv.queryTaskStatus;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.ruoyi.api.domain.wcs2wms;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 任务表对象 mydo_job
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-23
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class MydoJob extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 任务ID */
|
||||
@Excel(name = "任务ID")
|
||||
private String jobId;
|
||||
|
||||
/** 任务状态 */
|
||||
@Excel(name = "任务状态",dictType = "mydo_job_status")
|
||||
private String status;
|
||||
|
||||
/** 上线类型 */
|
||||
@Excel(name = "上线类型",dictType = "on_line_type")
|
||||
private String onLineType;
|
||||
|
||||
/** 任务号 */
|
||||
@Excel(name = "任务号")
|
||||
private String taskNo;
|
||||
|
||||
/** 供应商ID */
|
||||
@Excel(name = "供应商ID")
|
||||
private String supplierId;
|
||||
@Excel(name = "供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
/** 客户ID */
|
||||
@Excel(name = "客户ID")
|
||||
private String customerId;
|
||||
@Excel(name = "客户名称")
|
||||
private String customerName;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门ID")
|
||||
private String departmentId;
|
||||
@Excel(name = "部门")
|
||||
private String departmentName;
|
||||
|
||||
/** 托盘码 */
|
||||
@Excel(name = "托盘码")
|
||||
private String trayCode;
|
||||
|
||||
/** 巷道ID */
|
||||
@Excel(name = "巷道ID")
|
||||
private String roadwayId;
|
||||
|
||||
/** 货位ID */
|
||||
@Excel(name = "货位ID")
|
||||
private String cargoSpaceId;
|
||||
@Excel(name = "货位名称")
|
||||
private String cargoSpaceName;
|
||||
|
||||
/** 目标巷道ID */
|
||||
@Excel(name = "目标巷道ID")
|
||||
private String targetRoadwayId;
|
||||
|
||||
/** 目标货位ID */
|
||||
@Excel(name = "目标货位ID")
|
||||
private String targetCargoSpaceId;
|
||||
@Excel(name = "目标货位名称")
|
||||
private String targetCargoSpaceName;
|
||||
|
||||
/** 产线ID */
|
||||
@Excel(name = "产线ID")
|
||||
private String lineId;
|
||||
|
||||
/** 车间ID */
|
||||
@Excel(name = "车间ID")
|
||||
private String workshopId;
|
||||
|
||||
/** 优先级 */
|
||||
@Excel(name = "优先级")
|
||||
private Long priority;
|
||||
|
||||
/** 执行阶段 */
|
||||
@Excel(name = "执行阶段",dictType = "execution_phase_type")
|
||||
private String executionPhase;
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型",dictType = "in_or_out_type")
|
||||
private String inOrOut;
|
||||
|
||||
|
||||
|
||||
/** 开始时间 */
|
||||
@Excel(name = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@Excel(name = "结束时间")
|
||||
private String finishTime;
|
||||
|
||||
/** 入口ID */
|
||||
@Excel(name = "入口ID")
|
||||
private String entranceId;
|
||||
|
||||
/** 出口ID */
|
||||
@Excel(name = "出口ID")
|
||||
private String exitId;
|
||||
|
||||
/** 班组ID */
|
||||
@Excel(name = "班组ID")
|
||||
private String classId;
|
||||
|
||||
/** 仓库ID */
|
||||
@Excel(name = "仓库ID")
|
||||
private String warehouseId;
|
||||
@Excel(name = "仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
/** 重分标记 */
|
||||
@Excel(name = "重分标记")
|
||||
private String faultFlag;
|
||||
|
||||
private String inOut;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.ruoyi.device.api.mapper;
|
||||
package com.ruoyi.api.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.api.domain.RequestLog;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
|
||||
/**
|
||||
* 接口记录Mapper接口
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-11
|
||||
*/
|
||||
public interface RequestLogMapper
|
||||
public interface RequestLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询接口记录
|
||||
*
|
||||
*
|
||||
* @param requestId 接口记录主键
|
||||
* @return 接口记录
|
||||
*/
|
||||
@@ -21,7 +21,7 @@ public interface RequestLogMapper
|
||||
|
||||
/**
|
||||
* 查询接口记录列表
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 接口记录集合
|
||||
*/
|
||||
@@ -29,7 +29,7 @@ public interface RequestLogMapper
|
||||
|
||||
/**
|
||||
* 新增接口记录
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ public interface RequestLogMapper
|
||||
|
||||
/**
|
||||
* 修改接口记录
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -45,7 +45,7 @@ public interface RequestLogMapper
|
||||
|
||||
/**
|
||||
* 删除接口记录
|
||||
*
|
||||
*
|
||||
* @param requestId 接口记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -53,7 +53,7 @@ public interface RequestLogMapper
|
||||
|
||||
/**
|
||||
* 批量删除接口记录
|
||||
*
|
||||
*
|
||||
* @param requestIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.ruoyi.api.service;
|
||||
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackRequest;
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackResponse;
|
||||
import com.ruoyi.api.domain.agv.cancelTask.CancelTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.cancelTask.CancelTaskResponse;
|
||||
import com.ruoyi.api.domain.agv.continueTask.ContinueTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.continueTask.ContinueTaskResponse;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 接口记录Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-11
|
||||
*/
|
||||
public interface IApiService
|
||||
{
|
||||
/**
|
||||
* 获取任务列表
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
public List<MydoJob> getMydoJobList(MydoJob mydoJob);
|
||||
/**
|
||||
* 更新任务
|
||||
* @param mydoJob
|
||||
*/
|
||||
boolean updateMydoJob(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* WMS出库任务推送
|
||||
* @param mydoJob
|
||||
*/
|
||||
public AjaxResult PushOutMydoJob(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* 取消AGV任务
|
||||
*
|
||||
* @param cancelTaskRequest
|
||||
* @return
|
||||
*/
|
||||
public CancelTaskResponse cancelTask(CancelTaskRequest cancelTaskRequest);
|
||||
|
||||
/**
|
||||
* 继续AGV任务
|
||||
* @param continueTaskRequest
|
||||
* @return
|
||||
*/
|
||||
public ContinueTaskResponse continueTask(ContinueTaskRequest continueTaskRequest);
|
||||
|
||||
/**
|
||||
* 生成AGV生成任务
|
||||
*
|
||||
* @param genAgvSchedulingTaskRequest
|
||||
* @return
|
||||
*/
|
||||
public GenAgvSchedulingTaskResponse genAgvSchedulingTask(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest);
|
||||
|
||||
/**
|
||||
* agv任务状态推送
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
AgvCallbackResponse agvCallback(AgvCallbackRequest request);
|
||||
|
||||
/**
|
||||
* agv搬运作业
|
||||
* @param genAgvSchedulingTaskRequest
|
||||
* @return
|
||||
*/
|
||||
AjaxResult agvMoveJob(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest);
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.ruoyi.device.api.service;
|
||||
package com.ruoyi.api.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.api.domain.RequestLog;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
|
||||
/**
|
||||
* 接口记录Service接口
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-11
|
||||
*/
|
||||
public interface IRequestLogService
|
||||
public interface IRequestLogService
|
||||
{
|
||||
/**
|
||||
* 查询接口记录
|
||||
*
|
||||
*
|
||||
* @param requestId 接口记录主键
|
||||
* @return 接口记录
|
||||
*/
|
||||
@@ -21,7 +21,7 @@ public interface IRequestLogService
|
||||
|
||||
/**
|
||||
* 查询接口记录列表
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 接口记录集合
|
||||
*/
|
||||
@@ -29,7 +29,7 @@ public interface IRequestLogService
|
||||
|
||||
/**
|
||||
* 新增接口记录
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ public interface IRequestLogService
|
||||
|
||||
/**
|
||||
* 修改接口记录
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -45,7 +45,7 @@ public interface IRequestLogService
|
||||
|
||||
/**
|
||||
* 批量删除接口记录
|
||||
*
|
||||
*
|
||||
* @param requestIds 需要删除的接口记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -53,9 +53,26 @@ public interface IRequestLogService
|
||||
|
||||
/**
|
||||
* 删除接口记录信息
|
||||
*
|
||||
*
|
||||
* @param requestId 接口记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRequestLogByRequestId(Long requestId);
|
||||
|
||||
/**
|
||||
* 发送请求,并插入日志
|
||||
* @param url
|
||||
* @param param
|
||||
* @param endPoint
|
||||
* @return
|
||||
*/
|
||||
public RequestLog getRequestLog(String url, String param, String endPoint);
|
||||
|
||||
/**
|
||||
* 接收请求,并插入日志
|
||||
* @param url
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public RequestLog getRequestLog(String url, String param);
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package com.ruoyi.api.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.InterfaceReceive;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackRequest;
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackResponse;
|
||||
import com.ruoyi.api.domain.agv.cancelTask.CancelTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.cancelTask.CancelTaskResponse;
|
||||
import com.ruoyi.api.domain.agv.continueTask.ContinueTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.continueTask.ContinueTaskResponse;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.ruoyi.common.Constant.*;
|
||||
|
||||
/**
|
||||
* 接口记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-11
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ApiServiceImpl implements IApiService {
|
||||
@Autowired
|
||||
private RequestLogServiceImpl requestLogService;
|
||||
@Autowired
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<MydoJob> getMydoJobList(MydoJob mydoJob) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(GET_MYDOJOB_URL, "获取任务", JSONUtil.toJsonStr(mydoJob));
|
||||
String responseBody = requestLog.getResponseBody();
|
||||
InterfaceReceive bean = JSONUtil.toBean(responseBody, InterfaceReceive.class);
|
||||
return JSONUtil.toList(JSONUtil.toJsonStr(bean.getData()), MydoJob.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenAgvSchedulingTaskResponse genAgvSchedulingTask(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(GEN_AGV_SCHEDULING_TASK, JSONUtil.toJsonStr(genAgvSchedulingTaskRequest), "生成AGV任务");
|
||||
return BeanUtil.toBean(requestLog.getResponseBody(), GenAgvSchedulingTaskResponse.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvCallbackResponse agvCallback(AgvCallbackRequest request) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(request), "AGV任务执行通知");
|
||||
requestLog.setRequestUrl("http://10.214.18.61:8089/external/log/outStockJob");
|
||||
AgvCallbackResponse response = new AgvCallbackResponse(0, "成功", "");
|
||||
try {
|
||||
agvCallbackInfo(request);
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(response));
|
||||
requestLog.setResponseStatus("1");
|
||||
return new AgvCallbackResponse(0, "成功", "");
|
||||
} catch (RuntimeException e) {
|
||||
requestLog.setErrorDetails(e.getMessage());
|
||||
requestLog.setIsSuccessful("0");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(response));
|
||||
requestLog.setResponseStatus("0");
|
||||
return new AgvCallbackResponse(1, "失败", "");
|
||||
} finally {
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult agvMoveJob(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest) {
|
||||
//todo 生成agvQueue队列
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
agvQueueService.insertAgvQueue(agvQueue);
|
||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = genAgvSchedulingTask(genAgvSchedulingTaskRequest);
|
||||
if (genAgvSchedulingTaskResponse.getCode() == 0){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(genAgvSchedulingTaskResponse.getMessage());
|
||||
}
|
||||
|
||||
|
||||
private void agvCallbackInfo(AgvCallbackRequest request) {
|
||||
String taskCode = request.getTaskCode();
|
||||
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(taskCode);
|
||||
|
||||
if (ObjUtil.isNotNull(agvQueue)) {
|
||||
switch (request.getMethod()) {
|
||||
case "start":
|
||||
//任务开始
|
||||
log.info("【AGV任务开始】任务号:{}", taskCode);
|
||||
break;
|
||||
case "outbin":
|
||||
//走出储位
|
||||
if ("2".equals(agvQueue.getStatus())) {
|
||||
agvQueue.setStatus("3");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
log.info("【AGV走出储位】任务号:{}", taskCode);
|
||||
}
|
||||
break;
|
||||
case "end":
|
||||
//任务结束
|
||||
agvQueue.setStatus("4");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
if ("1".equals(agvQueue.getWmsTaskType()) || "2".equals(agvQueue.getWmsTaskType())){
|
||||
//通知wms 任务结束
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setTaskNo(agvQueue.getWmsTaskNo());
|
||||
mydoJobParam.setTrayCode(agvQueue.getWmsTraycode());
|
||||
List<MydoJob> mydoJobList = getMydoJobList(mydoJobParam);
|
||||
if (CollUtil.isNotEmpty(mydoJobList)) {
|
||||
MydoJob mydoJob = mydoJobList.get(0);
|
||||
//通知wms agv搬运阶段完成
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("task_no", agvQueue.getWmsTaskNo());
|
||||
param.put("tray_code", agvQueue.getWmsTraycode());
|
||||
requestLogService.getRequestLog(AGV_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
log.info("【AGV任务结束】任务号:{}", taskCode);
|
||||
if (Convert.toInt(mydoJob.getInOrOut()) < 20) {
|
||||
//入库任务 暂无特殊逻辑
|
||||
} else {
|
||||
//todo 写入对应的plc 任务号
|
||||
}
|
||||
} else {
|
||||
log.info("【AGV任务结束】任务号:{},wms不存在对应的作业", taskCode);
|
||||
}
|
||||
}else if (agvQueue.getWmsTaskType().equals("3")){
|
||||
//todo 绑定点位和料架
|
||||
}
|
||||
break;
|
||||
case "cancel":
|
||||
//任务单取消
|
||||
log.info("【AGV任务单取消】任务号:{}", taskCode);
|
||||
break;
|
||||
case "apply":
|
||||
//CTU料箱取放申请
|
||||
//请求放货
|
||||
if ("0".equals(agvQueue.getRequest())) {
|
||||
agvQueue.setRequest("1");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
}
|
||||
log.info("【AGV料箱取放申请】任务号:{}", taskCode);
|
||||
break;
|
||||
default:
|
||||
log.info("未知方法");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult PushOutMydoJob(MydoJob mydoJob) {
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
String reqCode = IdUtil.fastSimpleUUID();
|
||||
agvQueue.setReqCode(reqCode);
|
||||
agvQueue.setReqTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
agvQueue.setAgvType("CTU");
|
||||
agvQueue.setPositionCode1(mydoJob.getCargoSpaceId());
|
||||
agvQueue.setPositionCode2(mydoJob.getExitId());
|
||||
int i = agvQueueService.insertAgvQueue(agvQueue);
|
||||
if (i > 0) {
|
||||
log.info("向AGV下任务成功");
|
||||
return AjaxResult.success("向AGV下任务成功");
|
||||
} else {
|
||||
log.info("向AGV下任务失败");
|
||||
return AjaxResult.error("向AGV下任务失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CancelTaskResponse cancelTask(CancelTaskRequest cancelTaskRequest) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(CANCEL_TASK_URL, "取消任务", JSONUtil.toJsonStr(cancelTaskRequest));
|
||||
return BeanUtil.toBean(requestLog.getResponseBody(), CancelTaskResponse.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContinueTaskResponse continueTask(ContinueTaskRequest continueTaskRequest) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(CONTINUE_TASK_URL, "继续执行任务", JSONUtil.toJsonStr(continueTaskRequest));
|
||||
return BeanUtil.toBean(requestLog.getResponseBody(), ContinueTaskResponse.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateMydoJob(MydoJob mydoJob) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(GET_MYDOJOB_URL, "获取任务", JSONUtil.toJsonStr(mydoJob));
|
||||
String responseBody = requestLog.getResponseBody();
|
||||
InterfaceReceive bean = JSONUtil.toBean(responseBody, InterfaceReceive.class);
|
||||
if (bean.getCode() == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.device.api.service.impl;
|
||||
package com.ruoyi.api.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -6,15 +6,14 @@ import java.util.List;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.device.api.domain.InterfaceReceive;
|
||||
import com.ruoyi.api.domain.InterfaceReceive;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.api.mapper.RequestLogMapper;
|
||||
import com.ruoyi.device.api.domain.RequestLog;
|
||||
import com.ruoyi.device.api.service.IRequestLogService;
|
||||
import com.ruoyi.api.mapper.RequestLogMapper;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
import com.ruoyi.api.service.IRequestLogService;
|
||||
|
||||
/**
|
||||
* 接口记录Service业务层处理
|
||||
@@ -108,7 +107,8 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
* @param param 参数
|
||||
* @return requestLog
|
||||
*/
|
||||
private RequestLog getRequestLog(String url, String param, String endPoint) {
|
||||
@Override
|
||||
public RequestLog getRequestLog(String url, String param, String endPoint) {
|
||||
RequestLog requestLog = new RequestLog();
|
||||
Date requestTime = new Date();
|
||||
requestLog.setRequestTime(DateUtil.format(requestTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
@@ -150,7 +150,8 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
*
|
||||
* @return requestLog
|
||||
*/
|
||||
private RequestLog getRequestLog(String param, String endPoint) {
|
||||
@Override
|
||||
public RequestLog getRequestLog(String param, String endPoint) {
|
||||
RequestLog requestLog = new RequestLog();
|
||||
Date requestTime = new Date();
|
||||
requestLog.setRequestTime(DateUtil.format(requestTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
@@ -18,4 +18,12 @@ public class Constant {
|
||||
*/
|
||||
public static final String BASEURL_AGV = BASEURL + "/rcms-dps/rest/queryAgvStatus/";
|
||||
|
||||
|
||||
public static final String GET_MYDOJOB_URL = "http://127.0.0.1:8081/rcms-dps/rest/queryAgvStatus/";
|
||||
public static final String UPDATE_MYDOJOB_URL = "http://127.0.0.1:8081/rcms-dps/rest/queryAgvStatus/";
|
||||
public static final String AGV_FINISH_URL = "http://127.0.0.1:8081/rcms-dps/rest/queryAgvStatus/";
|
||||
public static final String CONTINUE_TASK_URL = "http://127.0.0.1:8081/rcms-dps/rest/queryAgvStatus/";
|
||||
public static final String CANCEL_TASK_URL = "http://127.0.0.1:8081/rcms-dps/rest/queryAgvStatus/";
|
||||
public static final String GEN_AGV_SCHEDULING_TASK = "http://127.0.0.1:8081/rcms-dps/rest/queryAgvStatus/";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.ruoyi.device.agv.controller;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.Constant;
|
||||
import com.ruoyi.common.TaskStatusCode;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
|
||||
import com.ruoyi.device.agv.domain.ResponseBase;
|
||||
import com.ruoyi.device.agv.domain.agvCallback.AgvCallbackRequest;
|
||||
import com.ruoyi.device.agv.domain.agvCallback.AgvCallbackResponse;
|
||||
import com.ruoyi.device.agv.domain.genAgvSchedulingTask.GenAgvSchedulingTaskRequest;
|
||||
import com.ruoyi.device.agv.domain.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||
import com.ruoyi.device.api.domain.RequestLog;
|
||||
import com.ruoyi.schedule.plc.domain.AgvRead;
|
||||
import com.ruoyi.schedule.task.domain.WcsTask;
|
||||
import com.ruoyi.schedule.task.mapper.WcsTaskMapper;
|
||||
import com.ruoyi.schedule.task.service.IWcsTaskService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Agv操作请求
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/agv/api")
|
||||
@Slf4j
|
||||
public class AgvController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
WcsTaskMapper wcsTaskMapper;
|
||||
|
||||
@PostMapping("/agvCallback")
|
||||
public AgvCallbackResponse agvCallback(@RequestBody AgvCallbackRequest request) {
|
||||
|
||||
AgvCallbackResponse response = new AgvCallbackResponse();
|
||||
|
||||
response.setCode(0);
|
||||
response.setMessage("success");
|
||||
response.setReqCode(request.getReqCode());
|
||||
|
||||
//请求字符串空校验
|
||||
if (request == null ||
|
||||
StringUtils.isBlank(request.getReqCode()) ||
|
||||
StringUtils.isBlank(request.getReqTime()) ||
|
||||
StringUtils.isBlank(request.getCurrentPositionCode()) ||
|
||||
StringUtils.isBlank(request.getMethod()) ||
|
||||
StringUtils.isBlank(request.getRobotCode()) ||
|
||||
StringUtils.isBlank(request.getTaskCode())
|
||||
) {
|
||||
response.setCode(1);
|
||||
response.setMessage("failed");
|
||||
log.error("【设备执行任务回调接口异常】:{}", JSON.toJSONString(request));
|
||||
}
|
||||
|
||||
//根据回调参数更新任务状态
|
||||
WcsTask task = wcsTaskMapper.selectWcsTaskByTaskId(request.getTaskCode());
|
||||
switch (request.getMethod()){
|
||||
case "start":
|
||||
case "outbin":
|
||||
task.setTaskStatus(TaskStatusCode.TASK_RUNNING);
|
||||
log.info("【更新任务状态】任务号:{},任务执行中",task.getTaskId());
|
||||
break;
|
||||
case "end":
|
||||
task.setTaskStatus(TaskStatusCode.TASK_FINISH);
|
||||
log.info("【更新任务状态】任务号:{},任务自动完成",task.getTaskId());
|
||||
break;
|
||||
case "cancel":
|
||||
task.setTaskStatus(TaskStatusCode.TASK_CANCEL);
|
||||
log.info("【更新任务状态】任务号:{},任务已取消",task.getTaskId());
|
||||
break;
|
||||
case "apply":
|
||||
//task.setTaskStatus(TaskStatusCode.TASK_RUNNING);
|
||||
break;
|
||||
}
|
||||
task.setDeviceId(request.getRobotCode());
|
||||
|
||||
wcsTaskMapper.updateWcsTask(task);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.device.agv.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* AGV任务队列Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/agv/queue")
|
||||
public class AgvQueueController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
/**
|
||||
* 查询AGV任务队列列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queue:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AgvQueue agvQueue)
|
||||
{
|
||||
startPage();
|
||||
List<AgvQueue> list = agvQueueService.selectAgvQueueList(agvQueue);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出AGV任务队列列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queue:export')")
|
||||
@Log(title = "AGV任务队列", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AgvQueue agvQueue)
|
||||
{
|
||||
List<AgvQueue> list = agvQueueService.selectAgvQueueList(agvQueue);
|
||||
ExcelUtil<AgvQueue> util = new ExcelUtil<AgvQueue>(AgvQueue.class);
|
||||
util.exportExcel(response, list, "AGV任务队列数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取AGV任务队列详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queue:query')")
|
||||
@GetMapping(value = "/{reqCode}")
|
||||
public AjaxResult getInfo(@PathVariable("reqCode") String reqCode)
|
||||
{
|
||||
return success(agvQueueService.selectAgvQueueByReqCode(reqCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增AGV任务队列
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queue:add')")
|
||||
@Log(title = "AGV任务队列", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AgvQueue agvQueue)
|
||||
{
|
||||
return toAjax(agvQueueService.insertAgvQueue(agvQueue));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改AGV任务队列
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queue:edit')")
|
||||
@Log(title = "AGV任务队列", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AgvQueue agvQueue)
|
||||
{
|
||||
return toAjax(agvQueueService.updateAgvQueue(agvQueue));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除AGV任务队列
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queue:remove')")
|
||||
@Log(title = "AGV任务队列", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{reqCodes}")
|
||||
public AjaxResult remove(@PathVariable String[] reqCodes)
|
||||
{
|
||||
return toAjax(agvQueueService.deleteAgvQueueByReqCodes(reqCodes));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.device.agv.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.device.agv.domain.AgvQueueFinish;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueFinishService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* agv历史队列Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/agv/queueFinish")
|
||||
public class AgvQueueFinishController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAgvQueueFinishService agvQueueFinishService;
|
||||
|
||||
/**
|
||||
* 查询agv历史队列列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queueFinish:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AgvQueueFinish agvQueueFinish)
|
||||
{
|
||||
startPage();
|
||||
List<AgvQueueFinish> list = agvQueueFinishService.selectAgvQueueFinishList(agvQueueFinish);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出agv历史队列列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queueFinish:export')")
|
||||
@Log(title = "agv历史队列", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AgvQueueFinish agvQueueFinish)
|
||||
{
|
||||
List<AgvQueueFinish> list = agvQueueFinishService.selectAgvQueueFinishList(agvQueueFinish);
|
||||
ExcelUtil<AgvQueueFinish> util = new ExcelUtil<AgvQueueFinish>(AgvQueueFinish.class);
|
||||
util.exportExcel(response, list, "agv历史队列数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取agv历史队列详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queueFinish:query')")
|
||||
@GetMapping(value = "/{reqCode}")
|
||||
public AjaxResult getInfo(@PathVariable("reqCode") String reqCode)
|
||||
{
|
||||
return success(agvQueueFinishService.selectAgvQueueFinishByReqCode(reqCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增agv历史队列
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queueFinish:add')")
|
||||
@Log(title = "agv历史队列", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AgvQueueFinish agvQueueFinish)
|
||||
{
|
||||
return toAjax(agvQueueFinishService.insertAgvQueueFinish(agvQueueFinish));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改agv历史队列
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queueFinish:edit')")
|
||||
@Log(title = "agv历史队列", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AgvQueueFinish agvQueueFinish)
|
||||
{
|
||||
return toAjax(agvQueueFinishService.updateAgvQueueFinish(agvQueueFinish));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除agv历史队列
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('agv:queueFinish:remove')")
|
||||
@Log(title = "agv历史队列", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{reqCodes}")
|
||||
public AjaxResult remove(@PathVariable String[] reqCodes)
|
||||
{
|
||||
return toAjax(agvQueueFinishService.deleteAgvQueueFinishByReqCodes(reqCodes));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
package com.ruoyi.device.agv.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* AGV任务队列对象 agv_queue
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public class AgvQueue extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 请求编号 */
|
||||
private String reqCode;
|
||||
|
||||
/** 请求时间截 yyyy-MM-dd HH:mm:ss */
|
||||
@Excel(name = "请求时间截 yyyy-MM-dd HH:mm:ss")
|
||||
private String reqTime;
|
||||
|
||||
/** 起点 */
|
||||
@Excel(name = "起点 ")
|
||||
private String positionCode1;
|
||||
|
||||
/** 终点 */
|
||||
@Excel(name = "终点")
|
||||
private String positionCode2;
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型 ")
|
||||
private String taskType;
|
||||
|
||||
/** 容器类型 */
|
||||
@Excel(name = "容器类型")
|
||||
private String ctnrType;
|
||||
|
||||
/** 容器编号 */
|
||||
@Excel(name = "容器编号")
|
||||
private String ctnrCode;
|
||||
|
||||
/** 容器数量 */
|
||||
@Excel(name = "容器数量")
|
||||
private String ctnrNum;
|
||||
|
||||
/** 任务模式 */
|
||||
@Excel(name = "任务模式")
|
||||
private String taskMode;
|
||||
|
||||
/** 优先级 */
|
||||
@Excel(name = "优先级")
|
||||
private String priority;
|
||||
|
||||
/** 设备类型 */
|
||||
@Excel(name = "设备类型")
|
||||
private String agvType;
|
||||
|
||||
/** 继续请求 */
|
||||
@Excel(name = "继续请求")
|
||||
private String request;
|
||||
|
||||
/** 结束时间 yyyy-MM-dd HH:mm:ss */
|
||||
@Excel(name = "结束时间 yyyy-MM-dd HH:mm:ss")
|
||||
private String finishTime;
|
||||
|
||||
/** wms托盘码/容器码 */
|
||||
@Excel(name = "wms托盘码/容器码")
|
||||
private String wmsTraycode;
|
||||
|
||||
/** wms任务号 */
|
||||
@Excel(name = "wms任务号")
|
||||
private String wmsTaskNo;
|
||||
|
||||
private String status;
|
||||
|
||||
private String taskCode;
|
||||
|
||||
private String wmsTaskType;
|
||||
|
||||
public String getWmsTaskType() {
|
||||
return wmsTaskType;
|
||||
}
|
||||
|
||||
public void setWmsTaskType(String wmsTaskType) {
|
||||
this.wmsTaskType = wmsTaskType;
|
||||
}
|
||||
|
||||
public String getTaskCode() {
|
||||
return taskCode;
|
||||
}
|
||||
|
||||
public void setTaskCode(String taskCode) {
|
||||
this.taskCode = taskCode;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setReqCode(String reqCode)
|
||||
{
|
||||
this.reqCode = reqCode;
|
||||
}
|
||||
|
||||
public String getReqCode()
|
||||
{
|
||||
return reqCode;
|
||||
}
|
||||
|
||||
public void setReqTime(String reqTime)
|
||||
{
|
||||
this.reqTime = reqTime;
|
||||
}
|
||||
|
||||
public String getReqTime()
|
||||
{
|
||||
return reqTime;
|
||||
}
|
||||
|
||||
public void setPositionCode1(String positionCode1)
|
||||
{
|
||||
this.positionCode1 = positionCode1;
|
||||
}
|
||||
|
||||
public String getPositionCode1()
|
||||
{
|
||||
return positionCode1;
|
||||
}
|
||||
|
||||
public void setPositionCode2(String positionCode2)
|
||||
{
|
||||
this.positionCode2 = positionCode2;
|
||||
}
|
||||
|
||||
public String getPositionCode2()
|
||||
{
|
||||
return positionCode2;
|
||||
}
|
||||
|
||||
public void setTaskType(String taskType)
|
||||
{
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public String getTaskType()
|
||||
{
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setCtnrType(String ctnrType)
|
||||
{
|
||||
this.ctnrType = ctnrType;
|
||||
}
|
||||
|
||||
public String getCtnrType()
|
||||
{
|
||||
return ctnrType;
|
||||
}
|
||||
|
||||
public void setCtnrCode(String ctnrCode)
|
||||
{
|
||||
this.ctnrCode = ctnrCode;
|
||||
}
|
||||
|
||||
public String getCtnrCode()
|
||||
{
|
||||
return ctnrCode;
|
||||
}
|
||||
|
||||
public void setCtnrNum(String ctnrNum)
|
||||
{
|
||||
this.ctnrNum = ctnrNum;
|
||||
}
|
||||
|
||||
public String getCtnrNum()
|
||||
{
|
||||
return ctnrNum;
|
||||
}
|
||||
|
||||
public void setTaskMode(String taskMode)
|
||||
{
|
||||
this.taskMode = taskMode;
|
||||
}
|
||||
|
||||
public String getTaskMode()
|
||||
{
|
||||
return taskMode;
|
||||
}
|
||||
|
||||
public void setPriority(String priority)
|
||||
{
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public String getPriority()
|
||||
{
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void setAgvType(String agvType)
|
||||
{
|
||||
this.agvType = agvType;
|
||||
}
|
||||
|
||||
public String getAgvType()
|
||||
{
|
||||
return agvType;
|
||||
}
|
||||
|
||||
public void setRequest(String request)
|
||||
{
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public String getRequest()
|
||||
{
|
||||
return request;
|
||||
}
|
||||
|
||||
public void setFinishTime(String finishTime)
|
||||
{
|
||||
this.finishTime = finishTime;
|
||||
}
|
||||
|
||||
public String getFinishTime()
|
||||
{
|
||||
return finishTime;
|
||||
}
|
||||
|
||||
public void setWmsTraycode(String wmsTraycode)
|
||||
{
|
||||
this.wmsTraycode = wmsTraycode;
|
||||
}
|
||||
|
||||
public String getWmsTraycode()
|
||||
{
|
||||
return wmsTraycode;
|
||||
}
|
||||
|
||||
public void setWmsTaskNo(String wmsTaskNo)
|
||||
{
|
||||
this.wmsTaskNo = wmsTaskNo;
|
||||
}
|
||||
|
||||
public String getWmsTaskNo()
|
||||
{
|
||||
return wmsTaskNo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("reqCode", getReqCode())
|
||||
.append("reqTime", getReqTime())
|
||||
.append("positionCode1", getPositionCode1())
|
||||
.append("positionCode2", getPositionCode2())
|
||||
.append("taskType", getTaskType())
|
||||
.append("ctnrType", getCtnrType())
|
||||
.append("ctnrCode", getCtnrCode())
|
||||
.append("ctnrNum", getCtnrNum())
|
||||
.append("taskMode", getTaskMode())
|
||||
.append("priority", getPriority())
|
||||
.append("agvType", getAgvType())
|
||||
.append("request", getRequest())
|
||||
.append("finishTime", getFinishTime())
|
||||
.append("wmsTraycode", getWmsTraycode())
|
||||
.append("wmsTaskNo", getWmsTaskNo())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
package com.ruoyi.device.agv.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* agv历史队列对象 agv_queue_finish
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public class AgvQueueFinish extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 请求编号 */
|
||||
private String reqCode;
|
||||
|
||||
/** 请求时间截 yyyy-MM-dd HH:mm:ss */
|
||||
@Excel(name = "请求时间截 yyyy-MM-dd HH:mm:ss")
|
||||
private String reqTime;
|
||||
|
||||
/** 起点 */
|
||||
@Excel(name = "起点 ")
|
||||
private String positionCode1;
|
||||
|
||||
/** 终点 */
|
||||
@Excel(name = "终点")
|
||||
private String positionCode2;
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型 ")
|
||||
private String taskType;
|
||||
|
||||
/** 容器类型 */
|
||||
@Excel(name = "容器类型")
|
||||
private String ctnrType;
|
||||
|
||||
/** 容器编号 */
|
||||
@Excel(name = "容器编号")
|
||||
private String ctnrCode;
|
||||
|
||||
/** 容器数量 */
|
||||
@Excel(name = "容器数量")
|
||||
private String ctnrNum;
|
||||
|
||||
/** 任务模式 */
|
||||
@Excel(name = "任务模式")
|
||||
private String taskMode;
|
||||
|
||||
/** 优先级 */
|
||||
@Excel(name = "优先级")
|
||||
private String priority;
|
||||
|
||||
/** 设备类型 */
|
||||
@Excel(name = "设备类型")
|
||||
private String agvType;
|
||||
|
||||
/** 继续请求 */
|
||||
@Excel(name = "继续请求")
|
||||
private String request;
|
||||
|
||||
/** 结束时间 yyyy-MM-dd HH:mm:ss */
|
||||
@Excel(name = "结束时间 yyyy-MM-dd HH:mm:ss")
|
||||
private String finishTime;
|
||||
|
||||
/** wms托盘码/容器码 */
|
||||
@Excel(name = "wms托盘码/容器码")
|
||||
private String wmsTraycode;
|
||||
|
||||
/** wms任务号 */
|
||||
@Excel(name = "wms任务号")
|
||||
private String wmsTaskNo;
|
||||
|
||||
public void setReqCode(String reqCode)
|
||||
{
|
||||
this.reqCode = reqCode;
|
||||
}
|
||||
|
||||
public String getReqCode()
|
||||
{
|
||||
return reqCode;
|
||||
}
|
||||
|
||||
public void setReqTime(String reqTime)
|
||||
{
|
||||
this.reqTime = reqTime;
|
||||
}
|
||||
|
||||
public String getReqTime()
|
||||
{
|
||||
return reqTime;
|
||||
}
|
||||
|
||||
public void setPositionCode1(String positionCode1)
|
||||
{
|
||||
this.positionCode1 = positionCode1;
|
||||
}
|
||||
|
||||
public String getPositionCode1()
|
||||
{
|
||||
return positionCode1;
|
||||
}
|
||||
|
||||
public void setPositionCode2(String positionCode2)
|
||||
{
|
||||
this.positionCode2 = positionCode2;
|
||||
}
|
||||
|
||||
public String getPositionCode2()
|
||||
{
|
||||
return positionCode2;
|
||||
}
|
||||
|
||||
public void setTaskType(String taskType)
|
||||
{
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public String getTaskType()
|
||||
{
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setCtnrType(String ctnrType)
|
||||
{
|
||||
this.ctnrType = ctnrType;
|
||||
}
|
||||
|
||||
public String getCtnrType()
|
||||
{
|
||||
return ctnrType;
|
||||
}
|
||||
|
||||
public void setCtnrCode(String ctnrCode)
|
||||
{
|
||||
this.ctnrCode = ctnrCode;
|
||||
}
|
||||
|
||||
public String getCtnrCode()
|
||||
{
|
||||
return ctnrCode;
|
||||
}
|
||||
|
||||
public void setCtnrNum(String ctnrNum)
|
||||
{
|
||||
this.ctnrNum = ctnrNum;
|
||||
}
|
||||
|
||||
public String getCtnrNum()
|
||||
{
|
||||
return ctnrNum;
|
||||
}
|
||||
|
||||
public void setTaskMode(String taskMode)
|
||||
{
|
||||
this.taskMode = taskMode;
|
||||
}
|
||||
|
||||
public String getTaskMode()
|
||||
{
|
||||
return taskMode;
|
||||
}
|
||||
|
||||
public void setPriority(String priority)
|
||||
{
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public String getPriority()
|
||||
{
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void setAgvType(String agvType)
|
||||
{
|
||||
this.agvType = agvType;
|
||||
}
|
||||
|
||||
public String getAgvType()
|
||||
{
|
||||
return agvType;
|
||||
}
|
||||
|
||||
public void setRequest(String request)
|
||||
{
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public String getRequest()
|
||||
{
|
||||
return request;
|
||||
}
|
||||
|
||||
public void setFinishTime(String finishTime)
|
||||
{
|
||||
this.finishTime = finishTime;
|
||||
}
|
||||
|
||||
public String getFinishTime()
|
||||
{
|
||||
return finishTime;
|
||||
}
|
||||
|
||||
public void setWmsTraycode(String wmsTraycode)
|
||||
{
|
||||
this.wmsTraycode = wmsTraycode;
|
||||
}
|
||||
|
||||
public String getWmsTraycode()
|
||||
{
|
||||
return wmsTraycode;
|
||||
}
|
||||
|
||||
public void setWmsTaskNo(String wmsTaskNo)
|
||||
{
|
||||
this.wmsTaskNo = wmsTaskNo;
|
||||
}
|
||||
|
||||
public String getWmsTaskNo()
|
||||
{
|
||||
return wmsTaskNo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("reqCode", getReqCode())
|
||||
.append("reqTime", getReqTime())
|
||||
.append("positionCode1", getPositionCode1())
|
||||
.append("positionCode2", getPositionCode2())
|
||||
.append("taskType", getTaskType())
|
||||
.append("ctnrType", getCtnrType())
|
||||
.append("ctnrCode", getCtnrCode())
|
||||
.append("ctnrNum", getCtnrNum())
|
||||
.append("taskMode", getTaskMode())
|
||||
.append("priority", getPriority())
|
||||
.append("agvType", getAgvType())
|
||||
.append("request", getRequest())
|
||||
.append("finishTime", getFinishTime())
|
||||
.append("wmsTraycode", getWmsTraycode())
|
||||
.append("wmsTaskNo", getWmsTaskNo())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.device.agv.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.agv.domain.AgvQueueFinish;
|
||||
|
||||
/**
|
||||
* agv历史队列Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public interface AgvQueueFinishMapper
|
||||
{
|
||||
/**
|
||||
* 查询agv历史队列
|
||||
*
|
||||
* @param reqCode agv历史队列主键
|
||||
* @return agv历史队列
|
||||
*/
|
||||
public AgvQueueFinish selectAgvQueueFinishByReqCode(String reqCode);
|
||||
|
||||
/**
|
||||
* 查询agv历史队列列表
|
||||
*
|
||||
* @param agvQueueFinish agv历史队列
|
||||
* @return agv历史队列集合
|
||||
*/
|
||||
public List<AgvQueueFinish> selectAgvQueueFinishList(AgvQueueFinish agvQueueFinish);
|
||||
|
||||
/**
|
||||
* 新增agv历史队列
|
||||
*
|
||||
* @param agvQueueFinish agv历史队列
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAgvQueueFinish(AgvQueueFinish agvQueueFinish);
|
||||
|
||||
/**
|
||||
* 修改agv历史队列
|
||||
*
|
||||
* @param agvQueueFinish agv历史队列
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAgvQueueFinish(AgvQueueFinish agvQueueFinish);
|
||||
|
||||
/**
|
||||
* 删除agv历史队列
|
||||
*
|
||||
* @param reqCode agv历史队列主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvQueueFinishByReqCode(String reqCode);
|
||||
|
||||
/**
|
||||
* 批量删除agv历史队列
|
||||
*
|
||||
* @param reqCodes 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvQueueFinishByReqCodes(String[] reqCodes);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.ruoyi.device.agv.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
|
||||
/**
|
||||
* AGV任务队列Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public interface AgvQueueMapper
|
||||
{
|
||||
/**
|
||||
* 查询AGV任务队列
|
||||
*
|
||||
* @param reqCode AGV任务队列主键
|
||||
* @return AGV任务队列
|
||||
*/
|
||||
public AgvQueue selectAgvQueueByReqCode(String reqCode);
|
||||
|
||||
/**
|
||||
* 查询AGV任务队列列表
|
||||
*
|
||||
* @param agvQueue AGV任务队列
|
||||
* @return AGV任务队列集合
|
||||
*/
|
||||
public List<AgvQueue> selectAgvQueueList(AgvQueue agvQueue);
|
||||
|
||||
/**
|
||||
* 新增AGV任务队列
|
||||
*
|
||||
* @param agvQueue AGV任务队列
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAgvQueue(AgvQueue agvQueue);
|
||||
|
||||
/**
|
||||
* 修改AGV任务队列
|
||||
*
|
||||
* @param agvQueue AGV任务队列
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAgvQueue(AgvQueue agvQueue);
|
||||
|
||||
/**
|
||||
* 删除AGV任务队列
|
||||
*
|
||||
* @param reqCode AGV任务队列主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvQueueByReqCode(String reqCode);
|
||||
|
||||
/**
|
||||
* 批量删除AGV任务队列
|
||||
*
|
||||
* @param reqCodes 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvQueueByReqCodes(String[] reqCodes);
|
||||
|
||||
/**
|
||||
* 根据任务单号获取agv队列
|
||||
* @param taskCode
|
||||
* @return
|
||||
*/
|
||||
AgvQueue selectAgvQueueByTaskCode(String taskCode);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.device.agv.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.agv.domain.AgvQueueFinish;
|
||||
|
||||
/**
|
||||
* agv历史队列Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public interface IAgvQueueFinishService
|
||||
{
|
||||
/**
|
||||
* 查询agv历史队列
|
||||
*
|
||||
* @param reqCode agv历史队列主键
|
||||
* @return agv历史队列
|
||||
*/
|
||||
public AgvQueueFinish selectAgvQueueFinishByReqCode(String reqCode);
|
||||
|
||||
/**
|
||||
* 查询agv历史队列列表
|
||||
*
|
||||
* @param agvQueueFinish agv历史队列
|
||||
* @return agv历史队列集合
|
||||
*/
|
||||
public List<AgvQueueFinish> selectAgvQueueFinishList(AgvQueueFinish agvQueueFinish);
|
||||
|
||||
/**
|
||||
* 新增agv历史队列
|
||||
*
|
||||
* @param agvQueueFinish agv历史队列
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAgvQueueFinish(AgvQueueFinish agvQueueFinish);
|
||||
|
||||
/**
|
||||
* 修改agv历史队列
|
||||
*
|
||||
* @param agvQueueFinish agv历史队列
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAgvQueueFinish(AgvQueueFinish agvQueueFinish);
|
||||
|
||||
/**
|
||||
* 批量删除agv历史队列
|
||||
*
|
||||
* @param reqCodes 需要删除的agv历史队列主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvQueueFinishByReqCodes(String[] reqCodes);
|
||||
|
||||
/**
|
||||
* 删除agv历史队列信息
|
||||
*
|
||||
* @param reqCode agv历史队列主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvQueueFinishByReqCode(String reqCode);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.ruoyi.device.agv.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
|
||||
/**
|
||||
* AGV任务队列Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public interface IAgvQueueService
|
||||
{
|
||||
/**
|
||||
* 查询AGV任务队列
|
||||
*
|
||||
* @param reqCode AGV任务队列主键
|
||||
* @return AGV任务队列
|
||||
*/
|
||||
public AgvQueue selectAgvQueueByReqCode(String reqCode);
|
||||
|
||||
/**
|
||||
* 查询AGV任务队列列表
|
||||
*
|
||||
* @param agvQueue AGV任务队列
|
||||
* @return AGV任务队列集合
|
||||
*/
|
||||
public List<AgvQueue> selectAgvQueueList(AgvQueue agvQueue);
|
||||
|
||||
/**
|
||||
* 新增AGV任务队列
|
||||
*
|
||||
* @param agvQueue AGV任务队列
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAgvQueue(AgvQueue agvQueue);
|
||||
|
||||
/**
|
||||
* 修改AGV任务队列
|
||||
*
|
||||
* @param agvQueue AGV任务队列
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAgvQueue(AgvQueue agvQueue);
|
||||
|
||||
/**
|
||||
* 批量删除AGV任务队列
|
||||
*
|
||||
* @param reqCodes 需要删除的AGV任务队列主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvQueueByReqCodes(String[] reqCodes);
|
||||
|
||||
/**
|
||||
* 删除AGV任务队列信息
|
||||
*
|
||||
* @param reqCode AGV任务队列主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvQueueByReqCode(String reqCode);
|
||||
|
||||
/**
|
||||
* 根据任务单号获取agv队列
|
||||
* @param taskCode
|
||||
* @return
|
||||
*/
|
||||
AgvQueue selectAgvQueueByTaskCode(String taskCode);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.ruoyi.device.agv.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.agv.mapper.AgvQueueFinishMapper;
|
||||
import com.ruoyi.device.agv.domain.AgvQueueFinish;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueFinishService;
|
||||
|
||||
/**
|
||||
* agv历史队列Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Service
|
||||
public class AgvQueueFinishServiceImpl implements IAgvQueueFinishService
|
||||
{
|
||||
@Autowired
|
||||
private AgvQueueFinishMapper agvQueueFinishMapper;
|
||||
|
||||
/**
|
||||
* 查询agv历史队列
|
||||
*
|
||||
* @param reqCode agv历史队列主键
|
||||
* @return agv历史队列
|
||||
*/
|
||||
@Override
|
||||
public AgvQueueFinish selectAgvQueueFinishByReqCode(String reqCode)
|
||||
{
|
||||
return agvQueueFinishMapper.selectAgvQueueFinishByReqCode(reqCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询agv历史队列列表
|
||||
*
|
||||
* @param agvQueueFinish agv历史队列
|
||||
* @return agv历史队列
|
||||
*/
|
||||
@Override
|
||||
public List<AgvQueueFinish> selectAgvQueueFinishList(AgvQueueFinish agvQueueFinish)
|
||||
{
|
||||
return agvQueueFinishMapper.selectAgvQueueFinishList(agvQueueFinish);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增agv历史队列
|
||||
*
|
||||
* @param agvQueueFinish agv历史队列
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAgvQueueFinish(AgvQueueFinish agvQueueFinish)
|
||||
{
|
||||
return agvQueueFinishMapper.insertAgvQueueFinish(agvQueueFinish);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改agv历史队列
|
||||
*
|
||||
* @param agvQueueFinish agv历史队列
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAgvQueueFinish(AgvQueueFinish agvQueueFinish)
|
||||
{
|
||||
return agvQueueFinishMapper.updateAgvQueueFinish(agvQueueFinish);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除agv历史队列
|
||||
*
|
||||
* @param reqCodes 需要删除的agv历史队列主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAgvQueueFinishByReqCodes(String[] reqCodes)
|
||||
{
|
||||
return agvQueueFinishMapper.deleteAgvQueueFinishByReqCodes(reqCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除agv历史队列信息
|
||||
*
|
||||
* @param reqCode agv历史队列主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAgvQueueFinishByReqCode(String reqCode)
|
||||
{
|
||||
return agvQueueFinishMapper.deleteAgvQueueFinishByReqCode(reqCode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.ruoyi.device.agv.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.agv.mapper.AgvQueueMapper;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
|
||||
/**
|
||||
* AGV任务队列Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Service
|
||||
public class AgvQueueServiceImpl implements IAgvQueueService
|
||||
{
|
||||
@Autowired
|
||||
private AgvQueueMapper agvQueueMapper;
|
||||
|
||||
/**
|
||||
* 查询AGV任务队列
|
||||
*
|
||||
* @param reqCode AGV任务队列主键
|
||||
* @return AGV任务队列
|
||||
*/
|
||||
@Override
|
||||
public AgvQueue selectAgvQueueByReqCode(String reqCode)
|
||||
{
|
||||
return agvQueueMapper.selectAgvQueueByReqCode(reqCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询AGV任务队列列表
|
||||
*
|
||||
* @param agvQueue AGV任务队列
|
||||
* @return AGV任务队列
|
||||
*/
|
||||
@Override
|
||||
public List<AgvQueue> selectAgvQueueList(AgvQueue agvQueue)
|
||||
{
|
||||
return agvQueueMapper.selectAgvQueueList(agvQueue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增AGV任务队列
|
||||
*
|
||||
* @param agvQueue AGV任务队列
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAgvQueue(AgvQueue agvQueue)
|
||||
{
|
||||
return agvQueueMapper.insertAgvQueue(agvQueue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改AGV任务队列
|
||||
*
|
||||
* @param agvQueue AGV任务队列
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAgvQueue(AgvQueue agvQueue)
|
||||
{
|
||||
return agvQueueMapper.updateAgvQueue(agvQueue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除AGV任务队列
|
||||
*
|
||||
* @param reqCodes 需要删除的AGV任务队列主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAgvQueueByReqCodes(String[] reqCodes)
|
||||
{
|
||||
return agvQueueMapper.deleteAgvQueueByReqCodes(reqCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除AGV任务队列信息
|
||||
*
|
||||
* @param reqCode AGV任务队列主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAgvQueueByReqCode(String reqCode)
|
||||
{
|
||||
return agvQueueMapper.deleteAgvQueueByReqCode(reqCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvQueue selectAgvQueueByTaskCode(String taskCode) {
|
||||
return agvQueueMapper.selectAgvQueueByTaskCode(taskCode);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.ruoyi.schedule;
|
||||
|
||||
import com.ruoyi.schedule.plc.PlcRead;
|
||||
import com.ruoyi.schedule.plc.domain.CustomThread;
|
||||
import com.ruoyi.schedule.plc.domain.SsjDevice;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.PlcConnectInfo;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.CustomThread;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Component
|
||||
@@ -18,8 +20,15 @@ public class ScheduleThread {
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
ConcurrentHashMap<String, SsjDevice> list = new ConcurrentHashMap<>();
|
||||
PlcRead plcRead = new PlcRead(list);
|
||||
String ip = "192.168.0.1";
|
||||
int port = 80;
|
||||
PlcConnectInfo ssjPlcConnectInfo = new PlcConnectInfo(ip, port);
|
||||
ConcurrentHashMap<String, SsjDevice>list = new ConcurrentHashMap<>();
|
||||
//获取要去取的输送机
|
||||
|
||||
|
||||
|
||||
PlcRead plcRead = new PlcRead(list,ssjPlcConnectInfo);
|
||||
Thread plcReadThread = new Thread(plcRead);
|
||||
customThread = new CustomThread(plcReadThread, plcRead);
|
||||
}
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
package com.ruoyi.schedule.data;
|
||||
|
||||
|
||||
import com.ruoyi.schedule.plc.domain.ConvPTLInRead;
|
||||
import com.ruoyi.schedule.plc.domain.ConvPTLOutRead;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.plc4x.java.PlcDriverManager;
|
||||
import org.apache.plc4x.java.api.PlcConnection;
|
||||
import org.apache.plc4x.java.api.messages.PlcReadRequest;
|
||||
import org.apache.plc4x.java.api.messages.PlcReadResponse;
|
||||
import org.apache.plc4x.java.api.types.PlcResponseCode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 获取输送机plc连接
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ConvConnection {
|
||||
|
||||
Integer convPortCount = 10;
|
||||
|
||||
String ipConv = "127.0.0.1";
|
||||
|
||||
PlcConnection convConnection;
|
||||
|
||||
/**
|
||||
* 初始化输送机plc连接
|
||||
*/
|
||||
@PostConstruct
|
||||
public void initializeConvConnection() {
|
||||
try {
|
||||
convConnection = new PlcDriverManager().getConnection("s7://" + ipConv);
|
||||
log.info("【输送机连接初始化】输送机连接成功!");
|
||||
}catch (Exception e){
|
||||
log.warn("【输送机连接初始化】输送机连接失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有PTL入口输送机状态参数
|
||||
* @return
|
||||
*/
|
||||
public List<ConvPTLInRead> getConvPTLIn() {
|
||||
|
||||
List<ConvPTLInRead> convPTLIn = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < convPortCount; i++) {
|
||||
try {
|
||||
PlcReadRequest.Builder builder = convConnection.readRequestBuilder();
|
||||
|
||||
builder.addItem("value-test","%M0.0:BOOL");
|
||||
builder.addItem("conv-inPostion","%DB501.DBW" + (0 + i * 30) + ":INT");
|
||||
// builder.addItem("conv-height","%DB501.DBW" + (2 + i * 30) + ":INT");
|
||||
builder.addItem("conv-isException","%DB501.DBD" + (4 + i * 30) + ":DINT");
|
||||
builder.addItem("conv-free","%DB501.DBW" + (6 + i * 30) + ":INT");
|
||||
builder.addItem("conv-taskId","%DB501.DBD" + (8 + i * 30) + ":INT");
|
||||
// builder.addItem("conv-palletId","%DB501.DBD" + (16 + i * 30) + ":STRING");
|
||||
|
||||
PlcReadRequest readRequest = builder.build();
|
||||
|
||||
PlcReadResponse response=readRequest.execute().get(2000, TimeUnit.MILLISECONDS);
|
||||
|
||||
if (response.getResponseCode("value-test") == PlcResponseCode.OK) {
|
||||
convPTLIn.get(i).setInPostion(response.getInteger("conv-inPostion"));
|
||||
// convPTLIn.get(i).setHeight(response.getInteger("conv-height"));
|
||||
convPTLIn.get(i).setIsException(response.getInteger("conv-isException"));
|
||||
convPTLIn.get(i).setFree(response.getInteger("conv-free"));
|
||||
convPTLIn.get(i).setTaskId(response.getString("conv-taskId"));
|
||||
// convPTLIn.get(i).setPalletId(response.getString("conv-palletId"));
|
||||
|
||||
}else{
|
||||
log.warn("【获取PTL拣选入口输送机状态】获取状态参数失败:" + response.getResponseCode("value-test"));
|
||||
return null;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("【获取PTL拣选入口输送机状态】获取状态参数失败:" + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return convPTLIn;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有PTL出口输送机状态参数
|
||||
* @return
|
||||
*/
|
||||
public List<ConvPTLOutRead> getConvPTLOut() {
|
||||
|
||||
List<ConvPTLOutRead> convPTLOut = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < convPortCount; i++) {
|
||||
try {
|
||||
PlcReadRequest.Builder builder = convConnection.readRequestBuilder();
|
||||
|
||||
builder.addItem("value-test","%M0.0:BOOL");
|
||||
builder.addItem("conv-inPostion","%DB501.DBW" + (0 + i * 30) + ":INT");
|
||||
builder.addItem("conv-height","%DB501.DBW" + (2 + i * 30) + ":INT");
|
||||
builder.addItem("conv-isException","%DB501.DBD" + (4 + i * 30) + ":DINT");
|
||||
builder.addItem("conv-free","%DB501.DBW" + (6 + i * 30) + ":INT");
|
||||
builder.addItem("conv-taskId","%DB501.DBD" + (8 + i * 30) + ":INT");
|
||||
builder.addItem("conv-palletId","%DB501.DBD" + (16 + i * 30) + ":STRING");
|
||||
|
||||
PlcReadRequest readRequest = builder.build();
|
||||
|
||||
PlcReadResponse response=readRequest.execute().get(2000, TimeUnit.MILLISECONDS);
|
||||
|
||||
if (response.getResponseCode("value-test") == PlcResponseCode.OK) {
|
||||
convPTLOut.get(i).setInPostion(response.getInteger("conv-inPostion"));
|
||||
convPTLOut.get(i).setHeight(response.getInteger("conv-height"));
|
||||
convPTLOut.get(i).setIsException(response.getInteger("conv-isException"));
|
||||
convPTLOut.get(i).setFree(response.getInteger("conv-free"));
|
||||
convPTLOut.get(i).setTaskId(response.getString("conv-taskId"));
|
||||
convPTLOut.get(i).setPalletId(response.getString("conv-palletId"));
|
||||
|
||||
}else{
|
||||
log.warn("【获取PTL拣选出口输送机状态】获取状态参数失败:" + response.getResponseCode("value-test"));
|
||||
return null;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("【获取PTL拣选出口输送机状态】获取状态参数失败:" + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return convPTLOut;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,460 +0,0 @@
|
||||
package com.ruoyi.schedule.job.mydojob.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 任务表对象 mydo_job
|
||||
*/
|
||||
public class MydoJob extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 任务ID */
|
||||
@Excel(name = "任务ID")
|
||||
private String jobId;
|
||||
|
||||
/** 任务状态 */
|
||||
@Excel(name = "任务状态",dictType = "mydo_job_status")
|
||||
private String status;
|
||||
|
||||
/** 上线类型 */
|
||||
@Excel(name = "上线类型",dictType = "on_line_type")
|
||||
private String onLineType;
|
||||
|
||||
/** 任务号 */
|
||||
@Excel(name = "任务号")
|
||||
private String taskNo;
|
||||
|
||||
/** 供应商ID */
|
||||
@Excel(name = "供应商ID")
|
||||
private String supplierId;
|
||||
@Excel(name = "供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
/** 客户ID */
|
||||
@Excel(name = "客户ID")
|
||||
private String customerId;
|
||||
@Excel(name = "客户名称")
|
||||
private String customerName;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门ID")
|
||||
private String departmentId;
|
||||
@Excel(name = "部门")
|
||||
private String departmentName;
|
||||
|
||||
/** 托盘码 */
|
||||
@Excel(name = "托盘码")
|
||||
private String trayCode;
|
||||
|
||||
/** 巷道ID */
|
||||
@Excel(name = "巷道ID")
|
||||
private String roadwayId;
|
||||
|
||||
/** 货位ID */
|
||||
@Excel(name = "货位ID")
|
||||
private String cargoSpaceId;
|
||||
@Excel(name = "货位名称")
|
||||
private String cargoSpaceName;
|
||||
|
||||
/** 目标巷道ID */
|
||||
@Excel(name = "目标巷道ID")
|
||||
private String targetRoadwayId;
|
||||
|
||||
/** 目标货位ID */
|
||||
@Excel(name = "目标货位ID")
|
||||
private String targetCargoSpaceId;
|
||||
@Excel(name = "目标货位名称")
|
||||
private String targetCargoSpaceName;
|
||||
|
||||
/** 产线ID */
|
||||
@Excel(name = "产线ID")
|
||||
private String lineId;
|
||||
|
||||
/** 车间ID */
|
||||
@Excel(name = "车间ID")
|
||||
private String workshopId;
|
||||
|
||||
/** 优先级 */
|
||||
@Excel(name = "优先级")
|
||||
private Long priority;
|
||||
|
||||
/** 执行阶段 */
|
||||
@Excel(name = "执行阶段",dictType = "execution_phase_type")
|
||||
private String executionPhase;
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型",dictType = "in_or_out_type")
|
||||
private String inOrOut;
|
||||
|
||||
|
||||
|
||||
/** 开始时间 */
|
||||
@Excel(name = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@Excel(name = "结束时间")
|
||||
private String finishTime;
|
||||
|
||||
/** 入口ID */
|
||||
@Excel(name = "入口ID")
|
||||
private String entranceId;
|
||||
|
||||
/** 出口ID */
|
||||
@Excel(name = "出口ID")
|
||||
private String exitId;
|
||||
|
||||
/** 班组ID */
|
||||
@Excel(name = "班组ID")
|
||||
private String classId;
|
||||
|
||||
/** 仓库ID */
|
||||
@Excel(name = "仓库ID")
|
||||
private String warehouseId;
|
||||
@Excel(name = "仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
/** 重分标记 */
|
||||
@Excel(name = "重分标记")
|
||||
private String faultFlag;
|
||||
|
||||
private String inOut;
|
||||
|
||||
|
||||
public String getDepartmentName() {
|
||||
return departmentName;
|
||||
}
|
||||
|
||||
public void setDepartmentName(String departmentName) {
|
||||
this.departmentName = departmentName;
|
||||
}
|
||||
|
||||
public String getWarehouseName() {
|
||||
return warehouseName;
|
||||
}
|
||||
|
||||
public void setWarehouseName(String warehouseName) {
|
||||
this.warehouseName = warehouseName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public String getInOut() {
|
||||
return inOut;
|
||||
}
|
||||
|
||||
public void setInOut(String inOut) {
|
||||
this.inOut = inOut;
|
||||
}
|
||||
|
||||
public void setJobId(String jobId)
|
||||
{
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
public String getJobId()
|
||||
{
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setOnLineType(String onLineType)
|
||||
{
|
||||
this.onLineType = onLineType;
|
||||
}
|
||||
|
||||
public String getOnLineType()
|
||||
{
|
||||
return onLineType;
|
||||
}
|
||||
|
||||
public void setTaskNo(String taskNo)
|
||||
{
|
||||
this.taskNo = taskNo;
|
||||
}
|
||||
|
||||
public String getTaskNo()
|
||||
{
|
||||
return taskNo;
|
||||
}
|
||||
|
||||
public void setSupplierId(String supplierId)
|
||||
{
|
||||
this.supplierId = supplierId;
|
||||
}
|
||||
|
||||
public String getSupplierId()
|
||||
{
|
||||
return supplierId;
|
||||
}
|
||||
|
||||
public void setCustomerId(String customerId)
|
||||
{
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
public String getCustomerId()
|
||||
{
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public void setDepartmentId(String departmentId)
|
||||
{
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
public String getDepartmentId()
|
||||
{
|
||||
return departmentId;
|
||||
}
|
||||
|
||||
public void setTrayCode(String trayCode)
|
||||
{
|
||||
this.trayCode = trayCode;
|
||||
}
|
||||
|
||||
public String getTrayCode()
|
||||
{
|
||||
return trayCode;
|
||||
}
|
||||
|
||||
public void setRoadwayId(String roadwayId)
|
||||
{
|
||||
this.roadwayId = roadwayId;
|
||||
}
|
||||
|
||||
public String getRoadwayId()
|
||||
{
|
||||
return roadwayId;
|
||||
}
|
||||
|
||||
public void setCargoSpaceId(String cargoSpaceId)
|
||||
{
|
||||
this.cargoSpaceId = cargoSpaceId;
|
||||
}
|
||||
|
||||
public String getCargoSpaceId()
|
||||
{
|
||||
return cargoSpaceId;
|
||||
}
|
||||
|
||||
public void setTargetRoadwayId(String targetRoadwayId)
|
||||
{
|
||||
this.targetRoadwayId = targetRoadwayId;
|
||||
}
|
||||
|
||||
public String getTargetRoadwayId()
|
||||
{
|
||||
return targetRoadwayId;
|
||||
}
|
||||
|
||||
public void setTargetCargoSpaceId(String targetCargoSpaceId)
|
||||
{
|
||||
this.targetCargoSpaceId = targetCargoSpaceId;
|
||||
}
|
||||
|
||||
public String getTargetCargoSpaceId()
|
||||
{
|
||||
return targetCargoSpaceId;
|
||||
}
|
||||
|
||||
public void setLineId(String lineId)
|
||||
{
|
||||
this.lineId = lineId;
|
||||
}
|
||||
|
||||
public String getLineId()
|
||||
{
|
||||
return lineId;
|
||||
}
|
||||
|
||||
public void setWorkshopId(String workshopId)
|
||||
{
|
||||
this.workshopId = workshopId;
|
||||
}
|
||||
|
||||
public String getWorkshopId()
|
||||
{
|
||||
return workshopId;
|
||||
}
|
||||
|
||||
public void setPriority(Long priority)
|
||||
{
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public Long getPriority()
|
||||
{
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void setExecutionPhase(String executionPhase)
|
||||
{
|
||||
this.executionPhase = executionPhase;
|
||||
}
|
||||
|
||||
public String getExecutionPhase()
|
||||
{
|
||||
return executionPhase;
|
||||
}
|
||||
|
||||
public void setInOrOut(String inOrOut)
|
||||
{
|
||||
this.inOrOut = inOrOut;
|
||||
}
|
||||
|
||||
public String getInOrOut()
|
||||
{
|
||||
return inOrOut;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime)
|
||||
{
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getStartTime()
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setFinishTime(String finishTime)
|
||||
{
|
||||
this.finishTime = finishTime;
|
||||
}
|
||||
|
||||
public String getFinishTime()
|
||||
{
|
||||
return finishTime;
|
||||
}
|
||||
|
||||
public void setEntranceId(String entranceId)
|
||||
{
|
||||
this.entranceId = entranceId;
|
||||
}
|
||||
|
||||
public String getEntranceId()
|
||||
{
|
||||
return entranceId;
|
||||
}
|
||||
|
||||
public void setExitId(String exitId)
|
||||
{
|
||||
this.exitId = exitId;
|
||||
}
|
||||
|
||||
public String getExitId()
|
||||
{
|
||||
return exitId;
|
||||
}
|
||||
|
||||
public void setClassId(String classId)
|
||||
{
|
||||
this.classId = classId;
|
||||
}
|
||||
|
||||
public String getClassId()
|
||||
{
|
||||
return classId;
|
||||
}
|
||||
|
||||
public void setWarehouseId(String warehouseId)
|
||||
{
|
||||
this.warehouseId = warehouseId;
|
||||
}
|
||||
|
||||
public String getWarehouseId()
|
||||
{
|
||||
return warehouseId;
|
||||
}
|
||||
|
||||
public void setFaultFlag(String faultFlag)
|
||||
{
|
||||
this.faultFlag = faultFlag;
|
||||
}
|
||||
|
||||
public String getFaultFlag()
|
||||
{
|
||||
return faultFlag;
|
||||
}
|
||||
|
||||
public String getSupplierName() {
|
||||
return supplierName;
|
||||
}
|
||||
|
||||
public void setSupplierName(String supplierName) {
|
||||
this.supplierName = supplierName;
|
||||
}
|
||||
|
||||
public String getCustomerName() {
|
||||
return customerName;
|
||||
}
|
||||
|
||||
public void setCustomerName(String customerName) {
|
||||
this.customerName = customerName;
|
||||
}
|
||||
|
||||
public String getCargoSpaceName() {
|
||||
return cargoSpaceName;
|
||||
}
|
||||
|
||||
public void setCargoSpaceName(String cargoSpaceName) {
|
||||
this.cargoSpaceName = cargoSpaceName;
|
||||
}
|
||||
|
||||
public String getTargetCargoSpaceName() {
|
||||
return targetCargoSpaceName;
|
||||
}
|
||||
|
||||
public void setTargetCargoSpaceName(String targetCargoSpaceName) {
|
||||
this.targetCargoSpaceName = targetCargoSpaceName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("jobId", getJobId())
|
||||
.append("status", getStatus())
|
||||
.append("onLineType", getOnLineType())
|
||||
.append("taskNo", getTaskNo())
|
||||
.append("supplierId", getSupplierId())
|
||||
.append("customerId", getCustomerId())
|
||||
.append("departmentId", getDepartmentId())
|
||||
.append("trayCode", getTrayCode())
|
||||
.append("roadwayId", getRoadwayId())
|
||||
.append("cargoSpaceId", getCargoSpaceId())
|
||||
.append("targetRoadwayId", getTargetRoadwayId())
|
||||
.append("targetCargoSpaceId", getTargetCargoSpaceId())
|
||||
.append("lineId", getLineId())
|
||||
.append("workshopId", getWorkshopId())
|
||||
.append("priority", getPriority())
|
||||
.append("executionPhase", getExecutionPhase())
|
||||
.append("inOrOut", getInOrOut())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("startTime", getStartTime())
|
||||
.append("finishTime", getFinishTime())
|
||||
.append("entranceId", getEntranceId())
|
||||
.append("exitId", getExitId())
|
||||
.append("classId", getClassId())
|
||||
.append("warehouseId", getWarehouseId())
|
||||
.append("faultFlag", getFaultFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.ruoyi.schedule.plc;
|
||||
|
||||
import com.ruoyi.schedule.plc.domain.SsjDevice;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class PlcRead implements Runnable{
|
||||
|
||||
private final Map<String, SsjDevice> deviceMap;
|
||||
private volatile boolean running = true;
|
||||
|
||||
public PlcRead(ConcurrentHashMap<String, SsjDevice> deviceMap) {
|
||||
this.deviceMap = deviceMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (running && !Thread.currentThread().isInterrupted()) {
|
||||
try {
|
||||
// 模拟PLC读取操作
|
||||
Thread.sleep(1000); // 模拟睡眠
|
||||
// TODO: 实际读取PLC设备数据逻辑
|
||||
} catch (InterruptedException e) {
|
||||
// 捕获中断异常,退出循环
|
||||
Thread.currentThread().interrupt(); // 重新设置中断标志
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void stopReading() {
|
||||
running = false;
|
||||
Thread.currentThread().interrupt(); // 主动中断线程
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.ruoyi.schedule.plc.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ConvBaseRead {
|
||||
|
||||
/**
|
||||
* 输送机编号
|
||||
*/
|
||||
private String convName;
|
||||
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 是否空闲
|
||||
* 1-空闲 0-占用
|
||||
*/
|
||||
private Integer free;
|
||||
|
||||
/**
|
||||
* 输送到位
|
||||
* 0-未到位 1-到位
|
||||
*/
|
||||
private Integer inPostion;
|
||||
|
||||
/**
|
||||
* 入库到位
|
||||
* 0-未到位 1-到位
|
||||
*/
|
||||
private Integer inPostionForStockIn;
|
||||
|
||||
/**
|
||||
* 出库到位
|
||||
* 0-未到位 1-到位
|
||||
*/
|
||||
private Integer inPostionForStockOut;
|
||||
|
||||
/**
|
||||
* 是否异常
|
||||
* 0-正常 1-异常
|
||||
*/
|
||||
private Integer isException;
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.ruoyi.schedule.plc.domain;
|
||||
|
||||
public class ConvBaseWrite {
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.ruoyi.schedule.plc.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* PTL拣选输送线入口输送机-读plc状态
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ConvPTLInRead extends ConvBaseRead {
|
||||
|
||||
/**
|
||||
* 外形检测-高度
|
||||
* 1-500mm 2-800mm 3-1000mm
|
||||
*/
|
||||
// private Integer height;
|
||||
|
||||
/**
|
||||
* 托盘码
|
||||
*/
|
||||
// private String palletId;
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.ruoyi.schedule.plc.domain;
|
||||
|
||||
public class ConvPTLInWrite extends ConvBaseWrite {
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.ruoyi.schedule.plc.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* PTL拣选输送线出口输送机
|
||||
*/
|
||||
@Data
|
||||
public class ConvPTLOutRead extends ConvBaseRead {
|
||||
|
||||
/**
|
||||
* 是否异常
|
||||
* 0-正常 1-异常
|
||||
*/
|
||||
private Integer isException;
|
||||
|
||||
/**
|
||||
* 外形检测-高度
|
||||
* 1-500mm 2-800mm 3-1000mm
|
||||
*/
|
||||
private Integer height;
|
||||
|
||||
/**
|
||||
* 托盘码
|
||||
*/
|
||||
private String palletId;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.ruoyi.schedule.plc.domain;
|
||||
|
||||
|
||||
public class ConvPTLOutWrite extends ConvBaseWrite{
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.ruoyi.schedule.plc.domain;
|
||||
|
||||
public class SsjDevice {
|
||||
}
|
||||
@@ -0,0 +1,568 @@
|
||||
package com.ruoyi.schedule.plcRead.ssj;
|
||||
|
||||
import HslCommunication.BasicFramework.SoftBasic;
|
||||
import HslCommunication.Core.Net.IReadWriteNet;
|
||||
import HslCommunication.Core.Types.OperateResult;
|
||||
import HslCommunication.Core.Types.OperateResultExOne;
|
||||
import HslCommunication.Profinet.Siemens.SiemensPLCS;
|
||||
import HslCommunication.Profinet.Siemens.SiemensS7Net;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.PlcConnectInfo;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import com.ruoyi.schedule.plcRead.util.ParseUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Slf4j
|
||||
public class PlcRead implements Runnable {
|
||||
|
||||
public static ConcurrentHashMap<String, SsjDevice> deviceMap;
|
||||
private volatile boolean running = true;
|
||||
|
||||
public SiemensS7Net siemensS7Net = null;
|
||||
public static IReadWriteNet readWriteNet = null;
|
||||
private String ip;
|
||||
private int port;
|
||||
private boolean success = false;
|
||||
|
||||
public PlcRead(ConcurrentHashMap<String, SsjDevice> deviceMap, PlcConnectInfo plcConnectInfo) {
|
||||
this.deviceMap = deviceMap;
|
||||
this.ip = plcConnectInfo.getIp();
|
||||
this.port = plcConnectInfo.getPort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (running && !Thread.currentThread().isInterrupted()) {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
|
||||
for (String ssjCode : deviceMap.keySet()) {
|
||||
SsjDevice ssjDevice = deviceMap.get(ssjCode);
|
||||
String readAddress = "";
|
||||
String writeAddress = "";
|
||||
|
||||
switch (ssjDevice.getDeviceCode()){
|
||||
case "G5011":
|
||||
// 处理 G5011
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5012":
|
||||
// 处理 G5012
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5016":
|
||||
// 处理 G5016
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5017":
|
||||
// 处理 G5017
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5002":
|
||||
// 处理 G5002
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5003":
|
||||
// 处理 G5003
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5007":
|
||||
// 处理 G5007
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5008":
|
||||
// 处理 G5008
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3011":
|
||||
// 处理 G3011
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3012":
|
||||
// 处理 G3012
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4007":
|
||||
// 处理 G4007
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4008":
|
||||
// 处理 G4008
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4016":
|
||||
// 处理 G4016
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4017":
|
||||
// 处理 G4017
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4011":
|
||||
// 处理 G4011
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4012":
|
||||
// 处理 G4012
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4002":
|
||||
// 处理 G4002
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4003":
|
||||
// 处理 G4003
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3002":
|
||||
// 处理 G3002
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3003":
|
||||
// 处理 G3003
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2002":
|
||||
// 处理 G2002
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2003":
|
||||
// 处理 G2003
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1011":
|
||||
// 处理 G1011
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3016":
|
||||
// 处理 G3016
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3017":
|
||||
// 处理 G3017
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3007":
|
||||
// 处理 G3007
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3008":
|
||||
// 处理 G3008
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1007":
|
||||
// 处理 G1007
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1008":
|
||||
// 处理 G1008
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1005":
|
||||
// 处理 G1005
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1001":
|
||||
// 处理 G1001
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1002":
|
||||
// 处理 G1002
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2010":
|
||||
// 处理 G2010
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2011":
|
||||
// 处理 G2011
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1003":
|
||||
// 处理 G1003
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1009":
|
||||
// 处理 G1009
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2012":
|
||||
// 处理 G2012
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3009":
|
||||
// 处理 G3009
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3018":
|
||||
// 处理 G3018
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4009":
|
||||
// 处理 G4009
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4018":
|
||||
// 处理 G4018
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5009":
|
||||
// 处理 G5009
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5018":
|
||||
// 处理 G5018
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5013":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5014":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5015":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5004":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5005":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5006":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4013":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4014":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4015":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4004":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4005":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4006":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1012":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3004":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3005":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3006":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3013":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3014":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3015":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1006":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2004":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2005":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2006":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2007":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2008":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2009":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1004":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G1010":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G2001":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3001":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G3010":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4001":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G4010":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5001":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
case "G5010":
|
||||
readAddress = "";
|
||||
writeAddress = "";
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (ssjDevice.getType()) {
|
||||
case "1":
|
||||
readPlcOutSsj(ssjDevice);
|
||||
break;
|
||||
case "2":
|
||||
readPlcPickSsj(ssjDevice);
|
||||
break;
|
||||
case "3":
|
||||
readPlcInSsj(ssjDevice);
|
||||
break;
|
||||
case "4":
|
||||
readPlcOtherSsj(ssjDevice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
// 捕获中断异常,退出循环
|
||||
Thread.currentThread().interrupt(); // 重新设置中断标志
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
log.info("********IP:" + this.ip + " port:" + this.port + "读取数据异常 " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他输送机
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcOtherSsj(SsjDevice ssjDevice) {
|
||||
ssjDevice.setPlcReadAddress(ssjDevice.getPlcReadAddress());
|
||||
ssjDevice.setPlcWriteAddress(ssjDevice.getPlcWriteAddress());
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcReadAddress(), Short.parseShort("18"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setEmpty(ParseUtil.optInt(0,ddsx1));
|
||||
ssjDevice.setInPlace(ParseUtil.optInt(1,ddsx1));
|
||||
ssjDevice.setEntryRequest(ParseUtil.optInt(2,ddsx1));
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(3,ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4,ddsx1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库输送机
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcInSsj(SsjDevice ssjDevice) {
|
||||
ssjDevice.setPlcReadAddress(ssjDevice.getPlcReadAddress());
|
||||
ssjDevice.setPlcWriteAddress(ssjDevice.getPlcWriteAddress());
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcReadAddress(), Short.parseShort("18"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setEmpty(ParseUtil.optInt(0,ddsx1));
|
||||
ssjDevice.setInPlace(ParseUtil.optInt(1,ddsx1));
|
||||
ssjDevice.setEntryRequest(ParseUtil.optInt(2,ddsx1));
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(3,ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4,ddsx1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拣选口输送机
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcPickSsj(SsjDevice ssjDevice) {
|
||||
ssjDevice.setPlcReadAddress(ssjDevice.getPlcReadAddress());
|
||||
ssjDevice.setPlcWriteAddress(ssjDevice.getPlcWriteAddress());
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcReadAddress(), Short.parseShort("18"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setEmpty(ParseUtil.optInt(0,ddsx1));
|
||||
ssjDevice.setInPlace(ParseUtil.optInt(1,ddsx1));
|
||||
ssjDevice.setEntryRequest(ParseUtil.optInt(2,ddsx1));
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(3,ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4,ddsx1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库输送机
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcOutSsj(SsjDevice ssjDevice) {
|
||||
ssjDevice.setPlcReadAddress(ssjDevice.getPlcReadAddress());
|
||||
ssjDevice.setPlcWriteAddress(ssjDevice.getPlcWriteAddress());
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcReadAddress(), Short.parseShort("18"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setEmpty(ParseUtil.optInt(0,ddsx1));
|
||||
ssjDevice.setInPlace(ParseUtil.optInt(1,ddsx1));
|
||||
ssjDevice.setEntryRequest(ParseUtil.optInt(2,ddsx1));
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(3,ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4,ddsx1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void stopReading() {
|
||||
running = false;
|
||||
Thread.currentThread().interrupt(); // 主动中断线程
|
||||
}
|
||||
|
||||
|
||||
void ConnectServer() {
|
||||
siemensS7Net = new SiemensS7Net(SiemensPLCS.S1500);
|
||||
try {
|
||||
siemensS7Net.setIpAddress(this.ip);
|
||||
siemensS7Net.setPort(this.port);
|
||||
siemensS7Net.setRack((byte) 0);
|
||||
siemensS7Net.setSlot((byte) 1);
|
||||
|
||||
OperateResult connect = siemensS7Net.ConnectServer();
|
||||
if (connect.IsSuccess) {
|
||||
setIsConnect(true);
|
||||
readWriteNet = siemensS7Net;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.info("********IP:" + this.ip + " port:" + this.port + "连接失败 " + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setIsConnect(boolean bflag) {
|
||||
if (!success) {
|
||||
success = bflag;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean IsConnect() {
|
||||
if (success) {
|
||||
return success;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void reConnect() {
|
||||
closeServer();
|
||||
ConnectServer();
|
||||
log.info("重新连接 SSJ-PLC");
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
if (readWriteNet != null) {
|
||||
siemensS7Net.ConnectClose();
|
||||
}
|
||||
setIsConnect(false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi.schedule.plc.domain;
|
||||
package com.ruoyi.schedule.plcRead.ssj.domain;
|
||||
|
||||
import com.ruoyi.schedule.plc.PlcRead;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.schedule.plcRead.ssj.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class PlcConnectInfo {
|
||||
|
||||
private String ip;
|
||||
private Integer port;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.schedule.plcRead.ssj.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SsjDevice {
|
||||
private String deviceCode;
|
||||
|
||||
private String plcReadAddress;
|
||||
|
||||
private String plcWriteAddress;
|
||||
//输送机类型:1-出库 2-拣选 3-入库 4-其他
|
||||
private String type;
|
||||
|
||||
//空闲 0-否 1-是
|
||||
private Integer empty;
|
||||
//到位 0-否 1-是
|
||||
private Integer inPlace;
|
||||
//入库请求 0-否 1-是
|
||||
private Integer entryRequest;
|
||||
//条码
|
||||
private String trayCode;
|
||||
//任务号
|
||||
private Integer taskNo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.ruoyi.schedule.plcRead.util;
|
||||
|
||||
|
||||
import HslCommunication.BasicFramework.SoftBasic;
|
||||
|
||||
/**
|
||||
* @author zn kai
|
||||
* @create 2021-06-28 14:04
|
||||
*/
|
||||
public class ParseUtil {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* short 16λתint
|
||||
* @param start
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static int optInt(int start, String data) {
|
||||
return Integer.parseInt(data.substring(start * 2, (start + 2) * 2), 16);
|
||||
}
|
||||
/**
|
||||
* int 16λתint
|
||||
* @param start
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static int optDInt(int start, String data) {
|
||||
return Integer.parseInt(data.substring(start * 2, (start + 4) * 2), 16);
|
||||
}
|
||||
/**
|
||||
* long 16λתlong
|
||||
* @param start
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static Long optLong(int start, String data) {
|
||||
return Long.parseLong(data.substring(start * 2, (start + 8) * 2), 16);
|
||||
}
|
||||
/**
|
||||
* string 16λתstring
|
||||
* @param start
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static String optString(int start, String data) {
|
||||
byte[] bytes = SoftBasic.HexStringToBytes(data.substring(start * 2, (start + 12) * 2));
|
||||
return Tools.bytetostringtool(bytes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,378 @@
|
||||
package com.ruoyi.schedule.plcRead.util;
|
||||
|
||||
import HslCommunication.BasicFramework.SoftBasic;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD><EFBFBD>:cyc16У<36><D0A3><EFBFBD><EFBFBD>
|
||||
*
|
||||
* @author zhu
|
||||
*/
|
||||
public class Tools implements Serializable {
|
||||
public static int Debug = 0x20;
|
||||
public final static int DEBUG_CONVERSIONS = 0x1000;
|
||||
public static final int DINT = 4;
|
||||
|
||||
public static final int INT = 2;
|
||||
|
||||
public static void main(String[] arg) {
|
||||
int jym = getJYM(1, 2, 3);
|
||||
System.out.println(jym);
|
||||
}
|
||||
|
||||
/*4<><34>CRC-16У<36><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷽<EFBFBD><E3B7BD><EFBFBD><EFBFBD>
|
||||
<20><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>ͼ<EFBFBD><CDBC>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD><EFBFBD>㷽<EFBFBD><E3B7BD>һ<EFBFBD>㶼<EFBFBD>ǣ<EFBFBD>
|
||||
<20><>1<EFBFBD><31><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4>1<EFBFBD><31>16λ<36>ļĴ<C4BC><C4B4><EFBFBD>Ϊʮ<CEAA><CAAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FFFF<46><46><EFBFBD><EFBFBD>ȫΪ1<CEAA><31><EFBFBD><EFBFBD><EFBFBD>ƴ˼Ĵ<CBBC><C4B4><EFBFBD>ΪCRC<52>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
<20><>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD>ѵ<EFBFBD>һ<EFBFBD><D2BB>8λ<38><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>ͨѶ<CDA8><D1B6>Ϣ֡<CFA2>ĵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֽڣ<D6BD><DAA3><EFBFBD>16λ<36><CEBB>CRC<52>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ĵ<EFBFBD>
|
||||
8λ<38><CEBB><EFBFBD><EFBFBD>ѽ<F2A3ACB0><D1BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CRC<52>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߰<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>ݲ<EFBFBD><DDB2>䣻
|
||||
<20><>3<EFBFBD><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CRC<52>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һλ<D2BB><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EEB2B9><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƺ<EFBFBD><C6BA><EFBFBD>Ƴ<EFBFBD>λ<EFBFBD><CEBB>
|
||||
<20><>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>λΪ0<CEAA><30><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD><EFBFBD><EFBFBD>һλ<D2BB><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>λΪ1<CEAA><31>CRC<52>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<20><>ʽA001<30><31>1010 0000 0000 0001<30><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<20><>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>4<EFBFBD><34>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD>Σ<EFBFBD><CEA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8λ<38><CEBB><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>
|
||||
<20><>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨѶ<CDA8><D1B6>Ϣ֡<CFA2><D6A1>һ<EFBFBD><D2BB><EFBFBD>ֽڵĴ<DAB5><C4B4><EFBFBD>
|
||||
<20><>7<EFBFBD><37><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨѶ<CDA8><D1B6>Ϣ֡<CFA2><D6A1><EFBFBD><EFBFBD><EFBFBD>ֽڰ<D6BD><DAB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺõ<F3A3ACB5><C3B5><EFBFBD>16λCRC<52>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ĸߡ<C4B8><DFA1><EFBFBD>
|
||||
<20>ֽڽ<D6BD><DABD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<20><>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>CRC<52>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>Ϊ<EFBFBD><CEAA>CRC<52>롣
|
||||
<20><><EFBFBD>ϼ<EFBFBD><CFBC>㲽<EFBFBD><E3B2BD><EFBFBD>еĶ<D0B5><C4B6><EFBFBD>ʽA001<30><31>8005<30><35>λ<EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD>
|
||||
<20><><EFBFBD><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD>0~256<35><36><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16λ<36>ļĴ<C4BC><C4B4><EFBFBD><EFBFBD>еĵͰ<C4B5>λ<EFBFBD><CEBB><EFBFBD>߰<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>0<EFBFBD><30>Ȼ<EFBFBD>üĴ<C3BC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ0XA001<30><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>4<EFBFBD><34><EFBFBD>裬ֱ<E8A3AC><D6B1><EFBFBD><EFBFBD>λȫ<CEBB><C8AB><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>е<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>DZ<EFBFBD><C7B1><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3>߰<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>Ͱ<EFBFBD>λ<EFBFBD>ֱ<D6B1>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>*/
|
||||
|
||||
|
||||
/**
|
||||
* ȫ<><C8AB>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ
|
||||
*
|
||||
* @param ints <20><><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD>
|
||||
* @return <20><><EFBFBD>ص<EFBFBD>int
|
||||
*/
|
||||
public static int getJYM(int... ints) {
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>תΪ32λ<32><CEBB><EFBFBD>ܺ<EFBFBD>תΪ<D7AA>ĸ<EFBFBD><C4B8>ֽڣ<D6BD><DAA3><EFBFBD><EFBFBD>תΪ<D7AA><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4
|
||||
int[] ints1 = new int[ints.length * 4];
|
||||
for (int i = 0; i < ints.length; i++) {
|
||||
int[] son;
|
||||
son = binaryTints(printBits(ints[i]));
|
||||
for (int j = 0; j < 4; j++) {
|
||||
int s = j + i * 4;
|
||||
ints1[s] = son[j];
|
||||
System.out.println(Arrays.toString(ints1));
|
||||
}
|
||||
}
|
||||
int a = 0;
|
||||
for (int j : ints1) {
|
||||
a = a + j;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hex <20>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
* @return a <20><><EFBFBD><EFBFBD>
|
||||
*/
|
||||
public static int[] binaryTints(String hex) {
|
||||
int[] a = new int[4];
|
||||
String hexString = change32(hex);
|
||||
a[0] = Integer.parseInt(hexString.substring(0, 8), 2);//<2F><>
|
||||
a[1] = Integer.parseInt(hexString.substring(8, 16), 2);
|
||||
a[2] = Integer.parseInt(hexString.substring(16, 24), 2);
|
||||
a[3] = Integer.parseInt(hexString.substring(24, 32), 2);
|
||||
return a;
|
||||
}
|
||||
|
||||
public static int[] binaryTints16(String hex) {
|
||||
int[] a = new int[2];
|
||||
String hexString = change16(hex);
|
||||
a[0] = Integer.parseInt(hexString.substring(0, 8), 2);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>תΪ<D7AA><CEAA><EFBFBD><EFBFBD>
|
||||
a[1] = Integer.parseInt(hexString.substring(8, 16), 2);
|
||||
return a;
|
||||
}
|
||||
|
||||
public static int binaryTints8(String hex) {
|
||||
int a;
|
||||
String hexString = change8(hex);
|
||||
a = Integer.parseInt(hexString.substring(0, 8), 2);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>תΪ<D7AA><CEAA><EFBFBD><EFBFBD>
|
||||
return a;
|
||||
}
|
||||
|
||||
public static int BytesToInt(int[] ss) {
|
||||
if (ss != null) {
|
||||
StringBuilder lString = new StringBuilder();
|
||||
for (int s : ss) {
|
||||
lString.append(change8(printBits(s)));
|
||||
}
|
||||
return Integer.parseInt(lString.toString(), 2);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD>ַ<EFBFBD>תΪ<D7AA><CEAA><EFBFBD><EFBFBD>
|
||||
**/
|
||||
public static int showAscii(char x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>תΪ<D7AA>ַ<EFBFBD>
|
||||
**/
|
||||
public static char showChar(int x) {
|
||||
return (char) x;
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
**/
|
||||
public static String byteToStringTool(byte[] aaa) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (byte b : aaa) {
|
||||
String x = Character.toString(showChar(b));
|
||||
builder.append(x);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>תΪ<D7AA><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
*/
|
||||
public static String printBits(int n) {
|
||||
return Integer.toBinaryString(n);
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>תΪ<D7AA><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
public static Float printFloat(int n) {
|
||||
return Float.intBitsToFloat(n);
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD><EFBFBD>8λ<38>Ӹ<EFBFBD>λ<EFBFBD><CEBB>0
|
||||
**/
|
||||
public static String change8(String value) {
|
||||
if (value != null && !value.equals("")) {
|
||||
StringBuilder ss = new StringBuilder(value);
|
||||
for (int i = 0; i < 8 - value.length(); i++) {
|
||||
ss.insert(0, "0");
|
||||
}
|
||||
return ss.toString();
|
||||
} else {
|
||||
return "00000000";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD><EFBFBD>32λ<32>Ӹ<EFBFBD>λ<EFBFBD><CEBB>0 4<><34><EFBFBD>ֽ<EFBFBD>
|
||||
**/
|
||||
public static String change32(String value) {
|
||||
if (value != null && !value.equals("")) {
|
||||
StringBuilder ss = new StringBuilder(value);
|
||||
for (int i = 0; i < 32 - value.length(); i++) {
|
||||
ss.insert(0, "0");
|
||||
}
|
||||
return ss.toString();
|
||||
} else {
|
||||
return "00000000000000000000000000000000";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD><EFBFBD>16λ<36>Ӹ<EFBFBD>λ<EFBFBD><CEBB>0 4<><34><EFBFBD>ֽ<EFBFBD>
|
||||
**/
|
||||
public static String change16(String value) {
|
||||
if (value != null && !value.equals("")) {
|
||||
StringBuilder ss = new StringBuilder(value);
|
||||
for (int i = 0; i < 16 - value.length(); i++) {
|
||||
ss.insert(0, "0");
|
||||
}
|
||||
return ss.toString();
|
||||
} else {
|
||||
return "0000000000000000";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///<2F>ֽ<EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
||||
public static int get(byte a1, byte a2, byte a3, byte a4, byte a5, byte a6, byte a7, byte a8,
|
||||
byte a9, byte a10, byte a11, byte a12, byte a13, byte a14, byte a15, byte a16,
|
||||
byte a17, byte a18, byte a19, byte a20, byte a21, byte a22, byte a23, byte a24, byte a25) {
|
||||
int[] ints = new int[25];
|
||||
ints[0] = binaryTints8(printBits(a1));
|
||||
ints[1] = binaryTints8(printBits(a2));
|
||||
ints[2] = binaryTints8(printBits(a3));
|
||||
ints[3] = binaryTints8(printBits(a4));
|
||||
ints[4] = binaryTints8(printBits(a5));
|
||||
ints[5] = binaryTints8(printBits(a6));
|
||||
ints[6] = binaryTints8(printBits(a7));
|
||||
ints[7] = binaryTints8(printBits(a8));
|
||||
ints[8] = binaryTints8(printBits(a9));
|
||||
ints[9] = binaryTints8(printBits(a10));
|
||||
ints[10] = binaryTints8(printBits(a11));
|
||||
ints[11] = binaryTints8(printBits(a12));
|
||||
ints[12] = binaryTints8(printBits(a13));
|
||||
ints[13] = binaryTints8(printBits(a14));
|
||||
ints[14] = binaryTints8(printBits(a15));
|
||||
ints[15] = binaryTints8(printBits(a16));
|
||||
ints[16] = binaryTints8(printBits(a17));
|
||||
ints[17] = binaryTints8(printBits(a18));
|
||||
ints[18] = binaryTints8(printBits(a19));
|
||||
ints[19] = binaryTints8(printBits(a20));
|
||||
ints[20] = binaryTints8(printBits(a21));
|
||||
ints[21] = binaryTints8(printBits(a22));
|
||||
ints[22] = binaryTints8(printBits(a23));
|
||||
ints[23] = binaryTints8(printBits(a24));
|
||||
ints[24] = binaryTints8(printBits(a25));
|
||||
for (int anInt : ints) System.out.print(anInt + " ");
|
||||
System.out.println();
|
||||
return BytesToInt(ints);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
public static byte[] int2byte(int res) {///Java<76><61>10<31><30><EFBFBD><EFBFBD>תbyte[]
|
||||
byte[] targets = new byte[4];
|
||||
|
||||
targets[3] = (byte) (res & 0xff);// <20><><EFBFBD>λ
|
||||
targets[2] = (byte) ((res >> 8) & 0xff);// <20>ε<EFBFBD>λ
|
||||
targets[1] = (byte) ((res >> 16) & 0xff);// <20>θ<EFBFBD>λ
|
||||
targets[0] = (byte) (res >>> 24);// <20><><EFBFBD>λ,<2C><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD>
|
||||
return targets;
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD>byte <20>ϲ<EFBFBD><CFB2><EFBFBD>һ<EFBFBD><D2BB>byte
|
||||
*/
|
||||
public static byte[] byteMerge(byte[]... values) {
|
||||
int length_byte = 0;
|
||||
for (byte[] value : values) {
|
||||
length_byte += value.length;
|
||||
}
|
||||
byte[] all_byte = new byte[length_byte];
|
||||
int countLength = 0;
|
||||
for (byte[] b : values) {
|
||||
System.arraycopy(b, 0, all_byte, countLength, b.length);
|
||||
countLength += b.length;
|
||||
}
|
||||
return all_byte;
|
||||
}
|
||||
|
||||
/** ???????????**/
|
||||
public static String bytetostringtool(byte[] aaa) {
|
||||
String tptm = "";
|
||||
for(int i=0;i<aaa.length;i++){
|
||||
//System.out.println("??????:for:"+aaa[i]);
|
||||
String x = Character.toString(showChar(aaa[i]));
|
||||
char ddd=showChar(aaa[i]);
|
||||
tptm=tptm+x;
|
||||
//System.out.println(tptm);
|
||||
}
|
||||
if(tptm.length() == 0 || tptm.equals("")){
|
||||
return "00000000";
|
||||
}else {
|
||||
return tptm;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* int תbyte
|
||||
*/
|
||||
public static byte[] intToBytes(int value, int len) {
|
||||
byte[] b = new byte[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
b[len - i - 1] = (byte) ((value >> 8 * i) & 0xff);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//<2F>·<EFBFBD><C2B7>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
public static byte[] sendDataToDevice(long taskNo,String trayCode, int...ints){
|
||||
int length = 0;
|
||||
byte[] xfData = null;
|
||||
if (trayCode == null){
|
||||
length = 4 + (ints.length * 2);
|
||||
xfData = new byte[length];
|
||||
byte[] RWH = new byte[4];
|
||||
RWH = Tools.int2byte((int) taskNo);
|
||||
for (int i = 0; i < length; i++){
|
||||
if (i < 4){
|
||||
xfData[i] = RWH[i];
|
||||
} else {
|
||||
if (i % 2 == 0){
|
||||
byte[] param = new byte[2];
|
||||
param = intbyte(ints[(i - 4) / 2]);
|
||||
xfData[i] = param[0];
|
||||
xfData[i + 1] = param[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
length = 12 + (ints.length * 2);
|
||||
xfData = new byte[length];
|
||||
byte[] RWH = new byte[4];
|
||||
RWH = Tools.int2byte((int) taskNo);
|
||||
byte[] tCode = new byte[8];
|
||||
if ("".equals(trayCode)){
|
||||
for (int i = 0;i < tCode.length;i++){
|
||||
tCode[i] = 0;
|
||||
}
|
||||
}else {
|
||||
byte[] code = trayCode.getBytes();
|
||||
for (int i = 0; i < tCode.length; i++) {
|
||||
tCode[i] = code[i];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i< length; i++){
|
||||
if (i < 4){
|
||||
xfData[i] = RWH[i];
|
||||
} else if (i > 3 && i< 12) {
|
||||
xfData[i] = tCode[i - 4];
|
||||
} else {
|
||||
if (i % 2 == 0){
|
||||
byte[] param = new byte[2];
|
||||
param = intbyte(ints[(i - 12) / 2]);
|
||||
xfData[i] = param[0];
|
||||
xfData[i + 1] = param[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return xfData;
|
||||
}
|
||||
|
||||
/**
|
||||
* <20>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
*/
|
||||
public static String byteToString(String substring) {
|
||||
return new String(SoftBasic.HexStringToBytes(substring), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getDate() {
|
||||
Date t = new Date();
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return df.format(t);
|
||||
}
|
||||
|
||||
//int ת2<D7AA>ֽ<EFBFBD>
|
||||
public static byte[] intbyte(int res) {///Java<76><61>10<31><30><EFBFBD><EFBFBD>תbyte[]
|
||||
byte[] targets = new byte[2];
|
||||
targets[1] = (byte) ((res >> 0) & 0xff);// <20>θ<EFBFBD>λ
|
||||
targets[0] = (byte) (res >>> 8);// <20><><EFBFBD>λ,<2C><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD>
|
||||
return targets;
|
||||
}
|
||||
|
||||
public static int[] binarysToints(String hex){
|
||||
int[] a = new int[4];
|
||||
String hexString = change32(hex);
|
||||
a[0] = Integer.parseInt(hexString.substring(0,8),2);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>תΪ<D7AA><CEAA><EFBFBD><EFBFBD>
|
||||
a[1] = Integer.parseInt(hexString.substring(8,16),2);
|
||||
a[2] = Integer.parseInt(hexString.substring(16,24),2);
|
||||
a[3] = Integer.parseInt(hexString.substring(24,32),2);
|
||||
return a;
|
||||
}
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
package com.ruoyi.schedule.scheduleTask;
|
||||
|
||||
import cn.hutool.Hutool;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.Constant;
|
||||
import com.ruoyi.common.TaskStatusCode;
|
||||
import com.ruoyi.common.TaskType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.ruoyi.device.agv.domain.ResponseBase;
|
||||
import com.ruoyi.device.agv.domain.genAgvSchedulingTask.GenAgvSchedulingTaskRequest;
|
||||
import com.ruoyi.device.agv.domain.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||
import com.ruoyi.device.agv.domain.genAgvSchedulingTask.PositionCodeData;
|
||||
import com.ruoyi.device.agv.domain.queryTaskStatus.TaskStatusData;
|
||||
import com.ruoyi.schedule.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.schedule.task.domain.WcsTask;
|
||||
import com.ruoyi.schedule.task.mapper.WcsTaskMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 向AGV/CTU下发指令
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class Execution {
|
||||
|
||||
@Autowired
|
||||
WcsTaskMapper wcsTaskMapper;
|
||||
|
||||
/**
|
||||
* 查询是否有wcs任务
|
||||
*/
|
||||
// @PostConstruct
|
||||
public List<MydoJob> getmydoJob(){
|
||||
|
||||
String url = Constant.BASEURL + "/job/inmydoJob/listAll";
|
||||
|
||||
HttpResponse response = HttpRequest.get(url).execute();
|
||||
|
||||
List<MydoJob> mydoJobs = JSON.parseArray(response.body(), MydoJob.class);
|
||||
|
||||
return mydoJobs;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有wcs任务并请求下发
|
||||
*/
|
||||
public void executeTask(){
|
||||
|
||||
//查询实时任务表获取所有【待执行】任务
|
||||
LambdaQueryWrapper<WcsTask> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(WcsTask::getTaskStatus, TaskStatusCode.TASK_READY);
|
||||
List<WcsTask> tasks = wcsTaskMapper.selectList(queryWrapper);
|
||||
|
||||
//无【待执行】任务
|
||||
if (tasks.size() == 0) return;
|
||||
|
||||
//请求agv/ctu下发指令
|
||||
GenAgvSchedulingTaskRequest request = new GenAgvSchedulingTaskRequest();
|
||||
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
|
||||
//判断任务类型
|
||||
switch (tasks.get(i).getTaskType()) {
|
||||
case TaskType.CONV_STOCKIN:
|
||||
//todo 是否要处理输送线取货工位有多个料箱的情况
|
||||
//todo 是否要处理输送线取货工位有多个料箱的情况
|
||||
|
||||
|
||||
request.setReqCode(UUID.randomUUID().toString().replace("-", ""));
|
||||
|
||||
//设备执行任务内置任务类型初始化
|
||||
switch (tasks.get(i).getTaskType()) {
|
||||
case "1":
|
||||
request.setTaskTyp("F12");
|
||||
break;
|
||||
case "2":
|
||||
request.setTaskTyp("F11");
|
||||
break;
|
||||
default:
|
||||
log.warn("【向设备下发任务请求】TaskTyp:{},生成任务的请求参数错误,异常的任务类型!", request.getTaskTyp());
|
||||
return;
|
||||
}
|
||||
|
||||
//todo 了解CTU货架与工作台输送过程中是否需要另外下发取放料箱的任务
|
||||
//todo 了解CTU货架与工作台输送过程中是否需要另外下发取放料箱的任务
|
||||
|
||||
//添加路径(未测试)
|
||||
//todo 了解AGV/CTU路径的格式/规则
|
||||
//todo 了解AGV/CTU路径的格式/规则
|
||||
List<PositionCodeData> path = new ArrayList<>();
|
||||
path.add(new PositionCodeData(tasks.get(i).getSourceLocation(),"05"));
|
||||
path.add(new PositionCodeData(tasks.get(i).getTargetLocation(),"05"));
|
||||
request.setPositionCodePath(path);
|
||||
|
||||
//wcs任务号---设备任务编号
|
||||
request.setTaskCode(tasks.get(i).getTaskId());
|
||||
|
||||
|
||||
//todo 上层平台是否有【校验料箱是否可入库】接口可用
|
||||
//todo 上层平台是否有【校验料箱是否可入库】接口可用
|
||||
|
||||
|
||||
//todo 是否需要单独请求取放料箱接口
|
||||
//todo 是否需要单独请求取放料箱接口
|
||||
|
||||
break;
|
||||
case TaskType.CONV_STOCKOUT_SINGLE_GROUP:
|
||||
|
||||
break;
|
||||
case TaskType.CONV_STOCKOUT_SEQUENCE:
|
||||
|
||||
break;
|
||||
case TaskType.AGV_MOVE:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//下发成功---更新【任务状态】为下发成功
|
||||
if (sendCommand(request)){
|
||||
tasks.get(i).setTaskStatus(TaskStatusCode.TASK_SEND_SUCCESS);
|
||||
wcsTaskMapper.updateWcsTask(tasks.get(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向AGV/CTU请求下发指令
|
||||
* @param request 请求对象
|
||||
* @return
|
||||
*/
|
||||
public boolean sendCommand(GenAgvSchedulingTaskRequest request) {
|
||||
|
||||
//下发校验
|
||||
if (checkForSendCommand(request)) return false;
|
||||
|
||||
String jsonString = JSON.toJSONString(request);
|
||||
|
||||
//请求源数据输出日志
|
||||
log.info("【下发设备指令】" + jsonString);
|
||||
|
||||
//请求接口
|
||||
HttpResponse response = HttpRequest.post(Constant.BASEURL_REST + "genAgvSchedulingTask")
|
||||
.body(jsonString)
|
||||
.header("Content-Type", "application/json")
|
||||
.execute();
|
||||
|
||||
//获取响应对象
|
||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = JSON.parseObject(response.body(), GenAgvSchedulingTaskResponse.class);
|
||||
|
||||
//返回请求编号校验
|
||||
if (genAgvSchedulingTaskResponse.getReqCode() != request.getReqCode()) {
|
||||
log.error("【下发设备任务】下发任务失败,请求编号错误不一致!");
|
||||
return false;
|
||||
}
|
||||
|
||||
//返回码错误
|
||||
if (genAgvSchedulingTaskResponse.getCode() != 0 ) {
|
||||
if (genAgvSchedulingTaskResponse.getMessage() == ""){
|
||||
log.error("【下发设备任务】下发任务失败,发生了未知错误");
|
||||
}else{
|
||||
log.error("【下发设备任务】下发任务失败,{}", genAgvSchedulingTaskResponse.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下发指令校验
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public boolean checkForSendCommand(GenAgvSchedulingTaskRequest request){
|
||||
//todo:请求信息校验
|
||||
//1.reqCode空
|
||||
if (StringUtils.isBlank(request.getReqCode())){
|
||||
log.warn("【生成AGV任务请求接口】---请求异常,reqCode为空!---");
|
||||
return false;
|
||||
}
|
||||
|
||||
//2.wbCode和positionCodePath至少填写其中一项,以确定任务中的位置信息。若任务中需要指定多个位置信息,如起点和终点信息等,请使用positionCodePath
|
||||
if (StringUtils.isBlank(request.getWbCode()) && request.getPositionCodePath().size() < 1){
|
||||
log.warn("【生成AGV任务请求接口】---请求异常,wbCode和positionCodePath至少填写其中一项!---");
|
||||
return false;
|
||||
}
|
||||
|
||||
//3.当前区域AGV/CTU是否已存在任务
|
||||
//todo 请求获取设备状态
|
||||
if (true){
|
||||
log.warn("【生成AGV任务请求接口】---当前设备已存在执行中的任务!---");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.ruoyi.schedule.scheduleTask;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.Constant;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.device.agv.domain.genAgvSchedulingTask.GenAgvSchedulingTaskRequest;
|
||||
import com.ruoyi.device.agv.domain.genAgvSchedulingTask.PositionCodeData;
|
||||
import com.ruoyi.schedule.data.ConvConnection;
|
||||
import com.ruoyi.schedule.plc.domain.ConvPTLInRead;
|
||||
import com.ruoyi.schedule.plc.domain.ConvPTLOutRead;
|
||||
import com.ruoyi.schedule.task.domain.WcsTask;
|
||||
import com.ruoyi.schedule.task.service.IWcsTaskService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取任务生成AGV指令
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class Generation {
|
||||
|
||||
@Autowired
|
||||
ConvConnection conv;
|
||||
|
||||
@Autowired
|
||||
Execution execution;
|
||||
|
||||
@Autowired
|
||||
IWcsTaskService iWcsTaskService;
|
||||
|
||||
public void generateTask() {
|
||||
|
||||
//=========================CTU入库(PTL拣选出口到位)=========================
|
||||
List<ConvPTLOutRead> convPTLOutReads=conv.getConvPTLOut();
|
||||
|
||||
//轮询输送机状态
|
||||
for (int i = 0; i < convPTLOutReads.size(); i++) {
|
||||
|
||||
//PTL出口输送机到位
|
||||
//条码不为空 && 存在任务号 && 设备占用(非空闲)
|
||||
if (StringUtils.isBlank(convPTLOutReads.get(i).getPalletId()) &&
|
||||
StringUtils.isBlank(convPTLOutReads.get(i).getTaskId()) &&
|
||||
convPTLOutReads.get(i).getFree() == 0) {
|
||||
|
||||
|
||||
//todo 请求wms获取调度任务 或 wms推送调度任务(请求wcs接口)
|
||||
//todo 有无其他任务字段校验
|
||||
|
||||
// HttpResponse response = HttpRequest.get(Constant.BASEURL + "/job/inmydoJob/getTaskCount").execute();
|
||||
// Integer count = JSON.parseObject(response.body(), Integer.class);
|
||||
//
|
||||
// WcsTask task = new WcsTask();
|
||||
//
|
||||
// iWcsTaskService.insertWcsTask(task);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//=========================CTU出库(PTL拣选入口空)=========================
|
||||
List<ConvPTLInRead> convPTLInReads=conv.getConvPTLIn();
|
||||
|
||||
for (int i = 0; i < convPTLInReads.size(); i++) {
|
||||
|
||||
//PTL入口输送机空位
|
||||
//设备空闲 && 输送机任务号空
|
||||
if (convPTLInReads.get(i).getFree() == 1 && StringUtils.isBlank(convPTLInReads.get(i).getTaskId())){
|
||||
//todo 请求wms获取调度任务 或 wms推送调度任务(请求wcs接口)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=========================获取PTL拣选工位出口状态---【CTU入库】=========================
|
||||
public List<ConvPTLOutRead> getConvPTLOutRead() {
|
||||
|
||||
List<ConvPTLOutRead> convPTLOutReads = conv.getConvPTLOut();
|
||||
|
||||
//轮询输送机状态
|
||||
for (int i = 0; i < convPTLOutReads.size(); i++) {
|
||||
|
||||
//条码不为空 && 存在任务号 && 设备占用(非空闲)
|
||||
if (StringUtils.isBlank(convPTLOutReads.get(i).getPalletId()) && StringUtils.isBlank(convPTLOutReads.get(i).getTaskId()) && convPTLOutReads.get(i).getFree() == 0) {
|
||||
|
||||
//查找mydoJob是否存在该条码的任务
|
||||
//todo 有无其他任务字段校验
|
||||
HttpResponse response = HttpRequest.get(Constant.BASEURL + "/job/inmydoJob/getTaskCount").execute();
|
||||
Integer count = JSON.parseObject(response.body(), Integer.class);
|
||||
|
||||
WcsTask task = new WcsTask();
|
||||
|
||||
iWcsTaskService.insertWcsTask(task);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return convPTLOutReads;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package com.ruoyi.schedule.scheduleTask;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.Constant;
|
||||
import com.ruoyi.common.TaskStatusCode;
|
||||
import com.ruoyi.device.agv.domain.queryTaskStatus.QueryTaskStatusRequest;
|
||||
import com.ruoyi.device.agv.domain.queryTaskStatus.QueryTaskStatusResponse;
|
||||
import com.ruoyi.device.agv.domain.queryTaskStatus.TaskStatusData;
|
||||
import com.ruoyi.schedule.task.domain.WcsTask;
|
||||
import com.ruoyi.schedule.task.mapper.WcsTaskMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通过【查询任务状态】接口获取当前任务的任务状态(待执行/执行中/结束...)
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class StatusUpdate {
|
||||
|
||||
@Autowired
|
||||
WcsTaskMapper wcsTaskMapper;
|
||||
|
||||
|
||||
public void statusUpdate() {
|
||||
|
||||
//查询实时任务表获取所有【下发成功】任务
|
||||
LambdaQueryWrapper<WcsTask> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.ne(WcsTask::getTaskStatus, TaskStatusCode.TASK_READY);
|
||||
List<WcsTask> tasks = wcsTaskMapper.selectList(queryWrapper);
|
||||
|
||||
if (tasks.size() == 0 || tasks == null) return;
|
||||
|
||||
//wcs本地任务轮询
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
//查询【设备任务状态】接口是否已有该任务号
|
||||
HttpResponse response = HttpRequest.post(Constant.BASEURL + "/queryTaskStatus")
|
||||
.body(JSON.toJSONString(new QueryTaskStatusRequest()))
|
||||
.execute();
|
||||
QueryTaskStatusResponse queryTaskStatusResponse = JSON.parseObject(response.body(), QueryTaskStatusResponse.class);
|
||||
List<TaskStatusData> deviceTasks = queryTaskStatusResponse.getData();
|
||||
|
||||
if (deviceTasks.size() == 0 || deviceTasks == null) return;
|
||||
|
||||
//接口查询的AGV/CTU设备任务轮询
|
||||
for (int j = 0; j < deviceTasks.size(); j++) {
|
||||
|
||||
//wcs任务记录的任务号与接口查询的任务号匹配
|
||||
if (tasks.get(i).getTaskId() != deviceTasks.get(j).getTaskCode()) continue;
|
||||
|
||||
switch (deviceTasks.get(j).getTaskStatus()) {
|
||||
case "1":
|
||||
//【任务状态】更新为已创建
|
||||
if (tasks.get(j).getTaskStatus() == TaskStatusCode.TASK_SEND_SUCCESS && tasks.get(j).getTaskStatus() != TaskStatusCode.TASK_CREATED) {
|
||||
tasks.get(j).setTaskStatus(TaskStatusCode.TASK_CREATED);
|
||||
wcsTaskMapper.updateWcsTask(tasks.get(i));
|
||||
}
|
||||
break;
|
||||
case "2"://【任务状态】更新为执行中
|
||||
if (tasks.get(j).getTaskStatus() == TaskStatusCode.TASK_CREATED && tasks.get(j).getTaskStatus() != TaskStatusCode.TASK_RUNNING) {
|
||||
tasks.get(j).setTaskStatus(TaskStatusCode.TASK_RUNNING);
|
||||
//更新【调度时间】
|
||||
tasks.get(j).setScheduleTime(LocalDateTime.now());
|
||||
wcsTaskMapper.updateWcsTask(tasks.get(i));
|
||||
}
|
||||
break;
|
||||
case "5"://【任务状态】更新为已取消
|
||||
if ((tasks.get(j).getTaskStatus() == TaskStatusCode.TASK_CREATED ||
|
||||
tasks.get(j).getTaskStatus() == TaskStatusCode.TASK_RUNNING) &&
|
||||
tasks.get(j).getTaskStatus() != TaskStatusCode.TASK_CANCEL) {
|
||||
tasks.get(j).setTaskStatus(TaskStatusCode.TASK_CANCEL);
|
||||
wcsTaskMapper.updateWcsTask(tasks.get(i));
|
||||
}
|
||||
break;
|
||||
case "9"://【任务状态】更新为已结束
|
||||
if (tasks.get(j).getTaskStatus() != TaskStatusCode.TASK_FINISH) {
|
||||
tasks.get(j).setTaskStatus(TaskStatusCode.TASK_FINISH);
|
||||
wcsTaskMapper.updateWcsTask(tasks.get(j));
|
||||
}
|
||||
break;
|
||||
case "10"://【任务状态】更新为被中断
|
||||
if (tasks.get(j).getTaskStatus() != TaskStatusCode.TASK_INTERUPTED) {
|
||||
tasks.get(j).setTaskStatus(TaskStatusCode.TASK_INTERUPTED);
|
||||
wcsTaskMapper.updateWcsTask(tasks.get(j));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.ruoyi.schedule.scheduleTask;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.TaskStatusCode;
|
||||
import com.ruoyi.schedule.task.domain.WcsTask;
|
||||
import com.ruoyi.schedule.task.mapper.WcsTaskMapper;
|
||||
import com.ruoyi.schedule.taskHistory.domain.WcsTaskHistory;
|
||||
import com.ruoyi.schedule.taskHistory.mapper.WcsTaskHistoryMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class TaskFinish {
|
||||
|
||||
@Autowired
|
||||
WcsTaskMapper wcsTaskMapper;
|
||||
|
||||
@Autowired
|
||||
WcsTaskHistoryMapper wcsTaskHistoryMapper;
|
||||
|
||||
public void taskFinish() {
|
||||
|
||||
//查询实时任务表获取所有【已结束】,【已取消】和手动处理的任务任务
|
||||
LambdaQueryWrapper<WcsTask> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(WcsTask::getTaskStatus, TaskStatusCode.TASK_FINISH)
|
||||
.or()
|
||||
.eq(WcsTask::getTaskStatus, TaskStatusCode.TASK_CANCEL)
|
||||
.or()
|
||||
.eq(WcsTask::getTaskStatus, TaskStatusCode.TASK_FINISH_MANUAL)
|
||||
.or()
|
||||
.eq(WcsTask::getTaskStatus, TaskStatusCode.TASK_CANCEL_MANUAL);;
|
||||
List<WcsTask> tasks = wcsTaskMapper.selectList(queryWrapper);
|
||||
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
|
||||
//todo 任务完成/取消请求wms
|
||||
//todo 任务完成/取消请求wms
|
||||
//todo 任务完成/取消请求wms
|
||||
|
||||
|
||||
|
||||
WcsTaskHistory wcsTaskHistory = new WcsTaskHistory();
|
||||
BeanUtils.copyProperties(tasks.get(i), wcsTaskHistory);
|
||||
wcsTaskHistory.setFinishTime(LocalDateTime.now());
|
||||
|
||||
//向历史记录添加任务数据
|
||||
wcsTaskHistoryMapper.insertWcsTaskHistory(wcsTaskHistory);
|
||||
log.info("【添加到历任务记录】{}", JSON.toJSONString(wcsTaskHistory));
|
||||
|
||||
//移除实时任务表数据
|
||||
wcsTaskMapper.deleteWcsTaskByTaskId(tasks.get(i).getTaskId());
|
||||
log.info("【实时任务已完成】{}", JSON.toJSONString(tasks.get(i)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.ruoyi.schedule.scheduleTask;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* 用于处理没有正常执行或完成/取消的任务
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class TaskHandler {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.ruoyi.schedule.scheduleTask;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class Timer {
|
||||
|
||||
@Autowired
|
||||
Generation generation;
|
||||
|
||||
@Autowired
|
||||
Execution execution;
|
||||
|
||||
@Autowired
|
||||
StatusUpdate statusUpdate;
|
||||
|
||||
@Autowired
|
||||
TaskFinish taskFinish;
|
||||
|
||||
@Autowired
|
||||
TaskHandler taskHandler;
|
||||
|
||||
@Async
|
||||
@Scheduled(cron = "*/2 * * * * *")
|
||||
public void timerTask() {
|
||||
|
||||
try {
|
||||
execution.executeTask();
|
||||
Thread.sleep(200);
|
||||
|
||||
//statusUpdate.statusUpdate();
|
||||
//Thread.sleep(200);
|
||||
|
||||
taskFinish.taskFinish();
|
||||
Thread.sleep(200);
|
||||
|
||||
// generation.
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("【调度任务异常】" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.ruoyi.schedule.scheduleTask.agv;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AgvDispatch {
|
||||
|
||||
// 基础URL
|
||||
private final String baseUrl;
|
||||
|
||||
// 客户端编号
|
||||
private String clientCode;
|
||||
|
||||
// 令牌号
|
||||
private String tokenCode;
|
||||
|
||||
public AgvDispatch(String ip, int port) {
|
||||
this.baseUrl = String.format("http://%s:%d/rcms/services/rest", ip, port);
|
||||
}
|
||||
|
||||
public AgvDispatch(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成唯一请求编号
|
||||
*/
|
||||
private String generateReqCode() {
|
||||
return IdUtil.fastSimpleUUID();
|
||||
}
|
||||
|
||||
// ------------------------------ 常用接口 ------------------------------
|
||||
|
||||
/**
|
||||
* 2.1.1 生成任务单
|
||||
* @param taskTyp 任务类型
|
||||
* @param wbCode 工作位
|
||||
* @param positionCodePath 位置路径
|
||||
* @param podCode 货架编号
|
||||
* @return 接口返回结果
|
||||
*/
|
||||
public String genAgvSchedulingTask(String taskTyp, String wbCode,
|
||||
Object[] positionCodePath, String podCode) throws IOException {
|
||||
String url = baseUrl + "/hikRpcService/genAgvSchedulingTask";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("taskTyp", taskTyp);
|
||||
params.put("wbCode", wbCode);
|
||||
params.put("positionCodePath", positionCodePath);
|
||||
params.put("podCode", podCode);
|
||||
return HttpUtil.post(url, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.1.2 继续执行任务
|
||||
* @param taskCode 任务单号
|
||||
* @return 接口返回结果
|
||||
*/
|
||||
public String continueTask(String taskCode) throws IOException {
|
||||
String url = baseUrl + "/hikRpcService/continueTask";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("taskCode", taskCode);
|
||||
return HttpUtil.post(url, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.1.3 取消任务
|
||||
* @param taskCode 任务单号
|
||||
* @param forceCancel 取消类型(0-直接放地上,1-软取消)
|
||||
* @return 接口返回结果
|
||||
*/
|
||||
public String cancelTask(String taskCode, String forceCancel) throws IOException {
|
||||
String url = baseUrl + "/hikRpcService/cancelTask";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("taskCode", taskCode);
|
||||
params.put("forceCancel", forceCancel);
|
||||
return HttpUtil.post(url, params);
|
||||
}
|
||||
|
||||
// ------------------------------ 可选接口 ------------------------------
|
||||
|
||||
/**
|
||||
* 3.1.1 任务优先级设置
|
||||
* @param priorities 优先级列表
|
||||
* @return 接口返回结果
|
||||
*/
|
||||
public String setTaskPriority(Object[] priorities) throws IOException {
|
||||
String url = baseUrl + "/hikRpcService/setTaskPriority";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("priorities", priorities);
|
||||
return HttpUtil.post(url, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.1.2 货架与位置绑定、解绑
|
||||
* @param podCode 货架编号
|
||||
* @param positionCode 位置编号
|
||||
* @param indBind 1-绑定,0-解绑
|
||||
* @return 接口返回结果
|
||||
*/
|
||||
public String bindPodAndBerth(String podCode, String positionCode, String indBind) throws IOException {
|
||||
String url = baseUrl + "/hikRpcService/bindPodAndBerth";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("podCode", podCode);
|
||||
params.put("positionCode", positionCode);
|
||||
params.put("indBind", indBind);
|
||||
return HttpUtil.post(url, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.1.9 查询任务状态
|
||||
* @param taskCodes 任务单编号数组
|
||||
* @return 接口返回结果
|
||||
*/
|
||||
public String queryTaskStatus(String[] taskCodes) throws IOException {
|
||||
String url = baseUrl + "/hikRpcService/queryTaskStatus";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("taskCodes", taskCodes);
|
||||
return HttpUtil.post(url, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.1.10 查询AGV状态
|
||||
* @param mapCode 地图编号
|
||||
* @return 接口返回结果
|
||||
*/
|
||||
public String queryAgvStatus(String mapCode) throws IOException {
|
||||
String url = "http://" + baseUrl.split("//")[1].split("/")[0] + "/rcms-dps/rest/queryAgvStatus";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("mapCode", mapCode);
|
||||
return HttpUtil.post(url, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.1.16 料箱出库TPS(CTU+分拨墙)
|
||||
* @param taskTyp 任务类型(传1)
|
||||
* @param data 任务数据列表
|
||||
* @return 接口返回结果
|
||||
*/
|
||||
public String getOutPod(String taskTyp, Object[] data) throws IOException {
|
||||
String url = baseUrl + "/hikTpsService/getOutPod";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("taskTyp", taskTyp);
|
||||
params.put("data", data);
|
||||
return HttpUtil.post(url, params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.ruoyi.schedule.scheduleTask.ssj;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class InSsjThread {
|
||||
|
||||
public ConcurrentHashMap<String, SsjDevice> deviceMap;
|
||||
|
||||
@Resource
|
||||
private IApiService apiService;
|
||||
@Resource
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
|
||||
public void inDispatch(SsjDevice inSsjDevice) {
|
||||
//如果入库请求1 并且 托盘码不为空
|
||||
if (inSsjDevice.getEntryRequest() == 1 && StrUtil.isNotEmpty(inSsjDevice.getTrayCode())) {
|
||||
//根据入口,查询对应的入库作业
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
//mydoJobParam.setEntranceId(inSsjDevice.getDeviceCode());
|
||||
mydoJobParam.setStatus("1");
|
||||
mydoJobParam.setTrayCode(inSsjDevice.getTrayCode());
|
||||
List<MydoJob> mydoJobs = apiService.getMydoJobList(mydoJobParam);
|
||||
if (CollUtil.isNotEmpty(mydoJobs)) {
|
||||
MydoJob mydoJob = mydoJobs.get(0);
|
||||
//修改mydojob入口
|
||||
mydoJob.setEntranceId(inSsjDevice.getDeviceCode());
|
||||
apiService.updateMydoJob(mydoJob);
|
||||
|
||||
//判断是否生成队列
|
||||
AgvQueue agvQueueParam = new AgvQueue();
|
||||
agvQueueParam.setWmsTaskNo(mydoJob.getTaskNo());
|
||||
agvQueueParam.setPositionCode1(inSsjDevice.getDeviceCode());
|
||||
agvQueueParam.setStatus("0");
|
||||
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueueParam);
|
||||
if (CollUtil.isEmpty(agvQueues)) {
|
||||
//生成agv队列
|
||||
AgvQueue agvQueue = createAgvQueue(inSsjDevice, mydoJob);
|
||||
//请求任务生成
|
||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = requestAgvQueue(mydoJob, agvQueue);
|
||||
//修改wms任务状态
|
||||
if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
||||
//修改ctu执行状态
|
||||
agvQueue.setStatus("1");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
log.info("向CTU下入库库作业");
|
||||
//修改mydoJob执行阶段
|
||||
mydoJob.setExecutionPhase("6");
|
||||
apiService.updateMydoJob(mydoJob);
|
||||
}
|
||||
} else {
|
||||
AgvQueue agvQueue = agvQueues.get(0);
|
||||
//请求任务生成
|
||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = requestAgvQueue(mydoJob, agvQueue);
|
||||
//修改wms任务状态
|
||||
if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
||||
//修改ctu执行状态
|
||||
agvQueue.setStatus("1");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
log.info("向CTU下入库库作业");
|
||||
//修改mydoJob执行阶段
|
||||
mydoJob.setExecutionPhase("6");
|
||||
apiService.updateMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mydoJobParam.setEntranceId(inSsjDevice.getDeviceCode());
|
||||
mydoJobParam.setStatus("3");
|
||||
mydoJobParam.setTrayCode(inSsjDevice.getTrayCode());
|
||||
mydoJobs = apiService.getMydoJobList(mydoJobParam);
|
||||
if (CollUtil.isNotEmpty(mydoJobs)) {
|
||||
log.info("trayCode:{} 入库作业正在执行中", inSsjDevice.getTrayCode());
|
||||
} else {
|
||||
log.info("trayCode:{} 无入库作业", inSsjDevice.getTrayCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成入库AGV队列
|
||||
*
|
||||
* @param ssjDevice
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
private AgvQueue createAgvQueue(SsjDevice ssjDevice, MydoJob mydoJob) {
|
||||
//生成ctu执行队列
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
String reqCode = IdUtil.fastSimpleUUID();
|
||||
agvQueue.setReqCode(reqCode);
|
||||
agvQueue.setReqTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
agvQueue.setAgvType("CTU");
|
||||
agvQueue.setPositionCode1(mydoJob.getCargoSpaceId());
|
||||
agvQueue.setPositionCode2(ssjDevice.getDeviceCode());
|
||||
agvQueue.setTaskType("F01");
|
||||
agvQueue.setCtnrType("0");
|
||||
agvQueue.setCtnrCode("0");
|
||||
agvQueue.setCtnrNum("0");
|
||||
agvQueue.setTaskMode("0");
|
||||
agvQueue.setPriority("10");
|
||||
agvQueue.setRequest("0");
|
||||
agvQueue.setWmsTraycode(mydoJob.getTrayCode());
|
||||
agvQueue.setWmsTaskNo(mydoJob.getTaskNo());
|
||||
agvQueue.setStatus("0");
|
||||
agvQueueService.insertAgvQueue(agvQueue);
|
||||
return agvQueue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求海康生成agv任务,并修改wms任务状态
|
||||
*
|
||||
* @param mydoJob
|
||||
* @param agvQueue
|
||||
*/
|
||||
private GenAgvSchedulingTaskResponse requestAgvQueue(MydoJob mydoJob, AgvQueue agvQueue) {
|
||||
//请求ctu
|
||||
GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest = new GenAgvSchedulingTaskRequest();
|
||||
genAgvSchedulingTaskRequest.setReqCode(agvQueue.getReqCode());
|
||||
genAgvSchedulingTaskRequest.setTaskMode("0");
|
||||
genAgvSchedulingTaskRequest.setPriority("10");
|
||||
genAgvSchedulingTaskRequest.setTaskTyp("F01");
|
||||
genAgvSchedulingTaskRequest.setCtnrCode("0");
|
||||
genAgvSchedulingTaskRequest.setCtnrNum("0");
|
||||
genAgvSchedulingTaskRequest.setTaskMode("0");
|
||||
genAgvSchedulingTaskRequest.setTaskCode(mydoJob.getTaskNo());
|
||||
genAgvSchedulingTaskRequest.setGroupId(mydoJob.getTaskNo());
|
||||
genAgvSchedulingTaskRequest.setAgvTyp("CTU");
|
||||
genAgvSchedulingTaskRequest.setPositionSelStrategy("0");
|
||||
return apiService.genAgvSchedulingTask(genAgvSchedulingTaskRequest);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.ruoyi.schedule.scheduleTask.ssj;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class OutSsjThread {
|
||||
|
||||
public ConcurrentHashMap<String, List<SsjDevice>> deviceMap;
|
||||
|
||||
@Resource
|
||||
private IApiService apiService;
|
||||
@Resource
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
|
||||
public void outDispatch(SsjDevice outSsjDevice) {
|
||||
//输送线出库
|
||||
if (outSsjDevice.getEmpty()==1){
|
||||
//查询对应的作业
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
agvQueue.setPositionCode2(outSsjDevice.getDeviceCode());
|
||||
agvQueue.setStatus("0");
|
||||
List<AgvQueue> agvQueueList = agvQueueService.selectAgvQueueList(agvQueue);
|
||||
if (CollUtil.isNotEmpty(agvQueueList)){
|
||||
for (AgvQueue queue : agvQueueList) {
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setTaskNo(queue.getWmsTaskNo());
|
||||
mydoJobParam.setTrayCode(queue.getWmsTraycode());
|
||||
mydoJobParam.setCargoSpaceId(queue.getPositionCode1());
|
||||
List<MydoJob> mydoJobList = apiService.getMydoJobList(mydoJobParam);
|
||||
if (CollUtil.isNotEmpty(mydoJobList)){
|
||||
MydoJob mydoJob = mydoJobList.get(0);
|
||||
requestAgvQueue(mydoJob, queue);
|
||||
}else {
|
||||
log.info("队列 agvCode {},无对应出库作业", agvQueue.getReqCode());
|
||||
}
|
||||
}
|
||||
}else {
|
||||
log.info("ssjCode:{},没有待下发的出库任务", outSsjDevice.getDeviceCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求海康生成agv任务,并修改wms任务状态
|
||||
* @param mydoJob
|
||||
* @param agvQueue
|
||||
*/
|
||||
private void requestAgvQueue(MydoJob mydoJob, AgvQueue agvQueue) {
|
||||
//请求ctu
|
||||
GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest = new GenAgvSchedulingTaskRequest();
|
||||
genAgvSchedulingTaskRequest.setReqCode(agvQueue.getReqCode());
|
||||
genAgvSchedulingTaskRequest.setTaskMode("0");
|
||||
genAgvSchedulingTaskRequest.setPriority("10");
|
||||
genAgvSchedulingTaskRequest.setTaskTyp("F01");
|
||||
genAgvSchedulingTaskRequest.setCtnrCode("0");
|
||||
genAgvSchedulingTaskRequest.setCtnrNum("0");
|
||||
genAgvSchedulingTaskRequest.setTaskMode("0");
|
||||
genAgvSchedulingTaskRequest.setTaskCode(mydoJob.getTaskNo());
|
||||
genAgvSchedulingTaskRequest.setGroupId(mydoJob.getTaskNo());
|
||||
genAgvSchedulingTaskRequest.setAgvTyp("CTU");
|
||||
genAgvSchedulingTaskRequest.setPositionSelStrategy("0");
|
||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = apiService.genAgvSchedulingTask(genAgvSchedulingTaskRequest);
|
||||
if (genAgvSchedulingTaskResponse.getCode() == 0){
|
||||
//修改ctu执行状态
|
||||
agvQueue.setStatus("1");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
log.info("向CTU下入库库作业");
|
||||
//修改mydoJob执行阶段
|
||||
mydoJob.setExecutionPhase("6");
|
||||
apiService.updateMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.ruoyi.schedule.scheduleTask.ssj;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PickSsjTread {
|
||||
|
||||
public ConcurrentHashMap<String, List<SsjDevice>> deviceMap;
|
||||
|
||||
@Resource
|
||||
private IApiService apiService;
|
||||
@Resource
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
|
||||
public void pickDispatch(SsjDevice pickSsjDevice) {
|
||||
if (pickSsjDevice.getInPlace() == 1 && pickSsjDevice.getTaskNo() > 0){
|
||||
Integer taskNo = pickSsjDevice.getTaskNo();
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setStatus("3");
|
||||
mydoJobParam.setTaskNo(Convert.toStr(taskNo));
|
||||
mydoJobParam.setExitId(pickSsjDevice.getDeviceCode());
|
||||
List<MydoJob> mydoJobList = apiService.getMydoJobList(mydoJobParam);
|
||||
if (CollUtil.isNotEmpty(mydoJobList)){
|
||||
MydoJob mydoJob = mydoJobList.get(0);
|
||||
if ("4".equals(mydoJob.getExecutionPhase())){
|
||||
mydoJob.setExecutionPhase("5");
|
||||
apiService.updateMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.ruoyi.schedule.task;
|
||||
|
||||
import com.ruoyi.schedule.data.ConvConnection;
|
||||
import com.ruoyi.schedule.plc.domain.ConvPTLInRead;
|
||||
import com.ruoyi.schedule.plc.domain.ConvPTLOutRead;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取任务生成AGV指令
|
||||
*/
|
||||
@Component
|
||||
public class Generation {
|
||||
|
||||
@Autowired
|
||||
ConvConnection conv;
|
||||
|
||||
//获取PTL拣选工位入口状态
|
||||
public List<ConvPTLInRead> getConvPTLInRead() {
|
||||
|
||||
List<ConvPTLInRead> convPTLInReads=conv.getConvPTLIn();
|
||||
|
||||
for (int i = 0; i < convPTLInReads.size(); i++) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
return convPTLInReads;
|
||||
}
|
||||
|
||||
|
||||
//获取PTL拣选工位出口状态
|
||||
public List<ConvPTLOutRead> getConvPTLOutRead() {
|
||||
|
||||
List<ConvPTLOutRead> convPTLOutReads=conv.getConvPTLOut();
|
||||
|
||||
|
||||
return convPTLOutReads;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
package com.ruoyi.schedule.task.controller;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.TaskStatusCode;
|
||||
import com.ruoyi.device.agv.domain.ResponseBase;
|
||||
import com.ruoyi.schedule.task.mapper.WcsTaskMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.schedule.task.domain.WcsTask;
|
||||
import com.ruoyi.schedule.task.service.IWcsTaskService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 实时任务Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schedule/task")
|
||||
@Slf4j
|
||||
public class WcsTaskController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IWcsTaskService wcsTaskService;
|
||||
|
||||
@Autowired
|
||||
WcsTaskMapper wcsTaskMapper;
|
||||
|
||||
/**
|
||||
* 查询实时任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:task:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WcsTask wcsTask)
|
||||
{
|
||||
startPage();
|
||||
List<WcsTask> list = wcsTaskService.selectWcsTaskList(wcsTask);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出实时任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:task:export')")
|
||||
@Log(title = "实时任务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WcsTask wcsTask)
|
||||
{
|
||||
List<WcsTask> list = wcsTaskService.selectWcsTaskList(wcsTask);
|
||||
ExcelUtil<WcsTask> util = new ExcelUtil<WcsTask>(WcsTask.class);
|
||||
util.exportExcel(response, list, "实时任务数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实时任务详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:task:query')")
|
||||
@GetMapping(value = "/{taskId}")
|
||||
public AjaxResult getInfo(@PathVariable("taskId") String taskId)
|
||||
{
|
||||
return success(wcsTaskService.selectWcsTaskByTaskId(taskId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增实时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:task:add')")
|
||||
@Log(title = "实时任务", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WcsTask wcsTask)
|
||||
{
|
||||
return toAjax(wcsTaskService.insertWcsTask(wcsTask));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改实时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:task:edit')")
|
||||
@Log(title = "实时任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WcsTask wcsTask)
|
||||
{
|
||||
return toAjax(wcsTaskService.updateWcsTask(wcsTask));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除实时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:task:remove')")
|
||||
@Log(title = "实时任务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{taskIds}")
|
||||
public AjaxResult remove(@PathVariable String[] taskIds)
|
||||
{
|
||||
return toAjax(wcsTaskService.deleteWcsTaskByTaskIds(taskIds));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* PTL拣选入口空---wms推送请求出库---生成wcs本地任务
|
||||
* @param task
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/stockOut")
|
||||
public ResponseBase stockOut(@RequestBody WcsTask task) {
|
||||
|
||||
log.info("【获取出库请求】" + JSON.toJSONString(task));
|
||||
|
||||
ResponseBase response = new ResponseBase();
|
||||
response.setCode(0);
|
||||
response.setMessage("success");
|
||||
response.setData(JSON.toJSONString(task));
|
||||
|
||||
//todo 有无信息校验
|
||||
//查询是否已经有该作业号的任务
|
||||
LambdaQueryWrapper<WcsTask> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(WcsTask::getJobId, task.getJobId());
|
||||
Long count= wcsTaskMapper.selectCount(wrapper);
|
||||
//任务已存在---返回失败
|
||||
if (count > 0) {
|
||||
response.setCode(1);
|
||||
response.setMessage("failed");
|
||||
return response;
|
||||
}
|
||||
|
||||
//初始化任务状态---待执行
|
||||
task.setTaskStatus(TaskStatusCode.TASK_READY);
|
||||
|
||||
wcsTaskService.insertWcsTask(task);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* PTL拣选出口扫描到到位料箱---wms推送请求入库---生成wcs本地任务
|
||||
* @param task
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/stockIn")
|
||||
public ResponseBase stockIn(@RequestBody WcsTask task) {
|
||||
|
||||
log.info("【获取入库请求】" + JSON.toJSONString(task));
|
||||
|
||||
ResponseBase response = new ResponseBase();
|
||||
response.setCode(0);
|
||||
response.setMessage("success");
|
||||
response.setData(JSON.toJSONString(task));
|
||||
|
||||
//todo 有无信息校验
|
||||
//查询是否已经有该作业号的任务
|
||||
LambdaQueryWrapper<WcsTask> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(WcsTask::getJobId, task.getJobId());
|
||||
Long count= wcsTaskMapper.selectCount(wrapper);
|
||||
//任务已存在---返回失败
|
||||
if (count > 0) {
|
||||
response.setCode(1);
|
||||
response.setMessage("failed");
|
||||
return response;
|
||||
}
|
||||
|
||||
//初始化任务状态---待执行
|
||||
task.setTaskStatus(TaskStatusCode.TASK_READY);
|
||||
|
||||
wcsTaskService.insertWcsTask(task);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.ruoyi.schedule.task.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 实时任务对象 wcs_task
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
@Data
|
||||
public class WcsTask
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 作业号 */
|
||||
@Excel(name = "作业号")
|
||||
private String jobId;
|
||||
|
||||
/** wcs任务号 */
|
||||
@Excel(name = "任务号")
|
||||
private String taskId;
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型")
|
||||
private String taskType;
|
||||
|
||||
/** 源站点 */
|
||||
@Excel(name = "源站点")
|
||||
private String sourceLocation;
|
||||
|
||||
/** 目标站点 */
|
||||
@Excel(name = "目标站点")
|
||||
private String targetLocation;
|
||||
|
||||
/** 任务状态 */
|
||||
@Excel(name = "任务状态")
|
||||
private String taskStatus;
|
||||
|
||||
/** 生成时间 */
|
||||
@Excel(name = "生成时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime = LocalDateTime.now();
|
||||
|
||||
/**
|
||||
* 调度时间
|
||||
* 设备开始运行的时间
|
||||
*/
|
||||
@Excel(name = "调度时间")
|
||||
private LocalDateTime scheduleTime;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String deviceId;
|
||||
|
||||
/** 库区代码 */
|
||||
@Excel(name = "库区代码")
|
||||
private String areaId;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.ruoyi.schedule.task.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.schedule.task.domain.WcsTask;
|
||||
|
||||
/**
|
||||
* 实时任务Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
public interface WcsTaskMapper extends BaseMapper<WcsTask>
|
||||
{
|
||||
/**
|
||||
* 查询实时任务
|
||||
*
|
||||
* @param taskId 实时任务主键
|
||||
* @return 实时任务
|
||||
*/
|
||||
public WcsTask selectWcsTaskByTaskId(String taskId);
|
||||
|
||||
/**
|
||||
* 查询实时任务
|
||||
*
|
||||
* @param jobId wms作业号
|
||||
* @return 实时任务
|
||||
*/
|
||||
public WcsTask selectWcsTaskByJobId(String jobId);
|
||||
|
||||
/**
|
||||
* 查询实时任务列表
|
||||
*
|
||||
* @param wcsTask 实时任务
|
||||
* @return 实时任务集合
|
||||
*/
|
||||
public List<WcsTask> selectWcsTaskList(WcsTask wcsTask);
|
||||
|
||||
/**
|
||||
* 新增实时任务
|
||||
*
|
||||
* @param wcsTask 实时任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWcsTask(WcsTask wcsTask);
|
||||
|
||||
/**
|
||||
* 修改实时任务
|
||||
*
|
||||
* @param wcsTask 实时任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWcsTask(WcsTask wcsTask);
|
||||
|
||||
/**
|
||||
* 删除实时任务
|
||||
*
|
||||
* @param taskId 实时任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWcsTaskByTaskId(String taskId);
|
||||
|
||||
/**
|
||||
* 批量删除实时任务
|
||||
*
|
||||
* @param taskIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWcsTaskByTaskIds(String[] taskIds);
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.ruoyi.schedule.task.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.schedule.task.domain.WcsTask;
|
||||
|
||||
/**
|
||||
* 实时任务Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
public interface IWcsTaskService
|
||||
{
|
||||
/**
|
||||
* 查询实时任务
|
||||
*
|
||||
* @param taskId 实时任务主键
|
||||
* @return 实时任务
|
||||
*/
|
||||
public WcsTask selectWcsTaskByTaskId(String taskId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询实时任务
|
||||
*
|
||||
* @param jobId wms作业号
|
||||
* @return 实时任务
|
||||
*/
|
||||
public WcsTask selectWcsTaskByJobId(String jobId);
|
||||
|
||||
/**
|
||||
* 查询实时任务列表
|
||||
*
|
||||
* @param wcsTask 实时任务
|
||||
* @return 实时任务集合
|
||||
*/
|
||||
public List<WcsTask> selectWcsTaskList(WcsTask wcsTask);
|
||||
|
||||
/**
|
||||
* 新增实时任务
|
||||
*
|
||||
* @param wcsTask 实时任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWcsTask(WcsTask wcsTask);
|
||||
|
||||
/**
|
||||
* 修改实时任务
|
||||
*
|
||||
* @param wcsTask 实时任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWcsTask(WcsTask wcsTask);
|
||||
|
||||
/**
|
||||
* 批量删除实时任务
|
||||
*
|
||||
* @param taskIds 需要删除的实时任务主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWcsTaskByTaskIds(String[] taskIds);
|
||||
|
||||
/**
|
||||
* 删除实时任务信息
|
||||
*
|
||||
* @param taskId 实时任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWcsTaskByTaskId(String taskId);
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.ruoyi.schedule.task.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.schedule.task.mapper.WcsTaskMapper;
|
||||
import com.ruoyi.schedule.task.domain.WcsTask;
|
||||
import com.ruoyi.schedule.task.service.IWcsTaskService;
|
||||
|
||||
/**
|
||||
* 实时任务Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
@Service
|
||||
public class WcsTaskServiceImpl implements IWcsTaskService
|
||||
{
|
||||
@Autowired
|
||||
private WcsTaskMapper wcsTaskMapper;
|
||||
|
||||
/**
|
||||
* 查询实时任务
|
||||
*
|
||||
* @param taskId 实时任务主键
|
||||
* @return 实时任务
|
||||
*/
|
||||
@Override
|
||||
public WcsTask selectWcsTaskByTaskId(String taskId)
|
||||
{
|
||||
return wcsTaskMapper.selectWcsTaskByTaskId(taskId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实时任务
|
||||
*
|
||||
* @param jobId 实时任务主键
|
||||
* @return 实时任务
|
||||
*/
|
||||
@Override
|
||||
public WcsTask selectWcsTaskByJobId(String jobId)
|
||||
{
|
||||
return wcsTaskMapper.selectWcsTaskByJobId(jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实时任务列表
|
||||
*
|
||||
* @param wcsTask 实时任务
|
||||
* @return 实时任务
|
||||
*/
|
||||
@Override
|
||||
public List<WcsTask> selectWcsTaskList(WcsTask wcsTask)
|
||||
{
|
||||
return wcsTaskMapper.selectWcsTaskList(wcsTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增实时任务
|
||||
*
|
||||
* @param wcsTask 实时任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWcsTask(WcsTask wcsTask)
|
||||
{
|
||||
wcsTask.setCreateTime(LocalDateTime.now());
|
||||
return wcsTaskMapper.insertWcsTask(wcsTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改实时任务
|
||||
*
|
||||
* @param wcsTask 实时任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWcsTask(WcsTask wcsTask)
|
||||
{
|
||||
return wcsTaskMapper.updateWcsTask(wcsTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除实时任务
|
||||
*
|
||||
* @param taskIds 需要删除的实时任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWcsTaskByTaskIds(String[] taskIds)
|
||||
{
|
||||
return wcsTaskMapper.deleteWcsTaskByTaskIds(taskIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除实时任务信息
|
||||
*
|
||||
* @param taskId 实时任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWcsTaskByTaskId(String taskId)
|
||||
{
|
||||
return wcsTaskMapper.deleteWcsTaskByTaskId(taskId);
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package com.ruoyi.schedule.taskHistory.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.schedule.taskHistory.domain.WcsTaskHistory;
|
||||
import com.ruoyi.schedule.taskHistory.service.IWcsTaskHistoryService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 任务历史记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schedule/history")
|
||||
public class WcsTaskHistoryController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IWcsTaskHistoryService wcsTaskHistoryService;
|
||||
|
||||
/**
|
||||
* 查询任务历史记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:history:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WcsTaskHistory wcsTaskHistory)
|
||||
{
|
||||
startPage();
|
||||
List<WcsTaskHistory> list = wcsTaskHistoryService.selectWcsTaskHistoryList(wcsTaskHistory);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出任务历史记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:history:export')")
|
||||
@Log(title = "任务历史记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WcsTaskHistory wcsTaskHistory)
|
||||
{
|
||||
List<WcsTaskHistory> list = wcsTaskHistoryService.selectWcsTaskHistoryList(wcsTaskHistory);
|
||||
ExcelUtil<WcsTaskHistory> util = new ExcelUtil<WcsTaskHistory>(WcsTaskHistory.class);
|
||||
util.exportExcel(response, list, "任务历史记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务历史记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:history:query')")
|
||||
@GetMapping(value = "/{taskId}")
|
||||
public AjaxResult getInfo(@PathVariable("taskId") String taskId)
|
||||
{
|
||||
return success(wcsTaskHistoryService.selectWcsTaskHistoryByTaskId(taskId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务历史记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:history:add')")
|
||||
@Log(title = "任务历史记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WcsTaskHistory wcsTaskHistory)
|
||||
{
|
||||
return toAjax(wcsTaskHistoryService.insertWcsTaskHistory(wcsTaskHistory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务历史记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:history:edit')")
|
||||
@Log(title = "任务历史记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WcsTaskHistory wcsTaskHistory)
|
||||
{
|
||||
return toAjax(wcsTaskHistoryService.updateWcsTaskHistory(wcsTaskHistory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务历史记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('schedule:history:remove')")
|
||||
@Log(title = "任务历史记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{taskIds}")
|
||||
public AjaxResult remove(@PathVariable String[] taskIds)
|
||||
{
|
||||
return toAjax(wcsTaskHistoryService.deleteWcsTaskHistoryByTaskIds(taskIds));
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.ruoyi.schedule.taskHistory.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 任务历史记录对象 wcs_task_history
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
@Data
|
||||
public class WcsTaskHistory extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 作业号 */
|
||||
@Excel(name = "作业号")
|
||||
private String jobId;
|
||||
|
||||
/** wcs任务号 */
|
||||
@Excel(name = "wcs任务号")
|
||||
private String taskId;
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型")
|
||||
private String taskType;
|
||||
|
||||
/** 源站点 */
|
||||
@Excel(name = "源站点")
|
||||
private String sourceLocation;
|
||||
|
||||
/** 目标站点 */
|
||||
@Excel(name = "目标站点")
|
||||
private String targetLocation;
|
||||
|
||||
/** 任务状态 */
|
||||
@Excel(name = "任务状态")
|
||||
private String taskStatus;
|
||||
|
||||
/** 调度时间 */
|
||||
@Excel(name = "调度时间")
|
||||
private LocalDateTime scheduleTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@Excel(name = "结束时间")
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String deviceId;
|
||||
|
||||
/** 库区代码 */
|
||||
@Excel(name = "库区代码")
|
||||
private String areaId;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.ruoyi.schedule.taskHistory.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.schedule.taskHistory.domain.WcsTaskHistory;
|
||||
|
||||
/**
|
||||
* 任务历史记录Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
public interface WcsTaskHistoryMapper
|
||||
{
|
||||
/**
|
||||
* 查询任务历史记录
|
||||
*
|
||||
* @param taskId 任务历史记录主键
|
||||
* @return 任务历史记录
|
||||
*/
|
||||
public WcsTaskHistory selectWcsTaskHistoryByTaskId(String taskId);
|
||||
|
||||
/**
|
||||
* 查询任务历史记录列表
|
||||
*
|
||||
* @param wcsTaskHistory 任务历史记录
|
||||
* @return 任务历史记录集合
|
||||
*/
|
||||
public List<WcsTaskHistory> selectWcsTaskHistoryList(WcsTaskHistory wcsTaskHistory);
|
||||
|
||||
/**
|
||||
* 新增任务历史记录
|
||||
*
|
||||
* @param wcsTaskHistory 任务历史记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWcsTaskHistory(WcsTaskHistory wcsTaskHistory);
|
||||
|
||||
/**
|
||||
* 修改任务历史记录
|
||||
*
|
||||
* @param wcsTaskHistory 任务历史记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWcsTaskHistory(WcsTaskHistory wcsTaskHistory);
|
||||
|
||||
/**
|
||||
* 删除任务历史记录
|
||||
*
|
||||
* @param taskId 任务历史记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWcsTaskHistoryByTaskId(String taskId);
|
||||
|
||||
/**
|
||||
* 批量删除任务历史记录
|
||||
*
|
||||
* @param taskIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWcsTaskHistoryByTaskIds(String[] taskIds);
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.ruoyi.schedule.taskHistory.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.schedule.taskHistory.domain.WcsTaskHistory;
|
||||
|
||||
/**
|
||||
* 任务历史记录Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
public interface IWcsTaskHistoryService
|
||||
{
|
||||
/**
|
||||
* 查询任务历史记录
|
||||
*
|
||||
* @param taskId 任务历史记录主键
|
||||
* @return 任务历史记录
|
||||
*/
|
||||
public WcsTaskHistory selectWcsTaskHistoryByTaskId(String taskId);
|
||||
|
||||
/**
|
||||
* 查询任务历史记录列表
|
||||
*
|
||||
* @param wcsTaskHistory 任务历史记录
|
||||
* @return 任务历史记录集合
|
||||
*/
|
||||
public List<WcsTaskHistory> selectWcsTaskHistoryList(WcsTaskHistory wcsTaskHistory);
|
||||
|
||||
/**
|
||||
* 新增任务历史记录
|
||||
*
|
||||
* @param wcsTaskHistory 任务历史记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWcsTaskHistory(WcsTaskHistory wcsTaskHistory);
|
||||
|
||||
/**
|
||||
* 修改任务历史记录
|
||||
*
|
||||
* @param wcsTaskHistory 任务历史记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWcsTaskHistory(WcsTaskHistory wcsTaskHistory);
|
||||
|
||||
/**
|
||||
* 批量删除任务历史记录
|
||||
*
|
||||
* @param taskIds 需要删除的任务历史记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWcsTaskHistoryByTaskIds(String[] taskIds);
|
||||
|
||||
/**
|
||||
* 删除任务历史记录信息
|
||||
*
|
||||
* @param taskId 任务历史记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWcsTaskHistoryByTaskId(String taskId);
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
package com.ruoyi.schedule.taskHistory.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.schedule.taskHistory.mapper.WcsTaskHistoryMapper;
|
||||
import com.ruoyi.schedule.taskHistory.domain.WcsTaskHistory;
|
||||
import com.ruoyi.schedule.taskHistory.service.IWcsTaskHistoryService;
|
||||
|
||||
/**
|
||||
* 任务历史记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
@Service
|
||||
public class WcsTaskHistoryServiceImpl implements IWcsTaskHistoryService
|
||||
{
|
||||
@Autowired
|
||||
private WcsTaskHistoryMapper wcsTaskHistoryMapper;
|
||||
|
||||
/**
|
||||
* 查询任务历史记录
|
||||
*
|
||||
* @param taskId 任务历史记录主键
|
||||
* @return 任务历史记录
|
||||
*/
|
||||
@Override
|
||||
public WcsTaskHistory selectWcsTaskHistoryByTaskId(String taskId)
|
||||
{
|
||||
return wcsTaskHistoryMapper.selectWcsTaskHistoryByTaskId(taskId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询任务历史记录列表
|
||||
*
|
||||
* @param wcsTaskHistory 任务历史记录
|
||||
* @return 任务历史记录
|
||||
*/
|
||||
@Override
|
||||
public List<WcsTaskHistory> selectWcsTaskHistoryList(WcsTaskHistory wcsTaskHistory)
|
||||
{
|
||||
return wcsTaskHistoryMapper.selectWcsTaskHistoryList(wcsTaskHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务历史记录
|
||||
*
|
||||
* @param wcsTaskHistory 任务历史记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWcsTaskHistory(WcsTaskHistory wcsTaskHistory)
|
||||
{
|
||||
wcsTaskHistory.setCreateTime(DateUtils.getNowDate());
|
||||
return wcsTaskHistoryMapper.insertWcsTaskHistory(wcsTaskHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务历史记录
|
||||
*
|
||||
* @param wcsTaskHistory 任务历史记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWcsTaskHistory(WcsTaskHistory wcsTaskHistory)
|
||||
{
|
||||
return wcsTaskHistoryMapper.updateWcsTaskHistory(wcsTaskHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除任务历史记录
|
||||
*
|
||||
* @param taskIds 需要删除的任务历史记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWcsTaskHistoryByTaskIds(String[] taskIds)
|
||||
{
|
||||
return wcsTaskHistoryMapper.deleteWcsTaskHistoryByTaskIds(taskIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务历史记录信息
|
||||
*
|
||||
* @param taskId 任务历史记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWcsTaskHistoryByTaskId(String taskId)
|
||||
{
|
||||
return wcsTaskHistoryMapper.deleteWcsTaskHistoryByTaskId(taskId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.device.agv.mapper.AgvQueueFinishMapper">
|
||||
|
||||
<resultMap type="AgvQueueFinish" id="AgvQueueFinishResult">
|
||||
<result property="reqCode" column="req_code" />
|
||||
<result property="reqTime" column="req_time" />
|
||||
<result property="positionCode1" column="position_code_1" />
|
||||
<result property="positionCode2" column="position_code_2" />
|
||||
<result property="taskType" column="task_type" />
|
||||
<result property="ctnrType" column="ctnr_type" />
|
||||
<result property="ctnrCode" column="ctnr_code" />
|
||||
<result property="ctnrNum" column="ctnr_num" />
|
||||
<result property="taskMode" column="task_mode" />
|
||||
<result property="priority" column="priority" />
|
||||
<result property="agvType" column="agv_type" />
|
||||
<result property="request" column="request" />
|
||||
<result property="finishTime" column="finish_time" />
|
||||
<result property="wmsTraycode" column="wms_traycode" />
|
||||
<result property="wmsTaskNo" column="wms_task_no" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAgvQueueFinishVo">
|
||||
select req_code, req_time, position_code_1, position_code_2, task_type, ctnr_type, ctnr_code, ctnr_num, task_mode, priority, agv_type, request, finish_time, wms_traycode, wms_task_no from agv_queue_finish
|
||||
</sql>
|
||||
|
||||
<select id="selectAgvQueueFinishList" parameterType="AgvQueueFinish" resultMap="AgvQueueFinishResult">
|
||||
<include refid="selectAgvQueueFinishVo"/>
|
||||
<where>
|
||||
<if test="reqTime != null and reqTime != ''"> and req_time = #{reqTime}</if>
|
||||
<if test="positionCode1 != null and positionCode1 != ''"> and position_code_1 = #{positionCode1}</if>
|
||||
<if test="positionCode2 != null and positionCode2 != ''"> and position_code_2 = #{positionCode2}</if>
|
||||
<if test="taskType != null and taskType != ''"> and task_type = #{taskType}</if>
|
||||
<if test="ctnrType != null and ctnrType != ''"> and ctnr_type = #{ctnrType}</if>
|
||||
<if test="ctnrCode != null and ctnrCode != ''"> and ctnr_code = #{ctnrCode}</if>
|
||||
<if test="ctnrNum != null and ctnrNum != ''"> and ctnr_num = #{ctnrNum}</if>
|
||||
<if test="taskMode != null and taskMode != ''"> and task_mode = #{taskMode}</if>
|
||||
<if test="priority != null and priority != ''"> and priority = #{priority}</if>
|
||||
<if test="agvType != null and agvType != ''"> and agv_type = #{agvType}</if>
|
||||
<if test="request != null and request != ''"> and request = #{request}</if>
|
||||
<if test="finishTime != null and finishTime != ''"> and finish_time = #{finishTime}</if>
|
||||
<if test="wmsTraycode != null and wmsTraycode != ''"> and wms_traycode = #{wmsTraycode}</if>
|
||||
<if test="wmsTaskNo != null and wmsTaskNo != ''"> and wms_task_no = #{wmsTaskNo}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAgvQueueFinishByReqCode" parameterType="String" resultMap="AgvQueueFinishResult">
|
||||
<include refid="selectAgvQueueFinishVo"/>
|
||||
where req_code = #{reqCode}
|
||||
</select>
|
||||
|
||||
<insert id="insertAgvQueueFinish" parameterType="AgvQueueFinish">
|
||||
insert into agv_queue_finish
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="reqCode != null">req_code,</if>
|
||||
<if test="reqTime != null">req_time,</if>
|
||||
<if test="positionCode1 != null">position_code_1,</if>
|
||||
<if test="positionCode2 != null">position_code_2,</if>
|
||||
<if test="taskType != null">task_type,</if>
|
||||
<if test="ctnrType != null">ctnr_type,</if>
|
||||
<if test="ctnrCode != null">ctnr_code,</if>
|
||||
<if test="ctnrNum != null">ctnr_num,</if>
|
||||
<if test="taskMode != null">task_mode,</if>
|
||||
<if test="priority != null">priority,</if>
|
||||
<if test="agvType != null">agv_type,</if>
|
||||
<if test="request != null">request,</if>
|
||||
<if test="finishTime != null">finish_time,</if>
|
||||
<if test="wmsTraycode != null">wms_traycode,</if>
|
||||
<if test="wmsTaskNo != null">wms_task_no,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="reqCode != null">#{reqCode},</if>
|
||||
<if test="reqTime != null">#{reqTime},</if>
|
||||
<if test="positionCode1 != null">#{positionCode1},</if>
|
||||
<if test="positionCode2 != null">#{positionCode2},</if>
|
||||
<if test="taskType != null">#{taskType},</if>
|
||||
<if test="ctnrType != null">#{ctnrType},</if>
|
||||
<if test="ctnrCode != null">#{ctnrCode},</if>
|
||||
<if test="ctnrNum != null">#{ctnrNum},</if>
|
||||
<if test="taskMode != null">#{taskMode},</if>
|
||||
<if test="priority != null">#{priority},</if>
|
||||
<if test="agvType != null">#{agvType},</if>
|
||||
<if test="request != null">#{request},</if>
|
||||
<if test="finishTime != null">#{finishTime},</if>
|
||||
<if test="wmsTraycode != null">#{wmsTraycode},</if>
|
||||
<if test="wmsTaskNo != null">#{wmsTaskNo},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAgvQueueFinish" parameterType="AgvQueueFinish">
|
||||
update agv_queue_finish
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="reqTime != null">req_time = #{reqTime},</if>
|
||||
<if test="positionCode1 != null">position_code_1 = #{positionCode1},</if>
|
||||
<if test="positionCode2 != null">position_code_2 = #{positionCode2},</if>
|
||||
<if test="taskType != null">task_type = #{taskType},</if>
|
||||
<if test="ctnrType != null">ctnr_type = #{ctnrType},</if>
|
||||
<if test="ctnrCode != null">ctnr_code = #{ctnrCode},</if>
|
||||
<if test="ctnrNum != null">ctnr_num = #{ctnrNum},</if>
|
||||
<if test="taskMode != null">task_mode = #{taskMode},</if>
|
||||
<if test="priority != null">priority = #{priority},</if>
|
||||
<if test="agvType != null">agv_type = #{agvType},</if>
|
||||
<if test="request != null">request = #{request},</if>
|
||||
<if test="finishTime != null">finish_time = #{finishTime},</if>
|
||||
<if test="wmsTraycode != null">wms_traycode = #{wmsTraycode},</if>
|
||||
<if test="wmsTaskNo != null">wms_task_no = #{wmsTaskNo},</if>
|
||||
</trim>
|
||||
where req_code = #{reqCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAgvQueueFinishByReqCode" parameterType="String">
|
||||
delete from agv_queue_finish where req_code = #{reqCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAgvQueueFinishByReqCodes" parameterType="String">
|
||||
delete from agv_queue_finish where req_code in
|
||||
<foreach item="reqCode" collection="array" open="(" separator="," close=")">
|
||||
#{reqCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
138
ruoyi-admin/src/main/resources/mapper/device/AgvQueueMapper.xml
Normal file
138
ruoyi-admin/src/main/resources/mapper/device/AgvQueueMapper.xml
Normal file
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.device.agv.mapper.AgvQueueMapper">
|
||||
|
||||
<resultMap type="AgvQueue" id="AgvQueueResult">
|
||||
<result property="reqCode" column="req_code" />
|
||||
<result property="reqTime" column="req_time" />
|
||||
<result property="positionCode1" column="position_code_1" />
|
||||
<result property="positionCode2" column="position_code_2" />
|
||||
<result property="taskType" column="task_type" />
|
||||
<result property="ctnrType" column="ctnr_type" />
|
||||
<result property="ctnrCode" column="ctnr_code" />
|
||||
<result property="ctnrNum" column="ctnr_num" />
|
||||
<result property="taskMode" column="task_mode" />
|
||||
<result property="priority" column="priority" />
|
||||
<result property="agvType" column="agv_type" />
|
||||
<result property="request" column="request" />
|
||||
<result property="finishTime" column="finish_time" />
|
||||
<result property="wmsTraycode" column="wms_traycode" />
|
||||
<result property="wmsTaskNo" column="wms_task_no" />
|
||||
<result property="status" column="status" />
|
||||
<result property="taskCode" column="task_code" />
|
||||
<result property="wmsTaskType" column="wms_task_type" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAgvQueueVo">
|
||||
select req_code, req_time, position_code_1, position_code_2, task_type, ctnr_type, ctnr_code, ctnr_num, task_mode, priority, agv_type, request, finish_time, wms_traycode, wms_task_no,status,task_code,wms_task_type from agv_queue
|
||||
</sql>
|
||||
|
||||
<select id="selectAgvQueueList" parameterType="AgvQueue" resultMap="AgvQueueResult">
|
||||
<include refid="selectAgvQueueVo"/>
|
||||
<where>
|
||||
<if test="reqTime != null and reqTime != ''"> and req_time = #{reqTime}</if>
|
||||
<if test="positionCode1 != null and positionCode1 != ''"> and position_code_1 = #{positionCode1}</if>
|
||||
<if test="positionCode2 != null and positionCode2 != ''"> and position_code_2 = #{positionCode2}</if>
|
||||
<if test="taskType != null and taskType != ''"> and task_type = #{taskType}</if>
|
||||
<if test="ctnrType != null and ctnrType != ''"> and ctnr_type = #{ctnrType}</if>
|
||||
<if test="ctnrCode != null and ctnrCode != ''"> and ctnr_code = #{ctnrCode}</if>
|
||||
<if test="ctnrNum != null and ctnrNum != ''"> and ctnr_num = #{ctnrNum}</if>
|
||||
<if test="taskMode != null and taskMode != ''"> and task_mode = #{taskMode}</if>
|
||||
<if test="priority != null and priority != ''"> and priority = #{priority}</if>
|
||||
<if test="agvType != null and agvType != ''"> and agv_type = #{agvType}</if>
|
||||
<if test="request != null and request != ''"> and request = #{request}</if>
|
||||
<if test="finishTime != null and finishTime != ''"> and finish_time = #{finishTime}</if>
|
||||
<if test="wmsTraycode != null and wmsTraycode != ''"> and wms_traycode = #{wmsTraycode}</if>
|
||||
<if test="wmsTaskNo != null and wmsTaskNo != ''"> and wms_task_no = #{wmsTaskNo}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="taskCode != null and taskCode != ''"> and task_code = #{taskCode}</if>
|
||||
<if test="wmsTaskType != null and wmsTaskType != ''"> and wms_task_type = #{wmsTaskType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAgvQueueByReqCode" parameterType="String" resultMap="AgvQueueResult">
|
||||
<include refid="selectAgvQueueVo"/>
|
||||
where req_code = #{reqCode}
|
||||
</select>
|
||||
<select id="selectAgvQueueByTaskCode" parameterType="String" resultMap="AgvQueueResult">
|
||||
<include refid="selectAgvQueueVo"/>
|
||||
where task_code = #{taskCode}
|
||||
</select>
|
||||
|
||||
<insert id="insertAgvQueue" parameterType="AgvQueue">
|
||||
insert into agv_queue
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="reqCode != null">req_code,</if>
|
||||
<if test="reqTime != null">req_time,</if>
|
||||
<if test="positionCode1 != null">position_code_1,</if>
|
||||
<if test="positionCode2 != null">position_code_2,</if>
|
||||
<if test="taskType != null">task_type,</if>
|
||||
<if test="ctnrType != null">ctnr_type,</if>
|
||||
<if test="ctnrCode != null">ctnr_code,</if>
|
||||
<if test="ctnrNum != null">ctnr_num,</if>
|
||||
<if test="taskMode != null">task_mode,</if>
|
||||
<if test="priority != null">priority,</if>
|
||||
<if test="agvType != null">agv_type,</if>
|
||||
<if test="request != null">request,</if>
|
||||
<if test="finishTime != null">finish_time,</if>
|
||||
<if test="wmsTraycode != null">wms_traycode,</if>
|
||||
<if test="wmsTaskNo != null">wms_task_no,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="taskCode != null">task_code,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="reqCode != null">#{reqCode},</if>
|
||||
<if test="reqTime != null">#{reqTime},</if>
|
||||
<if test="positionCode1 != null">#{positionCode1},</if>
|
||||
<if test="positionCode2 != null">#{positionCode2},</if>
|
||||
<if test="taskType != null">#{taskType},</if>
|
||||
<if test="ctnrType != null">#{ctnrType},</if>
|
||||
<if test="ctnrCode != null">#{ctnrCode},</if>
|
||||
<if test="ctnrNum != null">#{ctnrNum},</if>
|
||||
<if test="taskMode != null">#{taskMode},</if>
|
||||
<if test="priority != null">#{priority},</if>
|
||||
<if test="agvType != null">#{agvType},</if>
|
||||
<if test="request != null">#{request},</if>
|
||||
<if test="finishTime != null">#{finishTime},</if>
|
||||
<if test="wmsTraycode != null">#{wmsTraycode},</if>
|
||||
<if test="wmsTaskNo != null">#{wmsTaskNo},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="taskCode != null">#{taskCode},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAgvQueue" parameterType="AgvQueue">
|
||||
update agv_queue
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="reqTime != null">req_time = #{reqTime},</if>
|
||||
<if test="positionCode1 != null">position_code_1 = #{positionCode1},</if>
|
||||
<if test="positionCode2 != null">position_code_2 = #{positionCode2},</if>
|
||||
<if test="taskType != null">task_type = #{taskType},</if>
|
||||
<if test="ctnrType != null">ctnr_type = #{ctnrType},</if>
|
||||
<if test="ctnrCode != null">ctnr_code = #{ctnrCode},</if>
|
||||
<if test="ctnrNum != null">ctnr_num = #{ctnrNum},</if>
|
||||
<if test="taskMode != null">task_mode = #{taskMode},</if>
|
||||
<if test="priority != null">priority = #{priority},</if>
|
||||
<if test="agvType != null">agv_type = #{agvType},</if>
|
||||
<if test="request != null">request = #{request},</if>
|
||||
<if test="finishTime != null">finish_time = #{finishTime},</if>
|
||||
<if test="wmsTraycode != null">wms_traycode = #{wmsTraycode},</if>
|
||||
<if test="wmsTaskNo != null">wms_task_no = #{wmsTaskNo},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
</trim>
|
||||
where req_code = #{reqCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAgvQueueByReqCode" parameterType="String">
|
||||
delete from agv_queue where req_code = #{reqCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAgvQueueByReqCodes" parameterType="String">
|
||||
delete from agv_queue where req_code in
|
||||
<foreach item="reqCode" collection="array" open="(" separator="," close=")">
|
||||
#{reqCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.device.api.mapper.RequestLogMapper">
|
||||
<mapper namespace="com.ruoyi.api.mapper.RequestLogMapper">
|
||||
|
||||
<resultMap type="RequestLog" id="RequestLogResult">
|
||||
<result property="requestId" column="request_id" />
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.schedule.taskHistory.mapper.WcsTaskHistoryMapper">
|
||||
|
||||
<resultMap type="WcsTaskHistory" id="WcsTaskHistoryResult">
|
||||
<result property="jobId" column="job_id" />
|
||||
<result property="taskId" column="task_id" />
|
||||
<result property="taskType" column="task_type" />
|
||||
<result property="sourceLocation" column="source_location" />
|
||||
<result property="targetLocation" column="target_location" />
|
||||
<result property="taskStatus" column="task_status" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="scheduleTime" column="schedule_time" />
|
||||
<result property="finishTime" column="finish_time" />
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="areaId" column="area_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWcsTaskHistoryVo">
|
||||
select job_id, task_id, task_type, source_location, target_location, task_status, create_time, schedule_time, finish_time, device_id, area_id from wcs_task_history
|
||||
</sql>
|
||||
|
||||
<select id="selectWcsTaskHistoryList" parameterType="WcsTaskHistory" resultMap="WcsTaskHistoryResult">
|
||||
<include refid="selectWcsTaskHistoryVo"/>
|
||||
<where>
|
||||
<if test="jobId != null and jobId != ''"> and job_id = #{jobId}</if>
|
||||
<if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if>
|
||||
<if test="sourceLocation != null and sourceLocation != ''"> and source_location = #{sourceLocation}</if>
|
||||
<if test="targetLocation != null and targetLocation != ''"> and target_location = #{targetLocation}</if>
|
||||
<if test="taskStatus != null and taskStatus != ''"> and task_status = #{taskStatus}</if>
|
||||
<if test="createTime != null and createTime != ''"> and create_time = #{createTime}</if>
|
||||
<if test="finishTime != null and finishTime != ''"> and finish_time = #{finishTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWcsTaskHistoryByTaskId" parameterType="String" resultMap="WcsTaskHistoryResult">
|
||||
<include refid="selectWcsTaskHistoryVo"/>
|
||||
where task_id = #{taskId}
|
||||
</select>
|
||||
|
||||
<insert id="insertWcsTaskHistory" parameterType="WcsTaskHistory">
|
||||
insert into wcs_task_history
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="jobId != null">job_id,</if>
|
||||
<if test="taskId != null">task_id,</if>
|
||||
<if test="taskType != null">task_type,</if>
|
||||
<if test="sourceLocation != null">source_location,</if>
|
||||
<if test="targetLocation != null">target_location,</if>
|
||||
<if test="taskStatus != null">task_status,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="scheduleTime != null">schedule_time,</if>
|
||||
<if test="finishTime != null">finish_time,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="jobId != null">#{jobId},</if>
|
||||
<if test="taskId != null">#{taskId},</if>
|
||||
<if test="taskType != null">#{taskType},</if>
|
||||
<if test="sourceLocation != null">#{sourceLocation},</if>
|
||||
<if test="targetLocation != null">#{targetLocation},</if>
|
||||
<if test="taskStatus != null">#{taskStatus},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="scheduleTime != null">#{scheduleTime},</if>
|
||||
<if test="finishTime != null">#{finishTime},</if>
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWcsTaskHistory" parameterType="WcsTaskHistory">
|
||||
update wcs_task_history
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="jobId != null">job_id = #{jobId},</if>
|
||||
<if test="taskType != null">task_type = #{taskType},</if>
|
||||
<if test="sourceLocation != null">source_location = #{sourceLocation},</if>
|
||||
<if test="targetLocation != null">target_location = #{targetLocation},</if>
|
||||
<if test="taskStatus != null">task_status = #{taskStatus},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="scheduleTime != null">schedule_time = #{scheduleTime},</if>
|
||||
<if test="finishTime != null">finish_time = #{finishTime},</if>
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
</trim>
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWcsTaskHistoryByTaskId" parameterType="String">
|
||||
delete from wcs_task_history where task_id = #{taskId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWcsTaskHistoryByTaskIds" parameterType="String">
|
||||
delete from wcs_task_history where task_id in
|
||||
<foreach item="taskId" collection="array" open="(" separator="," close=")">
|
||||
#{taskId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -1,100 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.schedule.task.mapper.WcsTaskMapper">
|
||||
|
||||
<resultMap type="WcsTask" id="WcsTaskResult">
|
||||
<result property="jobId" column="job_id" />
|
||||
<result property="taskId" column="task_id" />
|
||||
<result property="taskType" column="task_type" />
|
||||
<result property="sourceLocation" column="source_location" />
|
||||
<result property="targetLocation" column="target_location" />
|
||||
<result property="taskStatus" column="task_status" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="scheduleTime" column="schedule_time" />
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="areaId" column="area_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWcsTaskVo">
|
||||
select job_id, task_id, task_type, source_location, target_location, task_status, create_time, schedule_time, device_id, area_id from wcs_task
|
||||
</sql>
|
||||
|
||||
<select id="selectWcsTaskList" parameterType="WcsTask" resultMap="WcsTaskResult">
|
||||
<include refid="selectWcsTaskVo"/>
|
||||
<where>
|
||||
<if test="jobId != null and jobId != ''"> and job_id = #{jobId}</if>
|
||||
<if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if>
|
||||
<if test="sourceLocation != null and sourceLocation != ''"> and source_location = #{sourceLocation}</if>
|
||||
<if test="targetLocation != null and targetLocation != ''"> and target_location = #{targetLocation}</if>
|
||||
<if test="taskStatus != null and taskStatus != ''"> and task_status = #{taskStatus}</if>
|
||||
<if test="scheduleTime != null and scheduleTime != ''"> and schedule_time = #{scheduleTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWcsTaskByTaskId" parameterType="String" resultMap="WcsTaskResult">
|
||||
<include refid="selectWcsTaskVo"/>
|
||||
where task_id = #{taskId}
|
||||
</select>
|
||||
|
||||
<select id="selectWcsTaskByJobId" parameterType="String" resultMap="WcsTaskResult">
|
||||
<include refid="selectWcsTaskVo"/>
|
||||
where job_id = #{jobId}
|
||||
</select>
|
||||
|
||||
<insert id="insertWcsTask" parameterType="WcsTask">
|
||||
insert into wcs_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="jobId != null">job_id,</if>
|
||||
<if test="taskId != null">task_id,</if>
|
||||
<if test="taskType != null">task_type,</if>
|
||||
<if test="sourceLocation != null">source_location,</if>
|
||||
<if test="targetLocation != null">target_location,</if>
|
||||
<if test="taskStatus != null">task_status,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="scheduleTime != null">schedule_time,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="jobId != null">#{jobId},</if>
|
||||
<if test="taskId != null">#{taskId},</if>
|
||||
<if test="taskType != null">#{taskType},</if>
|
||||
<if test="sourceLocation != null">#{sourceLocation},</if>
|
||||
<if test="targetLocation != null">#{targetLocation},</if>
|
||||
<if test="taskStatus != null">#{taskStatus},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="scheduleTime != null">#{scheduleTime},</if>
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWcsTask" parameterType="WcsTask">
|
||||
update wcs_task
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="jobId != null">job_id = #{jobId},</if>
|
||||
<if test="taskType != null">task_type = #{taskType},</if>
|
||||
<if test="sourceLocation != null">source_location = #{sourceLocation},</if>
|
||||
<if test="targetLocation != null">target_location = #{targetLocation},</if>
|
||||
<if test="taskStatus != null">task_status = #{taskStatus},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="scheduleTime != null">schedule_time = #{scheduleTime},</if>
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
</trim>
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWcsTaskByTaskId" parameterType="String">
|
||||
delete from wcs_task where task_id = #{taskId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWcsTaskByTaskIds" parameterType="String">
|
||||
delete from wcs_task where task_id in
|
||||
<foreach item="taskId" collection="array" open="(" separator="," close=")">
|
||||
#{taskId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user