Compare commits
4 Commits
fix/wcs-ou
...
24fb696a67
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24fb696a67 | ||
|
|
9b008f5fe7 | ||
|
|
03e30d1db0 | ||
|
|
9c6c32b7ed |
2
pom.xml
2
pom.xml
@@ -37,7 +37,7 @@
|
||||
<spring-framework.version>5.3.39</spring-framework.version>
|
||||
<hutool.version>5.8.27</hutool.version>
|
||||
<lombok.version>1.18.30</lombok.version>
|
||||
<HslCommunication.version>2.0.0</HslCommunication.version>
|
||||
<HslCommunication.version>3.7.0</HslCommunication.version>
|
||||
<mybatis-plus.version>3.5.2</mybatis-plus.version>
|
||||
|
||||
</properties>
|
||||
|
||||
@@ -83,12 +83,6 @@
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- plc连接库 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.plc4x</groupId>
|
||||
@@ -112,11 +106,6 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.2.5</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import com.ruoyi.schedule.ScheduleThread;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MyStartupRunner implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
private ScheduleThread scheduleThread;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
// 这里编写项目启动后要执行的方法逻辑
|
||||
//System.out.println("项目启动成功后自动执行此方法");
|
||||
// scheduleThread.startAllThread();
|
||||
// scheduleThread.startAllThread2();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import com.ruoyi.schedule.ScheduleThread;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -8,8 +7,6 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
@@ -20,7 +17,6 @@ import javax.annotation.Resource;
|
||||
@EnableAsync
|
||||
public class RuoYiApplication
|
||||
{
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
|
||||
@@ -1,43 +1,30 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.mchange.v2.lang.ObjectUtils;
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackRequest;
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackResponse;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.queue.agv.service.impl.AgvQueueServiceImpl;
|
||||
import com.ruoyi.system.domain.AgvContainerTask;
|
||||
import com.ruoyi.system.mapper.AgvContainerTaskMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Agv操作请求
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/agv")
|
||||
@RequestMapping("/agv/api")
|
||||
@Slf4j
|
||||
public class AgvController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IApiService apiService;
|
||||
@Autowired
|
||||
private AgvQueueServiceImpl agvQueueService;
|
||||
@Autowired
|
||||
private AgvContainerTaskMapper agvContainerTaskMapper;
|
||||
|
||||
/**
|
||||
* agv执行状态返回接口
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@@ -47,14 +34,15 @@ public class AgvController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* agv搬运作业
|
||||
*
|
||||
* @param param{ startPoint:起始点
|
||||
* endPoint:结束点
|
||||
* containerCode:容器编号
|
||||
* taskNo:任务号
|
||||
* }
|
||||
* @param param{
|
||||
* startPoint:起始点
|
||||
* endPoint:结束点
|
||||
* containerCode:容器编号
|
||||
* taskNo:任务号
|
||||
* }
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/receiveAgvMoveJob")
|
||||
@@ -62,98 +50,4 @@ public class AgvController extends BaseController {
|
||||
return apiService.receiveAgvMoveJob(param);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取AGV任务定时器
|
||||
*/
|
||||
|
||||
@Scheduled(fixedDelay = 5000)
|
||||
public void queryAgvMoveJob() {
|
||||
apiService.sendContarTask();
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 5000)
|
||||
public void finishAgvMoveJob() {
|
||||
AgvContainerTask agvContainerTask= agvContainerTaskMapper.selectAgvContainerFinishOne();
|
||||
if (agvContainerTask!=null){
|
||||
apiService.finishAgvJob(agvContainerTask.getContainer());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**任务下发
|
||||
*
|
||||
*/
|
||||
@Scheduled(fixedDelay = 1000)
|
||||
public void sendAgvMoveJob() {
|
||||
AgvContainerTask agvContainerTask = new AgvContainerTask();
|
||||
agvContainerTask.setStatus("0");
|
||||
List<AgvContainerTask> agvContainerTasks = agvContainerTaskMapper.selectAgvContainerTaskList(agvContainerTask);
|
||||
if (agvContainerTasks.size() > 0) {
|
||||
AgvContainerTask agvContainerTask1 = agvContainerTasks.get(0);
|
||||
Map<String, String> param = new HashMap<>();
|
||||
param.put("FromStation", agvContainerTask1.getStartPoint());
|
||||
param.put("ToStation", agvContainerTask1.getEndPoint());
|
||||
param.put("Type", agvContainerTask1.getSpare1());
|
||||
param.put("OrderId", agvContainerTask1.getContainer());
|
||||
// param.put("TaskGuideId", agvContainerTask1.getTaskNo());
|
||||
AjaxResult ajaxResult = apiService.sendAgvCar(param);
|
||||
Integer code = (Integer) ajaxResult.get("code");
|
||||
if (200 == code) {
|
||||
agvContainerTask1.setStatus("1");
|
||||
agvContainerTaskMapper.updateAgvContainerTask(agvContainerTask1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 请求取货放货接口
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/checkAllow")
|
||||
public AjaxResult checkAllow(@RequestBody JSONObject jsonObject) {
|
||||
// 取放货站点
|
||||
String requestStation = String.valueOf(jsonObject.get("requestStation"));
|
||||
// 表内主键
|
||||
String orderId = String.valueOf(jsonObject.get("orderId"));
|
||||
String Type = String.valueOf(jsonObject.get("type"));
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_position", requestStation);
|
||||
map.put("v_orderId", orderId);
|
||||
map.put("v_type", Type);
|
||||
agvQueueService.selectKx(map);
|
||||
Integer vResult = (Integer) map.get("v_result");
|
||||
if (vResult == 1) {
|
||||
return new AjaxResult(1, Type.equals("1") ? "允许取货" : "允许放货");
|
||||
} else {
|
||||
return new AjaxResult(0, Type.equals("1") ? "不允许取货,请等待" : "不允许放货,请等待");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取货放货完成返回接口
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/completionSignal")
|
||||
public AjaxResult completionSignal(@RequestBody JSONObject jsonObject) {
|
||||
|
||||
String orderId = String.valueOf(jsonObject.get("orderId"));
|
||||
String Type = String.valueOf(jsonObject.get("type"));
|
||||
|
||||
|
||||
agvContainerTaskMapper.updateAgvContainerTaskByOrder(orderId);
|
||||
// agvContainerTaskMapper.insertAgvContainerTaskFinish(orderId);
|
||||
// agvContainerTaskMapper.deleteAgvContainerTaskByContainer(orderId);
|
||||
|
||||
return new AjaxResult(1, "返回成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -55,5 +53,4 @@ public class Wcs2WmsController {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -136,18 +136,4 @@ public interface IApiService
|
||||
AjaxResult allotSpace(JobParam jobParam);
|
||||
|
||||
AjaxResult JobFinish(Map<String, Object> param);
|
||||
|
||||
AjaxResult OutMakeSure(HashMap<String, Object> map);
|
||||
|
||||
void updateLed(HashMap<String, Object> objectObjectHashMap);
|
||||
|
||||
void updateLedError(HashMap<String, Object> objectObjectHashMap);
|
||||
|
||||
void sendContarTask();
|
||||
|
||||
AjaxResult sendAgvCar(Map<String, String> param);
|
||||
|
||||
AjaxResult insertAgvQuene(HashMap<String, Object> objectObjectHashMap);
|
||||
|
||||
void finishAgvJob(String container);
|
||||
}
|
||||
|
||||
@@ -75,6 +75,4 @@ public interface IRequestLogService
|
||||
* @return
|
||||
*/
|
||||
public RequestLog getRequestLog(String url, String param);
|
||||
|
||||
public RequestLog getRequestLogs(String url, String param, String endPoint);
|
||||
}
|
||||
|
||||
@@ -18,15 +18,12 @@ import com.ruoyi.api.domain.agv.genAgvSchedulingTask.PositionCodeData;
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.cargospace.mapper.BasCargoSpaceMapper;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.job.service.IMydoJobService;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.system.domain.AgvContainerTask;
|
||||
import com.ruoyi.system.service.IAgvContainerTaskService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -54,10 +51,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
private IAgvQueueService agvQueueService;
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
@Autowired
|
||||
private BasCargoSpaceMapper basCargoSpaceMapper;
|
||||
@Autowired
|
||||
private IAgvContainerTaskService agvContainerTaskService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -144,6 +138,10 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 处理agv状态返回
|
||||
*
|
||||
@@ -198,24 +196,26 @@ public class ApiServiceImpl implements IApiService {
|
||||
public AjaxResult cancelMydoJob(JobParam jobParam) {
|
||||
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(jobParam.getTaskNo()));
|
||||
if (mydoJob == null) {
|
||||
if(mydoJob==null){
|
||||
return AjaxResult.error("任务不存在");
|
||||
}
|
||||
if ("1".equals(mydoJob.getStatus())) {
|
||||
if("1".equals(mydoJob.getStatus())){
|
||||
mydoJob.setStatus("5");
|
||||
mydoJobService.insertHistory(mydoJob.getJobId());
|
||||
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
}else{
|
||||
return AjaxResult.error("任务已开始");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult reAssign(JobParam jobParam) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(RE_ASSIGN_URL, "重新分配货位", JSONUtil.toJsonStr(jobParam));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
|
||||
MydoJob wmsMydoJob = BeanUtil.toBean(bean.getData(), MydoJob.class);
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(wmsMydoJob.getJobId());
|
||||
@@ -229,7 +229,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
@Override
|
||||
public AjaxResult reMaterial(JobParam jobParam) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(RE_MATERIAL_URL, "重新分配物料", JSONUtil.toJsonStr(jobParam));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
@@ -360,22 +360,9 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob) {
|
||||
Integer jobType = parseOutboundJobType(receiveOutJob);
|
||||
if (jobType == null || jobType < 20) {
|
||||
String rawType = receiveOutJob == null ? null : receiveOutJob.getInOrOut();
|
||||
return AjaxResult.error("WCS 无法识别作业类型 " + rawType + ",任务未接收");
|
||||
}
|
||||
if (jobType != 30) {
|
||||
String cargoSpaceId = receiveOutJob.getCargoSpaceId();
|
||||
if (basCargoSpaceMapper.selectBasCargoSpaceByCargoSpaceId(cargoSpaceId) == null) {
|
||||
return AjaxResult.error("WCS 未找到出库货位 " + cargoSpaceId + ",任务未接收");
|
||||
}
|
||||
if (basCargoSpaceMapper.countOutboundBlockingPositions(cargoSpaceId) > 0) {
|
||||
return AjaxResult.error("同通道外侧货位尚未清空,等待前置移库完成");
|
||||
}
|
||||
}
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setJobId(receiveOutJob.getJobId());
|
||||
mydoJob.setTaskNo(receiveOutJob.getTaskNo());
|
||||
@@ -393,23 +380,12 @@ public class ApiServiceImpl implements IApiService {
|
||||
int i = mydoJobService.insertMydoJob(mydoJob);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
}else{
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Integer parseOutboundJobType(ReceiveJob job) {
|
||||
if (job == null || job.getInOrOut() == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Integer.valueOf(job.getInOrOut());
|
||||
} catch (NumberFormatException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult receiveInMydoJob(ReceiveJob receiveInJob) {
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
@@ -426,7 +402,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
int i = mydoJobService.insertMydoJob(mydoJob);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
}else{
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
@@ -471,74 +447,4 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult OutMakeSure(HashMap<String, Object> map) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(OUT_MAKE_SURE, "线边直出请求过账", JSONUtil.toJsonStr(map));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
|
||||
return AjaxResult.success(bean.getData());
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLed(HashMap<String, Object> map) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(UPDATE_LED, "出库到位更新LED", JSONUtil.toJsonStr(map));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLedError(HashMap<String, Object> map) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(UPDATE_LED_ERROR, "更新线体报错信息", JSONUtil.toJsonStr(map));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendContarTask() {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(QUERY_AGV_QUENE, "请求获取AGV执行队列", JSONUtil.toJsonStr(""));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
|
||||
AgvContainerTask bean1 = BeanUtil.toBean(bean.getData(), AgvContainerTask.class);
|
||||
bean1.setStatus("0");
|
||||
agvContainerTaskService.insertAgvContainerTask(bean1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult sendAgvCar(Map<String, String> param) {
|
||||
RequestLog requestLog = requestLogService.getRequestLogs(SEND_AGV_CAR, "下发AGV执行对列", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
{
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult insertAgvQuene(HashMap<String, Object> param) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(INSERT_AGV_QUENE, "请求自动生成AGV执行队列", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
{
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishAgvJob(String container) {
|
||||
HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("order", container);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(FINISH_AGV_QUENE, "完成AGV执行队列", JSONUtil.toJsonStr(objectObjectHashMap));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
|
||||
agvContainerTaskService.deleteAgvContainerTaskByOrderId(container);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ 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.http.ContentType;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.InterfaceReceive;
|
||||
@@ -26,7 +24,8 @@ import com.ruoyi.api.service.IRequestLogService;
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RequestLogServiceImpl implements IRequestLogService {
|
||||
public class RequestLogServiceImpl implements IRequestLogService
|
||||
{
|
||||
@Autowired
|
||||
private RequestLogMapper requestLogMapper;
|
||||
|
||||
@@ -37,7 +36,8 @@ public class RequestLogServiceImpl implements IRequestLogService {
|
||||
* @return 接口记录
|
||||
*/
|
||||
@Override
|
||||
public RequestLog selectRequestLogByRequestId(Long requestId) {
|
||||
public RequestLog selectRequestLogByRequestId(Long requestId)
|
||||
{
|
||||
return requestLogMapper.selectRequestLogByRequestId(requestId);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ public class RequestLogServiceImpl implements IRequestLogService {
|
||||
* @return 接口记录
|
||||
*/
|
||||
@Override
|
||||
public List<RequestLog> selectRequestLogList(RequestLog requestLog) {
|
||||
public List<RequestLog> selectRequestLogList(RequestLog requestLog)
|
||||
{
|
||||
return requestLogMapper.selectRequestLogList(requestLog);
|
||||
}
|
||||
|
||||
@@ -59,10 +60,11 @@ public class RequestLogServiceImpl implements IRequestLogService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRequestLog(RequestLog requestLog) {
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
public int insertRequestLog(RequestLog requestLog)
|
||||
{
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
return requestLogMapper.insertRequestLog(requestLog);
|
||||
} else {
|
||||
}else {
|
||||
//log.error("请求失败:" + requestLog.getErrorDetails());
|
||||
return 0;
|
||||
}
|
||||
@@ -75,7 +77,8 @@ public class RequestLogServiceImpl implements IRequestLogService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRequestLog(RequestLog requestLog) {
|
||||
public int updateRequestLog(RequestLog requestLog)
|
||||
{
|
||||
return requestLogMapper.updateRequestLog(requestLog);
|
||||
}
|
||||
|
||||
@@ -86,7 +89,8 @@ public class RequestLogServiceImpl implements IRequestLogService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRequestLogByRequestIds(Long[] requestIds) {
|
||||
public int deleteRequestLogByRequestIds(Long[] requestIds)
|
||||
{
|
||||
return requestLogMapper.deleteRequestLogByRequestIds(requestIds);
|
||||
}
|
||||
|
||||
@@ -97,7 +101,8 @@ public class RequestLogServiceImpl implements IRequestLogService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRequestLogByRequestId(Long requestId) {
|
||||
public int deleteRequestLogByRequestId(Long requestId)
|
||||
{
|
||||
return requestLogMapper.deleteRequestLogByRequestId(requestId);
|
||||
}
|
||||
|
||||
@@ -110,7 +115,7 @@ public class RequestLogServiceImpl implements IRequestLogService {
|
||||
* @return requestLog
|
||||
*/
|
||||
@Override
|
||||
public RequestLog getRequestLog(String url, String endPoint, String param) {
|
||||
public RequestLog getRequestLog(String url, String endPoint,String param) {
|
||||
RequestLog requestLog = new RequestLog();
|
||||
Date requestTime = new Date();
|
||||
requestLog.setRequestTime(DateUtil.format(requestTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
@@ -123,17 +128,15 @@ public class RequestLogServiceImpl implements IRequestLogService {
|
||||
requestLog.setRequestUrl(url);
|
||||
try {
|
||||
String resStr = HttpUtil.post(url, param);
|
||||
|
||||
requestLog.setResponseBody(resStr);
|
||||
|
||||
InterfaceReceive bean = JSONUtil.toBean(resStr, InterfaceReceive.class);
|
||||
Date responseTime = new Date();
|
||||
Date responseTime =new Date();
|
||||
if (bean.getCode() == 200) {
|
||||
requestLog.setResponseTime(DateUtil.format(responseTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
requestLog.setResponseStatus("1");
|
||||
requestLog.setDuration(Convert.toStr(DateUtil.between(requestTime, responseTime, DateUnit.MS)));
|
||||
requestLog.setIsSuccessful("1");
|
||||
} else {
|
||||
}else {
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setErrorDetails(bean.getMsg());
|
||||
requestLog.setIsSuccessful("0");
|
||||
@@ -168,46 +171,4 @@ public class RequestLogServiceImpl implements IRequestLogService {
|
||||
requestLog.setDuration(Convert.toStr(DateUtil.between(requestTime, requestTime, DateUnit.MS)));
|
||||
return requestLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestLog getRequestLogs(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"));
|
||||
requestLog.setSourceSystem("wcs");
|
||||
requestLog.setTargetSystem("wms");
|
||||
requestLog.setEndpoint(param);
|
||||
requestLog.setRequestMethod("post");
|
||||
requestLog.setRequestHeaders(null);
|
||||
requestLog.setRequestBody(endPoint);
|
||||
requestLog.setRequestUrl(url);
|
||||
try {
|
||||
// 链式创建POST请求,获取完整响应对象
|
||||
HttpResponse response = HttpUtil.createPost(url)
|
||||
.body(endPoint, "application/json") // 传入表单参数
|
||||
.execute();
|
||||
String body = response.body();
|
||||
int status = response.getStatus();
|
||||
InterfaceReceive bean = JSONUtil.toBean(body, InterfaceReceive.class);
|
||||
Date responseTime = new Date();
|
||||
if (status == 200) {
|
||||
requestLog.setResponseTime(DateUtil.format(responseTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
requestLog.setResponseStatus("1");
|
||||
requestLog.setDuration(Convert.toStr(DateUtil.between(requestTime, responseTime, DateUnit.MS)));
|
||||
requestLog.setIsSuccessful("1");
|
||||
} else {
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setErrorDetails(bean.getMsg());
|
||||
requestLog.setIsSuccessful("0");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
requestLog.setErrorDetails(e.getMessage());
|
||||
requestLog.setIsSuccessful("0");
|
||||
requestLog.setResponseStatus("0");
|
||||
} finally {
|
||||
insertRequestLog(requestLog);
|
||||
}
|
||||
return requestLog;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,6 @@ public interface BasCargoSpaceMapper
|
||||
*/
|
||||
public BasCargoSpace selectBasCargoSpaceByCargoSpaceId(String cargoSpaceId);
|
||||
|
||||
/**
|
||||
* Count occupied positions or unfinished outbound jobs outside the requested position.
|
||||
*/
|
||||
int countOutboundBlockingPositions(@Param("cargoSpaceId") String cargoSpaceId);
|
||||
|
||||
/**
|
||||
* 查询库存信息列表
|
||||
*
|
||||
|
||||
@@ -141,7 +141,7 @@ public class RoadCacheServiceImpl implements RoadCacheService {
|
||||
HashSet<String> otherCarSiteList = new HashSet<>();
|
||||
for (WcsSrgvQueue wcsSrgvQueue : otherCarQueue) {
|
||||
if (wcsSrgvQueue.getPathInfo() != null) {
|
||||
//根据小车当前点位去除已走路径 除了当前点和上一个点之外都解锁
|
||||
//根据小车当前点位去除已走路径
|
||||
DeviceSrgv otherCarCurrStatus = deviceSrgvService.selectDeviceSrgvByGuid(wcsSrgvQueue.getAgvId());
|
||||
String currSite = otherCarCurrStatus.getCurrSite();
|
||||
List<String> allSiteList = Arrays.asList(wcsSrgvQueue.getPathInfo().split(","));
|
||||
|
||||
@@ -4,8 +4,8 @@ package com.ruoyi.common;
|
||||
public class Constant {
|
||||
|
||||
public static final String WMS_BASE_URL = "http://localhost:8080/api2wms/";
|
||||
public static final String RCS_BASE_URL = "http://192.168.188.251:9501/";
|
||||
public static final String WMS_BASE_PDA_URL = "http://localhost:8080/pda/";
|
||||
public static final String RCS_BASE_URL = "http://127.0.0.1:8081/rcms-dps/rest/";
|
||||
|
||||
|
||||
public static final String JOB_FINISH_URL = WMS_BASE_URL+"jobFinish";
|
||||
public static final String CONTINUE_TASK_URL = RCS_BASE_URL+"continueTask";
|
||||
@@ -17,13 +17,8 @@ public class Constant {
|
||||
public static final String RE_ASSIGN_URL = WMS_BASE_URL+"reAssign";
|
||||
public static final String RE_MATERIAL_URL = WMS_BASE_URL+"reMaterial";
|
||||
public static final String REQUEST_ENTER_URL = WMS_BASE_URL+"requestEnterByTrayCodeAndEntranceId";
|
||||
public static final String OUT_MAKE_SURE=WMS_BASE_PDA_URL+"outMakeSure";
|
||||
public static final String UPDATE_LED=WMS_BASE_URL+"updateLed";
|
||||
public static final String QUERY_AGV_QUENE=WMS_BASE_URL+"queryAgvQuene";
|
||||
public static final String FINISH_AGV_QUENE=WMS_BASE_URL+"finishAgvQuene";
|
||||
public static final String SEND_AGV_CAR=RCS_BASE_URL+"api/app/agvs-task";
|
||||
public static final String INSERT_AGV_QUENE=WMS_BASE_URL+"insertAgvQuene";
|
||||
public static final String UPDATE_LED_ERROR=WMS_BASE_URL+"updateLedError";
|
||||
|
||||
|
||||
public static final String WAREHOUSE_01 = "01";
|
||||
public static final String WAREHOUSE_02 = "02";
|
||||
|
||||
|
||||
@@ -83,8 +83,6 @@ public class DeviceSsj extends BaseEntity
|
||||
|
||||
@Excel(name="输送线模式 1-入库 2-出库")
|
||||
private int model;
|
||||
// 报警信息
|
||||
private int errorCode;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.ruoyi.job.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;
|
||||
@@ -30,7 +29,8 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/job/mydoJob")
|
||||
public class MydoJobController extends BaseController {
|
||||
public class MydoJobController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
|
||||
@@ -39,7 +39,8 @@ public class MydoJobController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('job:mydoJob:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MydoJob mydoJob) {
|
||||
public TableDataInfo list(MydoJob mydoJob)
|
||||
{
|
||||
startPage();
|
||||
List<MydoJob> list = mydoJobService.selectMydoJobList(mydoJob);
|
||||
return getDataTable(list);
|
||||
@@ -50,11 +51,10 @@ public class MydoJobController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('job:mydoJob:list')")
|
||||
@GetMapping("/listFinish")
|
||||
public TableDataInfo listFinish(MydoJob mydoJob) {
|
||||
public TableDataInfo listFinish(MydoJob mydoJob)
|
||||
{
|
||||
startPage();
|
||||
// mydoJob.setStatus("3");
|
||||
List<MydoJob> list = mydoJobService.selectMydoJobFinishList(mydoJob);
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -64,15 +64,9 @@ public class MydoJobController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('job:mydoJob:export')")
|
||||
@Log(title = "作业信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MydoJob mydoJob) {
|
||||
List<MydoJob> list = null;
|
||||
if (mydoJob.getStatus().equals("3")) {
|
||||
list = mydoJobService.selectMydoJobList(mydoJob);
|
||||
} else {
|
||||
|
||||
list = mydoJobService.selectMydoJobFinishList(mydoJob);
|
||||
}
|
||||
|
||||
public void export(HttpServletResponse response, MydoJob mydoJob)
|
||||
{
|
||||
List<MydoJob> list = mydoJobService.selectMydoJobList(mydoJob);
|
||||
ExcelUtil<MydoJob> util = new ExcelUtil<MydoJob>(MydoJob.class);
|
||||
util.exportExcel(response, list, "作业信息数据");
|
||||
}
|
||||
@@ -82,7 +76,8 @@ public class MydoJobController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('job:mydoJob:query')")
|
||||
@GetMapping(value = "/{jobId}")
|
||||
public AjaxResult getInfo(@PathVariable("jobId") String jobId) {
|
||||
public AjaxResult getInfo(@PathVariable("jobId") String jobId)
|
||||
{
|
||||
return success(mydoJobService.selectMydoJobByJobId(jobId));
|
||||
}
|
||||
|
||||
@@ -92,7 +87,8 @@ public class MydoJobController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('job:mydoJob:add')")
|
||||
@Log(title = "作业信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MydoJob mydoJob) {
|
||||
public AjaxResult add(@RequestBody MydoJob mydoJob)
|
||||
{
|
||||
return toAjax(mydoJobService.insertMydoJob(mydoJob));
|
||||
}
|
||||
|
||||
@@ -102,7 +98,8 @@ public class MydoJobController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('job:mydoJob:edit')")
|
||||
@Log(title = "作业信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MydoJob mydoJob) {
|
||||
public AjaxResult edit(@RequestBody MydoJob mydoJob)
|
||||
{
|
||||
return toAjax(mydoJobService.updateMydoJob(mydoJob));
|
||||
}
|
||||
|
||||
@@ -111,8 +108,9 @@ public class MydoJobController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('job:mydoJob:remove')")
|
||||
@Log(title = "作业信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{jobIds}")
|
||||
public AjaxResult remove(@PathVariable String[] jobIds) {
|
||||
@DeleteMapping("/{jobIds}")
|
||||
public AjaxResult remove(@PathVariable String[] jobIds)
|
||||
{
|
||||
return toAjax(mydoJobService.deleteMydoJobByJobIds(jobIds));
|
||||
}
|
||||
|
||||
@@ -120,7 +118,8 @@ public class MydoJobController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('job:mydoJob:manualCallback')")
|
||||
@Log(title = "作业信息", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/manualCallback/{jobId}")
|
||||
public AjaxResult manualCallback(@PathVariable("jobId") String jobId) {
|
||||
public AjaxResult manualCallback(@PathVariable("jobId") String jobId)
|
||||
{
|
||||
return mydoJobService.manualCallback(jobId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,10 @@ public class MydoJob extends BaseEntity
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 任务ID */
|
||||
@Excel(name = "任务ID")
|
||||
private String jobId;
|
||||
|
||||
/** 任务状态 */
|
||||
@Excel(name = "任务状态",dictType = "job_status")
|
||||
@Excel(name = "任务状态")
|
||||
private String status;
|
||||
|
||||
/** 任务号 */
|
||||
@@ -36,7 +35,7 @@ public class MydoJob extends BaseEntity
|
||||
private String taskNo;
|
||||
|
||||
/** 巷道ID */
|
||||
// @Excel(name = "巷道ID")
|
||||
@Excel(name = "巷道ID")
|
||||
private String roadwayId;
|
||||
|
||||
/** 货位ID */
|
||||
@@ -56,11 +55,11 @@ public class MydoJob extends BaseEntity
|
||||
private Long priority;
|
||||
|
||||
/** 执行阶段 */
|
||||
// @Excel(name = "执行阶段")
|
||||
@Excel(name = "执行阶段")
|
||||
private String executionPhase;
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型",dictType = "job_type")
|
||||
@Excel(name = "任务类型")
|
||||
private String inOrOut;
|
||||
|
||||
/** 开始时间 */
|
||||
@@ -84,9 +83,9 @@ public class MydoJob extends BaseEntity
|
||||
private String warehouseId;
|
||||
|
||||
/** 重分标志 */
|
||||
// @Excel(name = "重分标志")
|
||||
@Excel(name = "重分标志")
|
||||
private String faultFlag;
|
||||
@Excel(name = "托盘条码")
|
||||
|
||||
private String trayCode;
|
||||
|
||||
private String inOut;
|
||||
|
||||
@@ -89,18 +89,4 @@ public interface MydoJobMapper
|
||||
Integer selectExit(String ssj);
|
||||
|
||||
Integer selectMydoJobCount();
|
||||
|
||||
Integer selectMydoJobIn();
|
||||
|
||||
Integer selectMydoJobCountOut();
|
||||
|
||||
Integer selectByJobOut(Integer currFloor);
|
||||
|
||||
Integer selectByJobOutIsOne(Integer currFloor);
|
||||
|
||||
Integer selectMydoJobExit(String exit);
|
||||
|
||||
Integer selectTheFloorYk(String theFloor);
|
||||
|
||||
void deleteMydoJobByTaskNos(List<String> validTaskNos);
|
||||
}
|
||||
|
||||
@@ -88,16 +88,4 @@ public interface IMydoJobService
|
||||
Integer selectExit(String ssj);
|
||||
|
||||
Integer selectMydoJobCount();
|
||||
|
||||
Integer selectMydoJobIn();
|
||||
|
||||
Integer selectMydoJobCountOut();
|
||||
|
||||
Integer selectByJobOut(Integer currFloor);
|
||||
|
||||
Integer selectByJobOutIsOne(Integer currFloor);
|
||||
|
||||
Integer selectMydoJobExit(String exit);
|
||||
|
||||
Integer selectTheFloorYk(String theFloor);
|
||||
}
|
||||
|
||||
@@ -193,35 +193,4 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
public Integer selectMydoJobCount() {
|
||||
return mydoJobMapper.selectMydoJobCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectMydoJobIn() {
|
||||
return mydoJobMapper.selectMydoJobIn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectMydoJobCountOut() {
|
||||
return mydoJobMapper.selectMydoJobCountOut();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectByJobOut(Integer currFloor) {
|
||||
|
||||
return mydoJobMapper.selectByJobOut(currFloor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectByJobOutIsOne(Integer currFloor) {
|
||||
return mydoJobMapper.selectByJobOutIsOne(currFloor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectMydoJobExit(String exit) {
|
||||
return mydoJobMapper.selectMydoJobExit(exit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectTheFloorYk(String theFloor) {
|
||||
return mydoJobMapper.selectTheFloorYk(theFloor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi.queue.agv.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
|
||||
@@ -68,6 +67,4 @@ public interface AgvQueueMapper
|
||||
AgvQueue selectAgvQueueByTaskCode(String taskCode);
|
||||
|
||||
void insertHistory(String reqCode);
|
||||
|
||||
void selectKx(HashMap<String, Object> map);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi.queue.agv.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
|
||||
@@ -72,6 +71,4 @@ public interface IAgvQueueService
|
||||
* @param reqCode
|
||||
*/
|
||||
void insertHistory(String reqCode);
|
||||
|
||||
void selectKx(HashMap<String, Object> map);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi.queue.agv.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -101,9 +100,4 @@ public class AgvQueueServiceImpl implements IAgvQueueService
|
||||
public void insertHistory(String reqCode) {
|
||||
agvQueueMapper.insertHistory(reqCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectKx(HashMap<String, Object> map) {
|
||||
agvQueueMapper.selectKx(map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +77,4 @@ public interface WcsSrgvQueueMapper
|
||||
Integer selectTsj();
|
||||
|
||||
Integer selectByCaogoPlaceSite(String siteId);
|
||||
|
||||
Integer selectByEndSite();
|
||||
|
||||
List<String> selectTaskNosByGuids(String[] guids);
|
||||
}
|
||||
|
||||
@@ -83,6 +83,4 @@ public interface IWcsSrgvQueueService
|
||||
Integer selectTsj();
|
||||
|
||||
Integer selectByCaogoPlaceSite(String siteId);
|
||||
|
||||
Integer selectByEndSite();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.ruoyi.queue.srgv.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import com.ruoyi.job.mapper.MydoJobMapper;
|
||||
import com.ruoyi.queue.srgv.domain.WcsSrgvQueueFinish;
|
||||
import com.ruoyi.queue.srgv.mapper.WcsSrgvQueueFinishMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -28,8 +26,7 @@ public class WcsSrgvQueueServiceImpl implements IWcsSrgvQueueService
|
||||
private WcsSrgvQueueMapper wcsSrgvQueueMapper;
|
||||
@Autowired
|
||||
private WcsSrgvQueueFinishMapper wcsSrgvQueueFinishMapper;
|
||||
@Autowired
|
||||
private MydoJobMapper mydoJobMapper;
|
||||
|
||||
/**
|
||||
* 查询四向小车任务队列
|
||||
*
|
||||
@@ -103,29 +100,9 @@ public class WcsSrgvQueueServiceImpl implements IWcsSrgvQueueService
|
||||
@Override
|
||||
public int deleteWcsSrgvQueueByGuids(String[] guids)
|
||||
{
|
||||
if (guids == null || guids.length == 0) {
|
||||
return 0;
|
||||
}
|
||||
List<String> taskNos = wcsSrgvQueueMapper.selectTaskNosByGuids(guids);
|
||||
deleteMydoJobsByTaskNos(taskNos);
|
||||
return wcsSrgvQueueMapper.deleteWcsSrgvQueueByGuids(guids);
|
||||
}
|
||||
|
||||
private void deleteMydoJobsByTaskNos(List<String> taskNos) {
|
||||
if (taskNos == null || taskNos.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<String> validTaskNos = new ArrayList<>();
|
||||
for (String taskNo : taskNos) {
|
||||
if (taskNo != null && !"".equals(taskNo)) {
|
||||
validTaskNos.add(taskNo);
|
||||
}
|
||||
}
|
||||
if (!validTaskNos.isEmpty()) {
|
||||
mydoJobMapper.deleteMydoJobByTaskNos(validTaskNos);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除四向小车任务队列信息
|
||||
*
|
||||
@@ -154,12 +131,6 @@ public class WcsSrgvQueueServiceImpl implements IWcsSrgvQueueService
|
||||
return wcsSrgvQueueMapper.selectByCaogoPlaceSite(siteId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectByEndSite() {
|
||||
return wcsSrgvQueueMapper.selectByEndSite();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public WcsSrgvQueue insertHistory(String taskNo) {
|
||||
WcsSrgvQueue wcsSrgvQueue = wcsSrgvQueueMapper.selectWcsSrgvQueueByTaskNo(taskNo);
|
||||
|
||||
@@ -73,8 +73,6 @@ public class PlcCdzRead implements Runnable {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
deviceCdz.setStatus(ParseUtil.optInt(0, ddsx1));
|
||||
// deviceCdz.setModel(ParseUtil.optInt(2, ddsx1));
|
||||
}else {
|
||||
log.error(read2.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,8 +116,8 @@ public class PlcCdzRead implements Runnable {
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
if (siemensS7Net != null) {
|
||||
siemensS7Net.ConnectClose();
|
||||
if (readWriteNet != null) {
|
||||
readWriteNet.ConnectClose();
|
||||
}
|
||||
setIsConnect(false);
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ public class PlcDdjRead implements Runnable {
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
if (siemensS7Net != null) {
|
||||
siemensS7Net.ConnectClose();
|
||||
if (readWriteNet != null) {
|
||||
readWriteNet.ConnectClose();
|
||||
}
|
||||
setIsConnect(false);
|
||||
}
|
||||
|
||||
@@ -78,39 +78,23 @@ public class PlcSrgvRead implements Runnable {
|
||||
OperateResultExOne<byte[]> read1 = modbusTcpNet.Read("4068", (short) 15);//2400-2414
|
||||
if (read1.IsSuccess) {
|
||||
setValueByByte1(read1.Content, deviceSrgv);
|
||||
}else {
|
||||
log.error(read1.Message);
|
||||
}
|
||||
|
||||
OperateResultExOne<byte[]> read5 = modbusTcpNet.Read("4081", (short) 2);//2400-2414
|
||||
if (read5.IsSuccess) {
|
||||
setValueByByte5(read1.Content, deviceSrgv);
|
||||
}else {
|
||||
log.error(read1.Message);
|
||||
}
|
||||
|
||||
//读取二段任务 小车是否接收完成1段作业
|
||||
OperateResultExOne<byte[]> read3 = modbusTcpNet.Read("1000", (short) 2);//2400-2414
|
||||
if (read3.IsSuccess) {
|
||||
setValueByByte3(read3.Content, deviceSrgv);
|
||||
}else {
|
||||
log.error(read1.Message);
|
||||
}
|
||||
|
||||
//读取双字
|
||||
OperateResultExOne<byte[]> read2 = modbusTcpNet.Read("4060", (short) 8);// 4800-4807任务号、原点、目标点、当前
|
||||
if (read2.IsSuccess) {
|
||||
setValueByByte2(read2.Content, deviceSrgv);
|
||||
}else {
|
||||
log.error(read1.Message);
|
||||
}
|
||||
|
||||
// //读取双字,路径
|
||||
OperateResultExOne<byte[]> read4 = modbusTcpNet.Read("6000", (short) 800);// 5000-5799 路径 400个
|
||||
if (read4.IsSuccess) {
|
||||
setValueByByte4(read4.Content, deviceSrgv);
|
||||
}else {
|
||||
log.error(read1.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +111,7 @@ public class PlcSrgvRead implements Runnable {
|
||||
// agvData.setStatus(0);
|
||||
agvData.setStatus(Convert.toInt(byteTransform.TransInt16(content, 8)));
|
||||
//载货标志
|
||||
// agvData.setCargoFlag(Convert.toInt(byteTransform.TransInt32(content[1], 13)));
|
||||
agvData.setCargoFlag(Convert.toInt(byteTransform.TransInt16(content, 13)));
|
||||
//接收完成标志
|
||||
// agvData.setFinish(Convert.toInt(byteTransform.TransInt16(content, 10)));
|
||||
// agvData.setFinish(0);
|
||||
@@ -147,15 +131,6 @@ public class PlcSrgvRead implements Runnable {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void setValueByByte5(byte[] content, DeviceSrgv agvData) {
|
||||
int cargoFlag = content[27] & 0xFF;
|
||||
agvData.setCargoFlag(cargoFlag);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//单字
|
||||
private void setValueByByte3(byte[] content, DeviceSrgv agvData) {
|
||||
// agvData.setTaskType(0);
|
||||
@@ -244,8 +219,8 @@ public class PlcSrgvRead implements Runnable {
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
if (modbusTcpNet != null) {
|
||||
modbusTcpNet.ConnectClose();
|
||||
if (readWriteNet != null) {
|
||||
readWriteNet.ConnectClose();
|
||||
}
|
||||
setIsConnect(false);
|
||||
}
|
||||
|
||||
@@ -68,10 +68,6 @@ public class PlcSsjRead implements Runnable {
|
||||
// 线体到位输送机
|
||||
readPlcOtherSsj(ssjDevice);
|
||||
break;
|
||||
case "4":
|
||||
// 线体到位输送机
|
||||
readPlcInDwSsj(ssjDevice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,19 +86,6 @@ public class PlcSsjRead implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
private void readPlcInDwSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("10"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setKx(ParseUtil.optInt(4, ddsx1));
|
||||
ssjDevice.setDw(ParseUtil.optInt(6, ddsx1));
|
||||
ssjDevice.setErrorCode(ParseUtil.optInt(8,ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(0, ddsx1));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他输送机
|
||||
*
|
||||
@@ -136,8 +119,6 @@ public class PlcSsjRead implements Runnable {
|
||||
ssjDevice.setDw(ParseUtil.optInt(6, ddsx1));
|
||||
// ssjDevice.setTrayCode(ParseUtil.optString(14, 12, ddsx1));
|
||||
// ssjDevice.setModel(ParseUtil.optInt(28, ddsx1));
|
||||
}else {
|
||||
log.error(read2.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,8 +139,6 @@ public class PlcSsjRead implements Runnable {
|
||||
// ssjDevice.setKx(ParseUtil.optInt(4, ddsx1));
|
||||
// ssjDevice.setDw(ParseUtil.optInt(6, ddsx1));
|
||||
|
||||
}else {
|
||||
log.error(read2.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,8 +176,6 @@ public class PlcSsjRead implements Runnable {
|
||||
//去除bytes中
|
||||
ssjDevice.setTrayCode(ParseUtil.filterAndConvert(trayCodeRead.Content));
|
||||
}
|
||||
}else {
|
||||
log.error(read2.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,8 +219,8 @@ public class PlcSsjRead implements Runnable {
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
if (siemensS7Net != null) {
|
||||
siemensS7Net.ConnectClose();
|
||||
if (readWriteNet != null) {
|
||||
readWriteNet.ConnectClose();
|
||||
}
|
||||
setIsConnect(false);
|
||||
}
|
||||
|
||||
@@ -126,8 +126,8 @@ public class PlcTsjRead implements Runnable {
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
if (siemensS7Net != null) {
|
||||
siemensS7Net.ConnectClose();
|
||||
if (readWriteNet != null) {
|
||||
readWriteNet.ConnectClose();
|
||||
}
|
||||
setIsConnect(false);
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@ import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import com.ruoyi.schedule.plcRead.util.Tools;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -40,7 +37,6 @@ public class CdzThread implements Runnable {
|
||||
private final Integer LITTLE_BETTERY = 40;
|
||||
private final Integer MIDDLE_BETTERY = 70;
|
||||
private final Integer MAX_BETTERY = 90;
|
||||
private final Integer JOB_BETTERY=50;
|
||||
private ISrgvChargingJobService chargingJobService;
|
||||
private IDeviceCdzService deviceCdzService;
|
||||
private IDeviceSrgvService deviceSrgvService;
|
||||
@@ -70,19 +66,6 @@ public class CdzThread implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isMoreThan30Min(String timeStr, String pattern) {
|
||||
// 1. 创建格式化器
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||
// 2. 解析字符串为时间对象
|
||||
LocalDateTime targetTime = LocalDateTime.parse(timeStr, formatter);
|
||||
// 3. 获取当前系统时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
// 4. 计算两个时间相差的总分钟(可正可负)
|
||||
long diffMinutes = ChronoUnit.MINUTES.between(targetTime, now);
|
||||
// 取绝对值:不管是过去/未来时间,只要间隔超30分钟就满足
|
||||
long absDiff = Math.abs(diffMinutes);
|
||||
return absDiff > 30;
|
||||
}
|
||||
|
||||
void dispatch() {
|
||||
Integer count = mydoJobService.selectMydoJobCount();
|
||||
@@ -95,7 +78,7 @@ public class CdzThread implements Runnable {
|
||||
if (deviceSrgv.getWorkMode() == 5 && deviceSrgv.getStatus() != 3 && deviceSrgv.getChargeFlag() != 2) {
|
||||
if (deviceSrgv.getBattery() <= LITTLE_BETTERY) {
|
||||
littleBatterySRgv.add(deviceSrgv);
|
||||
} else if (deviceSrgv.getBattery() <= MIDDLE_BETTERY && isMoreThan30Min(deviceSrgv.getLastTime(),"yyyy-MM-dd HH:mm:ss")) {
|
||||
} else if (deviceSrgv.getBattery() <= MIDDLE_BETTERY && count == 0) {
|
||||
middleBatterySRgv.add(deviceSrgv);
|
||||
}
|
||||
}
|
||||
@@ -152,11 +135,11 @@ public class CdzThread implements Runnable {
|
||||
}
|
||||
|
||||
//生成断电任务 有任务且电量大于50
|
||||
|
||||
List<DeviceCdz> deviceCdzdd = deviceCdzService.selectDeviceCdzHasSRgvList();
|
||||
for (DeviceCdz deviceCdz : deviceCdzdd) {
|
||||
DeviceSrgv deviceSrgv = PlcSrgvRead.deviceSrgvMap.get(deviceCdz.getSpare1());
|
||||
//(deviceSrgv.getBattery() >= JOB_BETTERY && count > 0) ||
|
||||
if (( deviceSrgv.getBattery() >= MAX_BETTERY)
|
||||
if (((deviceSrgv.getBattery() >= MIDDLE_BETTERY && count > 0) || deviceSrgv.getBattery() >= MAX_BETTERY)
|
||||
&& deviceSrgv.getWorkMode() == 5
|
||||
&& deviceSrgv.getChargeFlag() == 2 && deviceCdz.getStatus() == 1) {
|
||||
createChargingOutJob(PlcSrgvRead.deviceSrgvMap.get(deviceCdz.getSpare1()), deviceCdz);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -46,13 +46,6 @@ public class SsjThread implements Runnable {
|
||||
ssjCodes2.add("L1004");
|
||||
ssjCodes2.add("L1005");
|
||||
ssjCodeList.put("road", ssjCodes2);
|
||||
|
||||
ArrayList<String> ssjCodes4 = new ArrayList<>();
|
||||
ssjCodes4.add("L1006");
|
||||
ssjCodes4.add("L1003");
|
||||
ssjCodeList.put("error", ssjCodes4);
|
||||
|
||||
|
||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
||||
jobCallBackService = SpringUtils.getBean(IJobCallBackService.class);
|
||||
apiService = SpringUtils.getBean(IApiService.class);
|
||||
@@ -104,70 +97,28 @@ public class SsjThread implements Runnable {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
case "error":
|
||||
for (String ssjCode : ssjCodeList.get("error")) {
|
||||
try {
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatchError(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void inDispatchError(DeviceSsj deviceSsj) {
|
||||
if (deviceSsj.getErrorCode() > 0) {
|
||||
if (deviceSsj.getDeviceCode().equals("L1003")) {
|
||||
String code = "TD1001";
|
||||
String errorCode = String.valueOf(deviceSsj.getErrorCode());
|
||||
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("deviceCode", code);
|
||||
objectObjectHashMap.put("errorCode", errorCode);
|
||||
apiService.updateLedError(objectObjectHashMap);
|
||||
}
|
||||
if (deviceSsj.getDeviceCode().equals("L1006")) {
|
||||
String code = "TD1008";
|
||||
String errorCode = String.valueOf(deviceSsj.getErrorCode());
|
||||
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("deviceCode", code);
|
||||
objectObjectHashMap.put("errorCode", errorCode);
|
||||
apiService.updateLedError(objectObjectHashMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void inDispatch(DeviceSsj deviceSsj) {
|
||||
//出库到位
|
||||
if (deviceSsj.getDw() == 1 && deviceSsj.getTaskNo() > 0) {
|
||||
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("deviceCode", deviceSsj.getDeviceCode());
|
||||
objectObjectHashMap.put("taskNo", deviceSsj.getTaskNo());
|
||||
apiService.updateLed(objectObjectHashMap);
|
||||
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(deviceSsj.getTaskNo()));
|
||||
if (mydoJob != null && mydoJob.getInOrOut().equals("22")) {
|
||||
// 新增agv执行队列,以及调用wms后台任务过账
|
||||
AjaxResult ajaxResult1 = apiService.insertAgvQuene(objectObjectHashMap);
|
||||
if (ajaxResult1.get("code").equals("200")) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("trayCode", mydoJob.getTrayCode());
|
||||
//拉取
|
||||
AjaxResult ajaxResult = apiService.OutMakeSure(map);
|
||||
if (ajaxResult.get("code").equals("200")) {
|
||||
mydoJobService.insertHistory(mydoJob.getJobId());
|
||||
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
|
||||
}
|
||||
}
|
||||
if (mydoJob != null) {
|
||||
log.info("设备:{} 位置:{} 任务号:{} 出库到位", "输送线", deviceSsj.getDeviceCode(), mydoJob.getTaskNo());
|
||||
mydoJobService.insertHistory(mydoJob.getJobId());
|
||||
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
|
||||
JobCallBack jobCallBack = new JobCallBack();
|
||||
jobCallBack.setType("2");
|
||||
jobCallBack.setMydojobId(mydoJob.getJobId());
|
||||
jobCallBack.setStatus("0");
|
||||
jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo()));
|
||||
jobCallBack.setCreateTime(new Date());
|
||||
jobCallBackService.insertJobCallBack(jobCallBack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,22 +127,14 @@ public class SsjThread implements Runnable {
|
||||
if (deviceSsj.getRkqq() == 1 && StrUtil.isNotBlank(deviceSsj.getTrayCode().trim())) {
|
||||
String trayCode = deviceSsj.getTrayCode().trim();
|
||||
MydoJob getMydoJob = mydoJobService.selectMydoJobByTrayCode(trayCode);
|
||||
if (getMydoJob == null && deviceSsj.getTaskNo() < 1000) {
|
||||
String exit = "";
|
||||
if (deviceSsj.getDeviceCode().equals("GS1002")) {
|
||||
exit = "L1004";
|
||||
}
|
||||
if (deviceSsj.getDeviceCode().equals("GS1007")) {
|
||||
exit = "L1005";
|
||||
}
|
||||
Integer count = mydoJobService.selectMydoJobExit(exit);
|
||||
if (count > 0) {
|
||||
int i = writeToSsj(deviceSsj.getPlcDbWriteAddress(), "0", 2, 2);
|
||||
if (i == 1) {
|
||||
log.info(deviceSsj.getDeviceCode() + "有相应入口的出库作业,下发退回,去向2 条码" + deviceSsj.getTrayCode());
|
||||
return;
|
||||
}
|
||||
if (getMydoJob != null && deviceSsj.getTaskNo() < 1000) {
|
||||
int i = writeToSsj(deviceSsj.getPlcDbWriteAddress(), getMydoJob.getTaskNo(), 1, 1);
|
||||
if (i == 1) {
|
||||
getMydoJob.setStatus("3");
|
||||
mydoJobService.updateMydoJob(getMydoJob);
|
||||
log.info(deviceSsj.getDeviceCode() + "输送机下发任务号成功:{}", getMydoJob.getTaskNo());
|
||||
}
|
||||
} else {
|
||||
//todo 查是否为入库模式,不是退回,是否超重
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("trayCode", deviceSsj.getTrayCode());
|
||||
@@ -241,28 +184,27 @@ public class SsjThread implements Runnable {
|
||||
if (deviceSsj.getDw() == 1 && deviceSsj.getTaskNo() > 1000) {
|
||||
|
||||
MydoJob mydoJob1 = mydoJobService.selectMydoJobByTaskNo(Long.valueOf(deviceSsj.getTaskNo()));
|
||||
if (mydoJob1 != null && mydoJob1.getCargoSpaceId() != null) {
|
||||
if (mydoJob1.getCargoSpaceId() != null) {
|
||||
return;
|
||||
}
|
||||
if (mydoJob1 != null && Integer.parseInt(mydoJob1.getInOrOut()) < 20) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("taskNo", deviceSsj.getTaskNo());
|
||||
map.put("deviceCode", deviceSsj.getDeviceCode());
|
||||
//拉取
|
||||
AjaxResult ajaxResult = apiService.sendCargoSpace(map);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
MydoJob data = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||
String cargoSpaceId = data.getCargoSpaceId();
|
||||
String theFloor = data.getClassId();
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo((long) deviceSsj.getTaskNo());
|
||||
if (mydoJob != null && cargoSpaceId != null && !cargoSpaceId.equals("")) {
|
||||
mydoJob.setTheFloor(theFloor);
|
||||
mydoJob.setCargoSpaceId(cargoSpaceId);
|
||||
mydoJob.setExecutionPhase("2");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("taskNo", deviceSsj.getTaskNo());
|
||||
//拉取
|
||||
AjaxResult ajaxResult = apiService.sendCargoSpace(map);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
MydoJob data = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||
String cargoSpaceId = data.getCargoSpaceId();
|
||||
String theFloor = data.getClassId();
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo((long) deviceSsj.getTaskNo());
|
||||
if (mydoJob != null) {
|
||||
mydoJob.setTheFloor(theFloor);
|
||||
mydoJob.setCargoSpaceId(cargoSpaceId);
|
||||
mydoJob.setExecutionPhase("2");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ import com.ruoyi.schedule.plcRead.tsj.PlcTsjRead;
|
||||
import com.ruoyi.schedule.plcRead.util.Tools;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
public class TsjThread implements Runnable {
|
||||
@@ -39,7 +39,7 @@ public class TsjThread implements Runnable {
|
||||
private IWcsSrgvQueueService wcsSrgvQueueService;
|
||||
private IMydoJobService mydoJobService;
|
||||
private IWcsSrgvMapService wcsSrgvMapService;
|
||||
public IWcsSrgvQueueService wcsSagvQueueMapper;
|
||||
|
||||
|
||||
public void init() {
|
||||
tsjDeviceExecutionQueueService = SpringUtils.getBean(ITsjDeviceExecutionQueueService.class);
|
||||
@@ -48,7 +48,6 @@ public class TsjThread implements Runnable {
|
||||
wcsSrgvQueueService = SpringUtils.getBean(IWcsSrgvQueueService.class);
|
||||
wcsSrgvMapService = SpringUtils.getBean(IWcsSrgvMapService.class);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,10 +102,6 @@ public class TsjThread implements Runnable {
|
||||
if (czfs == 2 && sbzt == 2 && jdbz == 2 && rwh > 500) {
|
||||
createSRgvQueueTsjQd(rwh, tsj);
|
||||
}
|
||||
// 提升机放货途中 取消当前小车的路径
|
||||
if (czfs == 2 && sbzt == 2 && jdbz == 3 && rwh > 500) {
|
||||
removePathCar(rwh, tsj);
|
||||
}
|
||||
|
||||
/*
|
||||
* 2、任务完成
|
||||
@@ -129,15 +124,6 @@ public class TsjThread implements Runnable {
|
||||
|
||||
}
|
||||
|
||||
private void removePathCar(Long rwh, DeviceTsj tsj) {
|
||||
WcsSrgvQueue wcsSrgvQueue = wcsSrgvQueueService.selectWcsSrgvQueueByTaskNo(String.valueOf(rwh));
|
||||
DeviceSrgv deviceSrgv = PlcSrgvRead.deviceSrgvMap.get(wcsSrgvQueue.getAgvId());
|
||||
if (!deviceSrgv.getCurrSite().equals("07050"+wcsSrgvQueue.getTheFloor()) && tsj.getHczt() == 1 && !wcsSrgvQueue.getPathInfo().isEmpty() && java.util.Arrays.asList(wcsSrgvQueue.getPathInfo().trim().replaceAll(",$", "").split(",")).contains("07050"+wcsSrgvQueue.getTheFloor())&&wcsSrgvQueue.getEndSite().equals("tsj")) {
|
||||
wcsSrgvQueue.setPathInfo("");
|
||||
wcsSrgvQueueService.updateWcsSrgvQueue(wcsSrgvQueue);
|
||||
}
|
||||
}
|
||||
|
||||
// 下发提升机启动
|
||||
private void createSRgvQueueTsjQd(Long rwh, DeviceTsj tsj) {
|
||||
for (String sRgv : PlcSrgvRead.deviceSrgvMap.keySet()) {
|
||||
@@ -198,42 +184,9 @@ public class TsjThread implements Runnable {
|
||||
break;
|
||||
case "2":
|
||||
//出库
|
||||
// startSite="tsj";
|
||||
startSite = "09050" + tsj.getDqcs();
|
||||
// 如果提升机当前层等于1 并且是出库任务,更新出库点位为出库缓存点
|
||||
// Integer i = mydoJobService.selectMydoJobCountOut();
|
||||
if (tsj.getDqcs() == 1 && "2".equals(wcsSrgvQueue.getDefault02())) {
|
||||
WcsSrgvMap wcsSrgvMapParam = new WcsSrgvMap();
|
||||
wcsSrgvMapParam.setRemark("outCache");
|
||||
List<WcsSrgvMap> wcsSrgvMaps = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMapParam);
|
||||
List<String> cacheSite = wcsSrgvMaps.stream().sorted(Comparator.comparing(WcsSrgvMap::getSiteId)).map(WcsSrgvMap::getSiteId).collect(Collectors.toList());
|
||||
List<String> currentSRgvSite = new ArrayList<>();
|
||||
// 判断是否有车是在一样的位置
|
||||
for (String srgvCode : PlcSrgvRead.deviceSrgvMap.keySet()) {
|
||||
currentSRgvSite.add(PlcSrgvRead.deviceSrgvMap.get(srgvCode).getCurrSite());
|
||||
}
|
||||
cacheSite.removeAll(currentSRgvSite);
|
||||
if (CollUtil.isNotEmpty(cacheSite)) {
|
||||
for (String cache : cacheSite) {
|
||||
WcsSrgvQueue wcsSrgvQueueParam = new WcsSrgvQueue();
|
||||
wcsSrgvQueueParam.setEndSite(cache);
|
||||
// 判断是否有车要去这个缓存点 没有就更新
|
||||
List<WcsSrgvQueue> wcsSrgvQueues1 = wcsSrgvQueueService.selectWcsSrgvQueueList(wcsSrgvQueueParam);
|
||||
// WcsSrgvQueue wcsSrgvQueueParam1 = new WcsSrgvQueue();
|
||||
// wcsSrgvQueueParam1.setStartSite(cache);
|
||||
// // 并且从缓存点走的
|
||||
// List<WcsSrgvQueue> wcsSrgvQueues2 = wcsSrgvQueueService.selectWcsSrgvQueueList(wcsSrgvQueueParam1);
|
||||
if (CollUtil.isEmpty(wcsSrgvQueues1)) {
|
||||
wcsSrgvQueue.setStartSite(startSite);
|
||||
wcsSrgvQueue.setEndSite(cacheSite.get(0));
|
||||
wcsSrgvQueue.setDefault02("7");
|
||||
wcsSrgvQueueService.updateWcsSrgvQueue(wcsSrgvQueue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
endSite = wcsSrgvQueue.getCargoPlaceSite();
|
||||
}
|
||||
endSite = wcsSrgvQueue.getCargoPlaceSite();
|
||||
break;
|
||||
case "3":
|
||||
break;
|
||||
@@ -259,16 +212,8 @@ public class TsjThread implements Runnable {
|
||||
WcsSrgvMap wcsSrgvMapq = wcsSrgvMapService.selectWcsSrgvMapBySiteId(cargoPickSite);
|
||||
WcsSrgvMap wcsSrgvMapf = wcsSrgvMapService.selectWcsSrgvMapBySiteId(cargoPlaceSite);
|
||||
if (wcsSrgvMapq != null && wcsSrgvMapf != null) {
|
||||
Integer count = wcsSrgvQueueService.selectByEndSite();
|
||||
List<DeviceSrgv> collect = PlcSrgvRead.deviceSrgvMap.values().stream().filter(d ->
|
||||
d.getCurrSite().equals(cargoPickSite))
|
||||
.collect(Collectors.toList());
|
||||
if ((count > 0 || !collect.isEmpty()) && tsj.getDqcs() == 1) {
|
||||
wcsSrgvQueue.setEndSite("070301");
|
||||
} else {
|
||||
wcsSrgvQueue.setEndSite(cargoPickSite);
|
||||
}
|
||||
|
||||
wcsSrgvQueue.setEndSite(cargoPickSite);
|
||||
wcsSrgvQueue.setDefault02("4");
|
||||
wcsSrgvQueue.setTheFloor(wcsSrgvMapq.getTheLayer().toString());
|
||||
wcsSrgvQueue.setDefault07(wcsSrgvMapf.getTheLayer().toString());
|
||||
@@ -312,8 +257,7 @@ public class TsjThread implements Runnable {
|
||||
for (String sRgv : PlcSrgvRead.deviceSrgvMap.keySet()) {
|
||||
DeviceSrgv deviceSrgv = PlcSrgvRead.deviceSrgvMap.get(sRgv);
|
||||
Integer count = tsjDeviceExecutionQueueService.selectCount();
|
||||
WcsSrgvQueue wcsSrgvQueue1 = wcsSrgvQueueService.selectWcsSrgvQueueByTaskNo(String.valueOf(deviceSrgv.getTaskNo()));
|
||||
if (deviceSrgv.getSpare2().equals("1") && deviceSrgv.getTaskNo() > 0 && count == 0 && wcsSrgvQueue1.getEndSite().equals("tsj")) {
|
||||
if (deviceSrgv.getSpare2().equals("1") && deviceSrgv.getTaskNo() > 0 && count == 0) {
|
||||
//请求进入输送机
|
||||
WcsSrgvQueue sRgvQueueParam = new WcsSrgvQueue();
|
||||
sRgvQueueParam.setAgvId(Convert.toStr(deviceSrgv.getDeviceId()));
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
package com.ruoyi.system.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.system.domain.AgvContainerTask;
|
||||
import com.ruoyi.system.service.IAgvContainerTaskService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* agv料架搬运任务Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-05-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/task")
|
||||
public class AgvContainerTaskController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAgvContainerTaskService agvContainerTaskService;
|
||||
|
||||
/**
|
||||
* 查询agv料架搬运任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:task:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AgvContainerTask agvContainerTask)
|
||||
{
|
||||
startPage();
|
||||
List<AgvContainerTask> list = agvContainerTaskService.selectAgvContainerTaskList(agvContainerTask);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出agv料架搬运任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:task:export')")
|
||||
@Log(title = "agv料架搬运任务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AgvContainerTask agvContainerTask)
|
||||
{
|
||||
List<AgvContainerTask> list = agvContainerTaskService.selectAgvContainerTaskList(agvContainerTask);
|
||||
ExcelUtil<AgvContainerTask> util = new ExcelUtil<AgvContainerTask>(AgvContainerTask.class);
|
||||
util.exportExcel(response, list, "agv料架搬运任务数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取agv料架搬运任务详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:task:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(agvContainerTaskService.selectAgvContainerTaskById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增agv料架搬运任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:task:add')")
|
||||
@Log(title = "agv料架搬运任务", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AgvContainerTask agvContainerTask)
|
||||
{
|
||||
return toAjax(agvContainerTaskService.insertAgvContainerTask(agvContainerTask));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改agv料架搬运任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:task:edit')")
|
||||
@Log(title = "agv料架搬运任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AgvContainerTask agvContainerTask)
|
||||
{
|
||||
return toAjax(agvContainerTaskService.updateAgvContainerTask(agvContainerTask));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除agv料架搬运任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:task:remove')")
|
||||
@Log(title = "agv料架搬运任务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(agvContainerTaskService.deleteAgvContainerTaskByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.ruoyi.system.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_container_task
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-05-15
|
||||
*/
|
||||
public class AgvContainerTask extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 作业编码 */
|
||||
@Excel(name = "作业编码")
|
||||
private String container;
|
||||
|
||||
/** 起点 */
|
||||
@Excel(name = "起点")
|
||||
private String startPoint;
|
||||
|
||||
/** 终点 */
|
||||
@Excel(name = "终点")
|
||||
private String endPoint;
|
||||
|
||||
/** 开始时间 */
|
||||
@Excel(name = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@Excel(name = "结束时间")
|
||||
private String finishTime;
|
||||
|
||||
/** 任务号 */
|
||||
@Excel(name = "任务号")
|
||||
private String taskNo;
|
||||
|
||||
/** 任务状态 0-创建 1-执行中 2-完成 */
|
||||
@Excel(name = "任务状态 0-创建 1-执行中 2-完成")
|
||||
private String status;
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型")
|
||||
private String spare1;
|
||||
|
||||
/** 托盘码 */
|
||||
@Excel(name = "托盘码")
|
||||
private String spare2;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setContainer(String container)
|
||||
{
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
public String getContainer()
|
||||
{
|
||||
return container;
|
||||
}
|
||||
|
||||
public void setStartPoint(String startPoint)
|
||||
{
|
||||
this.startPoint = startPoint;
|
||||
}
|
||||
|
||||
public String getStartPoint()
|
||||
{
|
||||
return startPoint;
|
||||
}
|
||||
|
||||
public void setEndPoint(String endPoint)
|
||||
{
|
||||
this.endPoint = endPoint;
|
||||
}
|
||||
|
||||
public String getEndPoint()
|
||||
{
|
||||
return endPoint;
|
||||
}
|
||||
|
||||
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 setTaskNo(String taskNo)
|
||||
{
|
||||
this.taskNo = taskNo;
|
||||
}
|
||||
|
||||
public String getTaskNo()
|
||||
{
|
||||
return taskNo;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setSpare1(String spare1)
|
||||
{
|
||||
this.spare1 = spare1;
|
||||
}
|
||||
|
||||
public String getSpare1()
|
||||
{
|
||||
return spare1;
|
||||
}
|
||||
|
||||
public void setSpare2(String spare2)
|
||||
{
|
||||
this.spare2 = spare2;
|
||||
}
|
||||
|
||||
public String getSpare2()
|
||||
{
|
||||
return spare2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("container", getContainer())
|
||||
.append("startPoint", getStartPoint())
|
||||
.append("endPoint", getEndPoint())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("startTime", getStartTime())
|
||||
.append("finishTime", getFinishTime())
|
||||
.append("taskNo", getTaskNo())
|
||||
.append("status", getStatus())
|
||||
.append("spare1", getSpare1())
|
||||
.append("spare2", getSpare2())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.AgvContainerTask;
|
||||
|
||||
/**
|
||||
* agv料架搬运任务Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-05-15
|
||||
*/
|
||||
public interface AgvContainerTaskMapper
|
||||
{
|
||||
/**
|
||||
* 查询agv料架搬运任务
|
||||
*
|
||||
* @param id agv料架搬运任务主键
|
||||
* @return agv料架搬运任务
|
||||
*/
|
||||
public AgvContainerTask selectAgvContainerTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 查询agv料架搬运任务列表
|
||||
*
|
||||
* @param agvContainerTask agv料架搬运任务
|
||||
* @return agv料架搬运任务集合
|
||||
*/
|
||||
public List<AgvContainerTask> selectAgvContainerTaskList(AgvContainerTask agvContainerTask);
|
||||
|
||||
/**
|
||||
* 新增agv料架搬运任务
|
||||
*
|
||||
* @param agvContainerTask agv料架搬运任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAgvContainerTask(AgvContainerTask agvContainerTask);
|
||||
|
||||
/**
|
||||
* 修改agv料架搬运任务
|
||||
*
|
||||
* @param agvContainerTask agv料架搬运任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAgvContainerTask(AgvContainerTask agvContainerTask);
|
||||
|
||||
/**
|
||||
* 删除agv料架搬运任务
|
||||
*
|
||||
* @param id agv料架搬运任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvContainerTaskById(Long id);
|
||||
|
||||
public int deleteAgvContainerTaskByContainer(String orderId);
|
||||
/**
|
||||
* 批量删除agv料架搬运任务
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvContainerTaskByIds(Long[] ids);
|
||||
|
||||
void insertAgvContainerTaskFinish(String orderId);
|
||||
|
||||
void updateAgvContainerTaskByOrder(String orderId);
|
||||
|
||||
AgvContainerTask selectAgvContainerFinishOne();
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.AgvContainerTask;
|
||||
|
||||
/**
|
||||
* agv料架搬运任务Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-05-15
|
||||
*/
|
||||
public interface IAgvContainerTaskService
|
||||
{
|
||||
/**
|
||||
* 查询agv料架搬运任务
|
||||
*
|
||||
* @param id agv料架搬运任务主键
|
||||
* @return agv料架搬运任务
|
||||
*/
|
||||
public AgvContainerTask selectAgvContainerTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 查询agv料架搬运任务列表
|
||||
*
|
||||
* @param agvContainerTask agv料架搬运任务
|
||||
* @return agv料架搬运任务集合
|
||||
*/
|
||||
public List<AgvContainerTask> selectAgvContainerTaskList(AgvContainerTask agvContainerTask);
|
||||
|
||||
/**
|
||||
* 新增agv料架搬运任务
|
||||
*
|
||||
* @param agvContainerTask agv料架搬运任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAgvContainerTask(AgvContainerTask agvContainerTask);
|
||||
|
||||
/**
|
||||
* 修改agv料架搬运任务
|
||||
*
|
||||
* @param agvContainerTask agv料架搬运任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAgvContainerTask(AgvContainerTask agvContainerTask);
|
||||
|
||||
/**
|
||||
* 批量删除agv料架搬运任务
|
||||
*
|
||||
* @param ids 需要删除的agv料架搬运任务主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvContainerTaskByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除agv料架搬运任务信息
|
||||
*
|
||||
* @param id agv料架搬运任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAgvContainerTaskById(Long id);
|
||||
|
||||
void deleteAgvContainerTaskByOrderId(String container);
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.ruoyi.system.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.system.mapper.AgvContainerTaskMapper;
|
||||
import com.ruoyi.system.domain.AgvContainerTask;
|
||||
import com.ruoyi.system.service.IAgvContainerTaskService;
|
||||
|
||||
/**
|
||||
* agv料架搬运任务Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-05-15
|
||||
*/
|
||||
@Service
|
||||
public class AgvContainerTaskServiceImpl implements IAgvContainerTaskService
|
||||
{
|
||||
@Autowired
|
||||
private AgvContainerTaskMapper agvContainerTaskMapper;
|
||||
|
||||
/**
|
||||
* 查询agv料架搬运任务
|
||||
*
|
||||
* @param id agv料架搬运任务主键
|
||||
* @return agv料架搬运任务
|
||||
*/
|
||||
@Override
|
||||
public AgvContainerTask selectAgvContainerTaskById(Long id)
|
||||
{
|
||||
return agvContainerTaskMapper.selectAgvContainerTaskById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询agv料架搬运任务列表
|
||||
*
|
||||
* @param agvContainerTask agv料架搬运任务
|
||||
* @return agv料架搬运任务
|
||||
*/
|
||||
@Override
|
||||
public List<AgvContainerTask> selectAgvContainerTaskList(AgvContainerTask agvContainerTask)
|
||||
{
|
||||
return agvContainerTaskMapper.selectAgvContainerTaskList(agvContainerTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增agv料架搬运任务
|
||||
*
|
||||
* @param agvContainerTask agv料架搬运任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAgvContainerTask(AgvContainerTask agvContainerTask)
|
||||
{
|
||||
agvContainerTask.setCreateTime(DateUtils.getNowDate());
|
||||
return agvContainerTaskMapper.insertAgvContainerTask(agvContainerTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改agv料架搬运任务
|
||||
*
|
||||
* @param agvContainerTask agv料架搬运任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAgvContainerTask(AgvContainerTask agvContainerTask)
|
||||
{
|
||||
return agvContainerTaskMapper.updateAgvContainerTask(agvContainerTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除agv料架搬运任务
|
||||
*
|
||||
* @param ids 需要删除的agv料架搬运任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAgvContainerTaskByIds(Long[] ids)
|
||||
{
|
||||
return agvContainerTaskMapper.deleteAgvContainerTaskByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除agv料架搬运任务信息
|
||||
*
|
||||
* @param id agv料架搬运任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAgvContainerTaskById(Long id)
|
||||
{
|
||||
return agvContainerTaskMapper.deleteAgvContainerTaskById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAgvContainerTaskByOrderId(String container) {
|
||||
agvContainerTaskMapper.deleteAgvContainerTaskByContainer(container);
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class GetDeviceSrgvMap {
|
||||
AgvDto dto = new AgvDto();
|
||||
dto.setId(d.getDeviceId() == null ? "" : String.format("%04d", d.getDeviceId()));
|
||||
dto.setTaskNo(d.getTaskNo() == null ? "" : String.valueOf(d.getTaskNo()));
|
||||
dto.setIsThere(d.getCargoFlag()==256?"1":"0");
|
||||
dto.setIsThere((d.getWorkPhase() >= 3 && d.getWorkPhase() < 6 ? "1" : "0"));
|
||||
Integer wp = d.getWorkPhase();
|
||||
String status = "0";
|
||||
if (wp != null) {
|
||||
|
||||
@@ -101,10 +101,14 @@ public class GetDeviceSsjMap {
|
||||
dto.setAlarmMsg(DictUtils.getDictLabel("ssj_ex", String.valueOf(d.getException())));
|
||||
dto.setKX(String.valueOf(d.getKx()));
|
||||
if (!dto.getTaskNo().equals("0")){
|
||||
if (dto.getKX().equals("0")){
|
||||
dto.setDW("1");
|
||||
if (dto.getRotationDirection().equals("1")){
|
||||
dto.setDW(String.valueOf(d.getDw()));
|
||||
}else {
|
||||
dto.setDW("0");
|
||||
if (dto.getKX().equals("0")){
|
||||
dto.setDW("1");
|
||||
}else {
|
||||
dto.setDW("0");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
dto.setDW("0");
|
||||
|
||||
@@ -96,7 +96,6 @@ public class Wcs2wmsgetEmptyCargoSpace {
|
||||
dto.setTrayCode(getText(node, "trayCode"));
|
||||
dto.setProductCode(getText(node, "productCode"));
|
||||
dto.setProductName(getText(node, "productName"));
|
||||
dto.setCargoSpaceId(getText(node, "cargoSpaceId"));
|
||||
return dto;
|
||||
}
|
||||
|
||||
@@ -126,6 +125,5 @@ public class Wcs2wmsgetEmptyCargoSpace {
|
||||
private String trayCode;
|
||||
private String productCode;
|
||||
private String productName;
|
||||
private String cargoSpaceId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,26 +60,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectBasCargoSpaceVo"/>
|
||||
where cargo_space_id = #{cargoSpaceId}
|
||||
</select>
|
||||
|
||||
<select id="countOutboundBlockingPositions" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM bas_cargo_space outer_space
|
||||
INNER JOIN bas_cargo_space requested
|
||||
ON requested.cargo_space_id = #{cargoSpaceId}
|
||||
AND outer_space.the_floor = requested.the_floor
|
||||
AND outer_space.group_coding_no = requested.group_coding_no
|
||||
AND outer_space.group_coding > requested.group_coding
|
||||
WHERE NULLIF(LTRIM(RTRIM(outer_space.tray_code)), '') IS NOT NULL
|
||||
OR ISNULL(NULLIF(LTRIM(RTRIM(outer_space.status)), ''), '0') <> '0'
|
||||
OR ISNULL(NULLIF(LTRIM(RTRIM(outer_space.locked)), ''), '0') <> '0'
|
||||
OR EXISTS (
|
||||
SELECT 1
|
||||
FROM mydo_job_wcs pending
|
||||
WHERE pending.cargo_space_id = outer_space.cargo_space_id
|
||||
AND pending.in_or_out >= 20
|
||||
AND ISNULL(pending.status, '') <> '4'
|
||||
)
|
||||
</select>
|
||||
<select id="selectBasCargoSpaceByWmsCargoSpaceId"
|
||||
resultMap="BasCargoSpaceResult">
|
||||
<include refid="selectBasCargoSpaceVo"/>
|
||||
|
||||
@@ -144,13 +144,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{reqCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="selectKx" parameterType="java.util.Map" statementType="CALLABLE">
|
||||
{call proc_select_kx(#{v_position,mode=IN,jdbcType=VARCHAR},
|
||||
#{v_orderId,mode=IN,jdbcType=VARCHAR},
|
||||
#{v_type,mode=IN,jdbcType=VARCHAR},
|
||||
#{v_result,mode=OUT,jdbcType=INTEGER},
|
||||
#{v_result_msg,mode=OUT,jdbcType=VARCHAR})}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -182,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="setFloor != null">set_floor = #{setFloor},</if>
|
||||
<if test="powerTime != null">power_time = #{powerTime},</if>
|
||||
|
||||
<if test="lastTime != null">last_time = #{lastTime},</if>
|
||||
<if test="agvStatus != null">agv_status = #{agvStatus},</if>
|
||||
<if test="taskNo != null">task_no = #{taskNo},</if>
|
||||
<if test="srcSite != null">src_site = #{srcSite},</if>
|
||||
@@ -227,6 +227,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<update id="updateLastTimeByAgvId" parameterType="String">
|
||||
update device_srgv set last_time =convert(varchar,getdate(),120) where guid=#{agvId}
|
||||
update device_srgv set last_time =getdate() where agv_id=#{agvId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@@ -47,8 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="priority != null "> and priority = #{priority}</if>
|
||||
<if test="executionPhase != null and executionPhase != ''"> and execution_phase = #{executionPhase}</if>
|
||||
<if test="inOrOut != null and inOrOut != ''"> and in_or_out = #{inOrOut}</if>
|
||||
<if test="startTime != null and startTime != ''"> and finish_time >= #{startTime}</if>
|
||||
<if test="finishTime != null and finishTime != ''"> and finish_time <= #{finishTime}</if>
|
||||
<if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
|
||||
<if test="finishTime != null and finishTime != ''"> and finish_time = #{finishTime}</if>
|
||||
<if test="entranceId != null and entranceId != ''"> and entrance_id = #{entranceId}</if>
|
||||
<if test="exitId != null and exitId != ''"> and exit_id = #{exitId}</if>
|
||||
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
|
||||
@@ -229,8 +229,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="priority != null "> and priority = #{priority}</if>
|
||||
<if test="executionPhase != null and executionPhase != ''"> and execution_phase = #{executionPhase}</if>
|
||||
<if test="inOrOut != null and inOrOut != ''"> and in_or_out = #{inOrOut}</if>
|
||||
<if test="startTime != null and startTime != ''"> and finish_time >= #{startTime}</if>
|
||||
<if test="finishTime != null and finishTime != ''"> and finish_time <= #{finishTime}</if>
|
||||
<if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
|
||||
<if test="finishTime != null and finishTime != ''"> and finish_time = #{finishTime}</if>
|
||||
<if test="entranceId != null and entranceId != ''"> and entrance_id = #{entranceId}</if>
|
||||
<if test="exitId != null and exitId != ''"> and exit_id = #{exitId}</if>
|
||||
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
|
||||
@@ -251,40 +251,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectMydoJobOut" resultMap="MydoJobResult">
|
||||
WITH floor_group AS (
|
||||
SELECT
|
||||
b.cargo_space_id,
|
||||
b.group_coding_no,
|
||||
b.the_floor,
|
||||
b.group_coding,
|
||||
a.task_no,
|
||||
a.job_id,
|
||||
a.in_or_out,
|
||||
a.target_cargo_space_id,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY b.the_floor, b.group_coding_no
|
||||
ORDER BY b.group_coding DESC,
|
||||
CASE WHEN a.in_or_out = 30 THEN 0 ELSE 1 END,
|
||||
a.create_time ASC,
|
||||
a.job_id ASC
|
||||
) AS rn
|
||||
FROM mydo_job_wcs a
|
||||
INNER JOIN bas_cargo_space b
|
||||
ON a.cargo_space_id = b.cargo_space_id
|
||||
AND a.the_floor = b.the_floor
|
||||
WHERE a.in_or_out >= 20
|
||||
SELECT
|
||||
b.cargo_space_id,
|
||||
b.group_coding_no,
|
||||
b.the_floor,
|
||||
b.group_coding,
|
||||
a.task_no AS task_no,
|
||||
a.job_id AS job_id,
|
||||
a.in_or_out, -- 之前新增的字段
|
||||
a.target_cargo_space_id, -- 新增字段:加入target_cargo_space_id
|
||||
ROW_NUMBER() OVER (PARTITION BY b.the_floor ORDER BY b.group_coding DESC) AS rn
|
||||
FROM
|
||||
mydo_job_wcs a
|
||||
INNER JOIN bas_cargo_space b
|
||||
ON a.cargo_space_id = b.cargo_space_id
|
||||
AND a.the_floor = b.the_floor
|
||||
WHERE
|
||||
a.in_or_out >= 20
|
||||
AND a.status = '1'
|
||||
GROUP BY
|
||||
b.group_coding_no,
|
||||
b.cargo_space_id,
|
||||
b.the_floor,
|
||||
b.group_coding,
|
||||
a.task_no,
|
||||
a.job_id,
|
||||
a.create_time,
|
||||
a.in_or_out, -- 之前新增的分组字段
|
||||
a.target_cargo_space_id -- 分组字段中新增:必须加入GROUP BY
|
||||
)
|
||||
SELECT
|
||||
cargo_space_id,
|
||||
group_coding_no,
|
||||
the_floor,
|
||||
group_coding,
|
||||
task_no,
|
||||
job_id,
|
||||
in_or_out,
|
||||
target_cargo_space_id
|
||||
FROM floor_group
|
||||
WHERE rn = 1 -- ✅ 每次每层每个通道只取 1 条
|
||||
ORDER BY group_coding DESC;
|
||||
cargo_space_id,
|
||||
group_coding_no,
|
||||
the_floor,
|
||||
task_no,
|
||||
job_id,
|
||||
in_or_out, -- 之前新增的展示字段
|
||||
target_cargo_space_id -- 最终查询结果中显示该字段
|
||||
FROM
|
||||
floor_group
|
||||
WHERE
|
||||
rn <= 1
|
||||
ORDER BY
|
||||
group_coding DESC;
|
||||
|
||||
</select>
|
||||
<select id="selectMydoJobByTrayCode" resultMap="MydoJobResult">
|
||||
<include refid="selectMydoJobVo"/>
|
||||
@@ -300,37 +310,5 @@ select count(1) from mydo_job_wcs where in_or_out>=20 and exit_id = #{exitId}
|
||||
select count(1) from mydo_job_wcs
|
||||
|
||||
</select>
|
||||
<select id="selectMydoJobIn" resultType="java.lang.Integer">
|
||||
select count(1) from mydo_job_wcs where in_or_out <20 and cargo_space_id is null and status='3' and execution_phase='1'
|
||||
</select>
|
||||
|
||||
<select id="selectMydoJobCountOut" resultType="java.lang.Integer">
|
||||
select count(1) from mydo_job_wcs where in_or_out>20
|
||||
</select>
|
||||
<select id="selectByJobOut" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from mydo_job_wcs
|
||||
where in_or_out > 20
|
||||
and status = '1'
|
||||
</select>
|
||||
|
||||
<select id="selectByJobOutIsOne" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
||||
select count(1) from mydo_job_wcs where in_or_out>20 and status='1' and the_floor=1
|
||||
</select>
|
||||
|
||||
<select id="selectMydoJobExit" parameterType="string" resultType="integer">
|
||||
select count(1) from mydo_job_wcs where in_or_out>20 and exit_id=#{exit}
|
||||
</select>
|
||||
|
||||
<select id="selectTheFloorYk" parameterType="string" resultType="java.lang.Integer">
|
||||
select count(1) from mydo_job_wcs where the_floor=#{theFloor} and in_or_out=30
|
||||
</select>
|
||||
|
||||
<delete id="deleteMydoJobByTaskNos">
|
||||
delete from mydo_job_wcs where task_no in
|
||||
<foreach item="taskNo" collection="taskNos" open="(" separator="," close=")">
|
||||
#{taskNo}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -222,15 +222,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select count(1) from wcs_srgv_queue where cargo_place_site=#{siteId}
|
||||
</select>
|
||||
|
||||
<select id="selectByEndSite" resultType="java.lang.Integer" >
|
||||
select count(1) from wcs_srgv_queue where end_site='070101' or end_site ='050101'
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectTaskNosByGuids" parameterType="String" resultType="string">
|
||||
select task_no from wcs_srgv_queue where guid in
|
||||
<foreach item="guid" collection="array" open="(" separator="," close=")">
|
||||
#{guid}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,116 +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.system.mapper.AgvContainerTaskMapper">
|
||||
|
||||
<resultMap type="AgvContainerTask" id="AgvContainerTaskResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="container" column="container" />
|
||||
<result property="startPoint" column="start_point" />
|
||||
<result property="endPoint" column="end_point" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="finishTime" column="finish_time" />
|
||||
<result property="taskNo" column="task_no" />
|
||||
<result property="status" column="status" />
|
||||
<result property="spare1" column="spare1" />
|
||||
<result property="spare2" column="spare2" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAgvContainerTaskVo">
|
||||
select id, container, start_point, end_point, create_time, start_time, finish_time, task_no, status, spare1, spare2 from agv_container_task
|
||||
</sql>
|
||||
|
||||
<select id="selectAgvContainerTaskList" parameterType="AgvContainerTask" resultMap="AgvContainerTaskResult">
|
||||
<include refid="selectAgvContainerTaskVo"/>
|
||||
<where>
|
||||
<if test="container != null and container != ''"> and container = #{container}</if>
|
||||
<if test="startPoint != null and startPoint != ''"> and start_point = #{startPoint}</if>
|
||||
<if test="endPoint != null and endPoint != ''"> and end_point = #{endPoint}</if>
|
||||
<if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
|
||||
<if test="finishTime != null and finishTime != ''"> and finish_time = #{finishTime}</if>
|
||||
<if test="taskNo != null and taskNo != ''"> and task_no = #{taskNo}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if>
|
||||
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAgvContainerTaskById" parameterType="Long" resultMap="AgvContainerTaskResult">
|
||||
<include refid="selectAgvContainerTaskVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAgvContainerTask" parameterType="AgvContainerTask" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into agv_container_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="container != null">container,</if>
|
||||
<if test="startPoint != null">start_point,</if>
|
||||
<if test="endPoint != null">end_point,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="finishTime != null">finish_time,</if>
|
||||
<if test="taskNo != null">task_no,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="spare1 != null">spare1,</if>
|
||||
<if test="spare2 != null">spare2,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="container != null">#{container},</if>
|
||||
<if test="startPoint != null">#{startPoint},</if>
|
||||
<if test="endPoint != null">#{endPoint},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="finishTime != null">#{finishTime},</if>
|
||||
<if test="taskNo != null">#{taskNo},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="spare1 != null">#{spare1},</if>
|
||||
<if test="spare2 != null">#{spare2},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAgvContainerTask" parameterType="AgvContainerTask">
|
||||
update agv_container_task
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="container != null">container = #{container},</if>
|
||||
<if test="startPoint != null">start_point = #{startPoint},</if>
|
||||
<if test="endPoint != null">end_point = #{endPoint},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="finishTime != null">finish_time = #{finishTime},</if>
|
||||
<if test="taskNo != null">task_no = #{taskNo},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="spare1 != null">spare1 = #{spare1},</if>
|
||||
<if test="spare2 != null">spare2 = #{spare2},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAgvContainerTaskById" parameterType="Long">
|
||||
delete from agv_container_task where id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteAgvContainerTaskByContainer" parameterType="string">
|
||||
delete from agv_container_task where container = #{container}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAgvContainerTaskByIds" parameterType="String">
|
||||
delete from agv_container_task where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="insertAgvContainerTaskFinish" parameterType="string">
|
||||
insert into agv_container_task_finish select * from agv_container_task where container=#{orderId}
|
||||
</select>
|
||||
|
||||
<update id="updateAgvContainerTaskByOrder" parameterType="string">
|
||||
update agv_container_task set status='2' where container=#{orderId}
|
||||
</update>
|
||||
|
||||
<select id="selectAgvContainerFinishOne" resultMap="AgvContainerTaskResult">
|
||||
select top 1 * from agv_container_task where status='2'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.ruoyi.api.service.impl;
|
||||
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.mapper.BasCargoSpaceMapper;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.job.service.IMydoJobService;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class ApiServiceImplTest {
|
||||
@Mock
|
||||
private IMydoJobService mydoJobService;
|
||||
@Mock
|
||||
private BasCargoSpaceMapper basCargoSpaceMapper;
|
||||
|
||||
private ApiServiceImpl service;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
service = new ApiServiceImpl();
|
||||
ReflectionTestUtils.setField(service, "mydoJobService", mydoJobService);
|
||||
ReflectionTestUtils.setField(service, "basCargoSpaceMapper", basCargoSpaceMapper);
|
||||
}
|
||||
|
||||
@Test
|
||||
void blockedOrdinaryOutboundIsNotInserted() {
|
||||
ReceiveJob job = outbound("60979", "130803", "20");
|
||||
when(basCargoSpaceMapper.selectBasCargoSpaceByCargoSpaceId("130803"))
|
||||
.thenReturn(cargoSpace("130803"));
|
||||
when(basCargoSpaceMapper.countOutboundBlockingPositions("130803")).thenReturn(1);
|
||||
|
||||
AjaxResult result = service.receiveOutMydoJob(job);
|
||||
|
||||
assertEquals(500, result.get(AjaxResult.CODE_TAG));
|
||||
assertEquals("同通道外侧货位尚未清空,等待前置移库完成", result.get(AjaxResult.MSG_TAG));
|
||||
verify(mydoJobService, never()).insertMydoJob(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void moveJobBypassesOutboundGuard() {
|
||||
ReceiveJob job = outbound("80183", "120703", "30");
|
||||
when(mydoJobService.insertMydoJob(any())).thenReturn(1);
|
||||
|
||||
AjaxResult result = service.receiveOutMydoJob(job);
|
||||
|
||||
assertEquals(200, result.get(AjaxResult.CODE_TAG));
|
||||
verify(basCargoSpaceMapper, never()).countOutboundBlockingPositions(any());
|
||||
verify(mydoJobService).insertMydoJob(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void unblockedOrdinaryOutboundIsInserted() {
|
||||
ReceiveJob job = outbound("60979", "130803", "20");
|
||||
when(basCargoSpaceMapper.selectBasCargoSpaceByCargoSpaceId("130803"))
|
||||
.thenReturn(cargoSpace("130803"));
|
||||
when(basCargoSpaceMapper.countOutboundBlockingPositions("130803")).thenReturn(0);
|
||||
when(mydoJobService.insertMydoJob(any())).thenReturn(1);
|
||||
|
||||
AjaxResult result = service.receiveOutMydoJob(job);
|
||||
|
||||
assertEquals(200, result.get(AjaxResult.CODE_TAG));
|
||||
verify(mydoJobService).insertMydoJob(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void unknownCargoSpaceIsRejectedInsteadOfAssumedSafe() {
|
||||
ReceiveJob job = outbound("60979", "UNKNOWN", "20");
|
||||
|
||||
AjaxResult result = service.receiveOutMydoJob(job);
|
||||
|
||||
assertEquals(500, result.get(AjaxResult.CODE_TAG));
|
||||
assertEquals("WCS 未找到出库货位 UNKNOWN,任务未接收", result.get(AjaxResult.MSG_TAG));
|
||||
verify(mydoJobService, never()).insertMydoJob(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void invalidOutboundTypeIsRejectedInsteadOfBypassingGuard() {
|
||||
ReceiveJob job = outbound("60979", "130803", "invalid");
|
||||
|
||||
AjaxResult result = service.receiveOutMydoJob(job);
|
||||
|
||||
assertEquals(500, result.get(AjaxResult.CODE_TAG));
|
||||
assertEquals("WCS 无法识别作业类型 invalid,任务未接收", result.get(AjaxResult.MSG_TAG));
|
||||
verify(mydoJobService, never()).insertMydoJob(any());
|
||||
}
|
||||
|
||||
private ReceiveJob outbound(String jobId, String cargoSpaceId, String inOrOut) {
|
||||
ReceiveJob job = new ReceiveJob();
|
||||
job.setJobId(jobId);
|
||||
job.setCargoSpaceId(cargoSpaceId);
|
||||
job.setInOrOut(inOrOut);
|
||||
job.setClassId("1");
|
||||
return job;
|
||||
}
|
||||
|
||||
private BasCargoSpace cargoSpace(String cargoSpaceId) {
|
||||
BasCargoSpace cargoSpace = new BasCargoSpace();
|
||||
cargoSpace.setCargoSpaceId(cargoSpaceId);
|
||||
return cargoSpace;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,9 @@ public class AjaxResult extends HashMap<String, Object>
|
||||
/**
|
||||
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
|
||||
*/
|
||||
|
||||
public AjaxResult()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化一个新创建的 AjaxResult 对象
|
||||
|
||||
@@ -116,7 +116,7 @@ public class SecurityConfig
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/changeLanguage", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**", "/pda/**").permitAll()
|
||||
.antMatchers("/device/operation/**").permitAll()
|
||||
.antMatchers("/api/agv/**").permitAll()
|
||||
.antMatchers("/agv/api/**").permitAll()
|
||||
.antMatchers("/device/api/**").permitAll()
|
||||
.antMatchers("/wcs2Wms/api/**").permitAll()
|
||||
.antMatchers("/test/**").permitAll()
|
||||
|
||||
Reference in New Issue
Block a user