Compare commits

...

52 Commits

Author SHA1 Message Date
CTOS
45f0f406f6 切换正式环境端口,删除任务优化 2026-07-05 16:09:37 +08:00
lsymicc
d6372ccc0c wms取消任务接口,程序便利性优化 2026-06-12 13:22:04 +08:00
lsymicc
6f60580268 出入库限制优化 2026-06-11 17:30:59 +08:00
lsymicc
cf538247e9 联合查表优化 2026-06-11 16:39:23 +08:00
lsymicc
e1fcfbf992 便利性优化 2026-06-11 11:18:26 +08:00
lsymicc
28c9ce8921 便利性优化 2026-06-11 11:13:38 +08:00
lsymicc
c9db39571c 出入库限制优化 2026-06-11 10:52:10 +08:00
lsymicc
08ceae0454 实时表历史表联查显示表数据 2026-06-10 15:02:28 +08:00
lsymicc
c10fb6af1c 限制出入库 2026-06-10 14:31:50 +08:00
lsymicc
70c2647699 限制出入库 2026-06-10 14:31:41 +08:00
CTOS
4c590f515f 文本优化,部分接口地址修正 2026-06-04 14:45:09 +08:00
lsymicc
d468c3a1a5 任务表查询排序 2026-06-04 14:31:33 +08:00
lsymicc
e77ed70162 任务表查询排序 2026-06-04 14:28:47 +08:00
lsymicc
43417820b1 任务表查询排序 2026-06-04 14:19:54 +08:00
lsymicc
135f082e16 任务表查询排序 2026-06-04 10:58:00 +08:00
lsymicc
361ec0dcb6 优化 2026-06-02 16:28:23 +08:00
lsymicc
c3689b2a6c 日志显示优化 2026-06-02 14:49:55 +08:00
lsymicc
8b2433c5a1 推送货位参数校验 2026-06-02 11:37:58 +08:00
lsymicc
5c6361217f 推送货位参数校验 2026-06-02 10:29:04 +08:00
lsymicc
472f94a1e8 推送货位参数校验 2026-06-02 10:16:03 +08:00
lsymicc
f9e1f958bf 增加几个接收出库推送校验 2026-05-22 16:07:39 +08:00
lsymicc
7aa97b743b 增加几个接收出库推送校验 2026-05-22 16:05:02 +08:00
lsymicc
3a5c338e18 增加作业管理界面搜索 2026-05-22 11:08:13 +08:00
lsymicc
f8ea7a5561 增加作业管理界面搜索 2026-05-22 09:20:14 +08:00
lsymicc
ef4694de29 增加作业管理界面搜索 2026-05-22 09:13:06 +08:00
lsymicc
a2229cb346 优化 2026-05-20 09:52:43 +08:00
lsymicc
50d2a924fc 优化 2026-05-19 17:21:50 +08:00
lsymicc
4436476ea3 完善控制台日志内容 2026-05-14 14:26:56 +08:00
lsymicc
4b1f8be0a3 完善控制台日志内容 2026-05-14 13:56:17 +08:00
lsymicc
666942b8f4 可视化监控界面调整 2026-05-12 17:20:48 +08:00
lsymicc
c48b3a4f2b 可视化监控界面调整 2026-05-12 13:05:39 +08:00
lsymicc
4566753e09 请求逻辑提示信息优化 2026-05-11 14:09:07 +08:00
lsymicc
93d7877620 输送机退回重进清除当前作业更改回调 2026-05-11 08:43:07 +08:00
lsymicc
6404fd8de9 输送机退回重进清除当前作业 2026-05-09 16:56:07 +08:00
lsymicc
014a0b830b 优化手动处理作业的队列处理 2026-05-09 15:23:14 +08:00
lsymicc
be289748cf 删除任务时同时处理堆垛机队列 2026-05-08 15:56:07 +08:00
lsymicc
9ef5198f00 请求错误信息显示优化 2026-05-08 14:43:25 +08:00
lsymicc
eafc68d1bf 请求错误信息显示优化 2026-05-08 13:59:03 +08:00
lsymicc
c30b7afab5 入口输送机重下任务功能和部分界面功能调整 2026-05-07 16:15:15 +08:00
CTOS
bb148ee7e4 Merge remote-tracking branch 'origin/master' 2026-05-06 16:04:30 +08:00
CTOS
671a83b493 文本优化,部分接口地址修正 2026-05-06 16:03:57 +08:00
CTOS
5e9a3ad800 入库优化 2026-04-29 13:32:49 +08:00
CTOS
af7b65f6dd 入库优化 2026-04-29 12:20:49 +08:00
lsymicc
741fe220d8 现场接口测试和出入库判断调整 2026-04-28 11:17:09 +08:00
lsymicc
955b94c145 优化调整 2026-04-22 17:13:01 +08:00
lsymicc
9d8496eeb6 优化调整 2026-04-15 17:30:36 +08:00
lsymicc
280053b113 优化调整 2026-04-14 17:13:58 +08:00
lsymicc
fe52fb7cd7 优化调整 2026-04-14 13:36:17 +08:00
lsymicc
a490dd0d9a 界面调整 2026-04-09 17:21:51 +08:00
lsymicc
9bc0cbf620 简化修改调度逻辑 2026-04-09 14:55:03 +08:00
lsymicc
1a93c78909 简化修改调度逻辑 2026-04-09 14:06:31 +08:00
lsymicc
715fd4a017 优化修正请求和响应逻辑 2026-04-09 08:50:52 +08:00
70 changed files with 2496 additions and 1077 deletions

View File

@@ -37,7 +37,7 @@
<spring-framework.version>5.3.39</spring-framework.version> <spring-framework.version>5.3.39</spring-framework.version>
<hutool.version>5.8.27</hutool.version> <hutool.version>5.8.27</hutool.version>
<lombok.version>1.18.30</lombok.version> <lombok.version>1.18.30</lombok.version>
<HslCommunication.version>3.7.0</HslCommunication.version> <HslCommunication.version>2.0.0</HslCommunication.version>
<mybatis-plus.version>3.5.2</mybatis-plus.version> <mybatis-plus.version>3.5.2</mybatis-plus.version>
</properties> </properties>

View File

@@ -43,12 +43,17 @@
<!-- <artifactId>mysql-connector-java</artifactId>--> <!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- </dependency>--> <!-- </dependency>-->
<!-- sql server驱动包 --> <!-- sql server驱动包 -->
<dependency> <!-- <dependency>-->
<groupId>com.microsoft.sqlserver</groupId> <!-- <groupId>com.microsoft.sqlserver</groupId>-->
<artifactId>mssql-jdbc</artifactId> <!-- <artifactId>mssql-jdbc</artifactId>-->
<version>12.10.1.jre11</version> <!-- <version>12.10.1.jre11</version>-->
</dependency> <!-- </dependency>-->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.1.jre8</version>
</dependency>
<!-- 核心模块--> <!-- 核心模块-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
@@ -103,9 +108,35 @@
</dependency> </dependency>
<!-- ✅ Kotlin 核心标准库(必加) -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.9.0</version>
</dependency>
<!-- ✅ Kotlin 反射(Spring Boot 配置绑定、@ConfigurationProperties、JSON 序列化必需) -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
<version>1.9.0</version>
</dependency>
<!-- ✅ Kotlin 协程(后端异步编程、WebFlux、suspend Controller 必需) -->
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>1.9.0</version> <!-- ✅ 与 Kotlin 1.9.x 兼容 -->
</dependency>
</dependencies> </dependencies>
<build> <build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<!-- <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>-->
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@@ -131,6 +162,48 @@
<warName>${project.artifactId}</warName> <warName>${project.artifactId}</warName>
</configuration> </configuration>
</plugin> </plugin>
<!-- ✅ Kotlin Maven 插件 -->
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/main/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/test/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
</plugins> </plugins>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
</build> </build>

View File

@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
@@ -20,13 +21,16 @@ import javax.annotation.PostConstruct;
@EnableScheduling @EnableScheduling
@EnableAsync @EnableAsync
@MapperScan("com.**.mapper") @MapperScan("com.**.mapper")
@ComponentScan(basePackages = {
"com.ruoyi",
"kotlin"
})
public class RuoYiApplication public class RuoYiApplication
{ {
public static void main(String[] args) public static void main(String[] args)
{ {
// System.setProperty("spring.devtools.restart.enabled", "false"); // System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args); SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 福来瑞达WCS系统启动成功 ლ(´ڡ`ლ)゙ "); System.out.println("(♥◠‿◠)ノ゙ 福莱瑞达WCS系统启动成功 ლ(´ڡ`ლ)゙ ");
} }
} }

View File

@@ -55,6 +55,17 @@ public class Wcs2WmsController {
return apiService.cancelMydoJob(jobParam); return apiService.cancelMydoJob(jobParam);
} }
/**
* @@@ FT568 - wms取消任务
* @param wmsTaskCode
* @return
*/
@DeleteMapping("/cancelJob/{wmsTaskCode}")
public AjaxResult cancelMydoJob(@PathVariable String wmsTaskCode)
{
return apiService.cancelMydoJob(wmsTaskCode);
}
/** /**
* 查询缓存点 * 查询缓存点

View File

@@ -20,12 +20,12 @@ public class ResponseResult {
/** /**
* 请求是否成功 * 请求是否成功
*/ */
private Integer success; private boolean success;
/** /**
* 提示信息 * 提示信息
*/ */
private boolean message; private String message;
/** /**
* 成功时返回任务信息对象 * 成功时返回任务信息对象

View File

@@ -40,6 +40,6 @@ public class TaskExceptionRequest {
/** /**
* 异常任务的类型 - 1052-入库有货,2-出库无货 * 异常任务的类型 - 1052-入库有货,2-出库无货
*/ */
private int type; private String type;
} }

View File

@@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class taskFinishReceive { public class TaskFinishReceive {
/** /**
* 任务类型(必填) * 任务类型(必填)

View File

@@ -27,6 +27,12 @@ public interface RequestLogMapper
*/ */
public List<RequestLog> selectRequestLogList(RequestLog requestLog); public List<RequestLog> selectRequestLogList(RequestLog requestLog);
/**
* 获取最新的任务请求响应记录
* @return
*/
public RequestLog selectRequestLogByLatestTask();
/** /**
* 新增接口记录 * 新增接口记录
* *
@@ -58,4 +64,6 @@ public interface RequestLogMapper
* @return 结果 * @return 结果
*/ */
public int deleteRequestLogByRequestIds(Long[] requestIds); public int deleteRequestLogByRequestIds(Long[] requestIds);
} }

View File

@@ -33,7 +33,6 @@ import java.util.Map;
public interface IApiService public interface IApiService
{ {
/** /**
* 生成agv队列 * 生成agv队列
* @param code1 起点 * @param code1 起点
@@ -90,6 +89,13 @@ public interface IApiService
*/ */
RequestLog finishMydoJob(Map<String, Object> param); RequestLog finishMydoJob(Map<String, Object> param);
/**
* @@@ FT568 任务完成回传 适应wms的自定义响应格式
* @param param
* @return
*/
RequestLog finishMydoJobForResponseResult(Map<String, Object> param);
/** /**
* 下发agv任务 * 下发agv任务
* @param agvQueue * @param agvQueue
@@ -105,6 +111,8 @@ public interface IApiService
*/ */
AjaxResult cancelMydoJob(JobParam jobParam); AjaxResult cancelMydoJob(JobParam jobParam);
AjaxResult cancelMydoJob(String wmsTaskCode);
AjaxResult selectWcsPort(WcsPort wcsPort); AjaxResult selectWcsPort(WcsPort wcsPort);
AjaxResult updateWcsPort(WcsPort wcsPort); AjaxResult updateWcsPort(WcsPort wcsPort);
@@ -144,6 +152,11 @@ public interface IApiService
*/ */
AjaxResult createInMydoJob(Map<String, Object> param); AjaxResult createInMydoJob(Map<String, Object> param);
/**
* @@@ FT568 入库请求生成作业 处理了请求响应,适应wms的自定义响应格式
*/
AjaxResult createMydoJobForStockin(Map<String, Object> param);
/** /**
* 入库请求作业异常反馈(扫码失败、外形、称重等异常) * 入库请求作业异常反馈(扫码失败、外形、称重等异常)
*/ */

View File

@@ -27,6 +27,12 @@ public interface IRequestLogService
*/ */
public List<RequestLog> selectRequestLogList(RequestLog requestLog); public List<RequestLog> selectRequestLogList(RequestLog requestLog);
/**
* 获取最新的任务请求响应记录
* @return
*/
public RequestLog selectRequestLogByLatestTask();
/** /**
* 新增接口记录 * 新增接口记录
* *
@@ -70,11 +76,21 @@ public interface IRequestLogService
/** /**
* 接收请求,并插入日志 * 接收请求,并插入日志
* @param param
* @param endPoint
* @return
*/
public RequestLog getRequestLog(String param, String endPoint);
RequestLog getRequestLog2(String url, String param, String endPoint);
/**
* @@@ FT568 使用用户自定义的wms请求响应
* @param url * @param url
* @param endPoint
* @param param * @param param
* @return * @return
*/ */
public RequestLog getRequestLog(String url, String param); RequestLog getRequestLogForResponseResult(String url, String endPoint, String param);
RequestLog getRequestLog2(String url, String param, String endPoint);
} }

View File

@@ -18,12 +18,17 @@ import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRespons
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.PositionCodeData; import com.ruoyi.api.domain.agv.genAgvSchedulingTask.PositionCodeData;
import com.ruoyi.api.domain.wcs2wms.JobParam; import com.ruoyi.api.domain.wcs2wms.JobParam;
import com.ruoyi.api.domain.wcs2wms.ReceiveJob; import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
import com.ruoyi.api.domain.wcs2wms.ResponseResult;
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionReceive;
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionRequest; import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionRequest;
import com.ruoyi.api.domain.wcs2wms.stockout.StockoutReceive; import com.ruoyi.api.domain.wcs2wms.stockout.StockoutReceive;
import com.ruoyi.api.service.IApiService; import com.ruoyi.api.service.IApiService;
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService; import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
import com.ruoyi.bas.port.domain.WcsPort; import com.ruoyi.bas.port.domain.WcsPort;
import com.ruoyi.bas.port.service.IWcsPortService; import com.ruoyi.bas.port.service.IWcsPortService;
import com.ruoyi.common.GoodsType;
import com.ruoyi.common.TaskType;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.job.domain.MydoJob; import com.ruoyi.job.domain.MydoJob;
@@ -42,8 +47,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static com.ruoyi.common.Constant.*; import static com.ruoyi.common.Constant.*;
import static com.ruoyi.common.TaskStatusCode.TASK_EP_CREATE; import static com.ruoyi.common.ConvType.CONV_STOCKOUT;
import static com.ruoyi.common.TaskStatusCode.TASK_EP_ROADWAY_SSJ; import static com.ruoyi.common.TaskStatusCode.*;
import static com.ruoyi.common.TaskType.STOCKIN;
/** /**
* 接口记录Service业务层处理 * 接口记录Service业务层处理
@@ -54,6 +60,7 @@ import static com.ruoyi.common.TaskStatusCode.TASK_EP_ROADWAY_SSJ;
@Service @Service
@Slf4j @Slf4j
public class ApiServiceImpl implements IApiService { public class ApiServiceImpl implements IApiService {
@Autowired @Autowired
private RequestLogServiceImpl requestLogService; private RequestLogServiceImpl requestLogService;
@Autowired @Autowired
@@ -66,7 +73,6 @@ public class ApiServiceImpl implements IApiService {
private IBasCargoSpaceService basCargoSpaceService; private IBasCargoSpaceService basCargoSpaceService;
/** /**
* 下发agv编码 * 下发agv编码
* *
@@ -155,6 +161,15 @@ public class ApiServiceImpl implements IApiService {
return requestLogService.getRequestLog(WMS_TASK_FINISH, "任务完成上报", JSONUtil.toJsonStr(param)); return requestLogService.getRequestLog(WMS_TASK_FINISH, "任务完成上报", JSONUtil.toJsonStr(param));
} }
/**
* @@@ FT568 任务完成回传 适应wms的自定义响应格式
* @param param
* @return
*/
public RequestLog finishMydoJobForResponseResult(Map<String, Object> param) {
return requestLogService.getRequestLogForResponseResult(WMS_TASK_FINISH, "任务完成上报", JSONUtil.toJsonStr(param));
}
/** /**
* 处理agv状态返回 * 处理agv状态返回
@@ -237,6 +252,28 @@ public class ApiServiceImpl implements IApiService {
} }
} }
/**
* wms删除任务(单选)
*
* @param wmsTaskCode
* @return
*/
@Override
public AjaxResult cancelMydoJob(String wmsTaskCode) {
if (wmsTaskCode == null || wmsTaskCode.equals("")) {
return AjaxResult.error("查不到执行wms任务号的作业");
}
MydoJob mydoJob = mydoJobService.selectMydoJobByWmsTaskNo(wmsTaskCode);
if (mydoJob == null) {
return AjaxResult.error("查不到该wms任务号正在执行中的作业,可能是已经取消或完成,请检查wcs任务状态");
}
return AjaxResult.success(mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId()));
}
@@ -266,14 +303,17 @@ public class ApiServiceImpl implements IApiService {
*/ */
@Override @Override
public AjaxResult reAssign(TaskExceptionRequest taskExceptionRequest) { public AjaxResult reAssign(TaskExceptionRequest taskExceptionRequest) {
RequestLog requestLog = requestLogService.getRequestLog(WMS_TASK_EXCEPTION, "入库异常-重新分配货位", JSONUtil.toJsonStr(taskExceptionRequest)); RequestLog requestLog = requestLogService.getRequestLogForResponseResult(WMS_TASK_EXCEPTION, "入库异常-重新分配货位", JSONUtil.toJsonStr(taskExceptionRequest));
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); ResponseResult bean = JSONUtil.toBean(requestLog.getResponseBody(), ResponseResult.class);
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(wmsMydoJob.getJobId()); TaskExceptionReceive taskExceptionReceive = BeanUtil.toBean(bean.getResult(), TaskExceptionReceive.class);
mydoJob.setCargoSpaceId(wmsMydoJob.getCargoSpaceId());
//更新任务信息
MydoJob mydoJob = mydoJobService.selectMydoJobByWmsTaskNo(taskExceptionReceive.getTaskCode());
mydoJob.setCargoSpaceId(taskExceptionReceive.getSiteCode());
mydoJobService.updateMydoJob(mydoJob); mydoJobService.updateMydoJob(mydoJob);
return AjaxResult.success(); return AjaxResult.success(taskExceptionReceive);
} }
return AjaxResult.error(); return AjaxResult.error();
} }
@@ -299,7 +339,7 @@ public class ApiServiceImpl implements IApiService {
*/ */
@Override @Override
public AjaxResult reMaterial(TaskExceptionRequest taskExceptionRequest) { public AjaxResult reMaterial(TaskExceptionRequest taskExceptionRequest) {
RequestLog requestLog = requestLogService.getRequestLog(WMS_TASK_EXCEPTION, "出库无货异常-任务作废", JSONUtil.toJsonStr(taskExceptionRequest)); RequestLog requestLog = requestLogService.getRequestLogForResponseResult(WMS_TASK_EXCEPTION, "出库无货异常-任务作废", JSONUtil.toJsonStr(taskExceptionRequest));
if ("1".equals(requestLog.getIsSuccessful())){ if ("1".equals(requestLog.getIsSuccessful())){
return AjaxResult.success(); return AjaxResult.success();
} }
@@ -433,8 +473,25 @@ public class ApiServiceImpl implements IApiService {
} }
} }
/** /**
* 入库请求作业异常反馈(扫码失败、外形、称重等异常) * @@@ FT568 请求wms获取入库任务参数 - 适应wms的自定义请求响应格式
* @param param
* @return
*/
@Override
public AjaxResult createMydoJobForStockin(Map<String, Object> param) {
RequestLog requestLog = requestLogService.getRequestLogForResponseResult(WMS_STOCKIN_MYDOJOB, "入库请求生成作业", JSONUtil.toJsonStr(param));
if ("1".equals(requestLog.getIsSuccessful())) {
ResponseResult bean = JSONUtil.toBean(requestLog.getResponseBody(), ResponseResult.class);
return AjaxResult.success(bean.getResult());
} else {
return AjaxResult.error();
}
}
/**
* @@@ FT568 入库请求作业异常反馈(扫码失败、外形、称重等异常)
* @param param * @param param
* @return * @return
*/ */
@@ -453,40 +510,105 @@ public class ApiServiceImpl implements IApiService {
@Override @Override
public AjaxResult receiveOutMydoJob(StockoutReceive stockoutReceive) { public AjaxResult receiveOutMydoJob(StockoutReceive stockoutReceive) {
//检查任务是否存在,避免重复生成 //生成接口记录
MydoJob job = new MydoJob(); RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(stockoutReceive), "推送出库作业");
job.setWmsTaskNo(stockoutReceive.getTaskCode()); requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
List<MydoJob> tasks = mydoJobService.selectMydoJobList(job); requestLog.setResponseStatus("0");
requestLog.setIsSuccessful("1");
requestLogService.insertRequestLog(requestLog);
//校验:任务已存在 // -------------------------检查推送的任务参数-------------------------
if (tasks.size() != 0) { log.info(
log.info("【请求异常】wms下发出库任务失败,该任务已存在,任务号:{}", stockoutReceive.getTaskCode()); "【wms推送出库】请求码:{},wms任务号:{},推送出库货位:{},推送类型:{}",stockoutReceive.getReqCode(), stockoutReceive.getTaskCode(), stockoutReceive.getSiteCode(), stockoutReceive.getTaskTypeCode()
return AjaxResult.error("【请求异常】wms下发出库任务失败,任务号:" + stockoutReceive.getTaskCode()); );
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stockoutReceive.getSiteCode());
// 0.检查货位参数是否合法
if(stockoutReceive.getSiteCode() == null || stockoutReceive.getSiteCode() == ""){
log.info("【请求错误】wms推送出库任务失败,参数错误,推送任务号:{},推送出库货位:{}", stockoutReceive.getTaskCode(), stockoutReceive.getSiteCode());
return AjaxResult.error("【请求错误】wms推送出库任务失败,参数错误,推送任务号:{}" + stockoutReceive.getTaskCode() + ",推送出库货位:" + stockoutReceive.getSiteCode());
}else{
//排号检查
if (cargoSpace.getThePlatoon() > 2 || cargoSpace.getThePlatoon() < 0){
log.info("【请求错误】wms推送出库任务失败,参数错误,推送任务号:{},推送排:{}", stockoutReceive.getTaskCode(), cargoSpace.getThePlatoon());
return AjaxResult.error("【请求错误】wms推送出库任务失败,错误,推送任务号:" + stockoutReceive.getTaskCode() + ",推送出库排号:" + cargoSpace.getThePlatoon() + ",仓库中不存在该位置!");
}
//列号检查
if (cargoSpace.getTheColumn() > 33 || cargoSpace.getTheColumn() < 0){
log.info("【请求错误】wms推送出库任务失败,参数错误,推送任务号:{},推送列:{}", stockoutReceive.getTaskCode(), cargoSpace.getTheColumn());
return AjaxResult.error("【请求错误】wms推送出库任务失败,错误,推送任务号:" + stockoutReceive.getTaskCode() + ",推送出库列号:" + cargoSpace.getTheColumn() + ",仓库中不存在该位置!");
}
//层号检查
if (cargoSpace.getTheFloor() > 6 || cargoSpace.getTheFloor() < 0){
log.info("【请求错误】wms推送出库任务失败,参数错误,推送任务号:{},推送层:{}", stockoutReceive.getTaskCode(), cargoSpace.getThePlatoon());
return AjaxResult.error("【请求错误】wms推送出库任务失败,错误,推送任务号:" + stockoutReceive.getTaskCode() + ",推送出库层号:" + cargoSpace.getThePlatoon() + ",仓库中不存在该位置!");
}
} }
// 1.wms推送的任务号是否重复
MydoJob job = new MydoJob().builder().wmsTaskNo(stockoutReceive.getTaskCode()).build();
List<MydoJob> tasks = mydoJobService.selectMydoJobList(job);
if (tasks.size() != 0) {
log.info("【请求错误】wms下发出库任务失败,该任务已存在,推送任务号:{},推送出库货位:{}", stockoutReceive.getTaskCode(), stockoutReceive.getSiteCode());
return AjaxResult.error("【请求错误】wms下发出库任务失败,该任务已存在,推送任务号:{}" + stockoutReceive.getTaskCode() + ",推送出库货位:" + stockoutReceive.getSiteCode());
}
// 2.wms推送的出库货位是否已经有任务
job = new MydoJob().builder().cargoSpaceId(stockoutReceive.getSiteCode()).build();
tasks = mydoJobService.selectMydoJobList(job);
if (tasks.size() != 0) {
log.info("【请求错误】wms下发出库任务失败,已经存在该货位的出库任务,推送任务号:{},推送出库货位:{}", stockoutReceive.getTaskCode(), stockoutReceive.getSiteCode());
return AjaxResult.error("【请求错误】wms下发出库任务失败,已经存在该货位的出库任务,推送任务号:{}" + stockoutReceive.getTaskCode() + ",推送出库货位:" + stockoutReceive.getSiteCode());
}
// 3.是否已经有正在执行的入库任务
// job = new MydoJob().builder().inOrOut(STOCKIN).build();
// tasks = mydoJobService.selectMydoJobList(job);
// if (tasks.size() > 0) {
// log.info("【警告】wms下发出库任务失败,已经有正在执行的入库任务,请稍后重试");
// return AjaxResult.error("【警告】wms下发出库任务失败,已经有正在执行的入库任务,请稍后重试");
// }
//生成出库作业 //生成出库作业
MydoJob mydoJob = new MydoJob(); MydoJob mydoJob = new MydoJob();
mydoJob.setJobId(mydoJobService.getJobId("CK")); mydoJob.setJobId(mydoJobService.getJobId("CK"));
mydoJob.setTaskNo(mydoJobService.getTaskNo("3")); mydoJob.setTaskNo(mydoJobService.getTaskNo("3"));
mydoJob.setWmsTaskNo(stockoutReceive.getTaskCode()); mydoJob.setWmsTaskNo(stockoutReceive.getTaskCode());
//todo 可能需要解析货位 wms参数【siteCode】
mydoJob.setCargoSpaceId(stockoutReceive.getSiteCode()); mydoJob.setCargoSpaceId(stockoutReceive.getSiteCode());
mydoJob.setExitId("G1004"); mydoJob.setRoadwayId(
//todo 是否需要解析wms推送的任务类型? basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stockoutReceive.getSiteCode()).getRoadwayId()
// mydoJob.setInOrOut(stockoutReceive.getTaskTypeCode()); );
mydoJob.setTraySize(GoodsType.TYPE_DEFAULT);//默认
mydoJob.setExitId(CONV_STOCKOUT);
mydoJob.setInOrOut("2"); mydoJob.setInOrOut("2");
mydoJob.setStatus("1"); mydoJob.setStatus(TASK_STATUS_CREATED);
mydoJob.setPriority(Long.valueOf(10)); mydoJob.setPriority(Long.valueOf(10));
//todo 可能需要查本地库存信息获取条码? //todo 可能需要查本地库存信息获取条码?
// mydoJob.setTrayCode(receiveOutJob.getTrayCode()); // mydoJob.setTrayCode(receiveOutJob.getTrayCode());
mydoJob.setCreateTime(DateUtils.getNowDate()); mydoJob.setCreateTime(DateUtils.getNowDate());
mydoJob.setExecutionPhase(TASK_EP_CREATE); mydoJob.setExecutionPhase(TASK_EP_CREATED);
// mydoJob.setTraySize(receiveOutJob.getDepartmentId()); // mydoJob.setTraySize(receiveOutJob.getDepartmentId());
if (mydoJobService.selectMydoJobByJobId(mydoJob.getJobId()) != null){
log.info("【警告】生成作业失败,已存在的作业号:{}", mydoJob.getJobId() + "(此条可忽略)");
return AjaxResult.error("【警告】生成作业失败,已存在的作业号:{}" + mydoJob.getJobId() + "(仅提示)");
}
// if (mydoJobService.selectMydoJobByWmsTaskNo(mydoJob.getWmsTaskNo()) != null){
// log.info("【警告】生成作业失败,已存在的作业号:{}", mydoJob.getJobId() + "(此条可忽略)");
// return AjaxResult.error("【警告】生成作业失败,已存在的wms任务号:{}" + mydoJob.getJobId() + "(仅提示)");
// }
int i = mydoJobService.insertMydoJob(mydoJob); int i = mydoJobService.insertMydoJob(mydoJob);
// boolean success = mydoJobService.saveOrUpdate(mydoJob); // boolean success = mydoJobService.saveOrUpdate(mydoJob);
if (i != 0) { if (i != 0) {
requestLog.setResponseStatus("1");
requestLogService.updateRequestLog(requestLog);
return AjaxResult.success( return AjaxResult.success(
"【请求成功】wms下发出库作业,下发任务号:" + stockoutReceive.getTaskCode() + ",出库货位:" + stockoutReceive.getSiteCode()); "【堆垛机出库】wms下发出库作业,下发任务号:" + stockoutReceive.getTaskCode() + ",出库货位:" + stockoutReceive.getSiteCode());
}else{ }else{
return AjaxResult.error(); return AjaxResult.error();
} }
@@ -576,38 +698,17 @@ public class ApiServiceImpl implements IApiService {
@Override @Override
public AjaxResult updateWcsPort(WcsPort wcsPort) { public AjaxResult updateWcsPort(WcsPort wcsPort) {
int i = wcsPortService.updateWcsPort(wcsPort); int i = wcsPortService.updateWcsPort(wcsPort);
if(i>0){ if(i > 0){
return AjaxResult.success(); return AjaxResult.success();
}else{ }else{
return AjaxResult.error(); return AjaxResult.error();
} }
} }
//// @PostConstruct // @PostConstruct
// void qwe() { void test() {
// HashMap<String, Object> map = new HashMap<>();
// map.put("v_param", "RK"); }
// mydoJobService.getJobId(map);
// String s = map.get("v_serial").toString();
// System.out.println(s);
//
//
// map.put("v_param", "CK");
// mydoJobService.getJobId(map);
// s = map.get("v_serial").toString();
// System.out.println(s);
//
// map.put("v_param", "2");
// mydoJobService.getTaskNo(map);
// s = map.get("v_serial").toString();
// System.out.println(s);
//
// map.put("v_param", "3");
// mydoJobService.getTaskNo(map);
// s = map.get("v_serial").toString();
// System.out.println(s);
//
// }
} }

View File

@@ -1,14 +1,19 @@
package com.ruoyi.api.service.impl; package com.ruoyi.api.service.impl;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.ruoyi.api.domain.InterfaceReceive; import com.ruoyi.api.domain.InterfaceReceive;
import com.ruoyi.api.domain.wcs2wms.ResponseResult;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -16,6 +21,8 @@ import com.ruoyi.api.mapper.RequestLogMapper;
import com.ruoyi.api.domain.RequestLog; import com.ruoyi.api.domain.RequestLog;
import com.ruoyi.api.service.IRequestLogService; import com.ruoyi.api.service.IRequestLogService;
import static com.ruoyi.common.Constant.HEADER_TOKEN;
/** /**
* 接口记录Service业务层处理 * 接口记录Service业务层处理
* *
@@ -53,6 +60,16 @@ public class RequestLogServiceImpl implements IRequestLogService
return requestLogMapper.selectRequestLogList(requestLog); return requestLogMapper.selectRequestLogList(requestLog);
} }
/**
* 获取最新的请求记录
* @return
*/
@Override
public RequestLog selectRequestLogByLatestTask()
{
return requestLogMapper.selectRequestLogByLatestTask();
}
/** /**
* 新增接口记录 * 新增接口记录
* *
@@ -128,9 +145,17 @@ public class RequestLogServiceImpl implements IRequestLogService
requestLog.setRequestUrl(url); requestLog.setRequestUrl(url);
Date responseTime =new Date(); Date responseTime =new Date();
try { try {
String resStr = HttpUtil.post(url, param); // String resStr = HttpUtil.post(url, param);
String resStr = HttpRequest.post(url)
.body(param)
.header("X-Service-Secret", HEADER_TOKEN)
.execute()
.body();
requestLog.setResponseBody(resStr); requestLog.setResponseBody(resStr);
InterfaceReceive bean = JSONUtil.toBean(resStr, InterfaceReceive.class); InterfaceReceive bean = JSONUtil.toBean(resStr, InterfaceReceive.class);
if (bean.getCode() == 200) { if (bean.getCode() == 200) {
requestLog.setResponseTime(DateUtil.format(responseTime, "yyyy-MM-dd HH:mm:ss")); requestLog.setResponseTime(DateUtil.format(responseTime, "yyyy-MM-dd HH:mm:ss"));
requestLog.setResponseStatus("1"); requestLog.setResponseStatus("1");
@@ -173,6 +198,7 @@ public class RequestLogServiceImpl implements IRequestLogService
String resStr = HttpUtil.post(url, param); String resStr = HttpUtil.post(url, param);
requestLog.setResponseBody(resStr); requestLog.setResponseBody(resStr);
InterfaceReceive bean = JSONUtil.toBean(resStr, InterfaceReceive.class); InterfaceReceive bean = JSONUtil.toBean(resStr, InterfaceReceive.class);
if (bean.getCode() == 0) { if (bean.getCode() == 0) {
requestLog.setResponseTime(DateUtil.format(responseTime, "yyyy-MM-dd HH:mm:ss")); requestLog.setResponseTime(DateUtil.format(responseTime, "yyyy-MM-dd HH:mm:ss"));
requestLog.setResponseStatus("1"); requestLog.setResponseStatus("1");
@@ -199,6 +225,63 @@ public class RequestLogServiceImpl implements IRequestLogService
} }
/**
* @@@ FT568 使用用户自定义的wms请求响应
* @param url
* @param endPoint
* @param param
* @return
*/
@Override
public RequestLog getRequestLogForResponseResult(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"));
requestLog.setSourceSystem("wcs");
requestLog.setTargetSystem("wms");
requestLog.setEndpoint(endPoint);
requestLog.setRequestMethod("post");
requestLog.setRequestHeaders(null);
requestLog.setRequestBody(param);
requestLog.setRequestUrl(url);
Date responseTime =new Date();
try {
// String resStr = HttpUtil.post(url, param, header, 3000);
String resStr = HttpRequest.post(url)
.body(param)
.header("X-Service-Secret", HEADER_TOKEN) // 向wms请求头必需添加的token
.execute()
.body();
requestLog.setResponseBody(resStr);
ResponseResult bean = JSONUtil.toBean(resStr, ResponseResult.class);
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 {
requestLog.setResponseTime(DateUtil.format(responseTime, "yyyy-MM-dd HH:mm:ss"));
requestLog.setResponseStatus("0");
requestLog.setErrorDetails(bean.isSuccess() + "-" + bean.getMessage());
requestLog.setIsSuccessful("0");
requestLog.setDuration(Convert.toStr(DateUtil.between(requestTime, responseTime, DateUnit.MS)));
}
} catch (Exception e) {
requestLog.setResponseTime(DateUtil.format(responseTime, "yyyy-MM-dd HH:mm:ss"));
requestLog.setErrorDetails(e.getMessage());
requestLog.setIsSuccessful("0");
requestLog.setResponseStatus("0");
requestLog.setDuration(Convert.toStr(DateUtil.between(requestTime, responseTime, DateUnit.MS)));
} finally {
insertRequestLog(requestLog);
}
return requestLog;
}
/** /**
* 插入请求日志 * 插入请求日志
* *
@@ -220,4 +303,25 @@ public class RequestLogServiceImpl implements IRequestLogService
} }
/**
* @@@ FT568 将wms自定义的响应格式解析为本地响应格式(减少其他改动)
* @param responseStr 请求响应字符串
* @return
*/
public InterfaceReceive resultToBean(String responseStr) {
InterfaceReceive interfaceReceive = new InterfaceReceive();
//返回供应商wms自定义的ResponseResult,解析为本地InterfaceReceive响应格式
ResponseResult result =JSONUtil.toBean(responseStr, ResponseResult.class);
interfaceReceive.setCode(result.getCode());
interfaceReceive.setMsg(result.isSuccess() + "-" + result.getMessage());
interfaceReceive.setData(result.getResult());
return interfaceReceive;
}
} }

View File

@@ -3,9 +3,13 @@ package com.ruoyi.common;
public class Constant { public class Constant {
public static final String WMS_BASE_URL = "http://192.168.58.10:8082/api2wms"; public static final String LOCAL_URL = "http://127.0.0.1:8084";
public static final String WMS_BASE_URL = "http://10.88.10.69:8390/service";
public static final String RCS_BASE_URL = "http://192.168.58.101:8182/rcms/services/rest/hikRpcService/"; public static final String RCS_BASE_URL = "http://192.168.58.101:8182/rcms/services/rest/hikRpcService/";
public static final String HEADER_TOKEN = "fed3d1511a5a474b9e1f9c56246cb1ec";
//#region AGV接口url //#region AGV接口url
public static final String GEN_AGV_SCHEDULING_TASK = RCS_BASE_URL+"genAgvSchedulingTask"; public static final String GEN_AGV_SCHEDULING_TASK = RCS_BASE_URL+"genAgvSchedulingTask";
public static final String CANCEL_TASK_URL = RCS_BASE_URL+"cancelTask"; public static final String CANCEL_TASK_URL = RCS_BASE_URL+"cancelTask";
@@ -22,7 +26,12 @@ public class Constant {
//#endregion //#endregion
/**
* 本地测试wms服务端url
*/
public static final String WMS_STOCKIN_MYDOJOB_LOCAL = "http://localhost:5066/api/TestModel/WcsStockin";
public static final String WMS_TASK_FINISH_LOCAL = "http://localhost:5066/api/TestModel/WcsCallBack";
public static final String WMS_TASK_EXCEPTION_LOCAL = "http://localhost:5066/api/TestModel/WcsException";
/** /**
* 向wms请求入库url * 向wms请求入库url

View File

@@ -8,23 +8,23 @@ public class ConvException {
/** /**
* 外形检测异常 * 外形检测异常
*/ */
public static final int CHECK_SIZE_EXCEPTION = 0; public static final int CHECK_SIZE_EXCEPTION = 1;
/** /**
* 超重 * 超重
*/ */
public static final int CHECK_OVERWEIGHT_EXCEPTION = 1; public static final int CHECK_OVERWEIGHT_EXCEPTION = 2;
/** /**
* 扫码异常 * 扫码异常
*/ */
public static final int CHECK_BARCODE_EXCEPTION = 2; public static final int CHECK_BARCODE_EXCEPTION = 3;
/** /**
* 输送机非自动 * 输送机非自动
*/ */
public static final int CHECK_MODE_EXCEPTION = 3; public static final int CHECK_MODE_EXCEPTION = 4;
} }

View File

@@ -0,0 +1,19 @@
package com.ruoyi.common;
public class ConvType {
/**
* 出库输送机(到位位置)
*/
public static final String CONV_STOCKOUT = "TD1001";
/**
* 入库输送机(到位位置)
*/
public static final String CONV_STOCKIN = "G1004";
/**
* 1#巷道口输送机(到位位置)
*/
public static final String CONV_ROAD_1 = "L1001";
}

View File

@@ -0,0 +1,22 @@
package com.ruoyi.common;
/**
* 货物类型
*/
public class GoodsType {
/**
* 默认
*/
public static final String TYPE_DEFAULT = "0";
/**
* 高度1
*/
public static final String TYPE_HEIGHT_1 = "1";
/**
* 高度2
*/
public static final String TYPE_HEIGHT_2 = "0";
}

View File

@@ -5,10 +5,12 @@ package com.ruoyi.common;
*/ */
public class TaskStatusCode { public class TaskStatusCode {
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 【任务状态】 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/** /**
* 任务状态-待执行 * 任务状态-待执行
*/ */
public static final String TASK_STATUS_CREATE = "1"; public static final String TASK_STATUS_CREATED = "1";
/** /**
* 任务状态-待执行 * 任务状态-待执行
@@ -25,41 +27,89 @@ public class TaskStatusCode {
*/ */
public static final String TASK_STATUS_FINISH = "4"; public static final String TASK_STATUS_FINISH = "4";
/**
* 任务状态-手动完成
*/
public static final String TASK_STATUS_FINISH_MANUAL = "4";
/** /**
* 任务状态-作废 * 任务状态-作废
*/ */
public static final String TASK_STATUS_INVALID = "5"; public static final String TASK_STATUS_INVALID = "5";
/**
* 任务执行阶段 创建 //>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 【执行阶段】 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*/
public static final String TASK_EP_CREATE = "0";
/** /**
* 任务执行阶段 产线 * 任务执行阶段 任务已生成
*/
public static final String TASK_EP_CREATED = "0";
/**
* 任务执行阶段 产线输送到位
*/ */
public static final String TASK_EP_LINE_SSJ = "1"; public static final String TASK_EP_LINE_SSJ = "1";
/** /**
* 任务执行阶段 AGV * 任务执行阶段 AGV
*/ */
public static final String TASK_EP_AGV = "2"; public static final String TASK_EP_AGV = "2";
/** /**
* 任务执行阶段 入口输送机 * 任务执行阶段 入口输送机输送到位
*/ */
public static final String TASK_EP_SSJ = "3"; public static final String TASK_EP_SSJ = "3";
/** /**
* 任务执行阶段 巷道口 * 任务执行阶段 巷道口入库到位
*/ */
public static final String TASK_EP_ROADWAY_SSJ = "4"; public static final String TASK_EP_ROADWAY_SSJ = "4";
/** /**
* 任务执行阶段 堆垛机 * 任务执行阶段 堆垛机执行
*/ */
public static final String TASK_EP_DDJ = "5"; public static final String TASK_EP_DDJ = "5";
/**
* 任务执行阶段 堆垛机放货完成
*/
public static final String TASK_EP_DDJ_FINISH = "6";
/**
* 任务执行阶段 输送机出库到位-出库完成
*/
public static final String TASK_EP_SSJ_STOCKOUT_FINISH = "6";
/**
* 任务执行阶段 任务自动完成
*/
public static final String TASK_EP_FINISH = "6";
/**
* 任务执行阶段 任务超时-自动结束当前任务
*/
public static final String TASK_EP_DDJ_FINISH_TIMEOUT = "6";
/**
* 入库异常 - 放货有货
*/
public static final String TASK_EXCEPTION_PUT = "STOCKIN_FAULT";
/**
* 出库异常 - 取货无货
*/
public static final String TASK_EXCEPTION_PICK = "STOCKOUT_FAULT";
/**
* 入库异常 - 重分完成
*/
public static final String TASK_EXCEPTION_PUT_REASSIGN = "STOCKIN_FAULT_REASSIGN";
/** /**
* 任务执行阶段 回传wms完成 * 任务执行阶段 回传wms完成
*/ */
public static final String TASK_EP_WMS_FINISH = "6"; public static final String TASK_EP_WMS_FINISH = "9";
} }

View File

@@ -1,15 +1,36 @@
package com.ruoyi.common; package com.ruoyi.common;
/**
* 堆垛机任务类型
*/
public class TaskType { public class TaskType {
/** /**
* 堆垛机任务类型 * 默认类型
*/
public static final int STACKER_TYPE_DEFAULT = 0;
/**
* 常规入库
*/
public static final String STOCKIN = "1";
/**
* 常规出库
*/
public static final String STOCKOUT = "2";
/**
* 1-二楼入出
*/ */
//1-二楼入出
public static final int DDJ_RWLX_1 = 1; public static final int DDJ_RWLX_1 = 1;
//2-一楼出库 /**
* 2-一楼出库
*/
public static final int DDJ_RWLX_2 = 2; public static final int DDJ_RWLX_2 = 2;
//3-一楼入库 /**
* 3-一楼入库
*/
public static final int DDJ_RWLX_3 = 3; public static final int DDJ_RWLX_3 = 3;
} }

View File

@@ -0,0 +1,48 @@
package com.ruoyi.common;
/**
* wms自定义的任务类型
*/
public class WmsTaskTypeCode {
/**
* 外部wms定义的入库类型
*/
public static final String WMS_TASK_TYPE_STOCKIN = "立库入库";
/**
* 外部wms定义的出库类型
*/
public static final String WMS_TASK_TYPE_STOCKOUT = "立库出库";
/**
* 外部wms定义的入库结束类型
*/
public static final String WMS_TASK_TYPE_STOCKIN_FINISH = "立库入库任务结束";
/**
* 外部wms定义的出库结束类型
*/
public static final String WMS_TASK_TYPE_STOCKOUT_FINISH = "立库出库任务结束";
/**
* 外部wms定义的任务结束类型
*/
public static final String WMS_TASK_TYPE_FINISH = "立库任务结束";
/**
* 外部wms定义的入库异常类型
*/
public static final String WMS_TASK_TYPE_STOCKIN_EXCEPTION = "立库入库异常任务-放货有货";
/**
* 外部wms定义的出库异常类型
*/
public static final String WMS_TASK_TYPE_STOCKOUT_EXCEPTION = "立库出库异常任务-取货无货";
/**
* 外部wms定义的任务异常类型
*/
public static final String WMS_TASK_TYPE_EXCEPTION = "立库异常任务";
}

View File

@@ -3,6 +3,13 @@ package com.ruoyi.device.ddj.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.api.domain.RequestLog;
import com.ruoyi.api.service.IRequestLogService;
import com.ruoyi.device.ddj.domain.StackerStatus; import com.ruoyi.device.ddj.domain.StackerStatus;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -23,6 +30,8 @@ import com.ruoyi.device.ddj.service.IMsgDdjService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import static com.ruoyi.common.Constant.LOCAL_URL;
/** /**
* 堆垛机状态表Controller * 堆垛机状态表Controller
* *
@@ -30,12 +39,15 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @date 2025-09-22 * @date 2025-09-22
*/ */
@RestController @RestController
@RequestMapping("/device/ddj") @RequestMapping("/device/stacker")
public class MsgDdjController extends BaseController public class MsgDdjController extends BaseController
{ {
@Autowired @Autowired
private IMsgDdjService msgDdjService; private IMsgDdjService msgDdjService;
@Autowired
private IRequestLogService requestLogService;
/** /**
* 查询堆垛机状态表列表 * 查询堆垛机状态表列表
*/ */
@@ -105,30 +117,171 @@ public class MsgDdjController extends BaseController
} }
@GetMapping("/getStackerStatus/{id}")
public StackerStatus getStackerStatus(@PathVariable Long id){
//返回堆垛机部分参数的状态映射
if (id == 1) {
MsgDdj msg = msgDdjService.selectMsgDdjById(id);
StackerStatus status = new StackerStatus();
status.setId(msg.getId());
status.setName(msg.getName());
status.setMode(msg.getCzfs());
status.setTaskNo(msg.getRwh());
status.setDeviceStatus(msg.getSbzt());
status.setForkStatus(msg.getHczt());
status.setExecutionPhase(msg.getJdbz());
status.setPermission(msg.getYxxf());
status.setCurrentRow(msg.getCurrentRow());
status.setCurrentColumn(msg.getCurrentColumn());
status.setCurrentFloor(msg.getCurrentFloor());
// status.setCurrentRoad(msg.getId());
status.setCurrentPosition(msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层");
return status; /**
}else{ * 返回堆垛机状态的记录类型 - 中
return null; * @param id 编号
* @param mode 操作模式
* @param taskNo 任务号
* @param deviceStatus 设备状态
* @param forkStatus 货叉状态
* @param executionPhase 执行阶段
* @param permission 允许下发
* @param position 当前位置
*/
public record StackerStatusContent(
@JsonProperty("堆垛机编号") String id,
@JsonProperty("操作模式") String mode,
@JsonProperty("任务号") String taskNo,
@JsonProperty("设备状态") String deviceStatus,
@JsonProperty("货叉状态") String forkStatus,
@JsonProperty("执行阶段") String executionPhase,
@JsonProperty("允许下发") String permission,
@JsonProperty("当前位置") String position){}
/**
* 请求获取堆垛机状态
* @param id 堆垛机编号
* @return
*/
@GetMapping("/getStackerStatus/{id}")
public AjaxResult getStackerStatus(@PathVariable Long id){
//返回堆垛机部分参数的状态映射
MsgDdj msg = msgDdjService.selectMsgDdjById(id);
if (msg == null) {
AjaxResult.error("【查询堆垛机状态】设备编号:" + id + ",查询超出最大索引");
} }
//操作模式
String mode;
switch (msg.getCzfs()){
case 1 -> mode = "手动";
case 5 -> mode = "联机自动";
default -> mode = "其他";
}
//设备状态
String deviceStatus;
switch (msg.getSbzt()){
case 0 -> deviceStatus = "待机";
case 1 -> deviceStatus = "运行中";
default -> deviceStatus = "运行报警";
}
//执行阶段
String executionPhase;
switch (msg.getJdbz()){
case 1 -> executionPhase = "取货途中";
case 2 -> executionPhase = "取货中";
case 3 -> executionPhase = "放货途中";
case 4 -> executionPhase = "放货中";
case 5 -> executionPhase = "放货完成";
default -> executionPhase = "待机";
}
StackerStatusContent statusContent = new StackerStatusContent(
String.valueOf(id),
mode,
String.valueOf(msg.getRwh()),
deviceStatus,
msg.getHczt() > 0 ? "货叉有货" : "货叉无货",
executionPhase,
msg.getYxxf() == 1 ? "允许" : "禁止",
msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层"
);
RequestLog requestLog = requestLogService.getRequestLog(String.valueOf(id), "获取指定堆垛机状态");
requestLog.setRequestUrl(LOCAL_URL + "/device/ddj/getStackerStatus/" + id);
requestLog.setRequestMethod("get");
requestLog.setResponseStatus("1");
requestLog.setResponseBody(JSON.toJSONString(statusContent));
requestLogService.insertRequestLog(requestLog);
// status.setId(msg.getId());
// status.setMode(msg.getCzfs());
// status.setTaskNo(msg.getRwh());
// status.setDeviceStatus(msg.getSbzt());
// status.setForkStatus(msg.getHczt());
// status.setExecutionPhase(msg.getJdbz());
// status.setPermission(msg.getYxxf());
// status.setCurrentRow(msg.getCurrentRow());
// status.setCurrentColumn(msg.getCurrentColumn());
// status.setCurrentFloor(msg.getCurrentFloor());
// status.setCurrentRoad(msg.getId());
// status.setCurrentPosition(msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层");
return AjaxResult.success(statusContent);
} }
/**
* 返回堆垛机状态的记录类型 - 英
* @param id 编号
* @param mode 操作模式
* @param taskNo 任务号
* @param deviceStatus 设备状态
* @param forkStatus 货叉状态
* @param executionPhase 执行阶段
* @param permission 允许下发
* @param position 当前位置
*/
public record StackerStatus(
Long id,
int mode,
String taskNo,
int deviceStatus,
int forkStatus,
int executionPhase,
int permission,
String position){}
/**
* 请求获取堆垛机状态
* @param id 堆垛机编号
* @return
*/
@GetMapping("/getStackerStatus/en/{id}")
public AjaxResult getStackerStatusEn(@PathVariable Long id){
//返回堆垛机部分参数的状态映射
MsgDdj msg = msgDdjService.selectMsgDdjById(id);
if (msg == null) {
AjaxResult.error("【查询堆垛机状态】设备编号:" + id + ",查询超出最大索引");
}
StackerStatus statusContent = new StackerStatus(
id,
msg.getCzfs(),
String.valueOf(msg.getRwh()),
msg.getSbzt(),
msg.getHczt(),
msg.getJdbz(),
msg.getYxxf(),
String.format("%02d",msg.getCurrentRow()) + String.format("%02d",msg.getCurrentColumn()) + String.format("%02d",msg.getCurrentFloor())
);
RequestLog requestLog = requestLogService.getRequestLog(String.valueOf(id), "获取指定堆垛机状态");
requestLog.setRequestUrl(LOCAL_URL + "/device/ddj/getStackerStatus/en/" + id);
requestLog.setRequestMethod("get");
requestLog.setResponseStatus("1");
requestLog.setResponseBody(JSON.toJSONString(statusContent));
requestLogService.insertRequestLog(requestLog);
// status.setId(msg.getId());
// status.setMode(msg.getCzfs());
// status.setTaskNo(msg.getRwh());
// status.setDeviceStatus(msg.getSbzt());
// status.setForkStatus(msg.getHczt());
// status.setExecutionPhase(msg.getJdbz());
// status.setPermission(msg.getYxxf());
// status.setCurrentRow(msg.getCurrentRow());
// status.setCurrentColumn(msg.getCurrentColumn());
// status.setCurrentFloor(msg.getCurrentFloor());
// status.setCurrentRoad(msg.getId());
// status.setCurrentPosition(msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层");
return AjaxResult.success(statusContent);
}
} }

View File

@@ -86,3 +86,4 @@ public class StackerStatus {
} }

View File

@@ -2,6 +2,11 @@ package com.ruoyi.device.ssj.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ruoyi.api.domain.RequestLog;
import com.ruoyi.api.service.IRequestLogService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@@ -21,6 +26,8 @@ import com.ruoyi.device.ssj.service.IDeviceSsjService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import static com.ruoyi.common.Constant.LOCAL_URL;
/** /**
* 输送机Controller * 输送机Controller
* *
@@ -28,12 +35,15 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @date 2025-07-04 * @date 2025-07-04
*/ */
@RestController @RestController
@RequestMapping("/device/ssj") @RequestMapping("/device/conv")
public class DeviceSsjController extends BaseController public class DeviceSsjController extends BaseController
{ {
@Autowired @Autowired
private IDeviceSsjService deviceSsjService; private IDeviceSsjService deviceSsjService;
@Autowired
private IRequestLogService requestLogService;
/** /**
* 查询输送机列表 * 查询输送机列表
*/ */
@@ -101,4 +111,93 @@ public class DeviceSsjController extends BaseController
{ {
return toAjax(deviceSsjService.deleteDeviceSsjByIds(ids)); return toAjax(deviceSsjService.deleteDeviceSsjByIds(ids));
} }
/**
* 返回的输送机状态 - 中
*/
private record ConvStatusContent(
@JsonProperty("输送机编号") String id,
@JsonProperty("操作模式") String mode,
@JsonProperty("占用状态") String free,
@JsonProperty("输送状态") String inPosition,
@JsonProperty("任务号") String taskNo){}
/**
* 请求返回输送机状态
* @param id 输送机编号
* @return
*/
@GetMapping("/getConvStatus/{id}")
public AjaxResult getConvStatus(@PathVariable String id){
DeviceSsj msgSsj = deviceSsjService.selectDeviceSsjByDeviceCode(id);
if (msgSsj == null) {
return AjaxResult.error("【查询输送机状态】设备编号:" + id + ",该设备不存在!");
}
ConvStatusContent status = new ConvStatusContent(
id,
msgSsj.getMode() == 1 ? "自动" : "手动",
msgSsj.getKx() == 1 ? "占用" : "空闲",
msgSsj.getDw() == 1 ? "输送到位" : "未到位",
// msgSsj.getMode() == 1 ? "1" : "0",
// msgSsj.getKx() == 1 ? "1" : "0",
// msgSsj.getDw() == 1 ? "1" : "0",
String.valueOf(msgSsj.getTaskNo())
);
RequestLog requestLog = requestLogService.getRequestLog(id, "获取指定输送机状态");
requestLog.setRequestUrl(LOCAL_URL + "/device/ssj/getConvStatus/" + id);
requestLog.setRequestMethod("get");
requestLog.setResponseStatus("1");
requestLog.setResponseBody(JSON.toJSONString(status));
requestLogService.insertRequestLog(requestLog);
return AjaxResult.success(status);
}
/**
* 请求返回输送机状态 - 英
* @param id 输送机编号
* @return
*/
private record ConvStatus(
String id,
String mode,
String free,
String inPosition,
int taskNo){}
@GetMapping("/getConvStatus/en/{id}")
public AjaxResult getConvStatusEn(@PathVariable String id){
DeviceSsj msgSsj = deviceSsjService.selectDeviceSsjByDeviceCode(id);
if (msgSsj == null) {
return AjaxResult.error("【查询输送机状态】设备编号:" + id + ",该设备不存在!");
}
ConvStatus status = new ConvStatus(
id,
msgSsj.getMode() == 1 ? "1" : "0",
msgSsj.getKx() == 1 ? "1" : "0",
msgSsj.getDw() == 1 ? "1" : "0",
msgSsj.getTaskNo()
);
RequestLog requestLog = requestLogService.getRequestLog(id, "获取指定输送机状态");
requestLog.setRequestUrl(LOCAL_URL + "/device/ssj/getConvStatus/en/" + id);
requestLog.setRequestMethod("get");
requestLog.setResponseStatus("1");
requestLog.setResponseBody(JSON.toJSONString(status));
requestLogService.insertRequestLog(requestLog);
return AjaxResult.success(status);
}
} }

View File

@@ -86,6 +86,9 @@ public class DeviceSsj extends BaseEntity
@Excel(name="允许放货") @Excel(name="允许放货")
private int allowPut; private int allowPut;
/**
* 输送状态
*/
private int sszt; private int sszt;
private int taskNo2; private int taskNo2;
@@ -103,6 +106,11 @@ public class DeviceSsj extends BaseEntity
/** /**
* 称重 * 称重
*/ */
private int weight; private String weight;
/**
* 手/自动
*/
private int mode;
} }

View File

@@ -19,6 +19,14 @@ public interface DeviceSsjMapper
*/ */
public DeviceSsj selectDeviceSsjById(Long id); public DeviceSsj selectDeviceSsjById(Long id);
/**
* 查询输送机
*
* @param deviceCode 输送机编号
* @return 输送机
*/
public DeviceSsj selectDeviceSsjByDeviceCode(String deviceCode);
/** /**
* 查询输送机列表 * 查询输送机列表
* *

View File

@@ -19,6 +19,14 @@ public interface IDeviceSsjService
*/ */
public DeviceSsj selectDeviceSsjById(Long id); public DeviceSsj selectDeviceSsjById(Long id);
/**
* 查询输送机
*
* @param deviceCode 输送机编号
* @return 输送机
*/
public DeviceSsj selectDeviceSsjByDeviceCode(String deviceCode);
/** /**
* 查询输送机列表 * 查询输送机列表
* *

View File

@@ -32,6 +32,18 @@ public class DeviceSsjServiceImpl implements IDeviceSsjService
return deviceSsjMapper.selectDeviceSsjById(id); return deviceSsjMapper.selectDeviceSsjById(id);
} }
/**
* 查询输送机
*
* @param deviceCode 输送机主键
* @return 输送机
*/
@Override
public DeviceSsj selectDeviceSsjByDeviceCode(String deviceCode)
{
return deviceSsjMapper.selectDeviceSsjByDeviceCode(deviceCode);
}
/** /**
* 查询输送机列表 * 查询输送机列表
* *

View File

@@ -104,8 +104,5 @@ public class JobCallBackController extends BaseController
return toAjax(jobCallBackService.deleteJobCallBackByIds(ids)); return toAjax(jobCallBackService.deleteJobCallBackByIds(ids));
} }
@Scheduled(fixedDelay=2000)
public void jobCallBack() {
jobCallBackService.jobCallBack();
}
} }

View File

@@ -2,6 +2,8 @@ package com.ruoyi.job.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -14,6 +16,9 @@ import com.ruoyi.job.service.IMydoJobService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import static com.ruoyi.common.TaskStatusCode.TASK_EP_DDJ_FINISH;
import static com.ruoyi.common.TaskStatusCode.TASK_EP_SSJ_STOCKOUT_FINISH;
/** /**
* 作业信息Controller * 作业信息Controller
* *
@@ -51,6 +56,18 @@ public class MydoJobController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询作业信息列表
*/
@PreAuthorize("@ss.hasPermi('job:mydoJob:list')")
@GetMapping("/listUnion")
public TableDataInfo listUnion(MydoJob mydoJob)
{
startPage();
List<MydoJob> list = mydoJobService.selectMydoJobUnionList(mydoJob);
return getDataTable(list);
}
/** /**
* 导出作业信息列表 * 导出作业信息列表
*/ */
@@ -107,11 +124,33 @@ public class MydoJobController extends BaseController
return toAjax(mydoJobService.deleteMydoJobByJobIds(jobIds)); return toAjax(mydoJobService.deleteMydoJobByJobIds(jobIds));
} }
@PreAuthorize("@ss.hasAnyPermi('job:mydoJob:OuthandFinish')") @PreAuthorize("@ss.hasAnyPermi('job:mydoJob:outhandFinish')")
@Log(title = "出库手动完成", businessType = BusinessType.OTHER) @Log(title = "出库手动完成", businessType = BusinessType.OTHER)
@RequestMapping("/OuthandFinish") @RequestMapping("/outhandFinish")
public AjaxResult manualCompleted(@RequestParam("jobIds")String[] jobIds) public AjaxResult manualCompleted(@RequestParam("jobIds")String[] jobIds)
{ {
return mydoJobService.OuthandFinish(jobIds); return mydoJobService.outhandFinish(jobIds);
} }
@PreAuthorize("@ss.hasAnyPermi('job:mydoJob:cancelJob')")
@Log(title = "出库作废", businessType = BusinessType.OTHER)
@RequestMapping("/cancelJob")
public AjaxResult cancelJob(@RequestParam("jobIds")String[] jobIds)
{
return toAjax(mydoJobService.deleteMydoJobByJobIds(jobIds));
}
@PreAuthorize("@ss.hasAnyPermi('job:mydoJob:resendTaskToEntrance')")
@Log(title = "入口输送机重新下发", businessType = BusinessType.OTHER)
@PutMapping("/resendTaskToEntrance")
public AjaxResult resendTaskToEntrance(@RequestParam("jobId") String jobId){
if (jobId == null || jobId == "") return AjaxResult.error("未选择任务或选择任务异常");
MydoJob job = mydoJobService.selectMydoJobByJobId(jobId);
job.setExecutionPhase("0");
job.setStatus("1");
return toAjax(mydoJobService.updateMydoJob(job));
}
} }

View File

@@ -1,11 +1,6 @@
package com.ruoyi.job.domain; package com.ruoyi.job.domain;
import lombok.AllArgsConstructor; import lombok.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
@@ -19,6 +14,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ToString @ToString
@Builder
public class JobCallBack extends BaseEntity public class JobCallBack extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -36,7 +32,7 @@ public class JobCallBack extends BaseEntity
/** mydojob作业号 */ /** mydojob作业号 */
@Excel(name = "mydojob作业号") @Excel(name = "mydojob作业号")
private String mydojobId; private String mydoJobId;
/** 状态 */ /** 状态 */
@Excel(name = "状态") @Excel(name = "状态")
@@ -54,5 +50,9 @@ public class JobCallBack extends BaseEntity
@Excel(name = "wms任务编号") @Excel(name = "wms任务编号")
private String taskCode; private String taskCode;
/** 回传重试次数 */
@Excel(name = "重试次数")
private int retry;
} }

View File

@@ -1,11 +1,9 @@
package com.ruoyi.job.domain; package com.ruoyi.job.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor; import lombok.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
@@ -23,13 +21,15 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ToString @ToString
//@TableName("mydo_job_wcs") @Builder
@TableName("mydo_job_wcs")
public class MydoJob extends BaseEntity public class MydoJob extends BaseEntity
{ {
@TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 任务ID */ /** 任务ID */
// @TableId @TableId
private String jobId; private String jobId;
/** 任务状态 */ /** 任务状态 */
@@ -94,7 +94,7 @@ public class MydoJob extends BaseEntity
private String trayCode; private String trayCode;
// private String inOut; private String inOut;
private String flag; private String flag;

View File

@@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Param;
* @author ruoyi * @author ruoyi
* @date 2025-09-22 * @date 2025-09-22
*/ */
public interface MydoJobMapper extends BaseMapper<MydoJob> public interface MydoJobMapper
{ {
/** /**
* 查询作业信息 * 查询作业信息
@@ -103,6 +103,8 @@ public interface MydoJobMapper extends BaseMapper<MydoJob>
MydoJob selectMydoJobByExitId(@Param("exitId") String exitId); MydoJob selectMydoJobByExitId(@Param("exitId") String exitId);
MydoJob selectMydoJobByWmsTaskNo(@Param("wmsTaskNo") String exitId);
/** /**
* 获取本地生成作业号 * 获取本地生成作业号
* @param map * @param map
@@ -117,4 +119,7 @@ public interface MydoJobMapper extends BaseMapper<MydoJob>
*/ */
void getTaskNo(HashMap<String, Object> map); void getTaskNo(HashMap<String, Object> map);
List<MydoJob> selectMydoJobUnionList(MydoJob mydoJob);
} }

View File

@@ -1,13 +1,9 @@
package com.ruoyi.job.service; package com.ruoyi.job.service;
import java.util.HashMap;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.job.domain.MydoJob; import com.ruoyi.job.domain.MydoJob;
import org.apache.ibatis.annotations.Param;
/** /**
* 作业信息Service接口 * 作业信息Service接口
@@ -15,7 +11,7 @@ import org.apache.ibatis.annotations.Param;
* @author ruoyi * @author ruoyi
* @date 2025-09-22 * @date 2025-09-22
*/ */
public interface IMydoJobService extends IService<MydoJob> public interface IMydoJobService
{ {
/** /**
* 查询作业信息 * 查询作业信息
@@ -69,6 +65,8 @@ public interface IMydoJobService extends IService<MydoJob>
boolean ddjTaskFinish(Long rwh, Integer id); boolean ddjTaskFinish(Long rwh, Integer id);
boolean taskFinish(Long rwh);
boolean InvalidMydoJob(Long rwh, Integer id); boolean InvalidMydoJob(Long rwh, Integer id);
MydoJob selectMydoJobByExitList(List<String> exitList); MydoJob selectMydoJobByExitList(List<String> exitList);
@@ -90,14 +88,18 @@ public interface IMydoJobService extends IService<MydoJob>
MydoJob selectMydoJobByEntranceList1(String entranceId); MydoJob selectMydoJobByEntranceList1(String entranceId);
AjaxResult OuthandFinish(String[] jobIds); AjaxResult outhandFinish(String[] jobIds);
public AjaxResult ManuelTaskFinish(String[] taskNos); AjaxResult ManuelTaskFinish(String taskNo);
List<MydoJob> getInJobByEntranceId(String exitId); List<MydoJob> getInJobByEntranceId(String exitId);
MydoJob selectMydoJobByExitId(String exitId); MydoJob selectMydoJobByExitId(String exitId);
MydoJob selectMydoJobByWmsTaskNo(String wmsTaskNo);
/** /**
* 获取本地生成作业号 * 获取本地生成作业号
* @param type RK-入库 CK-出库 * @param type RK-入库 CK-出库
@@ -112,4 +114,6 @@ public interface IMydoJobService extends IService<MydoJob>
*/ */
String getTaskNo(String type); String getTaskNo(String type);
List<MydoJob> selectMydoJobUnionList(MydoJob mydoJob);
} }

View File

@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import cn.hutool.core.lang.UUID;
import com.ruoyi.api.domain.RequestLog; import com.ruoyi.api.domain.RequestLog;
import com.ruoyi.api.service.IApiService; import com.ruoyi.api.service.IApiService;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
@@ -110,15 +111,17 @@ public class JobCallBackServiceImpl implements IJobCallBackService
//设定请求参数 //设定请求参数
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("taskTypeCode", jobCallBack.getTaskTypeCode()); param.put("taskTypeCode", jobCallBack.getTaskTypeCode());
param.put("reqCode", jobCallBack.getReqCode()); param.put("reqCode", UUID.randomUUID().toString().replace("-", ""));
param.put("taskCode", jobCallBack.getTaskCode()); param.put("taskCode", jobCallBack.getTaskCode());
//请求回传 //请求回传
RequestLog requestLog = apiService.finishMydoJob(param); // RequestLog requestLog = apiService.finishMydoJob(param);
if ("0".equals(requestLog.getIsSuccessful())){ RequestLog requestLog = apiService.finishMydoJobForResponseResult(param);//@@@ FT568 返回自定义的wms响应格式
if ("1".equals(requestLog.getIsSuccessful())){
jobCallBack.setStatus("1"); jobCallBack.setStatus("1");
}else{ }else{
jobCallBack.setStatus("99"); jobCallBack.setStatus("99");
jobCallBack.setRetry(jobCallBack.getRetry() + 1);
} }
jobCallBackMapper.updateJobCallBack(jobCallBack); jobCallBackMapper.updateJobCallBack(jobCallBack);
} }

View File

@@ -1,25 +1,31 @@
package com.ruoyi.job.service.impl; package com.ruoyi.job.service.impl;
import java.io.Serializable;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.extension.service.IService; import cn.hutool.core.lang.UUID;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.job.domain.JobCallBack; import com.ruoyi.job.domain.JobCallBack;
import com.ruoyi.job.service.IJobCallBackService; import com.ruoyi.job.service.IJobCallBackService;
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueueFinish;
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueFinishService;
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.job.mapper.MydoJobMapper; import com.ruoyi.job.mapper.MydoJobMapper;
import com.ruoyi.job.domain.MydoJob; import com.ruoyi.job.domain.MydoJob;
import com.ruoyi.job.service.IMydoJobService; import com.ruoyi.job.service.IMydoJobService;
import javax.annotation.PostConstruct; import static com.ruoyi.common.TaskStatusCode.TASK_STATUS_FINISH_MANUAL;
import static com.ruoyi.common.TaskStatusCode.TASK_STATUS_INVALID;
import static com.ruoyi.common.WmsTaskTypeCode.*;
/** /**
* 作业信息Service业务层处理 * 作业信息Service业务层处理
@@ -28,12 +34,17 @@ import javax.annotation.PostConstruct;
* @date 2025-09-22 * @date 2025-09-22
*/ */
@Service @Service
public class MydoJobServiceImpl extends ServiceImpl<MydoJobMapper, MydoJob> implements IMydoJobService @Slf4j
public class MydoJobServiceImpl implements IMydoJobService
{ {
@Autowired @Autowired
private MydoJobMapper mydoJobMapper; private MydoJobMapper mydoJobMapper;
@Autowired @Autowired
private IJobCallBackService jobCallBackService; private IJobCallBackService jobCallBackService;
@Autowired
private IDdjDeviceExecutionQueueService ddjDeviceExecutionQueueService;
@Autowired
private IDdjDeviceExecutionQueueFinishService ddjDeviceExecutionQueueServiceFinishService;
/** /**
* 查询作业信息 * 查询作业信息
@@ -96,7 +107,23 @@ public class MydoJobServiceImpl extends ServiceImpl<MydoJobMapper, MydoJob> impl
public int deleteMydoJobByJobIds(String[] jobIds) public int deleteMydoJobByJobIds(String[] jobIds)
{ {
for (String jobId : jobIds) { for (String jobId : jobIds) {
MydoJob mydoJob = selectMydoJobByJobId(jobId);
if (mydoJob == null) continue;
mydoJob.setStatus(TASK_STATUS_INVALID);
updateMydoJob(mydoJob);
mydoJobMapper.insertHistory(jobId); mydoJobMapper.insertHistory(jobId);
deleteMydoJobByJobId(jobId);
//当执行任务的【删除】操作时(特殊场景需要手动处理异常导致不需要入库时,此时不需要向回传异常)
// 此处顺便处理对应任务号生成的堆垛机执行队列,省去sql直接表中删记录的操作
DdjDeviceExecutionQueue queue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByTaskNo(mydoJob.getTaskNo());
if (queue != null){
ddjDeviceExecutionQueueService.deleteDdjDeviceExecutionQueueByTaskNo(mydoJob.getTaskNo());
}
log.info("【人工操作】执行手动删除作业,作业号:{}", jobId);
} }
return mydoJobMapper.deleteMydoJobByJobIds(jobIds); return mydoJobMapper.deleteMydoJobByJobIds(jobIds);
} }
@@ -110,6 +137,26 @@ public class MydoJobServiceImpl extends ServiceImpl<MydoJobMapper, MydoJob> impl
@Override @Override
public int deleteMydoJobByJobId(String jobId) public int deleteMydoJobByJobId(String jobId)
{ {
try{
MydoJob mydoJob = selectMydoJobByJobId(jobId);
if (mydoJob == null) return 0;
mydoJob.setStatus(TASK_STATUS_INVALID);
updateMydoJob(mydoJob);
mydoJobMapper.insertHistory(jobId);
//当执行任务的【删除】操作时(特殊场景需要手动处理异常导致不需要入库时,此时不需要向回传异常)
// 此处顺便处理对应任务号生成的堆垛机执行队列,省去sql直接表中删记录的操作
String taskNo = selectMydoJobByJobId(jobId).getTaskNo();
if (taskNo != null || taskNo != "") {
ddjDeviceExecutionQueueService.deleteDdjDeviceExecutionQueueByTaskNo(taskNo);
}
log.info("【人工操作】执行手动删除作业,作业号:{}", jobId);
}catch (Exception e){
log.warn("【提示】操作失败,发生了未知错误:{}", e.getMessage());
}
return mydoJobMapper.deleteMydoJobByJobId(jobId); return mydoJobMapper.deleteMydoJobByJobId(jobId);
} }
@@ -132,12 +179,35 @@ public class MydoJobServiceImpl extends ServiceImpl<MydoJobMapper, MydoJob> impl
} }
} }
@Override
public boolean taskFinish(Long rwh) {
MydoJob task = selectMydoJobByTaskNo(rwh);
insertHistory(task.getJobId());
deleteMydoJobByJobId(task.getJobId());
ddjDeviceExecutionQueueService.deleteDdjDeviceExecutionQueueByTaskNo(task.getTaskNo());
JobCallBack jobCallBack = new JobCallBack();
jobCallBack.setType(Integer.valueOf(task.getInOrOut()) < 20 ? "1" : "2");
jobCallBack.setMydoJobId(task.getJobId());
jobCallBack.setStatus("0");
jobCallBack.setTaskNo(Convert.toLong(task.getTaskNo()));
jobCallBack.setCreateTime(new Date());
jobCallBack.setTaskTypeCode(WMS_TASK_TYPE_FINISH);
jobCallBack.setReqCode(UUID.randomUUID().toString().replace("-", ""));
jobCallBack.setTaskCode(task.getWmsTaskNo());
jobCallBackService.insertJobCallBack(jobCallBack);
return true;
}
@Override @Override
public boolean InvalidMydoJob(Long rwh, Integer id) { public boolean InvalidMydoJob(Long rwh, Integer id) {
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("v_rwh", rwh); map.put("v_rwh", rwh);
map.put("v_ddj_id", id); map.put("v_ddj_id", id);
mydoJobMapper.InvalidMydoJob(map); mydoJobMapper.InvalidMydoJob(map);
log.info("【人工操作】手动作废wcs任务并移除执行中的堆垛机队列,wcs任务号:{}", rwh);
if (Convert.toInt(map.get("v_result")) == 10){ if (Convert.toInt(map.get("v_result")) == 10){
return true; return true;
}else { }else {
@@ -145,6 +215,7 @@ public class MydoJobServiceImpl extends ServiceImpl<MydoJobMapper, MydoJob> impl
} }
} }
@Override @Override
public MydoJob selectMydoJobByExitList(List<String> exitList ) { public MydoJob selectMydoJobByExitList(List<String> exitList ) {
return mydoJobMapper.selectMydoJobByExitList(exitList); return mydoJobMapper.selectMydoJobByExitList(exitList);
@@ -177,82 +248,93 @@ public class MydoJobServiceImpl extends ServiceImpl<MydoJobMapper, MydoJob> impl
/** /**
* 手动完成同一【作业单号】的作业 * 手动完成同一【作业单号】的作业
* 如果【jobid】和【taskno】是一对多的情况,使用上一个方法<OuthandFinish>手动完成作业会导致整个【jobid】单据完成回传
* @param jobIds * @param jobIds
* @return * @return
*/ */
@Override @Override
public AjaxResult OuthandFinish(String[] jobIds) { public AjaxResult outhandFinish(String[] jobIds) {
//获取所有符合【任务单号】的作业 //获取所有符合【任务单号】的作业
for (String jobId : jobIds) { for (String jobId : jobIds) {
//todo 是否需要校验响应成功后再执行历史表操作 //生成回传记录
MydoJob mydoJob = mydoJobMapper.selectMydoJobByJobId(jobId);
mydoJob.setStatus(TASK_STATUS_FINISH_MANUAL);
updateMydoJob(mydoJob);
//插入历史表 //插入历史表
mydoJobMapper.insertHistory(jobId); mydoJobMapper.insertHistory(jobId);
//生成回传记录的参数
MydoJob mydoJob = mydoJobMapper.selectMydoJobByJobId(jobId);
JobCallBack jobCallBack = new JobCallBack(); JobCallBack jobCallBack = new JobCallBack();
long jobIdNum = Long.parseLong(mydoJob.getInOrOut()); jobCallBack.setType(mydoJob.getInOrOut());
if (jobIdNum > 20){ jobCallBack.setTaskTypeCode(WMS_TASK_TYPE_FINISH);// wms自定义的任务类型
jobCallBack.setType("2"); jobCallBack.setMydoJobId(mydoJob.getJobId());
}else{
jobCallBack.setType("1");
}
jobCallBack.setMydojobId(mydoJob.getJobId());
jobCallBack.setStatus("0"); jobCallBack.setStatus("0");
jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo())); jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo()));
jobCallBack.setCreateTime(new Date()); jobCallBack.setCreateTime(new Date());
jobCallBack.setTaskCode(mydoJob.getWmsTaskNo()); jobCallBack.setTaskCode(mydoJob.getWmsTaskNo());
// jobCallBack.setTaskTypeCode();//todo wms下发的任务类型 jobCallBack.setRetry(0);
jobCallBack.setReqCode(mydoJob.getJobId() + mydoJob.getTaskNo());
// jobCallBack.setSpare1("0"); jobCallBack.setReqCode(UUID.randomUUID().toString());
jobCallBackService.insertJobCallBack(jobCallBack); jobCallBackService.insertJobCallBack(jobCallBack);
//移除实时任务 //移除实时任务
mydoJobMapper.deleteMydoJobByJobId(jobId); mydoJobMapper.deleteMydoJobByJobId(jobId);
log.info("【人工操作】手动完成wcs任务,wcs任务号:{},wms任务号:{}", mydoJob.getTaskNo(), mydoJob.getWmsTaskNo());
DdjDeviceExecutionQueue queue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByTaskNo(mydoJob.getTaskNo());
try {
if (queue != null)
{
DdjDeviceExecutionQueueFinish queueFinish = BeanUtil.copyProperties(queue, DdjDeviceExecutionQueueFinish.class);
ddjDeviceExecutionQueueServiceFinishService.insertDdjDeviceExecutionQueueFinish(queueFinish);
ddjDeviceExecutionQueueService.deleteDdjDeviceExecutionQueueByTaskNo(mydoJob.getTaskNo());
log.info("【人工操作】移除堆垛机队列,wcs任务号:{}", mydoJob.getTaskNo());
}
} catch (Exception e) {
}
} }
return AjaxResult.success("操作成功"); return AjaxResult.success("操作成功");
} }
/** /**
* 手动处理指定批量【任务号】的作业 * 手动处理指定【任务号】的作业
* >>需要确定【jobid】是否由wms下发 * @param taskNo
* >>如果【jobid】和【taskno】是一对多的情况,使用上一个方法<OuthandFinish>手动完成作业会导致整个【jobid】单据完成回传
* >>如果【jobid】和【taskno】是一对一的情况,则直接使用 <OuthandFinish> 方法手动完成即可
* @param taskNos
* @return * @return
*/ */
@Override @Override
public AjaxResult ManuelTaskFinish(String[] taskNos) { public AjaxResult ManuelTaskFinish(String taskNo) {
//获取所有符合【任务号】的作业 //获取所有符合【任务号】的作业
for (String taskNo : taskNos) { MydoJob mydoJob = mydoJobMapper.selectMydoJobByTaskNo(taskNo);
MydoJob mydoJob = mydoJobMapper.selectMydoJobByTaskNo(taskNo); mydoJobMapper.insertHistory(mydoJob.getInOrOut());
mydoJobMapper.insertHistory(mydoJob.getInOrOut()); JobCallBack jobCallBack = new JobCallBack();
JobCallBack jobCallBack = new JobCallBack(); jobCallBack.setType(mydoJob.getInOrOut());
long jobIdNum = Long.parseLong(mydoJob.getInOrOut()); jobCallBack.setTaskTypeCode(WMS_TASK_TYPE_FINISH);// wms下发的任务类型
if (jobIdNum > 20) { jobCallBack.setMydoJobId(mydoJob.getJobId());
jobCallBack.setType("2"); jobCallBack.setStatus("0");
} else { jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo()));
jobCallBack.setType("1"); jobCallBack.setCreateTime(new Date());
} jobCallBack.setTaskCode(mydoJob.getWmsTaskNo());
jobCallBack.setMydojobId(mydoJob.getJobId()); jobCallBack.setRetry(0);
jobCallBack.setStatus("0"); jobCallBack.setReqCode(UUID.randomUUID().toString());
jobCallBack.setTaskNo(Convert.toLong(taskNo)); jobCallBackService.insertJobCallBack(jobCallBack);
jobCallBack.setCreateTime(new Date());
mydoJobMapper.deleteMydoJobByTaskNo(taskNo);
// jobCallBack.setSpare1("0");
jobCallBackService.insertJobCallBack(jobCallBack);
mydoJobMapper.deleteMydoJobByTaskNo(taskNo);
}
return AjaxResult.success("操作成功"); return AjaxResult.success("操作成功");
} }
@Override @Override
public List<MydoJob> getInJobByEntranceId(String exitId) { public List<MydoJob> getInJobByEntranceId(String exitId) {
return mydoJobMapper.getInJobByEntranceId(exitId); return mydoJobMapper.getInJobByEntranceId(exitId);
@@ -263,6 +345,11 @@ public class MydoJobServiceImpl extends ServiceImpl<MydoJobMapper, MydoJob> impl
return mydoJobMapper.selectMydoJobByExitId(exitId); return mydoJobMapper.selectMydoJobByExitId(exitId);
} }
@Override
public MydoJob selectMydoJobByWmsTaskNo(String wmsTaskNo){
return mydoJobMapper.selectMydoJobByWmsTaskNo(wmsTaskNo);
}
@Override @Override
public List<MydoJob> selectMydoJobFinishList(MydoJob mydoJob) { public List<MydoJob> selectMydoJobFinishList(MydoJob mydoJob) {
return mydoJobMapper.selectMydoJobFinishList(mydoJob); return mydoJobMapper.selectMydoJobFinishList(mydoJob);
@@ -310,6 +397,9 @@ public class MydoJobServiceImpl extends ServiceImpl<MydoJobMapper, MydoJob> impl
return map.get("v_serial").toString(); return map.get("v_serial").toString();
} }
@Override
public List<MydoJob> selectMydoJobUnionList(MydoJob mydoJob) {
return mydoJobMapper.selectMydoJobUnionList(mydoJob);
}
} }

View File

@@ -19,6 +19,14 @@ public interface DdjDeviceExecutionQueueFinishMapper
*/ */
public DdjDeviceExecutionQueueFinish selectDdjDeviceExecutionQueueFinishByUuid(String uuid); public DdjDeviceExecutionQueueFinish selectDdjDeviceExecutionQueueFinishByUuid(String uuid);
/**
* 查询堆垛机完成队列
*
* @param taskNo 堆垛机完成队列任务号
* @return 堆垛机完成队列
*/
public DdjDeviceExecutionQueueFinish selectDdjDeviceExecutionQueueFinishByTaskNo(String taskNo);
/** /**
* 查询堆垛机完成队列列表 * 查询堆垛机完成队列列表
* *

View File

@@ -20,6 +20,14 @@ public interface DdjDeviceExecutionQueueMapper
*/ */
public DdjDeviceExecutionQueue selectDdjDeviceExecutionQueueByUuid(String uuid); public DdjDeviceExecutionQueue selectDdjDeviceExecutionQueueByUuid(String uuid);
/**
* 查询堆垛机执行队列
*
* @param taskNo 堆垛机执行队列主键
* @return 堆垛机执行队列
*/
public DdjDeviceExecutionQueue selectDdjDeviceExecutionQueueByTaskNo(String taskNo);
/** /**
* 查询堆垛机执行队列列表 * 查询堆垛机执行队列列表
* *
@@ -43,7 +51,7 @@ public interface DdjDeviceExecutionQueueMapper
* @return 结果 * @return 结果
*/ */
public int updateDdjDeviceExecutionQueue(DdjDeviceExecutionQueue ddjDeviceExecutionQueue); public int updateDdjDeviceExecutionQueue(DdjDeviceExecutionQueue ddjDeviceExecutionQueue);
public int updateDdjDeviceExecutionQueue1(DdjDeviceExecutionQueue ddjDeviceExecutionQueue); // public int updateDdjDeviceExecutionQueue1(DdjDeviceExecutionQueue ddjDeviceExecutionQueue);
/** /**
* 删除堆垛机执行队列 * 删除堆垛机执行队列
@@ -53,6 +61,14 @@ public interface DdjDeviceExecutionQueueMapper
*/ */
public int deleteDdjDeviceExecutionQueueByUuid(String uuid); public int deleteDdjDeviceExecutionQueueByUuid(String uuid);
/**
* 删除堆垛机执行队列
*
* @param taskNo 堆垛机执行队列主键
* @return 结果
*/
public int deleteDdjDeviceExecutionQueueByTaskNo(String taskNo);
/** /**
* 批量删除堆垛机执行队列 * 批量删除堆垛机执行队列
* *

View File

@@ -19,6 +19,8 @@ public interface IDdjDeviceExecutionQueueFinishService
*/ */
public DdjDeviceExecutionQueueFinish selectDdjDeviceExecutionQueueFinishByUuid(String uuid); public DdjDeviceExecutionQueueFinish selectDdjDeviceExecutionQueueFinishByUuid(String uuid);
public DdjDeviceExecutionQueueFinish selectDdjDeviceExecutionQueueFinishByTaskNo(String taskNo);
/** /**
* 查询堆垛机完成队列列表 * 查询堆垛机完成队列列表
* *

View File

@@ -19,6 +19,14 @@ public interface IDdjDeviceExecutionQueueService
*/ */
public DdjDeviceExecutionQueue selectDdjDeviceExecutionQueueByUuid(String uuid); public DdjDeviceExecutionQueue selectDdjDeviceExecutionQueueByUuid(String uuid);
/**
* 查询堆垛机执行队列
*
* @param TaskNo 堆垛机执行队列任务号
* @return 堆垛机执行队列
*/
public DdjDeviceExecutionQueue selectDdjDeviceExecutionQueueByTaskNo(String TaskNo);
/** /**
* 查询堆垛机执行队列列表 * 查询堆垛机执行队列列表
* *
@@ -51,6 +59,14 @@ public interface IDdjDeviceExecutionQueueService
*/ */
public int deleteDdjDeviceExecutionQueueByUuids(String[] uuids); public int deleteDdjDeviceExecutionQueueByUuids(String[] uuids);
/**
* 查询任务号删除堆垛机执行队列
*
* @param taskNo 需要删除的堆垛机执行队列的任务号
* @return 结果
*/
public int deleteDdjDeviceExecutionQueueByTaskNo(String taskNo);
/** /**
* 删除堆垛机执行队列信息 * 删除堆垛机执行队列信息
* *

View File

@@ -31,6 +31,10 @@ public class DdjDeviceExecutionQueueFinishServiceImpl implements IDdjDeviceExecu
return ddjDeviceExecutionQueueFinishMapper.selectDdjDeviceExecutionQueueFinishByUuid(uuid); return ddjDeviceExecutionQueueFinishMapper.selectDdjDeviceExecutionQueueFinishByUuid(uuid);
} }
public DdjDeviceExecutionQueueFinish selectDdjDeviceExecutionQueueFinishByTaskNo(String taskNo){
return ddjDeviceExecutionQueueFinishMapper.selectDdjDeviceExecutionQueueFinishByTaskNo(taskNo);
}
/** /**
* 查询堆垛机完成队列列表 * 查询堆垛机完成队列列表
* *

View File

@@ -31,6 +31,18 @@ public class DdjDeviceExecutionQueueServiceImpl implements IDdjDeviceExecutionQu
return ddjDeviceExecutionQueueMapper.selectDdjDeviceExecutionQueueByUuid(uuid); return ddjDeviceExecutionQueueMapper.selectDdjDeviceExecutionQueueByUuid(uuid);
} }
/**
* 查询堆垛机执行队列
*
* @param taskNo 堆垛机执行队列主键
* @return 堆垛机执行队列
*/
@Override
public DdjDeviceExecutionQueue selectDdjDeviceExecutionQueueByTaskNo(String taskNo)
{
return ddjDeviceExecutionQueueMapper.selectDdjDeviceExecutionQueueByTaskNo(taskNo);
}
/** /**
* 查询堆垛机执行队列列表 * 查询堆垛机执行队列列表
* *
@@ -81,6 +93,10 @@ public class DdjDeviceExecutionQueueServiceImpl implements IDdjDeviceExecutionQu
return ddjDeviceExecutionQueueMapper.deleteDdjDeviceExecutionQueueByUuids(uuids); return ddjDeviceExecutionQueueMapper.deleteDdjDeviceExecutionQueueByUuids(uuids);
} }
public int deleteDdjDeviceExecutionQueueByTaskNo(String taskNo){
return ddjDeviceExecutionQueueMapper.deleteDdjDeviceExecutionQueueByTaskNo(taskNo);
}
/** /**
* 删除堆垛机执行队列信息 * 删除堆垛机执行队列信息
* *

View File

@@ -72,9 +72,9 @@ public class PlcDdj1Read extends Thread {
msgDdj.setYxxf(ParseUtil.optInt(24, ddsx)); msgDdj.setYxxf(ParseUtil.optInt(24, ddsx));
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx)); msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
msgDdj.setCurrentRow(ParseUtil.optInt(26, ddsx)); msgDdj.setCurrentRow(ParseUtil.optInt(12, ddsx));
msgDdj.setCurrentColumn(ParseUtil.optInt(26, ddsx)); msgDdj.setCurrentColumn(ParseUtil.optInt(14, ddsx));
msgDdj.setCurrentFloor(ParseUtil.optInt(26, ddsx)); msgDdj.setCurrentFloor(ParseUtil.optInt(16, ddsx));
} }
} }
@@ -119,7 +119,8 @@ public class PlcDdj1Read extends Thread {
void closeServer() { void closeServer() {
if (readWriteNet != null) { if (readWriteNet != null) {
readWriteNet.ConnectClose(); // readWriteNet.ConnectClose();
siemensS7Net.ConnectClose();
} }
setIsConnect(false); setIsConnect(false);
} }

View File

@@ -119,7 +119,8 @@ public class PlcDdj2Read extends Thread {
void closeServer() { void closeServer() {
if (readWriteNet != null) { if (readWriteNet != null) {
readWriteNet.ConnectClose(); // readWriteNet.ConnectClose();
siemensS7Net.ConnectClose();
} }
setIsConnect(false); setIsConnect(false);
} }

View File

@@ -108,7 +108,10 @@ public class PlcSsjRead implements Runnable {
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1)); ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1)); ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1));
ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1)); ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1)); ssjDevice.setHeight(ParseUtil.optInt(12, ddsx1));
ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1)); //此处不修改device_ssj表,把托盘尺寸值当作高度使用
ssjDevice.setTrayCode(ParseUtil.optString(14, ddsx1).replaceAll("\\s", ""));
ssjDevice.setMode(ParseUtil.optInt(24, ddsx1));//todo 输送机操作模式
ssjDevice.setException(ParseUtil.optInt(28, ddsx1)); ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
} }
} }
@@ -245,7 +248,8 @@ public class PlcSsjRead implements Runnable {
void closeServer() { void closeServer() {
if (readWriteNet != null) { if (readWriteNet != null) {
readWriteNet.ConnectClose(); // readWriteNet.ConnectClose();
siemensS7Net.ConnectClose();
} }
setIsConnect(false); setIsConnect(false);
} }
@@ -253,9 +257,13 @@ public class PlcSsjRead implements Runnable {
public static int writeToSsj(String address, String taskNo, int qx , int completed) { public static int writeToSsj(String address, String taskNo, int qx , int completed) {
int jym = Tools.getJYM(Integer.parseInt(taskNo), qx); int jym = Tools.getJYM(Integer.parseInt(taskNo), qx);
//任务号
SendData taskNoSendData = new SendData(Tools.DINT, taskNo); SendData taskNoSendData = new SendData(Tools.DINT, taskNo);
//去向
SendData qxSendData = new SendData(Tools.INT, qx); SendData qxSendData = new SendData(Tools.INT, qx);
//下发完成
SendData completedSendData = new SendData(Tools.INT, completed); SendData completedSendData = new SendData(Tools.INT, completed);
//校验码
SendData jymSendData = new SendData(Tools.INT, jym); SendData jymSendData = new SendData(Tools.INT, jym);
byte[] bytes = Tools.sendData(taskNoSendData, qxSendData, completedSendData, jymSendData); byte[] bytes = Tools.sendData(taskNoSendData, qxSendData, completedSendData, jymSendData);
return PlcSsjRead.WriteToSSJ(address, bytes); return PlcSsjRead.WriteToSSJ(address, bytes);

View File

@@ -0,0 +1,248 @@
package com.ruoyi.schedule.scheduleTask;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.UUID;
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionReceive;
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionRequest;
import com.ruoyi.api.service.IApiService;
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.job.domain.MydoJob;
import com.ruoyi.job.service.IJobCallBackService;
import com.ruoyi.job.service.IMydoJobService;
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.List;
import static com.ruoyi.common.TaskExceptionType.TASK_EXCEPTION_STOCKIN_OCCUPIED;
import static com.ruoyi.common.TaskStatusCode.*;
import static com.ruoyi.common.WmsTaskTypeCode.WMS_TASK_TYPE_EXCEPTION;
/**
* 处理wcs执行作业的定时任务类
*/
@Component
@Slf4j
public class TaskHandler {
@Autowired
private IMydoJobService mydoJobService;
@Autowired
private IJobCallBackService jobCallBackService;
@Autowired
private IBasCargoSpaceService basCargoSpaceService;
@Autowired
private IApiService apiService;
@Autowired
private IDdjDeviceExecutionQueueService ddjDeviceExecutionQueueService;
private static final int DEFAULTTIMEINTERVAL = 2000;
/**
* 处理未正常移除的【堆垛机执行完成】或【出库到位】的遗留任务
*/
// @Scheduled(fixedDelay = 3000)
public void mydoJobHandler() {
//查询所有标记为【已完成】的任务
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
new MydoJob().builder().executionPhase(TASK_EP_FINISH).build()
);
if (!jobs.isEmpty()) {
for (MydoJob job : jobs) {
mydoJobService.taskFinish(Long.valueOf(job.getTaskNo()));
}
}
}
/**
* 【手动作废】 - 查询并处理标记为已经作废的任务
*/
//@Scheduled(fixedDelay = 3000)
public void cancelMydoJob(){
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
new MydoJob().builder().status(TASK_STATUS_INVALID).build()
);
if (!jobs.isEmpty()) {
for (MydoJob job : jobs) {
mydoJobService.ManuelTaskFinish(job.getTaskNo());
}
}
}
/**
* 【手动完成】 - 查询并处理标记为已经手动完成的任务
*/
//@Scheduled(fixedDelay = 3000)
public void finishMydoJob(){
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
new MydoJob().builder().status(TASK_STATUS_FINISH_MANUAL).build()
);
if (!jobs.isEmpty()) {
for (MydoJob job : jobs) {
mydoJobService.ManuelTaskFinish(job.getTaskNo());
}
}
}
/**
* 定时扫描未回传或回传异常的任务记录
*/
@Scheduled(fixedDelay = 3000)
public void jobCallBack() {
jobCallBackService.jobCallBack();
}
/**
* 【入库异常-请求重分】 - 【放货有货】处理方法
*/
@Scheduled(fixedDelay = DEFAULTTIMEINTERVAL)
public void stockinExceptionHandler() {
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
new MydoJob().builder().executionPhase(TASK_EXCEPTION_PUT).build()
);
if (!jobs.isEmpty()) {
for (MydoJob job : jobs) {
String oldCargo = job.getCargoSpaceId();
//上报异常 - 向wms请求重分接口
TaskExceptionRequest taskExceptionRequest = new TaskExceptionRequest();
taskExceptionRequest.setTaskClass(job.getInOrOut().substring(0, 1));
taskExceptionRequest.setType(String.valueOf(TASK_EXCEPTION_STOCKIN_OCCUPIED));
taskExceptionRequest.setTaskCode(job.getWmsTaskNo());
taskExceptionRequest.setTaskTypeCode(WMS_TASK_TYPE_EXCEPTION);//wms自定义文本
taskExceptionRequest.setReqCode(UUID.randomUUID().toString().replace("-", ""));
taskExceptionRequest.setAdverseCauses("当前位置已有货物,盘点后重新分配货位");
AjaxResult ajaxResult = apiService.reAssign(taskExceptionRequest);
if (ajaxResult.isSuccess()){
//获取返回的任务号和新分配的货位
TaskExceptionReceive mydoJobReAssign = BeanUtil.toBean(ajaxResult.get("data"), TaskExceptionReceive.class);
MydoJob wmsJob = new MydoJob();
wmsJob.setWmsTaskNo(mydoJobReAssign.getTaskCode());
if (mydoJobService.selectMydoJobList(wmsJob).size() == 0) {
log.warn("【响应异常】该任务不存在,任务号:{}", mydoJobReAssign.getTaskCode());
return;
}
//更新任务参数
job = mydoJobService.selectMydoJobByTaskNo(Long.valueOf(job.getTaskNo()));
job.setCargoSpaceId(mydoJobReAssign.getSiteCode());
job.setExecutionPhase(TASK_EXCEPTION_PUT_REASSIGN);
job.setFaultFlag("2");
mydoJobService.updateMydoJob(job);
log.info("【入库异常】请求wms重分货位成功,异常货位:{},新货位:{},任务号:{}", oldCargo, mydoJobReAssign.getSiteCode(), job.getTaskNo());
}else{
log.info("【入库异常】请求wms重分货位异常,异常上报请求失败,请咨询操作管理员,异常货位:{},当前任务号:{}", oldCargo, job.getTaskNo());
}
}
}
}
/**
* 【出库异常】 - 【取货无货】处理方法
*/
@Scheduled(fixedDelay = DEFAULTTIMEINTERVAL)
public void stockoutExceptionHandler() {
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
new MydoJob().builder().executionPhase(TASK_EXCEPTION_PICK).build()
);
if (!jobs.isEmpty()) {
for (MydoJob job : jobs) {
//向wms返回异常信息
TaskExceptionRequest taskExceptionRequest = new TaskExceptionRequest();
taskExceptionRequest.setTaskClass(job.getInOrOut().substring(0, 1));
taskExceptionRequest.setType(String.valueOf(TASK_EXCEPTION_STOCKIN_OCCUPIED));
taskExceptionRequest.setTaskCode(String.valueOf(job.getWmsTaskNo()));
taskExceptionRequest.setTaskTypeCode(WMS_TASK_TYPE_EXCEPTION);//todo 不知道填什么
taskExceptionRequest.setReqCode(UUID.randomUUID().toString().replace("-", ""));
taskExceptionRequest.setAdverseCauses("取货位置空,盘点后作废该任务");
AjaxResult ajaxResult = apiService.reMaterial(taskExceptionRequest);
if (ajaxResult.isSuccess()){
mydoJobService.InvalidMydoJob(Long.valueOf(job.getTaskNo()), Integer.valueOf(job.getRoadwayId()));
//清空/重置【取货无货】的出库异常货位库存信息
basCargoSpaceService.resetCargoSpaceByStockoutException(job.getCargoSpaceId());
log.info("【出库异常】堆垛机取货时目标位置无货,当前任务已作废,异常货位:{},任务号:{}", job.getCargoSpaceId(), job.getRoadwayId());
}else{
log.info("【出库异常】堆垛机取货时目标位置无货,异常上报请求失败,请咨询操作管理员,异常货位:{},任务号:{}", job.getCargoSpaceId(), job.getRoadwayId());
}
}
}
}
/**
* 【入库异常-重分完成】 - 堆垛机重新下发
*/
@Scheduled(fixedDelay = DEFAULTTIMEINTERVAL)
public void sendTaskForStacker(){
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
new MydoJob().builder().executionPhase(TASK_EXCEPTION_PUT_REASSIGN).build()
);
if (!jobs.isEmpty()) {
for (MydoJob job : jobs) {
stackerTask(job);
}
}
}
/**
* 更新堆垛机任务队列 - 异常盘点重新下发
* @param mydoJob
*/
public void stackerTask(MydoJob mydoJob) {
//获取重分的货位重新向堆垛机下发任务
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
DdjDeviceExecutionQueue ddjDeviceExecutionQueue =
ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Long.valueOf(mydoJob.getTaskNo()), Integer.valueOf(mydoJob.getRoadwayId()));
ddjDeviceExecutionQueue.setMbph(basCargoSpace.getThePlatoon());
ddjDeviceExecutionQueue.setMblh(basCargoSpace.getTheColumn());
ddjDeviceExecutionQueue.setMbch(basCargoSpace.getTheFloor());
ddjDeviceExecutionQueue.setDdjxf("0");
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
}
/**
* 查询正在执行的堆垛机队列是否为遗留记录 - 清理遗留队列数据
*/
// @Scheduled(fixedDelay = 30000)
public void clearStackerQueue(){
// ddjDeviceExecutionQueueService.se
}
@PostConstruct
public void mpTest(){
}
}

View File

@@ -31,7 +31,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import static com.ruoyi.common.TaskExceptionType.TASK_EXCEPTION_STOCKIN_OCCUPIED; import static com.ruoyi.common.TaskExceptionType.TASK_EXCEPTION_STOCKIN_OCCUPIED;
import static com.ruoyi.common.TaskExceptionType.TASK_EXCEPTION_STOCKOUT_EMPTY; import static com.ruoyi.common.TaskStatusCode.*;
import static com.ruoyi.common.WmsTaskTypeCode.WMS_TASK_TYPE_EXCEPTION;
@Slf4j @Slf4j
@@ -89,7 +90,7 @@ public class DdjThread implements Runnable {
} }
} }
try { try {
Thread.sleep(1500); Thread.sleep(3000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -103,30 +104,38 @@ public class DdjThread implements Runnable {
以防存在漏处理,没处理的情况发生 以防存在漏处理,没处理的情况发生
*/ */
//非【联机自动】状态
if (ddj.getCzfs() != 5) return;
// 检查当前堆垛机参数 - 是否有执行中的作业 // 检查当前堆垛机参数 - 是否有执行中的作业
// 1.联机自动【5】 2.设备状态【0】 3.执行阶段【0】【5】(无执行中的任务) // 1.联机自动【5】 2.设备状态【0】 3.执行阶段【0】【5】(无执行中的任务)
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 0 && (ddj.getJdbz() == 5 || ddj.getJdbz() == 0)) { if (ddj.getSbzt() == 0 && (ddj.getJdbz() == 5 || ddj.getJdbz() == 0)) {
Long rwh = ddj.getRwh(); Long rwh = ddj.getRwh();
//完成作业 //完成作业
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh); MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId()); DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
//满足上述条件,表示该任务已完成-执行任务回传 //满足上述条件(【有实时任务】且【存在堆垛机执行队列】),表示该任务已完成-执行任务回传
if (mydoJob != null && ddjDeviceExecutionQueue != null) { if (mydoJob != null && ddjDeviceExecutionQueue != null) {
//回传完成信号 //标记为堆垛机执行完成
mydoJob.setExecutionPhase(TASK_EP_DDJ_FINISH);
mydoJobService.updateMydoJob(mydoJob);
//回传完成信号 - 方法在存储过程【proc_mydojob_finish】中
ddjTaskFinish(rwh, ddj.getId()); ddjTaskFinish(rwh, ddj.getId());
log.info("堆垛机:"+ddj.getId()+"任务完成,任务号:"+ddj.getRwh()); log.info("【堆垛机执行】堆垛机编号:" + ddj.getId() + " 执行完成,任务结束,任务号:"+ddj.getRwh());
} }
} }
//-------------------------------------- 【2 更新执行阶段】 -------------------------------------- //-------------------------------------- 【2 更新执行阶段】 --------------------------------------
// 1.联机自动【5】 2.设备状态 - 运行中【1】 3.执行阶段【2】 // 1.联机自动【5】 2.设备状态 - 运行中【1】 3.执行阶段【2】
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1 && ddj.getJdbz() == 2) { if (ddj.getSbzt() == 1 && ddj.getJdbz() == 2) {
//根据堆垛机上任务号,修改任务执行阶段 //根据堆垛机上任务号,修改任务执行阶段
Long rwh = ddj.getRwh(); Long rwh = ddj.getRwh();
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId()); DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
if (ddjDeviceExecutionQueue != null && !"1".equals(ddjDeviceExecutionQueue.getSpare1())) { if (ddjDeviceExecutionQueue != null && !"1".equals(ddjDeviceExecutionQueue.getSpare1())) {
//修改队列执行阶段 //修改队列执行阶段
ddjDeviceExecutionQueue.setRwzt(ddj.getJdbz()); ddjDeviceExecutionQueue.setRwzt(ddj.getJdbz());
@@ -136,97 +145,123 @@ public class DdjThread implements Runnable {
} }
/* -------------------------------------- 【3 放货有货,重新分配货位】-------------------------------------- */ /* -------------------------------------- 【3 放货有货,重新分配货位】-------------------------------------- */
// ddj.setCzfs(5);
// ddj.setSbzt(1052);
// ddj.setYxxf(1);
// ddj.setJdbz(4);
// ddj.setRwh(85015L);
// 1.联机自动【5】 2.设备状态-放货有货【1052】 3.执行阶段【0】【5】(无执行中的任务) // 1.联机自动【5】 2.设备状态-放货有货【1052】 3.执行阶段【0】【5】(无执行中的任务)
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1052 && ddj.getJdbz() < 5 && ddj.getYxxf() == 1) { if (ddj.getSbzt() == 1052 && ddj.getJdbz() < 5 && ddj.getYxxf() == 1) {
// 判断堆垛机上任务是否已重分,若未重分,则调用接口,请求重分货位 // 判断堆垛机上任务是否已重分,若未重分,则调用接口,请求重分货位
Long rwh = ddj.getRwh(); Long rwh = ddj.getRwh();
//获取堆垛机正在执行中的任务和队列 //查询正在执行中的【任务号】获取堆垛机队列
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh); MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
//更新异常类型【FaultFlag】-1 if (mydoJob != null && mydoJob.getExecutionPhase() != TASK_EXCEPTION_PUT) {
if ("0".equals(mydoJob.getFaultFlag()) && "1".equals(ddjDeviceExecutionQueue.getSpare1())) { DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
mydoJob.setStatus("1"); //更新异常类型【FaultFlag】-1
mydoJobService.updateMydoJob(mydoJob); if ("0".equals(mydoJob.getFaultFlag()) && "1".equals(ddjDeviceExecutionQueue.getSpare1())) {
mydoJob.setStatus("1");
//上报异常 - 向wms请求重分接口 //把执行阶段标记为【入库放货有货】的异常
TaskExceptionRequest taskExceptionRequest = new TaskExceptionRequest(); mydoJob.setExecutionPhase(TASK_EXCEPTION_PUT);
taskExceptionRequest.setTaskClass(mydoJob.getInOrOut());
taskExceptionRequest.setType(TASK_EXCEPTION_STOCKIN_OCCUPIED);
taskExceptionRequest.setTaskCode(mydoJob.getWmsTaskNo());
taskExceptionRequest.setTaskTypeCode("");//todo 不知道填什么内容
taskExceptionRequest.setReqCode(mydoJob.getJobId() + mydoJob.getTaskNo());
taskExceptionRequest.setAdverseCauses("当前位置已有货物,盘点后重新分配货位");
AjaxResult ajaxResult = apiService.reAssign(taskExceptionRequest);
if (ajaxResult.isSuccess()){
//获取返回的任务号和新分配的货位
TaskExceptionReceive mydoJobReAssign = BeanUtil.toBean(ajaxResult.get("result"), TaskExceptionReceive.class);
MydoJob wmsJob = new MydoJob();
wmsJob.setInOrOut(mydoJobReAssign.getTaskCode());
if (mydoJobService.selectMydoJobList(wmsJob).size() == 0) {
log.warn("该任务不存在,任务号:{}", mydoJobReAssign.getTaskCode());
return;
}
//更新任务参数
mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
mydoJob.setCargoSpaceId(mydoJobReAssign.getSiteCode());
mydoJob.setFaultFlag("2");
mydoJobService.updateMydoJob(mydoJob); mydoJobService.updateMydoJob(mydoJob);
log.info("【入库异常】堆垛机放货时目标位置有货,异常货位:{},任务号:{}", mydoJob.getCargoSpaceId(), rwh);
}
//获取重分的货位重新向堆垛机下发任务 // //上报异常 - 向wms请求重分接口
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId()); // TaskExceptionRequest taskExceptionRequest = new TaskExceptionRequest();
ddjDeviceExecutionQueue.setMbph(basCargoSpace.getThePlatoon()); // taskExceptionRequest.setTaskClass(mydoJob.getInOrOut().substring(0, 1));
ddjDeviceExecutionQueue.setMblh(basCargoSpace.getTheColumn()); // taskExceptionRequest.setType(String.valueOf(TASK_EXCEPTION_STOCKIN_OCCUPIED));
ddjDeviceExecutionQueue.setMbch(basCargoSpace.getTheFloor()); // taskExceptionRequest.setTaskCode(mydoJob.getWmsTaskNo());
ddjDeviceExecutionQueue.setDdjxf("0"); // taskExceptionRequest.setTaskTypeCode(WMS_TASK_TYPE_EXCEPTION);//todo 不知道填什么
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue); // taskExceptionRequest.setReqCode(UUID.randomUUID().toString().replace("-", ""));
} // taskExceptionRequest.setAdverseCauses("当前位置已有货物,盘点后重新分配货位");
//
// AjaxResult ajaxResult = apiService.reAssign(taskExceptionRequest);
// if (ajaxResult.isSuccess()){
// //获取返回的任务号和新分配的货位
// TaskExceptionReceive mydoJobReAssign = BeanUtil.toBean(ajaxResult.get("result"), TaskExceptionReceive.class);
//
// MydoJob wmsJob = new MydoJob();
// wmsJob.setWmsTaskNo(mydoJobReAssign.getTaskCode());
// if (mydoJobService.selectMydoJobList(wmsJob).size() == 0) {
// log.warn("【响应异常】该任务不存在,任务号:{}", mydoJobReAssign.getTaskCode());
// return;
// }
//
// //更新任务参数
// mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
// mydoJob.setCargoSpaceId(mydoJobReAssign.getSiteCode());
// mydoJob.setExecutionPhase(TASK_EP_DDJ);
// mydoJob.setFaultFlag("2");
// mydoJobService.updateMydoJob(mydoJob);
//
// //获取重分的货位重新向堆垛机下发任务
// BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
// ddjDeviceExecutionQueue.setMbph(basCargoSpace.getThePlatoon());
// ddjDeviceExecutionQueue.setMblh(basCargoSpace.getTheColumn());
// ddjDeviceExecutionQueue.setMbch(basCargoSpace.getTheFloor());
// ddjDeviceExecutionQueue.setDdjxf("0");
// ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
// }
} }
} }
// -------------------------------------- 4 取货无货,作废当前任务,重新分配单据 -------------------------------------- // -------------------------------------- 4 取货无货,作废当前任务,重新分配单据 --------------------------------------
//测试数据
// ddj.setCzfs(5);
// ddj.setSbzt(1053);
// ddj.setYxxf(1);
// ddj.setJdbz(3);
// ddj.setRwh(20021L);
// ddj.setId(1);
// 1.联机自动【5】 2.设备状态-取货无货【1053】 3.执行阶段【<5】(任务执行中) // 1.联机自动【5】 2.设备状态-取货无货【1053】 3.执行阶段【<5】(任务执行中)
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1053 && ddj.getJdbz() < 5) { if (ddj.getSbzt() == 1053 && ddj.getJdbz() < 5) {
Long rwh = ddj.getRwh(); Long rwh = ddj.getRwh();
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh); MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
//无货异常处理 if (mydoJob != null && mydoJob.getExecutionPhase() != TASK_EXCEPTION_PICK) {
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId()); //把执行阶段标记为【出库取货无货】的异常
mydoJob.setExecutionPhase(TASK_EXCEPTION_PICK);
//找到对应任务 调用api接口 取货无货,重新分配单据 mydoJobService.updateMydoJob(mydoJob);
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) { log.info("【出库异常】堆垛机取货时目标位置无货,异常货位:{},任务号:{}", mydoJob.getCargoSpaceId(), rwh);
//向wms返回异常信息
TaskExceptionRequest taskExceptionRequest = new TaskExceptionRequest();
taskExceptionRequest.setTaskClass(mydoJob.getInOrOut());
taskExceptionRequest.setType(TASK_EXCEPTION_STOCKOUT_EMPTY);
taskExceptionRequest.setTaskCode(String.valueOf(mydoJob));
taskExceptionRequest.setTaskTypeCode("");//todo 不知道填什么内容
taskExceptionRequest.setReqCode(UUID.randomUUID().toString());
taskExceptionRequest.setAdverseCauses("取货位置空,盘点后作废该任务");
AjaxResult ajaxResult = apiService.reMaterial(taskExceptionRequest);
if (ajaxResult.isSuccess()) {
//作废作业
InvalidMydoJob(rwh, ddj.getId());
//清空/重置【取货无货】的出库异常货位库存信息
basCargoSpaceService.resetCargoSpaceByStockoutException(mydoJob.getCargoSpaceId());
}
} }
// //无货异常处理
// DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
//
// //找到对应任务 调用api接口 取货无货,重新分配单据
// if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) {
//
// //向wms返回异常信息
// TaskExceptionRequest taskExceptionRequest = new TaskExceptionRequest();
// taskExceptionRequest.setTaskClass(mydoJob.getInOrOut().substring(0, 1));
// taskExceptionRequest.setType(String.valueOf(TASK_EXCEPTION_STOCKIN_OCCUPIED));
// taskExceptionRequest.setTaskCode(String.valueOf(mydoJob));
// taskExceptionRequest.setTaskTypeCode(WMS_TASK_TYPE_EXCEPTION);//todo 不知道填什么
// taskExceptionRequest.setReqCode(UUID.randomUUID().toString().replace("-", ""));
// taskExceptionRequest.setAdverseCauses("取货位置空,盘点后作废该任务");
//
// AjaxResult ajaxResult = apiService.reMaterial(taskExceptionRequest);
// if (ajaxResult.isSuccess()) {
// //作废作业
// InvalidMydoJob(rwh, ddj.getId());
//
// //清空/重置【取货无货】的出库异常货位库存信息
// basCargoSpaceService.resetCargoSpaceByStockoutException(mydoJob.getCargoSpaceId());
// }
// }
} }
// -------------------------------------- 5 下发堆垛机任务 -------------------------------------- // -------------------------------------- 5 下发堆垛机任务 --------------------------------------
//重分货位后重下 //重分货位后重下
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5 && ddj.getSbzt() == 1052) { if (ddj.getYxxf() == 1 && ddj.getSbzt() == 1052) {
Long rwh = ddj.getRwh(); Long rwh = ddj.getRwh();
//查询执行中的作业 //查询执行中的作业
@@ -248,16 +283,17 @@ public class DdjThread implements Runnable {
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue); ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
mydoJob.setFaultFlag("0"); mydoJob.setFaultFlag("0");
mydoJobService.updateMydoJob(mydoJob); mydoJobService.updateMydoJob(mydoJob);
log.info("堆垛机放货目标有货,重分货位下发任务成功 rwh:{}", rwh); log.info("【入库异常】重分货位下发堆垛机任务成功,当前任务号:{}", rwh);
} else { } else {
log.error("堆垛机放货目标有货,重分货位下发任务失败!!!!!!!"); log.error("【入库异常】重分货位 - 下发堆垛机任务失败!!!!!!!");
} }
} }
} }
} }
//正常下发 //正常下发
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5 && ddj.getSbzt() == 0 ) { if (ddj.getYxxf() == 1 && ddj.getSbzt() == 0 ) {
//检查是否有正在执行的堆垛机队列 //检查是否有正在执行的堆垛机队列
Long rwh = ddj.getRwh(); Long rwh = ddj.getRwh();
DdjDeviceExecutionQueue ddjDeviceExecutionQueueRunningParam = new DdjDeviceExecutionQueue(); DdjDeviceExecutionQueue ddjDeviceExecutionQueueRunningParam = new DdjDeviceExecutionQueue();
@@ -266,7 +302,7 @@ public class DdjThread implements Runnable {
ddjDeviceExecutionQueueRunningParam.setDevId(ddj.getId()); ddjDeviceExecutionQueueRunningParam.setDevId(ddj.getId());
List<DdjDeviceExecutionQueue> ddjDeviceExecutionRunningQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueueRunningParam); List<DdjDeviceExecutionQueue> ddjDeviceExecutionRunningQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueueRunningParam);
if (CollUtil.isNotEmpty(ddjDeviceExecutionRunningQueues)) { if (CollUtil.isNotEmpty(ddjDeviceExecutionRunningQueues)) {
log.error("堆垛机有正在执行的任务 {}" , ddjDeviceExecutionRunningQueues.get(0).getRwh()); log.error("【提示】堆垛机有正在执行的队列,任务号: {},请检查该任务号的wcs作业是否已经手动处理" , ddjDeviceExecutionRunningQueues.get(0).getRwh());
return; return;
} }
@@ -285,9 +321,9 @@ public class DdjThread implements Runnable {
ddjDeviceExecutionQueue.setXfsj(DateUtil.formatDateTime(DateUtil.date())); ddjDeviceExecutionQueue.setXfsj(DateUtil.formatDateTime(DateUtil.date()));
ddjDeviceExecutionQueue.setDdjxf("1"); ddjDeviceExecutionQueue.setDdjxf("1");
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue); ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
log.info("堆垛机下发任务成功 rwh:{}", ddjDeviceExecutionQueue.getRwh()); log.info("【堆垛机执行】下发任务成功,任务执行中, 任务号:{}", ddjDeviceExecutionQueue.getRwh());
} else { } else {
log.error("堆垛机下发任务失败!!!!!!!"); log.error("【堆垛机执行】执行异常, 堆垛机下发任务失败!");
} }
} }
} }
@@ -331,6 +367,7 @@ public class DdjThread implements Runnable {
int mlfs = 5; int mlfs = 5;
int xfwc = 1; int xfwc = 1;
int hwlx = Convert.toInt(queue.getSpare1()); int hwlx = Convert.toInt(queue.getSpare1());
// int hwlx = 0;//默认值
int jym = Tools.getJYM(taskNo, yph, ylh, ych, mbph, mblh, mbch, mlfs, hwlx); int jym = Tools.getJYM(taskNo, yph, ylh, ych, mbph, mblh, mbch, mlfs, hwlx);
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, hwlx, xfwc, jym); byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, hwlx, xfwc, jym);
if (devId==1){ if (devId==1){

View File

@@ -2,49 +2,56 @@ package com.ruoyi.schedule.scheduleTask.ssj;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.UUID; import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil; import com.alibaba.fastjson2.JSON;
import com.ruoyi.api.domain.wcs2wms.ResponseResult;
import com.ruoyi.api.domain.wcs2wms.stockin.StockinReceive; import com.ruoyi.api.domain.wcs2wms.stockin.StockinReceive;
import com.ruoyi.api.service.IApiService; import com.ruoyi.api.service.IApiService;
import com.ruoyi.api.service.IRequestLogService;
import com.ruoyi.bas.cargospace.domain.BasCargoSpace; import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService; import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
import com.ruoyi.common.ConvException;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.device.ssj.domain.DeviceSsj; import com.ruoyi.device.ssj.domain.DeviceSsj;
import com.ruoyi.job.domain.JobCallBack;
import com.ruoyi.job.domain.MydoJob; import com.ruoyi.job.domain.MydoJob;
import com.ruoyi.job.service.IJobCallBackService; import com.ruoyi.job.service.IJobCallBackService;
import com.ruoyi.job.service.IMydoJobService; import com.ruoyi.job.service.IMydoJobService;
import com.ruoyi.queue.agv.domain.AgvQueue;
import com.ruoyi.queue.agv.service.IAgvQueueService;
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead; import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import java.io.IOException;
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static com.ruoyi.common.TaskStatusCode.*; import static com.ruoyi.common.TaskStatusCode.*;
import static com.ruoyi.common.TaskType.STOCKOUT;
import static com.ruoyi.common.WmsTaskTypeCode.WMS_TASK_TYPE_STOCKIN;
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj; import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsjQH;
/** /**
* 出入口输送线线程 * 出入口输送线线程
*/ */
@Slf4j @Slf4j
@Component
public class PortConvThread implements Runnable { public class PortConvThread implements Runnable {
public HashMap<String, List<String>> ssjCodeList; public HashMap<String, List<String>> ssjCodeList;
private IApiService apiService; private IApiService apiService;
private IAgvQueueService agvQueueService; // private IAgvQueueService agvQueueService;
private IMydoJobService mydoJobService; private IMydoJobService mydoJobService;
private IJobCallBackService jobCallBackService; private IJobCallBackService jobCallBackService;
private IBasCargoSpaceService cargoSpaceService; private IBasCargoSpaceService basCargoSpaceService;
private IRequestLogService requestLogService;
public boolean isRun = true; public boolean isRun = true;
@@ -53,13 +60,15 @@ public class PortConvThread implements Runnable {
ssjCodeList = new HashMap<>(); ssjCodeList = new HashMap<>();
ArrayList<String> ssjCodes = new ArrayList<>(); ArrayList<String> ssjCodes = new ArrayList<>();
ssjCodes.add("G1004"); ssjCodes.add("G1004");
// ssjCodes.add("L1003"); ssjCodes.add("TD1001");
ssjCodeList.put("portConv", ssjCodes); ssjCodeList.put("portConv", ssjCodes);
apiService = SpringUtils.getBean(IApiService.class); apiService = SpringUtils.getBean(IApiService.class);
agvQueueService = SpringUtils.getBean(IAgvQueueService.class); // agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
mydoJobService = SpringUtils.getBean(IMydoJobService.class); mydoJobService = SpringUtils.getBean(IMydoJobService.class);
jobCallBackService = SpringUtils.getBean(IJobCallBackService.class); jobCallBackService = SpringUtils.getBean(IJobCallBackService.class);
log.info("初始化服务 {},{}", apiService, agvQueueService); basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
requestLogService = SpringUtils.getBean(IRequestLogService.class);
// log.info("初始化服务 {},{}", apiService, agvQueueService);
} }
@Override @Override
@@ -73,8 +82,13 @@ public class PortConvThread implements Runnable {
for (String ssjCode : ssjCodeList.get(type)) { for (String ssjCode : ssjCodeList.get(type)) {
try { try {
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) { if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode)); if (ssjCode == "G1004"){
// inDispatch1(PlcSsjRead.deviceSsjMap.get(ssjCode)); inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
}
if (ssjCode == "TD1001"){
outDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
}
} else { } else {
log.error("设备不存在 ssjCode:{}", ssjCode); log.error("设备不存在 ssjCode:{}", ssjCode);
} }
@@ -83,10 +97,11 @@ public class PortConvThread implements Runnable {
} }
} }
break; break;
} }
} }
try { try {
Thread.sleep(1500); Thread.sleep(3000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -96,179 +111,287 @@ public class PortConvThread implements Runnable {
public void inDispatch(DeviceSsj inSsjDevice) { public void inDispatch(DeviceSsj inSsjDevice) {
switch (inSsjDevice.getInOrOut()) { // 测试数据
//---------------------------入库模式--------------------------- // inSsjDevice.setInOrOut(1);
case 1: // inSsjDevice.setTrayCode("T000004503");
//---------------------------入口取输送机(叉车取放货位置)--------------------------- // inSsjDevice.setTaskNo(777778);
//输送机【非空闲】、【输送到位】、【条码不为空】、有【入库请求】 // inSsjDevice.setKx(0);
if (inSsjDevice.getKx() != 1 && inSsjDevice.getDw() == 1) { // inSsjDevice.setDw(1);
// inSsjDevice.setHeight(1);
// inSsjDevice.setWeight("100");
// inSsjDevice.setException(0);
// inSsjDevice.setRkqq(1);
AjaxResult ajaxResult; //输送机状态
if (!convChecked(inSsjDevice)) return;
//请求参数 //请求wms获取入库任务
HashMap<String, Object> paramMap = new HashMap<>(); requestMydoJob(inSsjDevice);
paramMap.put("taskTypeCode", inSsjDevice.getTrayCode());//任务类型编号
paramMap.put("reqCode", UUID.randomUUID().toString());//请求码
paramMap.put("cntCode", inSsjDevice.getTrayCode());//容器编号
int height = inSsjDevice.getHeight();
int weight = inSsjDevice.getWeight();
paramMap.put("weight", weight);//重量
paramMap.put("height", height);//高度
//入库口异常校验 //更新入库任务阶段
switch (inSsjDevice.getException()) { updateMydoJob(inSsjDevice);
//外形检测异常
case ConvException.CHECK_SIZE_EXCEPTION:
paramMap.put("adverseCauses", "外形检测异常-货物超高");
ajaxResult = apiService.createInMydoJobException(paramMap);
if (ajaxResult.isSuccess()) {
//向输送机下发退回
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 99, 1);
}
return;
//超重检测
case ConvException.CHECK_OVERWEIGHT_EXCEPTION:
paramMap.put("adverseCauses", "外形检测异常-货物超重");
ajaxResult = apiService.createInMydoJobException(paramMap);
if (ajaxResult.isSuccess()) {
//向输送机下发退回
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 99, 1);
}
return;
//扫码异常
case ConvException.CHECK_BARCODE_EXCEPTION:
if (inSsjDevice.getTrayCode() == "") {
paramMap.put("adverseCauses", "条码扫描失败:扫描结果为空");
ajaxResult = apiService.createInMydoJobException(paramMap);
}else{
//条码格式校验
paramMap.put("adverseCauses", "条码扫描异常:格式错误");
ajaxResult = apiService.createInMydoJobException(paramMap);
}
if (ajaxResult.isSuccess()) {
//向输送机下发退回
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 99, 1);
}
return;
}
//校验:有【入库请求】再请求获取wcs任务
if (inSsjDevice.getRkqq() != 1) {
return;
}
//校验:当前条码任务已存在
MydoJob job = new MydoJob();
job.setTrayCode(inSsjDevice.getTrayCode());
if (mydoJobService.selectMydoJobList(job).size() > 0) {
log.warn("【生成wcs任务异常】该托盘号已有作业,托盘条码:{}",inSsjDevice.getTrayCode());
return;
}
//校验:当前条码已有库存
BasCargoSpace cargoSpace = new BasCargoSpace();
cargoSpace.setTrayCode(inSsjDevice.getTrayCode());
if (cargoSpaceService.selectBasCargoSpaceList(cargoSpace).size() > 0) {
log.warn("【生成wcs任务异常】该托盘号已有库存,托盘条码:{}",inSsjDevice.getTrayCode());
return;
}
//请求生成wcs任务
ajaxResult = apiService.createInMydoJob(paramMap);
if (ajaxResult.isSuccess()) {
//获取wms下发的任务号和分配货位
StockinReceive result = BeanUtil.toBean(ajaxResult.get("result"), StockinReceive.class);
MydoJob mydoJob = new MydoJob();
// mydoJob.setJobId();
mydoJob.setTrayCode(result.getCntCode());
mydoJob.setCargoSpaceId(result.getSiteCode());
mydoJob.setWmsTaskNo(result.getTaskCode());
mydoJob.setJobId(mydoJobService.getJobId("RK"));
mydoJob.setTaskNo(mydoJobService.getTaskNo("1"));
// mydoJob.setTaskNo(result.getTaskCode());//todo 确定是否用获取的任务号作为wcs的任务号
//todo 校验wms分配的货位(排列层)是否合法
if (mydoJob.getCargoSpaceId() == null) {
log.info("【请求参数异常】分配货位:null,托盘条码:{}",inSsjDevice.getTrayCode());
return;
}else{
}
mydoJob.setStatus("1");
mydoJob.setInOrOut("1");
mydoJob.setExecutionPhase(TASK_EP_CREATE);
mydoJob.setCreateTime(new Date());
// mydoJob.setTraySize(Convert.toStr(inSsjDevice.getTraySize()));
mydoJob.setFaultFlag("0");
mydoJob.setPriority(Long.valueOf(10));
//拿到正常作业,插到wcs作业表,下发给输送机任务号,覆盖任务号
if (mydoJobService.insertMydoJob(mydoJob) == 1) {
log.info("请求生成wcs作业成功,wms下发任务单号:{}, 任务号:{},托盘条码:{},分配货位:{}", mydoJob.getJobId(), mydoJob.getTaskNo(), mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
}else{
//向输送机下发任务号
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), Integer.parseInt(mydoJob.getTraySize()), 1);
if (i == 1) {
//写入成功则更新执行阶段
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
mydoJobService.updateMydoJob(mydoJob);
log.info("G1004入口输送机下发任务号成功:{}", mydoJob.getTaskNo());
}
}
}else{
//请求生成wcs任务失败
//todo 向输送机下发退回
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 99, 1);
//todo 接口调用失败处理
log.info("【请求入库】请求生成wcs作业失败退回,请重试");
}
}
break;
//---------------------------出库模式---------------------------
case 2:
//出库到位
if (inSsjDevice.getDw() == 1 && inSsjDevice.getTaskNo() > 0) {
//查询该出库任务
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(inSsjDevice.getTaskNo()));
if (mydoJob != null && Integer.parseInt(mydoJob.getInOrOut()) > 20) {
log.info("设备:{} 位置:{} 任务号:{} 出库到位", "输送线:", inSsjDevice.getDeviceCode(), mydoJob.getTaskNo());
mydoJobService.insertHistory(mydoJob.getJobId());
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
JobCallBack jobCallBack = new JobCallBack();
jobCallBack.setType("2");
jobCallBack.setMydojobId(mydoJob.getJobId());
jobCallBack.setStatus("0");
jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo()));
jobCallBack.setCreateTime(new Date());
jobCallBack.setTaskTypeCode("");//todo ???
jobCallBack.setReqCode(UUID.randomUUID().toString());
jobCallBack.setTaskCode(mydoJob.getWmsTaskNo());
// jobCallBack.setSpare1("0");
jobCallBackService.insertJobCallBack(jobCallBack);
}
}
break;
}
} }
/**
* 输送机到位判断校验
* @param inSsjDevice
* @return
*/
private boolean convChecked(DeviceSsj inSsjDevice){
boolean flag = false;
//---------------------------入口取输送机(叉车取放货位置)---------------------------
//输送机【条码】空
if (inSsjDevice.getTrayCode() == "" || inSsjDevice.getTrayCode() == null) return flag;
//【入库请求】,表示输送到位和空闲
if (inSsjDevice.getRkqq() != 1) return flag;
//【输送高度】
if (inSsjDevice.getHeight() == 0) return flag;
return true;
}
/**
* 请求wms获取wcs任务参数
* @param inSsjDevice
*/
private void requestMydoJob(DeviceSsj inSsjDevice){
//请求成功已经生成该任务则不继续执行
int count = mydoJobService.selectInOrOutMydoJobList(
new MydoJob().builder().trayCode(inSsjDevice.getTrayCode()).build()
).size();
if (count > 0) {
log.warn("【警告】已经存在该托盘号的入库作业,无法继续执行该托盘的入库请求,请稍后重试");
writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 2, 1);
return;
}
int stockoutMydoJob = mydoJobService.selectMydoJobList(
new MydoJob().builder().inOrOut(STOCKOUT).build()
).size();
if (stockoutMydoJob > 0) {
log.warn("【警告】已经存在执行中的出库作业,无法执行入库请求,请稍后重试");
writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 2, 1);
return;
}
String errorMessage = "";
AjaxResult ajaxResult;
//初始化请求wms参数
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("taskTypeCode", WMS_TASK_TYPE_STOCKIN);//wms自定义的任务类型编号
paramMap.put("reqCode", UUID.randomUUID().toString());//请求码
paramMap.put("cntCode", inSsjDevice.getTrayCode().trim());//容器编号
int height = inSsjDevice.getHeight();
// String weight = inSsjDevice.getWeight();//不需要直读重量或从plc读值,wms不需要该参数
// paramMap.put("weight", getWeightByMoxa(MOXA_IP, MOXA_PORT, SO_TIMEOUT_MS));//重量
paramMap.put("altimetry", height);//高度
paramMap.put("adverseCauses", errorMessage);
//-----------------警告校验:条码已有库存-----------------
BasCargoSpace cargoSpace = new BasCargoSpace();
cargoSpace.setTrayCode(inSsjDevice.getTrayCode());
if (!basCargoSpaceService.selectBasCargoSpaceList(cargoSpace).isEmpty()) {
log.warn("【警告】该托盘号已有库存,托盘条码:{}",inSsjDevice.getTrayCode());
}
/*-----------------请求生成wcs任务----------------- */
ajaxResult = apiService.createMydoJobForStockin(paramMap);
if (ajaxResult.isSuccess()) {
//解析wms下发的响应参数(任务号和货位)
StockinReceive result = BeanUtil.toBean(ajaxResult.get("data"), StockinReceive.class);
//校验:wms分配的货位(排列层)是否合法
if (ObjUtil.isNull(basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(result.getSiteCode()))) {
errorMessage = "wms下发货位错误,任务生成失败!";
paramMap.put("adverseCauses", errorMessage);
apiService.createInMydoJobException(paramMap);
log.info("【响应参数异常】分配货位:null,无法生成作业,托盘条码:{}",inSsjDevice.getTrayCode());
writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 2, 1);
return;
}
//初始化要生成的任务
MydoJob mydoJob = new MydoJob().builder()
// mydoJob.setTaskNo(result.getTaskCode());//如果需要用wms下发的任务号作为wcs的任务号使用
.trayCode(result.getCntCode())
.cargoSpaceId(result.getSiteCode())
.wmsTaskNo(result.getTaskCode())
.jobId(mydoJobService.getJobId("RK"))
.taskNo(mydoJobService.getTaskNo("1"))
.traySize(String.valueOf(inSsjDevice.getHeight()))
.status(TASK_STATUS_CREATED)
.inOrOut("1")
.roadwayId(basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(result.getSiteCode()).getRoadwayId())//获取货位表货位对应的巷道号
.entranceId("G1004")
.executionPhase(TASK_EP_CREATED)
.faultFlag("0")
.priority(10L)
.build();
//如果还没有wcs任务 - 生成一条任务
if (mydoJobService.selectInOrOutMydoJobList(mydoJob).isEmpty()) {
mydoJobService.insertMydoJob(mydoJob);
log.info("【入库请求】请求生成wcs作业成功,wms任务号:{}, wcs任务号:{},托盘条码:{},分配货位:{}", mydoJob.getWmsTaskNo(), mydoJob.getTaskNo(), mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
}
}else{
// 接口调用失败处理
log.info("【入库请求】请求生成wcs作业失败退回,请检查网络或请求参数,请求内容:{}", JSON.toJSONString(paramMap));
log.info("【错误信息】{}", requestLogService.selectRequestLogByLatestTask().getErrorDetails());
// 请求生成wcs任务失败
// 向输送机下发退回
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 2, 1);
}
}
/**
* 更新入库任务阶段
* @param inSsjDevice
*/
private void updateMydoJob(DeviceSsj inSsjDevice){
//检查是否有已经创建成功的任务(请求成功的入库任务) - 更新到下一个执行阶段
MydoJob mydoJobStockin = new MydoJob().builder()
.trayCode(inSsjDevice.getTrayCode())
.status(TASK_STATUS_CREATED)
.executionPhase(TASK_EP_CREATED)
.build();
if(!mydoJobService.selectMydoJobList(mydoJobStockin).isEmpty()){
mydoJobStockin = mydoJobService.selectMydoJobList(mydoJobStockin).get(0);
//如果已经生成入库任务 - 向输送机下发任务号
//输送去向值【1】
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), mydoJobStockin.getTaskNo(), 1, 1);
// int i = 1;
if (i == 1) {
//写入成功则更新执行阶段
mydoJobStockin.setStatus(TASK_STATUS_RUNNING);
mydoJobStockin.setExecutionPhase(TASK_EP_SSJ);
mydoJobStockin.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
mydoJobService.updateMydoJob(mydoJobStockin);
log.info("【更新状态】G1004入口输送机下发成功,任务号:{},入库执行中", mydoJobStockin.getTaskNo());
}
}
}
/**
* 输送机出库到位 - 任务出库完成
* 出库完成在升降位置,即【TD1001】判断完成
* @param outSsjDevice
*/
private void finishStockoutMydoJob(DeviceSsj outSsjDevice){
//出库到位
if (outSsjDevice.getDw() == 1 && outSsjDevice.getTaskNo() > 0) {
//查询该出库任务
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(outSsjDevice.getTaskNo()));
if (mydoJob != null && Integer.parseInt(mydoJob.getInOrOut()) > 20) {
log.info("【出库完成】去向:{},出库货位:{},任务号:{},出库到位", "任务结束", outSsjDevice.getDeviceCode(),mydoJob.getCargoSpaceId() , mydoJob.getTaskNo());
mydoJob.setExecutionPhase(TASK_EP_SSJ_STOCKOUT_FINISH);
mydoJobService.updateMydoJob(mydoJob);
mydoJobService.taskFinish(Long.valueOf(mydoJob.getTaskNo()));
}
}
}
// ====== 【请按实际修改】======
private static final String MOXA_IP = "192.168.1.200"; // NPort 5110 的 IP
private static final int MOXA_PORT = 4001; // NPort 配置的 Local Port
private static final int RECONNECT_DELAY_SEC = 3; // 断线后重试间隔(秒)
private static final int SO_TIMEOUT_MS = 5000; // Socket 读超时(防卡死)
private static final Pattern WEIGHT_PATTERN = Pattern.compile(
"[+-]?\\d+\\.\\d{1,3}(?=[\\s\\r\\n]|kg|g|lb|$)"); // 匹配如 +12.34、-5.678、345.0kg
/**
* 从 MOXA NPort 5110(TCP Server 模式)读取单次称重值
* ************测试方法************
* ************测试方法************
* ************测试方法************
*
* @param moxaIp MOXA 设备 IP(如 "192.168.1.200")
* @param moxaPort MOXA 配置的 TCP 端口(如 4001)
* @param timeout 最大等待时间(单位:毫秒),建议 2000~5000
* @return 重量(kg),成功时为非 NaN 的 Double;失败(超时/断连/解析失败)返回 null
*/
public static Double getWeightByMoxa(String moxaIp, int moxaPort, long timeout) {
Socket socket = null;
try {
// 1️⃣ - 建立连接(带连接超时)
socket = new Socket();
socket.connect(new InetSocketAddress(moxaIp, moxaPort), 3000); // 连接超时 3s
socket.setSoTimeout((int) Math.min(timeout, Integer.MAX_VALUE)); // 读超时
// 2 - 发送请求指令(可选:仅当秤需指令才启用)
// OutputStream out = socket.getOutputStream();
// out.write("\r\n".getBytes(StandardCharsets.US_ASCII)); // 或 "\r", "W\r\n"
// out.flush();
// 3 - 读响应(使用 BufferedInputStream + 手动读字节,更健壮于无换行场景)
InputStream in = socket.getInputStream();
byte[] buffer = new byte[128];
int len = in.read(buffer);
if (len <= 0) return null;
String response = new String(buffer, 0, len, StandardCharsets.US_ASCII).trim();
if (response.isEmpty()) return null;
// 4 - 解析重量(兼容常见格式:+12.34、-5.678、00012.34kg、123.45\r\n)
Pattern p = Pattern.compile("[+-]?\\d*\\.?\\d+(?=[\\s\\r\\n]|kg|g|lb|$)");
java.util.regex.Matcher m = p.matcher(response);
if (m.find()) {
try {
double w = Double.parseDouble(m.group());
// 过滤明显异常值(可选)
if (Double.isFinite(w) && Math.abs(w) < 1e6) {
return w;
}
} catch (NumberFormatException ignored) {}
}
return null;
} catch (IOException e) {
return null; // 连接失败、读超时、解析异常等均返回 null
} finally {
if (socket != null && !socket.isClosed()) {
try { socket.close(); } catch (IOException ignored) {}
}
}
}
public void inDispatch1(DeviceSsj ssjDevice) { public void inDispatch1(DeviceSsj ssjDevice) {
//有入库请求就肯定是电气的任务号的作业 //有入库请求就肯定是电气的任务号的作业
if(StrUtil.isNotBlank(ssjDevice.getTrayCode()) && ssjDevice.getRkqq()==1 && ssjDevice.getTaskNo()<1000){ if(StrUtil.isNotBlank(ssjDevice.getTrayCode()) && ssjDevice.getRkqq()==1 && ssjDevice.getTaskNo()<1000){
//,如果有正执行的出库作业退回 //,如果有正执行的出库作业退回
MydoJob mydoJobParam = new MydoJob(); MydoJob mydoJobParam = new MydoJob();
// mydoJobParam.setInOut("2"); // mydoJobParam.setInOut("2");
mydoJobParam.setStatus("3"); mydoJobParam.setStatus("3");
@@ -294,13 +417,13 @@ public class PortConvThread implements Runnable {
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(mydoJob); List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(mydoJob);
if(!mydoJobs.isEmpty()){ if(!mydoJobs.isEmpty()){
MydoJob mydoJob1 = mydoJobs.get(0); MydoJob mydoJob1 = mydoJobs.get(0);
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob1.getTaskNo(),1,1); int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob1.getTaskNo(),1,1);
if (i == 1) { if (i == 1) {
mydoJob1.setExecutionPhase(TASK_EP_SSJ); mydoJob1.setExecutionPhase(TASK_EP_SSJ);
mydoJob1.setStatus("3"); mydoJob1.setStatus("3");
mydoJobService.updateMydoJob(mydoJob1); mydoJobService.updateMydoJob(mydoJob1);
log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:{}" , mydoJob1.getTaskNo()); log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:{}" , mydoJob1.getTaskNo());
} }
}else{ }else{
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("trayCode",ssjDevice.getTrayCode()); map.put("trayCode",ssjDevice.getTrayCode());
@@ -310,10 +433,10 @@ public class PortConvThread implements Runnable {
if(ajaxResult.isSuccess()){ if(ajaxResult.isSuccess()){
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class); MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
mydoJob2.setStatus("1"); mydoJob2.setStatus("1");
mydoJob2.setExecutionPhase(TASK_EP_CREATE); mydoJob2.setExecutionPhase(TASK_EP_CREATED);
mydoJob2.setCreateTime(new Date()); mydoJob2.setCreateTime(new Date());
mydoJob2.setFaultFlag("0"); mydoJob2.setFaultFlag("0");
mydoJob2.setPriority(Long.valueOf(10)); mydoJob2.setPriority(10L);
mydoJobService.insertMydoJob(mydoJob2); mydoJobService.insertMydoJob(mydoJob2);
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1); int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
if (i == 1) { if (i == 1) {
@@ -334,6 +457,20 @@ public class PortConvThread implements Runnable {
} }
public void outDispatch(DeviceSsj ssjDevice) {
//出库完成
finishStockoutMydoJob(ssjDevice);
}
private static final Map<String, Pattern> PATTERNS = createPatterns(); private static final Map<String, Pattern> PATTERNS = createPatterns();
private static Map<String, Pattern> createPatterns() { private static Map<String, Pattern> createPatterns() {
@@ -356,4 +493,5 @@ public class PortConvThread implements Runnable {
Matcher m = pattern.matcher(input); Matcher m = pattern.matcher(input);
return m.find() ? m.group(1) : null; return m.find() ? m.group(1) : null;
} }
} }

View File

@@ -9,6 +9,7 @@ import cn.hutool.core.util.ObjUtil;
import com.ruoyi.api.service.IApiService; import com.ruoyi.api.service.IApiService;
import com.ruoyi.bas.cargospace.domain.BasCargoSpace; import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService; import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
import com.ruoyi.common.TaskType;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.device.ssj.domain.DeviceSsj; import com.ruoyi.device.ssj.domain.DeviceSsj;
@@ -22,8 +23,9 @@ import lombok.extern.slf4j.Slf4j;
import java.util.*; import java.util.*;
import static com.ruoyi.common.ConvType.*;
import static com.ruoyi.common.TaskStatusCode.*; import static com.ruoyi.common.TaskStatusCode.*;
import static com.ruoyi.common.TaskType.DDJ_RWLX_1; import static com.ruoyi.common.TaskType.*;
/** /**
* 巷道口输送机(堆垛机取放位)线程 检测当前巷道有没有入库作业,没有作业,生成堆垛机出库队列 * 巷道口输送机(堆垛机取放位)线程 检测当前巷道有没有入库作业,没有作业,生成堆垛机出库队列
@@ -53,7 +55,8 @@ public class RoadConvThread implements Runnable {
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class); basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class); ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
//初始化巷道口 排 列 层 //初始化巷道口 排 列 层
roadwayMap.put("L1001", Arrays.asList(2, 0, 1)); //todo 核对堆垛机取放位置的货位编码
roadwayMap.put("L1001", Arrays.asList(2, 1, 1));
// roadwayMap.put("L1004", Arrays.asList(4, 0, 1)); // roadwayMap.put("L1004", Arrays.asList(4, 0, 1));
log.info("初始化服务 {},{}", apiService, agvQueueService); log.info("初始化服务 {},{}", apiService, agvQueueService);
} }
@@ -91,119 +94,146 @@ public class RoadConvThread implements Runnable {
public void inDispatch(DeviceSsj roadSsjDevice) { public void inDispatch(DeviceSsj roadSsjDevice) {
//巷道口到位,且任务号大于1000
sendStackerIn(roadSsjDevice);
sendStackerOut(roadSsjDevice);
}
/**
* 向堆垛机发送【入库】任务
* @param roadSsjDevice
*/
private void sendStackerIn(DeviceSsj roadSsjDevice){
//模拟数据
// roadSsjDevice.setDw(1);
// roadSsjDevice.setTaskNo(85012);
//---------------------------入库任务---------------------------
//巷道口输送机到位,且任务号大于1000
if (roadSsjDevice.getDw()==1 && roadSsjDevice.getTaskNo()>1000) { if (roadSsjDevice.getDw()==1 && roadSsjDevice.getTaskNo()>1000) {
//根据输送机【任务号】查找当前执行的入库任务
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(roadSsjDevice.getTaskNo())); MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(roadSsjDevice.getTaskNo()));
if(ObjUtil.isNotNull(mydoJob)){ if(ObjUtil.isNotNull(mydoJob)){
if(mydoJob.getCargoSpaceId() == null || "".equals(mydoJob.getCargoSpaceId())){
AjaxResult ajaxResult = apiService.requestWmsSpace(mydoJob); //如果任务存在 - 表示该任务已经巷道口输送到位
if(ajaxResult.isSuccess()){ //更新任务阶段【巷道口入库到位】
BasCargoSpace space = BeanUtil.toBean(ajaxResult.get("data"), BasCargoSpace.class); if(mydoJob.getExecutionPhase().equals(TASK_EP_SSJ)){
String cargoSpaceId = space.getCargoSpaceId(); mydoJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ);
mydoJob.setCargoSpaceId(cargoSpaceId); mydoJobService.updateMydoJob(mydoJob);
mydoJobService.updateMydoJob(mydoJob);
}
} }
if(mydoJob.getCargoSpaceId()!=null && !"".equals(mydoJob.getCargoSpaceId())){
if(mydoJob.getExecutionPhase().equals(TASK_EP_SSJ)){
mydoJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ);
mydoJobService.updateMydoJob(mydoJob);
}
if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)
&& Convert.toInt(mydoJob.getInOrOut()) < 20) {
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_1, Convert.toInt(mydoJob.getRoadwayId()));
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());
if (CollUtil.isEmpty(ddjDeviceExecutionQueues) && ObjUtil.isNotNull(basCargoSpace) && CollUtil.isNotEmpty(pclList)) {
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
ddjDeviceExecutionQueue.setRwh(Convert.toLong(mydoJob.getTaskNo()));
ddjDeviceExecutionQueue.setDevName(mydoJob.getRoadwayId());
ddjDeviceExecutionQueue.setDevId(Convert.toInt(mydoJob.getRoadwayId()));
ddjDeviceExecutionQueue.setRwzt(0);
ddjDeviceExecutionQueue.setYph(pclList.get(0));
ddjDeviceExecutionQueue.setYlh(pclList.get(1));
ddjDeviceExecutionQueue.setYch(pclList.get(2));
ddjDeviceExecutionQueue.setMbph(Convert.toInt(basCargoSpace.getThePlatoon()));
ddjDeviceExecutionQueue.setMblh(Convert.toInt(basCargoSpace.getTheColumn()));
ddjDeviceExecutionQueue.setMbch(Convert.toInt(basCargoSpace.getTheFloor()));
ddjDeviceExecutionQueue.setDdjxf("0");
ddjDeviceExecutionQueue.setMlfs(5);
ddjDeviceExecutionQueue.setSpare1(mydoJob.getTraySize());
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_1);
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
mydoJob.setExecutionPhase(TASK_EP_DDJ); // 检查任务属性:【任务已存在】、执行阶段-【巷道口输送机到位】、任务类型-【入库】 → 下发堆垛机执行队列
mydoJobService.updateMydoJob(mydoJob); if (mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ) && Convert.toInt(mydoJob.getInOrOut()) < 20) {
}
}
}
}
}
if(roadSsjDevice.getKx()==1 && roadSsjDevice.getTaskNo() == 0){ //检查堆垛机是否在正在执行中/已经有执行队列
// List<String> exitList = new ArrayList<>(); List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_3, Convert.toInt(mydoJob.getRoadwayId()));
// if("L1002".equals(roadSsjDevice.getDeviceCode())){
// exitList.add("L1001");
// }
// if("L1004".equals(roadSsjDevice.getDeviceCode())){
// exitList.add("L1003");
// }
// List<MydoJob> inList = mydoJobService.getInJobByEntrance(exitList);
String exitId = "";
if("L1002".equals(roadSsjDevice.getDeviceCode())){
exitId = "L1001";
}
if("L1004".equals(roadSsjDevice.getDeviceCode())){
exitId = "L1003";
}
List<MydoJob> inList = mydoJobService.getInJobByEntranceId(exitId);
if(inList.size() == 0){
// MydoJob mydoJob = mydoJobService.selectMydoJobByExitList(exitList);
MydoJob mydoJob = mydoJobService.selectMydoJobByExitId(exitId);
if (ObjUtil.isNotNull(mydoJob)) {
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId()); BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
if (ObjUtil.isNull(basCargoSpace)) { List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());
log.error("货位不存在 cargoSpaceId{}", mydoJob.getCargoSpaceId());
} else {
//生成队列
List<DdjDeviceExecutionQueue> list = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_1, Convert.toInt(mydoJob.getRoadwayId()));
List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());
if (CollUtil.isEmpty(list) && CollUtil.isNotEmpty(pclList)) {
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
ddjDeviceExecutionQueue.setRwh(Convert.toLong(mydoJob.getTaskNo()));
ddjDeviceExecutionQueue.setDevName(mydoJob.getRoadwayId());
ddjDeviceExecutionQueue.setDevId(Convert.toInt(mydoJob.getRoadwayId()));
ddjDeviceExecutionQueue.setRwzt(0);
ddjDeviceExecutionQueue.setYph(Convert.toInt(basCargoSpace.getThePlatoon()));
ddjDeviceExecutionQueue.setYlh(Convert.toInt(basCargoSpace.getTheColumn()));
ddjDeviceExecutionQueue.setYch(Convert.toInt(basCargoSpace.getTheFloor()));
ddjDeviceExecutionQueue.setMbph(pclList.get(0));
ddjDeviceExecutionQueue.setMblh(pclList.get(1));
ddjDeviceExecutionQueue.setMbch(pclList.get(2));
ddjDeviceExecutionQueue.setDdjxf("0");
ddjDeviceExecutionQueue.setMlfs(5);
ddjDeviceExecutionQueue.setSpare1(mydoJob.getTraySize());
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_1);
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
//修改作业状态 //生成堆垛机执行队列
mydoJob.setStatus(TASK_STATUS_RUNNING); if (CollUtil.isEmpty(ddjDeviceExecutionQueues) && ObjUtil.isNotNull(basCargoSpace) && CollUtil.isNotEmpty(pclList)) {
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
ddjDeviceExecutionQueue.setRwh(Convert.toLong(mydoJob.getTaskNo()));
ddjDeviceExecutionQueue.setDevName(mydoJob.getRoadwayId());
ddjDeviceExecutionQueue.setDevId(Convert.toInt(mydoJob.getRoadwayId()));
ddjDeviceExecutionQueue.setRwzt(0);
ddjDeviceExecutionQueue.setYph(pclList.get(0));
ddjDeviceExecutionQueue.setYlh(pclList.get(1));
ddjDeviceExecutionQueue.setYch(pclList.get(2));
ddjDeviceExecutionQueue.setMbph(Convert.toInt(basCargoSpace.getThePlatoon()));
ddjDeviceExecutionQueue.setMblh(Convert.toInt(basCargoSpace.getTheColumn()));
ddjDeviceExecutionQueue.setMbch(Convert.toInt(basCargoSpace.getTheFloor()));
ddjDeviceExecutionQueue.setDdjxf("0");
ddjDeviceExecutionQueue.setMlfs(5);
ddjDeviceExecutionQueue.setSpare1(mydoJob.getTraySize());//货物高度
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_3);
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
if (ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueue).size() > 0){
//下发后更新任务阶段
mydoJob.setExecutionPhase(TASK_EP_DDJ); mydoJob.setExecutionPhase(TASK_EP_DDJ);
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
mydoJobService.updateMydoJob(mydoJob); mydoJobService.updateMydoJob(mydoJob);
} }
} }
} }
}else{
log.info("当前出口"+ exitId+"存在入库任务,无法出库!");
} }
} }
}
/**
* 向堆垛机发送【出库】任务
* @param roadSsjDevice
*/
private void sendStackerOut(DeviceSsj roadSsjDevice){
//---------------------------出库任务---------------------------
//检查巷道口输送机是否空闲
if(roadSsjDevice.getKx()!=1 || roadSsjDevice.getTaskNo() != 0) return;
//检查是否有入口是【TD1001-出库到位输送机】的入库任务 - 此处查询作用:如果已经有入库任务,则只可生成出库作业,不可生成堆垛机队列
String exitId = CONV_STOCKOUT;
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
new MydoJob().builder().inOrOut(STOCKIN).build()
);
if(jobs.size() != 0) {
log.info("【提示】当前出口"+ exitId +"有正在执行的任务,无法执行堆垛机出库,请等待执行的入库任务结束");
return;
}
//检查是否有出库任务
MydoJob mydoJob = mydoJobService.selectMydoJobByExitId(exitId);
if (ObjUtil.isNotNull(mydoJob)) {
//如果有出库任务 - 检查货位编码是否合法
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
if (ObjUtil.isNull(basCargoSpace)) {
log.error("【任务异常】货位不存在 cargoSpaceId{}", mydoJob.getCargoSpaceId());
return;
}
//生成队列
List<DdjDeviceExecutionQueue> list = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_2, Convert.toInt(mydoJob.getRoadwayId()));
List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());
if (CollUtil.isEmpty(list) && CollUtil.isNotEmpty(pclList)) {
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
ddjDeviceExecutionQueue.setRwh(Convert.toLong(mydoJob.getTaskNo()));
ddjDeviceExecutionQueue.setDevName(mydoJob.getRoadwayId());
ddjDeviceExecutionQueue.setDevId(Convert.toInt(mydoJob.getRoadwayId()));
ddjDeviceExecutionQueue.setRwzt(0);
ddjDeviceExecutionQueue.setYph(Convert.toInt(basCargoSpace.getThePlatoon()));
ddjDeviceExecutionQueue.setYlh(Convert.toInt(basCargoSpace.getTheColumn()));
ddjDeviceExecutionQueue.setYch(Convert.toInt(basCargoSpace.getTheFloor()));
ddjDeviceExecutionQueue.setMbph(pclList.get(0));
ddjDeviceExecutionQueue.setMblh(pclList.get(1));
ddjDeviceExecutionQueue.setMbch(pclList.get(2));
ddjDeviceExecutionQueue.setDdjxf("0");
ddjDeviceExecutionQueue.setMlfs(5);
ddjDeviceExecutionQueue.setSpare1(mydoJob.getTraySize());//货物高度
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_2);
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
//修改作业状态
mydoJob.setStatus(TASK_STATUS_RUNNING);
mydoJob.setExecutionPhase(TASK_EP_DDJ);
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
mydoJobService.updateMydoJob(mydoJob);
}
}
} }
} }

View File

@@ -12,9 +12,9 @@ spring:
# password: Flrd0914. # password: Flrd0914.
# 本机 # 本机
url: jdbc:sqlserver://localhost:1433;databaseName=FT568-wcs;encrypt=true;trustServerCertificate=true; url: jdbc:sqlserver://127.0.0.1:1433;databaseName=FT568-wcs;encrypt=true;trustServerCertificate=true;
username: sa username: sa
password: 123456 password: Aa123456
# 生产 # 生产
# url: jdbc:sqlserver://192.168.58.10:1433;databaseName=FT568-wcs;encrypt=true;trustServerCertificate=true; # url: jdbc:sqlserver://192.168.58.10:1433;databaseName=FT568-wcs;encrypt=true;trustServerCertificate=true;

View File

@@ -41,7 +41,7 @@ logging:
user: user:
password: password:
# 密码最大错误次数 # 密码最大错误次数
maxRetryCount: 5 maxRetryCount: 10
# 密码锁定时间(默认10分钟) # 密码锁定时间(默认10分钟)
lockTime: 10 lockTime: 10
@@ -107,6 +107,18 @@ mybatis:
# 加载全局的配置文件 # 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml configLocation: classpath:mybatis/mybatis-config.xml
#MybatisPlus
#mybatis-plus:
# # Mapper XML 扫描路径(若你用了 XML)
# mapper-locations: classpath*:mapper/**/*Mapper.xml
# # 实体类别名包(让 XML 中能用 User 而非全限定名)
# type-aliases-package: com.ruoyi.**.domain
# configuration:
# map-underscore-to-camel-case: true
# cache-enabled: false
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# interceptor: com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
# PageHelper分页插件 # PageHelper分页插件
pagehelper: pagehelper:
helperDialect: sqlserver helperDialect: sqlserver
@@ -128,3 +140,4 @@ xss:
excludes: /system/notice excludes: /system/notice
# 匹配链接 # 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/* urlPatterns: /system/*,/monitor/*,/tool/*

View File

@@ -24,6 +24,7 @@
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
<charset>UTF-8</charset>
</encoder> </encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 --> <!-- 过滤的级别 -->
@@ -46,6 +47,7 @@
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
<charset>UTF-8</charset>
</encoder> </encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 --> <!-- 过滤的级别 -->
@@ -57,6 +59,29 @@
</filter> </filter>
</appender> </appender>
<appender name="file_warn" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-warn.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-warn.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
<charset>UTF-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>WARN</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 用户访问日志输出 --> <!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file> <file>${log.path}/sys-user.log</file>
@@ -83,6 +108,7 @@
<!--系统操作日志--> <!--系统操作日志-->
<root level="info"> <root level="info">
<appender-ref ref="file_info" /> <appender-ref ref="file_info" />
<appender-ref ref="file_warn" />
<appender-ref ref="file_error" /> <appender-ref ref="file_error" />
</root> </root>

View File

@@ -60,6 +60,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="selectDeviceSsjByDeviceCode" parameterType="string" resultMap="DeviceSsjResult">
<include refid="selectDeviceSsjVo"/>
where device_code = #{deviceCode}
</select>
<insert id="insertDeviceSsj" parameterType="DeviceSsj" useGeneratedKeys="true" keyProperty="id"> <insert id="insertDeviceSsj" parameterType="DeviceSsj" useGeneratedKeys="true" keyProperty="id">
insert into device_ssj insert into device_ssj
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@@ -29,6 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRequestLogList" parameterType="RequestLog" resultMap="RequestLogResult"> <select id="selectRequestLogList" parameterType="RequestLog" resultMap="RequestLogResult">
<include refid="selectRequestLogVo"/> <include refid="selectRequestLogVo"/>
<where> <where>
<!-- 只查最近14天 -->
and request_time >= DATEADD(DAY, -14, CAST(GETDATE() AS DATE))
<if test="requestTime != null and requestTime != ''"> and request_time = #{requestTime}</if> <if test="requestTime != null and requestTime != ''"> and request_time = #{requestTime}</if>
<if test="sourceSystem != null and sourceSystem != ''"> and source_system = #{sourceSystem}</if> <if test="sourceSystem != null and sourceSystem != ''"> and source_system = #{sourceSystem}</if>
<if test="targetSystem != null and targetSystem != ''"> and target_system = #{targetSystem}</if> <if test="targetSystem != null and targetSystem != ''"> and target_system = #{targetSystem}</if>
@@ -47,6 +49,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by request_time desc order by request_time desc
</select> </select>
<select id="selectRequestLogByLatestTask" resultMap="RequestLogResult">
select top 1 request_id, request_time, source_system, target_system, endpoint, request_url, request_method, request_headers, request_body, response_time, response_body, response_status, error_details, duration, Is_successful from request_log
order by request_time desc
</select>
<select id="selectRequestLogByRequestId" parameterType="Long" resultMap="RequestLogResult"> <select id="selectRequestLogByRequestId" parameterType="Long" resultMap="RequestLogResult">
<include refid="selectRequestLogVo"/> <include refid="selectRequestLogVo"/>
where request_id = #{requestId} where request_id = #{requestId}
@@ -121,4 +128,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{requestId} #{requestId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@@ -8,16 +8,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id" /> <result property="id" column="id" />
<result property="type" column="type" /> <result property="type" column="type" />
<result property="taskNo" column="task_no" /> <result property="taskNo" column="task_no" />
<result property="mydojobId" column="mydojob_id" /> <result property="mydoJobId" column="mydoJob_Id" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<!-- <result property="spare1" column="spare1" />--> <result property="reqCode" column="req_code" />
<!-- <result property="spare2" column="spare2" />--> <result property="taskTypeCode" column="task_type_code" />
<!-- <result property="spare3" column="spare3" />--> <result property="taskCode" column="task_code" />
<result property="retry" column="retry" />
</resultMap> </resultMap>
<sql id="selectJobCallBackVo"> <sql id="selectJobCallBackVo">
select id, type, task_no, mydojob_id, status, create_time from job_call_back select id, type, task_no, mydoJob_Id, status, create_time, req_code, task_type_code, task_code, retry from job_call_back
</sql> </sql>
<select id="selectJobCallBackList" parameterType="JobCallBack" resultMap="JobCallBackResult"> <select id="selectJobCallBackList" parameterType="JobCallBack" resultMap="JobCallBackResult">
@@ -25,11 +26,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="type != null and type != ''"> and type = #{type}</if> <if test="type != null and type != ''"> and type = #{type}</if>
<if test="taskNo != null "> and task_no = #{taskNo}</if> <if test="taskNo != null "> and task_no = #{taskNo}</if>
<if test="mydojobId != null and mydojobId != ''"> and mydojob_id = #{mydojobId}</if> <if test="mydoJobId != null and mydoJobId != ''"> and mydoJob_Id = #{mydoJobId}</if>
<if test="status != null and status != ''"> and status = #{status}</if> <if test="status != null and status != ''"> and status = #{status}</if>
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if> <if test="reqCode != null and reqCode != ''"> and req_code = #{reqCode}</if>
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if> <if test="taskTypeCode != null and taskTypeCode != ''"> and task_type_code = #{taskTypeCode}</if>
<if test="spare3 != null and spare3 != ''"> and spare3 = #{spare3}</if> <if test="taskCode != null and taskCode != ''"> and task_code = #{taskCode}</if>
<if test="retry != null and retry != ''"> and retry = #{retry}</if>
</where> </where>
</select> </select>
@@ -39,30 +42,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectJobCallBackListNoSuccess" resultMap="JobCallBackResult"> <select id="selectJobCallBackListNoSuccess" resultMap="JobCallBackResult">
<include refid="selectJobCallBackVo"/> <include refid="selectJobCallBackVo"/>
where status != '1' where status != '1' and retry &lt; 10
</select> </select>
<insert id="insertJobCallBack" parameterType="JobCallBack" useGeneratedKeys="true" keyProperty="id"> <insert id="insertJobCallBack" parameterType="JobCallBack" useGeneratedKeys="false" keyProperty="id">
insert into job_call_back insert into job_call_back
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="taskNo != null">task_no,</if> <if test="taskNo != null">task_no,</if>
<if test="mydojobId != null">mydojob_id,</if> <if test="mydoJobId != null">mydoJob_Id,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<!-- <if test="spare1 != null">spare1,</if>--> <if test="reqCode != null">req_code,</if>
<!-- <if test="spare2 != null">spare2,</if>--> <if test="taskTypeCode != null">task_type_code,</if>
<!-- <if test="spare3 != null">spare3,</if>--> <if test="taskCode != null">task_code,</if>
<if test="retry != null">retry,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="taskNo != null">#{taskNo},</if> <if test="taskNo != null">#{taskNo},</if>
<if test="mydojobId != null">#{mydojobId},</if> <if test="mydoJobId != null">#{mydoJobId},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<!-- <if test="spare1 != null">#{spare1},</if>--> <if test="reqCode != null">#{reqCode},</if>
<!-- <if test="spare2 != null">#{spare2},</if>--> <if test="taskTypeCode != null">#{taskTypeCode},</if>
<!-- <if test="spare3 != null">#{spare3},</if>--> <if test="taskCode != null">#{taskCode},</if>
<if test="retry != null">#{retry},</if>
</trim> </trim>
</insert> </insert>
@@ -71,12 +76,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="taskNo != null">task_no = #{taskNo},</if> <if test="taskNo != null">task_no = #{taskNo},</if>
<if test="mydojobId != null">mydojob_id = #{mydojobId},</if> <if test="mydoJobId != null">mydoJob_Id = #{mydoJobId},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<!-- <if test="spare1 != null">spare1 = #{spare1},</if>--> <if test="reqCode != null">req_code = #{reqCode},</if>
<!-- <if test="spare2 != null">spare2 = #{spare2},</if>--> <if test="taskTypeCode != null">task_type_code = #{taskTypeCode},</if>
<!-- <if test="spare3 != null">spare3 = #{spare3},</if>--> <if test="taskCode != null">task_code = #{taskCode},</if>
<if test="retry != null">retry = #{retry},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@@ -93,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<select id="getTopJobCallBack" resultMap="JobCallBackResult"> <select id="getTopJobCallBack" resultMap="JobCallBackResult">
select top(1) id, type, task_no, mydojob_id, status, create_timefrom job_call_back select top(1) id, type, task_no, mydoJob_Id, status, create_time,req_code,task_type_code,task_code,retry from job_call_back
where status = '0' and spare1 in ('0','1','2') where status = '0' and spare1 in ('0','1','2')
order by create_time asc order by create_time asc
</select> </select>

View File

@@ -31,10 +31,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectMydoJobVo"> <sql id="selectMydoJobVo">
select job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag,tray_code,tray_size,wms_task_no from mydo_job_wcs select job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag,tray_code,tray_size,wms_task_no from mydo_job_wcs
</sql> </sql>
<sql id="selectMydoJobVoTop">
select top 1 job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag,tray_code,tray_size,wms_task_no from mydo_job_wcs
</sql>
<sql id="selectMydoJobFinishVo"> <sql id="selectMydoJobFinishVo">
select job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag,tray_code,tray_size,wms_task_no from mydo_job_wcs_finish select job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag,tray_code,tray_size,wms_task_no from mydo_job_wcs_finish
</sql> </sql>
<sql id="selectMydoJobUnion">
SELECT * FROM (
SELECT
job_id,status,task_no,roadway_id,cargo_space_id,target_roadway_id,target_cargo_space_id,priority,execution_phase,in_or_out,create_time,start_time,finish_time,entrance_id,exit_id,warehouse_id,fault_flag,flag,tray_code,tray_size,wms_task_no,'mydo_job_wcs' AS source_table
FROM mydo_job_wcs
UNION ALL
SELECT
job_id,status,task_no,roadway_id,cargo_space_id,target_roadway_id,target_cargo_space_id,priority,execution_phase,in_or_out,create_time,start_time,finish_time,entrance_id,exit_id,warehouse_id,fault_flag,flag,tray_code,tray_size,wms_task_no,'mydo_job_wcs_finish' AS source_table
FROM mydo_job_wcs_finish
)
AS combined_jobs
</sql>
<select id="selectMydoJobUnionList" parameterType="MydoJob" resultMap="MydoJobResult">
<include refid="selectMydoJobUnion"/>
<where>
<if test="status != null and status != ''">and status = #{status}</if>
<if test="taskNo != null and taskNo != ''">and task_no = #{taskNo}</if>
<if test="roadwayId != null and roadwayId != ''">and roadway_id = #{roadwayId}</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''">and cargo_space_id = #{cargoSpaceId}</if>
<if test="targetRoadwayId != null and targetRoadwayId != ''">and target_roadway_id = #{targetRoadwayId}
</if>
<if test="targetCargoSpaceId != null and targetCargoSpaceId != ''">and target_cargo_space_id =
#{targetCargoSpaceId}
</if>
<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 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>
<if test="faultFlag != null and faultFlag != ''">and fault_flag = #{faultFlag}</if>
<if test="flag != null and flag != ''">and flag = #{flag}</if>
<if test="trayCode != null and trayCode != ''">and tray_code = #{trayCode}</if>
<if test="traySize != null and traySize != ''">and traySize = #{tray_size}</if>
<if test="epList != null and epList.size() > 0">
and entrance_id in
<foreach item="item" index="index" collection="epList" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="wmsTaskNo != null and wmsTaskNo != ''">and wms_task_no = #{wmsTaskNo}</if>
</where>
ORDER BY create_time DESC,finish_time DESC;
</select>
<select id="selectMydoJobList" parameterType="MydoJob" resultMap="MydoJobResult"> <select id="selectMydoJobList" parameterType="MydoJob" resultMap="MydoJobResult">
<include refid="selectMydoJobVo"/> <include refid="selectMydoJobVo"/>
<where> <where>
@@ -273,13 +324,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectMydoJobByExitId" parameterType="java.lang.String" resultMap="MydoJobResult"> <select id="selectMydoJobByExitId" parameterType="java.lang.String" resultMap="MydoJobResult">
select TOP 1 job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag, tray_code from mydo_job_wcs select TOP 1 job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag, wms_task_no, tray_code, tray_size, flag from mydo_job_wcs
where exit_id = #{exitId} where exit_id = #{exitId}
and in_or_out &gt; 20 and in_or_out = 2
and status = 1 and execution_phase= 0 and status = 1 and execution_phase= 0
order by priority asc,create_time asc order by priority asc,create_time asc
</select> </select>
<select id="selectMydoJobByWmsTaskNo" parameterType="java.lang.String" resultMap="MydoJobResult">
<include refid="selectMydoJobVo"/>
where wms_task_no = #{wmsTaskNo}
</select>
<select id="selectMydoJobFinishList" resultMap="MydoJobResult"> <select id="selectMydoJobFinishList" resultMap="MydoJobResult">
<include refid="selectMydoJobFinishVo"/> <include refid="selectMydoJobFinishVo"/>
<where> <where>
@@ -289,7 +345,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and cargo_space_id = #{cargoSpaceId}</if> <if test="cargoSpaceId != null and cargoSpaceId != ''"> and cargo_space_id = #{cargoSpaceId}</if>
<if test="targetRoadwayId != null and targetRoadwayId != ''"> and target_roadway_id = #{targetRoadwayId}</if> <if test="targetRoadwayId != null and targetRoadwayId != ''"> and target_roadway_id = #{targetRoadwayId}</if>
<if test="targetCargoSpaceId != null and targetCargoSpaceId != ''"> and target_cargo_space_id = #{targetCargoSpaceId}</if> <if test="targetCargoSpaceId != null and targetCargoSpaceId != ''"> and target_cargo_space_id = #{targetCargoSpaceId}</if>
<if test="priority != null "> and priority = #{priority}</if> <if test="priority != null and priority != '' "> and priority = #{priority}</if>
<if test="executionPhase != null and executionPhase != ''"> and execution_phase = #{executionPhase}</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="inOrOut != null and inOrOut != ''"> and in_or_out = #{inOrOut}</if>
<if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if> <if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
@@ -303,6 +359,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="traySize != null and traySize != ''"> and tray_size = #{traySize}</if> <if test="traySize != null and traySize != ''"> and tray_size = #{traySize}</if>
<if test="wmsTaskNo != null and wmsTaskNo != ''">and wms_task_no = #{wmsTaskNo}</if> <if test="wmsTaskNo != null and wmsTaskNo != ''">and wms_task_no = #{wmsTaskNo}</if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectRunningMydoJobByExitList" resultMap="MydoJobResult"> <select id="selectRunningMydoJobByExitList" resultMap="MydoJobResult">
select TOP 1 job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag,tray_size,tray_code from mydo_job_wcs select TOP 1 job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag,tray_size,tray_code from mydo_job_wcs

View File

@@ -61,6 +61,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where uuid = #{uuid} where uuid = #{uuid}
</select> </select>
<select id="selectDdjDeviceExecutionQueueFinishByTaskNo" parameterType="String" resultMap="DdjDeviceExecutionQueueFinishResult">
<include refid="selectDdjDeviceExecutionQueueFinishVo"/>
where rwh = #{taskNo}
</select>
<insert id="insertDdjDeviceExecutionQueueFinish" parameterType="DdjDeviceExecutionQueueFinish"> <insert id="insertDdjDeviceExecutionQueueFinish" parameterType="DdjDeviceExecutionQueueFinish">
insert into ddj_device_execution_queue_finish insert into ddj_device_execution_queue_finish
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@@ -61,6 +61,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDdjDeviceExecutionQueueVo"/> <include refid="selectDdjDeviceExecutionQueueVo"/>
where uuid = #{uuid} where uuid = #{uuid}
</select> </select>
<select id="selectDdjDeviceExecutionQueueByTaskNo" parameterType="String" resultMap="DdjDeviceExecutionQueueResult">
<include refid="selectDdjDeviceExecutionQueueVo"/>
where rwh = #{taskNo}
</select>
<select id="selectDdjDeviceExecutionQueueListByRwlx" <select id="selectDdjDeviceExecutionQueueListByRwlx"
resultMap="DdjDeviceExecutionQueueResult"> resultMap="DdjDeviceExecutionQueueResult">
<include refid="selectDdjDeviceExecutionQueueVo"/> <include refid="selectDdjDeviceExecutionQueueVo"/>
@@ -153,6 +159,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from ddj_device_execution_queue where uuid = #{uuid} delete from ddj_device_execution_queue where uuid = #{uuid}
</delete> </delete>
<delete id="deleteDdjDeviceExecutionQueueByTaskNo" parameterType="String">
delete from ddj_device_execution_queue where rwh = #{taskNo}
</delete>
<delete id="deleteDdjDeviceExecutionQueueByUuids" parameterType="String"> <delete id="deleteDdjDeviceExecutionQueueByUuids" parameterType="String">
delete from ddj_device_execution_queue where uuid in delete from ddj_device_execution_queue where uuid in
<foreach item="uuid" collection="array" open="(" separator="," close=")"> <foreach item="uuid" collection="array" open="(" separator="," close=")">

View File

@@ -129,6 +129,12 @@
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-annotation</artifactId>
<version>3.5.14</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@@ -146,7 +146,7 @@ public class BaseController
*/ */
protected AjaxResult toAjax(int rows) protected AjaxResult toAjax(int rows)
{ {
return rows > 0 ? AjaxResult.success() : AjaxResult.error(); return rows != 0 ? AjaxResult.success() : AjaxResult.error();
} }
/** /**

View File

@@ -7,12 +7,17 @@ import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
/** /**
* Entity基类 * Entity基类
* *
* @author ruoyi * @author ruoyi
*/ */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class BaseEntity implements Serializable public class BaseEntity implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -64,7 +69,7 @@ public class BaseEntity implements Serializable
public Date getCreateTime() public Date getCreateTime()
{ {
return createTime; return new Date();
} }
public void setCreateTime(Date createTime) public void setCreateTime(Date createTime)

View File

@@ -119,9 +119,9 @@ public class SecurityConfig
.antMatchers("/agv/api/**").permitAll() .antMatchers("/agv/api/**").permitAll()
.antMatchers("/device/api/**").permitAll() .antMatchers("/device/api/**").permitAll()
.antMatchers("/wcs2Wms/api/**").permitAll() .antMatchers("/wcs2Wms/api/**").permitAll()
.antMatchers("/largeScreen/monitor/**").permitAll() .antMatchers("/largeScreen/monitor/**").permitAll();
// 除上面外的所有请求全部需要鉴权认证 // 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated(); // .anyRequest().authenticated();
}) })
// 添加Logout filter // 添加Logout filter
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler)) .logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))

View File

@@ -2,285 +2,88 @@
"boxRows": [ "boxRows": [
{ {
"id": "row1", "id": "row1",
"boxWidth": 20, "boxWidth": 30,
"boxHeight": 17, "boxHeight": 30,
"boxCount": 46, "boxCount": 33,
"rowGap": 0 "rowGap": 0
}, },
{ {
"id": "row2", "id": "row2",
"boxWidth": 20, "boxWidth": 30,
"boxHeight": 17, "boxHeight": 30,
"boxCount": 46, "boxCount": 33,
"rowGap": 30 "rowGap": 40
},
{
"id": "row3",
"boxWidth": 12,
"boxHeight": 20,
"boxCount": 69,
"rowGap": 10
},
{
"id": "row4",
"boxWidth": 12,
"boxHeight": 20,
"boxCount": 69,
"rowGap": 30
},
{
"id": "row1_1",
"boxWidth": 20,
"boxHeight": 17,
"boxCount": 46,
"rowGap": 200
},
{
"id": "row2_1",
"boxWidth": 20,
"boxHeight": 17,
"boxCount": 46,
"rowGap": 30
},
{
"id": "row3_1",
"boxWidth": 12,
"boxHeight": 20,
"boxCount": 69,
"rowGap": 10
},
{
"id": "row4_1",
"boxWidth": 12,
"boxHeight": 20,
"boxCount": 69,
"rowGap": 30
} }
], ],
"conveyors": [ "conveyors": [
{
"id": "L1002",
"width": 45,
"height": 25,
"rotation": 0,
"x": 362,
"y": 330
},
{ {
"id": "L1001", "id": "L1001",
"width": 45, "width": 80,
"height": 25, "height": 30,
"rotation": 0, "rotation": 0,
"x": 316, "x": 317,
"y": 330 "y": 563
}, },
{ {
"id": "L1011", "id": "G1002",
"width": 30, "width": 80,
"height": 25, "height": 30,
"rotation": 0, "rotation": 0,
"x": 285, "x": 232,
"y": 330 "y": 563
},
{
"id": "L1004",
"width": 45,
"height": 25,
"rotation": 0,
"x": 362,
"y": 415
},
{
"id": "L1003",
"width": 45,
"height": 25,
"rotation": 0,
"x": 316,
"y": 415
},
{
"id": "L1012",
"width": 30,
"height": 25,
"rotation": 0,
"x": 285,
"y": 415
},
{
"id": "L2001",
"width": 45,
"height": 25,
"rotation": 0,
"x": 1513,
"y": 638
},
{
"id": "L2002",
"width": 45,
"height": 25,
"rotation": 0,
"x": 1559,
"y": 638
},
{
"id": "L2003",
"width": 45,
"height": 25,
"rotation": 0,
"x": 1513,
"y": 689
},
{
"id": "L2004",
"width": 45,
"height": 25,
"rotation": 0,
"x": 1559,
"y": 689
},
{
"id": "L2012",
"width": 30,
"height": 25,
"rotation": 0,
"x": 1605,
"y": 689
},
{
"id": "L2005",
"width": 45,
"height": 25,
"rotation": 0,
"x": 1513,
"y": 722
},
{
"id": "L2006",
"width": 50,
"height": 25,
"rotation": 0,
"x": 1559,
"y": 722
},
{
"id": "L1013",
"width": 25,
"height": 25,
"rotation": 0,
"x": 1610,
"y": 722
},
{
"id": "L2007",
"width": 45,
"height": 25,
"rotation": 0,
"x": 1513,
"y": 776
},
{
"id": "L2008",
"width": 45,
"height": 25,
"rotation": 0,
"x": 1559,
"y": 776
} }
], ],
"stackers": [ "stackers": [
{ {
"id": "1", "id": "1",
"width": 60, "width": 70,
"height": 28, "height": 35,
"rotation": 0, "rotation": 0,
"x": 441, "x": 441,
"y": 302, "y": 522,
"shelfId": "row1" "shelfId": "row1"
},
{
"id": "2",
"width": 60,
"height": 28,
"rotation": 0,
"x": 441,
"y": 388,
"shelfId": "row3"
} }
], ],
"tracks": [ "tracks": [
{ {
"id": "gd1", "id": "gd1",
"width": 1230, "width": 1350,
"height": 2, "height": 2,
"rotation": 0, "rotation": 0,
"x": 346, "x": 240,
"y": 314 "y": 539
},
{
"id": "gd2",
"width": 1230,
"height": 2,
"rotation": 0,
"x": 346,
"y": 400
},
{
"id": "gd1_1",
"width": 1230,
"height": 2,
"rotation": 0,
"x": 346,
"y": 676
},
{
"id": "gd2_1",
"width": 1230,
"height": 2,
"rotation": 0,
"x": 346,
"y": 760
} }
], ],
"rollerConveyors": [ "rollerConveyors": [
{ {
"id": "G1005", "id": "G1003",
"width": 20, "width": 40,
"height": 45, "height": 30,
"rotation": 90, "rotation": 0,
"x": 376, "x": 250,
"y": 463 "y": 597
}, },
{ {
"id": "G1006", "id": "G1004",
"width": 20, "width": 40,
"height": 45, "height": 45,
"rotation": 90, "rotation": 0,
"x": 423, "x": 250,
"y": 463 "y": 630
} }
], ],
"deviceDraggable": false, "deviceDraggable": false,
"editMode": false, "editMode": false,
"labels": [ "labels": [
{ {
"id": "bq", "id": "bq1",
"content": "二 层",
"fontSize": 24,
"fontColor": "#000000",
"bgColor": "#ffffff",
"borderRadius": 4,
"x": 882,
"y": 198
},
{
"id": "bq2",
"content": "一 层", "content": "一 层",
"fontSize": 24, "fontSize": 24,
"fontColor": "#000000", "fontColor": "#000000",
"bgColor": "#ffffff", "bgColor": "#ffffff",
"borderRadius": 4, "borderRadius": 4,
"x": 882, "x": 882,
"y": 562 "y": 200
}, },
{ {
"id": "bq3", "id": "bq3",
@@ -289,38 +92,8 @@
"fontColor": "#ffffff", "fontColor": "#ffffff",
"bgColor": "#006666", "bgColor": "#006666",
"borderRadius": 4, "borderRadius": 4,
"x": 189, "x": 150,
"y": 293 "y": 522
},
{
"id": "bq4",
"content": "一巷道",
"fontSize": 16,
"fontColor": "#ffffff",
"bgColor": "#006666",
"borderRadius": 4,
"x": 189,
"y": 658
},
{
"id": "bq5",
"content": "二巷道",
"fontSize": 16,
"fontColor": "#ffffff",
"bgColor": "#006666",
"borderRadius": 4,
"x": 189,
"y": 383
},
{
"id": "bq6",
"content": "二巷道",
"fontSize": 16,
"fontColor": "#ffffff",
"bgColor": "#006666",
"borderRadius": 4,
"x": 189,
"y": 743
} }
], ],
"titleSettings": { "titleSettings": {
@@ -335,7 +108,7 @@
"alarmSettings": { "alarmSettings": {
"width": 700, "width": 700,
"height": 40, "height": 40,
"scrollSpeed": 50, "scrollSpeed": 20,
"position": "bottom-center" "position": "bottom-center"
}, },
"apiSettings": { "apiSettings": {

View File

@@ -12,8 +12,8 @@
"ywz":"3", "ywz":"3",
"yc":"1", "yc":"1",
"mbp":"2", "mbp":"2",
"mbwz":"46", "mbwz":"33",
"mbc":"5" "mbc":"6"
},{ },{
"id":"2", "id":"2",
"name":"堆垛机", "name":"堆垛机",

View File

@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询堆垛机监控列表 // 查询堆垛机监控列表
export function listDdj(query) { export function listDdj(query) {
return request({ return request({
url: '/device/ddj/list', url: '/device/stacker/list',
method: 'get', method: 'get',
params: query params: query
}) })
@@ -12,7 +12,7 @@ export function listDdj(query) {
// 查询堆垛机监控详细 // 查询堆垛机监控详细
export function getDdj(id) { export function getDdj(id) {
return request({ return request({
url: '/device/ddj/' + id, url: '/device/stacker/' + id,
method: 'get' method: 'get'
}) })
} }
@@ -20,7 +20,7 @@ export function getDdj(id) {
// 新增堆垛机监控 // 新增堆垛机监控
export function addDdj(data) { export function addDdj(data) {
return request({ return request({
url: '/device/ddj', url: '/device/stacker',
method: 'post', method: 'post',
data: data data: data
}) })
@@ -29,7 +29,7 @@ export function addDdj(data) {
// 修改堆垛机监控 // 修改堆垛机监控
export function updateDdj(data) { export function updateDdj(data) {
return request({ return request({
url: '/device/ddj', url: '/device/stacker',
method: 'put', method: 'put',
data: data data: data
}) })
@@ -38,7 +38,7 @@ export function updateDdj(data) {
// 删除堆垛机监控 // 删除堆垛机监控
export function delDdj(id) { export function delDdj(id) {
return request({ return request({
url: '/device/ddj/' + id, url: '/device/stacker/' + id,
method: 'delete' method: 'delete'
}) })
} }

View File

@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询输送机列表 // 查询输送机列表
export function listSsj(query) { export function listSsj(query) {
return request({ return request({
url: '/device/ssj/list', url: '/device/conv/list',
method: 'get', method: 'get',
params: query params: query
}) })
@@ -12,7 +12,7 @@ export function listSsj(query) {
// 查询输送机详细 // 查询输送机详细
export function getSsj(id) { export function getSsj(id) {
return request({ return request({
url: '/device/ssj/' + id, url: '/device/conv/' + id,
method: 'get' method: 'get'
}) })
} }
@@ -20,7 +20,7 @@ export function getSsj(id) {
// 新增输送机 // 新增输送机
export function addSsj(data) { export function addSsj(data) {
return request({ return request({
url: '/device/ssj', url: '/device/conv',
method: 'post', method: 'post',
data: data data: data
}) })
@@ -29,7 +29,7 @@ export function addSsj(data) {
// 修改输送机 // 修改输送机
export function updateSsj(data) { export function updateSsj(data) {
return request({ return request({
url: '/device/ssj', url: '/device/conv',
method: 'put', method: 'put',
data: data data: data
}) })
@@ -38,7 +38,7 @@ export function updateSsj(data) {
// 删除输送机 // 删除输送机
export function delSsj(id) { export function delSsj(id) {
return request({ return request({
url: '/device/ssj/' + id, url: '/device/conv/' + id,
method: 'delete' method: 'delete'
}) })
} }

View File

@@ -18,6 +18,14 @@ export function listMydoJobFinish(query) {
}) })
} }
export function listMydoJobUnion(query) {
return request({
url: '/job/mydoJob/listUnion',
method: 'get',
params: query
})
}
// 查询作业信息详细 // 查询作业信息详细
export function getMydoJob(jobId) { export function getMydoJob(jobId) {
return request({ return request({
@@ -52,12 +60,21 @@ export function delMydoJob(jobId) {
}) })
} }
// 手动完成作业
export function handFinish(jobIds) { export function handFinish(jobIds) {
return request({ return request({
url: '/job/mydoJob/OuthandFinish', url: '/job/mydoJob/outhandFinish',
method: 'get', method: 'get',
params: { jobIds: jobIds } params: { jobIds: jobIds }
}) })
} }
// 重新向入口输送机下发任务
export function resendTaskToEntrance(jobId) {
return request({
url: '/job/mydoJob/resendTaskToEntrance' + '?jobId=' + jobId,
method: 'put',
})
}

View File

@@ -44,7 +44,7 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
@@ -75,7 +75,7 @@
@click="handleDelete" @click="handleDelete"
v-hasPermi="['device:api:remove']" v-hasPermi="['device:api:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col> -->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@@ -86,6 +86,7 @@
v-hasPermi="['device:api:export']" v-hasPermi="['device:api:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<!-- <span style="font-size:10px;line-height: 0px;vertical-align: bottom; color: darkgray;" class="text">* 仅展示14天内的数据</span> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>

View File

@@ -70,6 +70,11 @@
<!-- <el-table-column label="设备名称" prop="name"/>--> <!-- <el-table-column label="设备名称" prop="name"/>-->
<el-table-column label="任务号" prop="taskNo"/> <el-table-column label="任务号" prop="taskNo"/>
<el-table-column label="托盘条码" prop="trayCode"/> <el-table-column label="托盘条码" prop="trayCode"/>
<el-table-column label="入库请求" prop="rkqq">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_rkqq" :value="scope.row.rkqq"/>
</template>
</el-table-column>
<el-table-column label="到位" prop="dw"> <el-table-column label="到位" prop="dw">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.ssj_dw" :value="scope.row.dw"/> <dict-tag :options="dict.type.ssj_dw" :value="scope.row.dw"/>
@@ -241,7 +246,7 @@ import { listDeviceCar, getDeviceCar, delDeviceCar, addDeviceCar, updateDeviceCa
export default { export default {
name: "deviceMonitor", name: "deviceMonitor",
dicts: ['ddj_task_status', 'ddj_sbzt', 'ddj_czfs', 'ddj_yxxf', 'ddj_hczt', 'ssj_dw', 'ssj_kx', 'ssj_ex','ssj_allow_put','tray_size','ssj_rkqq'], dicts: ['ddj_task_status', 'ddj_sbzt', 'ddj_czfs', 'ddj_yxxf', 'ddj_hczt', 'ssj_rkqq', 'ssj_dw', 'ssj_kx', 'ssj_ex','ssj_allow_put','tray_size'],
data() { data() {
return { return {
// 查询参数 // 查询参数

View File

@@ -89,7 +89,7 @@
<div slot="header" class="card-header"> <div slot="header" class="card-header">
<span>任务类型分布</span> <!-- 任务类型分布 --> <span>任务类型分布</span> <!-- 任务类型分布 -->
</div> </div>
<div id="taskTypeChart" style="height: 300px;"></div> <div id="taskTypeChart" style="height: 350px;"></div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@@ -97,7 +97,7 @@
<div slot="header" class="card-header"> <div slot="header" class="card-header">
<span>设备状态分布</span> <!-- 设备状态分布 --> <span>设备状态分布</span> <!-- 设备状态分布 -->
</div> </div>
<div id="deviceStatusChart" style="height: 300px;"></div> <div id="deviceStatusChart" style="height: 350px;"></div>
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
@@ -149,9 +149,12 @@
style="width: 100%" style="width: 100%"
height="300" height="300"
v-loading="loading.devices"> v-loading="loading.devices">
<el-table-column prop="deviceCode" :label="$t('index.deviceCode')" width="200"/> <!-- 设备编码 --> <!-- 设备编码 -->
<el-table-column prop="deviceName" :label="$t('index.deviceName')" width="200"/> <!-- 设备名称 --> <!-- <el-table-column prop="deviceCode" :label="$t('index.deviceCode')" width="200"/> -->
<el-table-column prop="deviceType" :label="$t('index.type')" width="150"> <!-- 类型 --> <!-- 设备名称 -->
<el-table-column prop="deviceName" :label="$t('index.deviceName')" width="200"/>
<!-- 类型 -->
<el-table-column prop="deviceType" :label="$t('index.type')" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag>{{scope.row.deviceType}}</el-tag> <el-tag>{{scope.row.deviceType}}</el-tag>
</template> </template>
@@ -585,6 +588,8 @@ export default {
height: 120px; height: 120px;
cursor: pointer; cursor: pointer;
transition: all 0.3s; transition: all 0.3s;
overflow-x: auto;
/* white-space: nowrap; */
} }
.stats-card:hover { .stats-card:hover {
@@ -601,6 +606,7 @@ export default {
.stats-icon { .stats-icon {
width: 60px; width: 60px;
/* width: 60vh; */
height: 60px; height: 60px;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;

View File

@@ -88,7 +88,7 @@
<el-table v-loading="loading" :data="jobCallBackList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="jobCallBackList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="主键" align="center" prop="id"/> <el-table-column label="主键" align="center" prop="id"/>
<el-table-column label="作业ID" align="center" prop="mydojobId"/> <el-table-column label="作业ID" align="center" prop="mydoJobId"/>
<el-table-column label="任务号" align="center" prop="taskNo"/> <el-table-column label="任务号" align="center" prop="taskNo"/>
<el-table-column label="任务类型" align="center" prop="type"> <el-table-column label="任务类型" align="center" prop="type">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -139,7 +139,7 @@
<el-input v-model="form.id" placeholder="请输入主键" style="width: 240px" disabled/> <el-input v-model="form.id" placeholder="请输入主键" style="width: 240px" disabled/>
</el-form-item> </el-form-item>
<el-form-item label="作业ID" prop="jobId"> <el-form-item label="作业ID" prop="jobId">
<el-input v-model="form.mydojobId" placeholder="请输入作业ID" style="width: 240px"/> <el-input v-model="form.mydoJobId" placeholder="请输入作业ID" style="width: 240px"/>
</el-form-item> </el-form-item>
<el-form-item label="任务号" prop="taskNo"> <el-form-item label="任务号" prop="taskNo">
<el-input v-model="form.taskNo" placeholder="请输入任务号" style="width: 240px"/> <el-input v-model="form.taskNo" placeholder="请输入任务号" style="width: 240px"/>

View File

@@ -1,128 +1,125 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="任务号" prop="taskNo"> <el-form-item label="wcs任务号" prop="taskNo">
<el-input <el-input v-model="queryParams.taskNo" placeholder="请输入wcs任务号" clearable @keyup.enter.native="handleQuery" />
v-model="queryParams.taskNo"
placeholder="请输入任务号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item label="wms任务号" prop="wmsTaskNo">
<el-input v-model="queryParams.wmsTaskNo" placeholder="请输入wms任务号" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="托盘条码" prop="trayCode">
<el-input v-model="queryParams.trayCode" placeholder="请输入条码" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="货位ID" prop="cargoSpaceId">
<el-input v-model="queryParams.cargoSpaceId" placeholder="请输入货位ID" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="任务状态" prop="status"> <el-form-item label="任务状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable> <el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable>
<el-option <el-option v-for="dict in dict.type.job_status" :key="dict.value" :label="dict.label" :value="dict.value" />
v-for="dict in dict.type.job_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="巷道ID" prop="roadwayId">
<el-input <el-form-item label="任务类型" prop="inOrOut">
v-model="queryParams.roadwayId" <el-select v-model="queryParams.inOrOut" placeholder="请选择任务类型" clearable>
placeholder="请输入巷道ID" <el-option v-for="dict in dict.type.job_type" :key="dict.value" :label="dict.label" :value="dict.value" />
clearable </el-select>
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="货位ID" prop="cargoSpaceId">-->
<!-- <el-input--> <!-- <el-form-item label="巷道ID" prop="roadwayId">
<!-- v-model="queryParams.cargoSpaceId"--> <el-input v-model="queryParams.roadwayId" placeholder="请输入巷道ID" clearable @keyup.enter.native="handleQuery" />
<!-- placeholder="请输入货位ID"--> </el-form-item> -->
<!-- clearable--> <!-- <el-form-item label="去向" prop="targetRoadwayId">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.targetRoadwayId"-->
<!-- </el-form-item>--> <!-- placeholder="请输入去向"-->
<!-- <el-form-item label="去向" prop="targetRoadwayId">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.targetRoadwayId"--> <!-- />-->
<!-- placeholder="请输入去向"--> <!-- </el-form-item>-->
<!-- clearable--> <!-- <el-form-item label="目标货位ID" prop="targetCargoSpaceId">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.targetCargoSpaceId"-->
<!-- </el-form-item>--> <!-- placeholder="请输入目标货位ID"-->
<!-- <el-form-item label="目标货位ID" prop="targetCargoSpaceId">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.targetCargoSpaceId"--> <!-- />-->
<!-- placeholder="请输入目标货位ID"--> <!-- </el-form-item>-->
<!-- clearable--> <!-- <el-form-item label="优先级" prop="priority">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.priority"-->
<!-- </el-form-item>--> <!-- placeholder="请输入优先级"-->
<!-- <el-form-item label="优先级" prop="priority">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.priority"--> <!-- />-->
<!-- placeholder="请输入优先级"--> <!-- </el-form-item>-->
<!-- clearable--> <!-- <el-form-item label="执行阶段" prop="executionPhase">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.executionPhase"-->
<!-- </el-form-item>--> <!-- placeholder="请输入执行阶段"-->
<!-- <el-form-item label="执行阶段" prop="executionPhase">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.executionPhase"--> <!-- />-->
<!-- placeholder="请输入执行阶段"--> <!-- </el-form-item>-->
<!-- clearable--> <!-- <el-form-item label="任务类型" prop="inOrOut">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.inOrOut"-->
<!-- </el-form-item>--> <!-- placeholder="请输入任务类型"-->
<!-- <el-form-item label="任务类型" prop="inOrOut">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.inOrOut"--> <!-- />-->
<!-- placeholder="请输入任务类型"--> <!-- </el-form-item>-->
<!-- clearable--> <!-- <el-form-item label="开始时间" prop="startTime">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.startTime"-->
<!-- </el-form-item>--> <!-- placeholder="请输入开始时间"-->
<!-- <el-form-item label="开始时间" prop="startTime">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.startTime"--> <!-- />-->
<!-- placeholder="请输入开始时间"--> <!-- </el-form-item>-->
<!-- clearable--> <!-- <el-form-item label="结束时间" prop="finishTime">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.finishTime"-->
<!-- </el-form-item>--> <!-- placeholder="请输入结束时间"-->
<!-- <el-form-item label="结束时间" prop="finishTime">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.finishTime"--> <!-- />-->
<!-- placeholder="请输入结束时间"--> <!-- </el-form-item>-->
<!-- clearable--> <!-- <el-form-item label="入口ID" prop="entranceId">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.entranceId"-->
<!-- </el-form-item>--> <!-- placeholder="请输入入口ID"-->
<!-- <el-form-item label="入口ID" prop="entranceId">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.entranceId"--> <!-- />-->
<!-- placeholder="请输入入口ID"--> <!-- </el-form-item>-->
<!-- clearable--> <!-- <el-form-item label="出口ID" prop="exitId">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.exitId"-->
<!-- </el-form-item>--> <!-- placeholder="请输入出口ID"-->
<!-- <el-form-item label="出口ID" prop="exitId">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.exitId"--> <!-- />-->
<!-- placeholder="请输入出口ID"--> <!-- </el-form-item>-->
<!-- clearable--> <!--&lt;!&ndash; <el-form-item label="仓库ID" prop="warehouseId">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.warehouseId"-->
<!-- </el-form-item>--> <!-- placeholder="请输入仓库ID"-->
<!--&lt;!&ndash; <el-form-item label="仓库ID" prop="warehouseId">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.warehouseId"--> <!-- />-->
<!-- placeholder="请输入仓库ID"--> <!-- </el-form-item>-->
<!-- clearable--> <!-- <el-form-item label="重分标志" prop="faultFlag">-->
<!-- @keyup.enter.native="handleQuery"--> <!-- <el-input-->
<!-- />--> <!-- v-model="queryParams.faultFlag"-->
<!-- </el-form-item>--> <!-- placeholder="请输入重分标志"-->
<!-- <el-form-item label="重分标志" prop="faultFlag">--> <!-- clearable-->
<!-- <el-input--> <!-- @keyup.enter.native="handleQuery"-->
<!-- v-model="queryParams.faultFlag"--> <!-- />-->
<!-- placeholder="请输入重分标志"--> <!-- </el-form-item>&ndash;&gt;-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>&ndash;&gt;-->
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -131,15 +128,19 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="success" plain icon="el-icon-check" size="mini" :disabled="multiple" @click="outhandFinish"
type="danger" v-hasPermi="['job:mydoJob:outhandFinish']">手动完成
plain </el-button>
icon="el-icon-delete" </el-col>
size="mini" <el-col :span="1.5">
:disabled="multiple" <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
@click="OuthandFinish" @click="cancelTask" v-hasPermi="['job:mydoJob:remove']">手动作废
v-hasPermi="['job:mydoJob:OuthandFinish']" </el-button>
>手动完成</el-button> </el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-edit" size="mini" :disabled="single"
@click="onResendTaskClicked" v-hasPermi="['job:mydoJob:resendTaskToEntrance']">入库重新下发
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@@ -147,84 +148,64 @@
<el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="任务ID" align="center" prop="jobId" /> <el-table-column label="任务ID" align="center" prop="jobId" />
<el-table-column label="任务状态" align="center" prop="status" > <el-table-column label="任务状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.job_status" :value="scope.row.status"/> <dict-tag :options="dict.type.job_status" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="任务号" align="center" prop="taskNo" /> <el-table-column label="wcs任务号" align="center" prop="taskNo" />
<el-table-column label="wms任务号" align="center" prop="wmsTaskNo" />
<el-table-column label="巷道ID" align="center" prop="roadwayId" /> <el-table-column label="巷道ID" align="center" prop="roadwayId" />
<el-table-column label="货位ID" align="center" prop="cargoSpaceId" /> <el-table-column label="货位ID" align="center" prop="cargoSpaceId" />
<el-table-column label="序列号" align="center" prop="trayCode" /> <el-table-column label="托盘条码" align="center" prop="trayCode" />
<el-table-column label="优先级" align="center" prop="priority" /> <!-- <el-table-column label="优先级" align="center" prop="priority" /> -->
<el-table-column label="执行阶段" align="center" prop="executionPhase" > <el-table-column label="执行阶段" align="center" prop="executionPhase">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.job_ep" :value="scope.row.executionPhase"/> <dict-tag :options="dict.type.job_ep" :value="scope.row.executionPhase" />
</template>
</el-table-column>
<el-table-column label="任务类型" align="center" prop="inOrOut">
<template slot-scope="scope">
<dict-tag :options="dict.type.job_type" :value="scope.row.inOrOut" />
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="任务类型" align="center" prop="inOrOut" />-->
<el-table-column label="开始时间" align="center" prop="startTime" /> <el-table-column label="开始时间" align="center" prop="startTime" />
<el-table-column label="结束时间" align="center" prop="finishTime" /> <el-table-column label="结束时间" align="center" prop="finishTime" />
<el-table-column label="入口ID" align="center" prop="entranceId" /> <el-table-column label="入口ID" align="center" prop="entranceId" />
<el-table-column label="出口ID" align="center" prop="exitId" /> <el-table-column label="出口ID" align="center" prop="exitId" />
<!-- <el-table-column label="仓库ID" align="center" prop="warehouseId" />--> <!-- <el-table-column label="仓库ID" align="center" prop="warehouseId" />-->
<!-- <el-table-column label="重分标志" align="center" prop="faultFlag" />--> <!-- <el-table-column label="重分标志" align="center" prop="faultFlag" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
size="mini" v-hasPermi="['job:mydoJob:edit']">修改</el-button>
type="text" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
icon="el-icon-edit" v-hasPermi="['job:mydoJob:remove']">删除</el-button>
@click="handleUpdate(scope.row)"
v-hasPermi="['job:mydoJob:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['job:mydoJob:remove']"
>删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
v-show="total>0" @pagination="getList" />
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改作业信息对话框 --> <!-- 添加或修改作业信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="400px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="400px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="任务号" prop="taskNo"> <el-form-item label="任务号" prop="taskNo">
<el-input v-model="form.taskNo" placeholder="请输入任务号" style="width: 220px"/> <el-input v-model="form.taskNo" placeholder="请输入任务号" style="width: 220px" />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select v-model="form.status" placeholder="请修改状态" > <el-select v-model="form.status" placeholder="请修改状态">
<el-option <el-option v-for="dict in dict.type.job_status" :key="dict.value" :label="dict.label" :value="dict.value" />
v-for="dict in dict.type.job_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="执行阶段" prop="executionPhase"> <el-form-item label="执行阶段" prop="executionPhase">
<el-select v-model="form.executionPhase" placeholder="请修改执行阶段"> <el-select v-model="form.executionPhase" placeholder="请修改执行阶段">
<el-option <el-option v-for="dict in dict.type.job_ep" :key="dict.value" :label="dict.label" :value="dict.value" />
v-for="dict in dict.type.job_ep"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="优先级" prop="priority"> <el-form-item label="优先级" prop="priority">
<el-input v-model="form.priority" placeholder="请输入优先级" type="number" style="width: 220px"/> <el-input v-model="form.priority" placeholder="请输入优先级" type="number" style="width: 220px" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@@ -236,11 +217,11 @@
</template> </template>
<script> <script>
import {listMydoJob, getMydoJob, delMydoJob, addMydoJob, updateMydoJob, listMydoJobFinish,handFinish} from "@/api/job/mydoJob" import { listMydoJob, getMydoJob, delMydoJob, addMydoJob, updateMydoJob, listMydoJobFinish,listMydoJobUnion, handFinish, resendTaskToEntrance } from "@/api/job/mydoJob"
export default { export default {
name: "MydoJob", name: "MydoJob",
dicts:['job_status','job_ep'], dicts: ['job_status','job_type', 'job_ep'],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
@@ -267,6 +248,7 @@ export default {
pageSize: 10, pageSize: 10,
status: null, status: null,
taskNo: null, taskNo: null,
wmsTaskNo: null, //@@@ FT568 入库请求wms返回的任务号
roadwayId: null, roadwayId: null,
cargoSpaceId: null, cargoSpaceId: null,
targetRoadwayId: null, targetRoadwayId: null,
@@ -302,19 +284,27 @@ export default {
/** 查询作业信息列表 */ /** 查询作业信息列表 */
getList() { getList() {
this.loading = true this.loading = true
if ( this.queryParams.status ==='4' || this.queryParams.status ==='5'){
listMydoJobFinish(this.queryParams).then(response => { listMydoJobUnion(this.queryParams).then(response => {
this.mydoJobList = response.rows this.mydoJobList = response.rows
this.total = response.total this.total = response.total
this.loading = false this.loading = false
}) })
}else {
listMydoJob(this.queryParams).then(response => { // if (this.queryParams.status === '4' || this.queryParams.status === '5'
this.mydoJobList = response.rows // || this.queryParams.status === '6') {
this.total = response.total // listMydoJobFinish(this.queryParams).then(response => {
this.loading = false // this.mydoJobList = response.rows
}) // this.total = response.total
} // this.loading = false
// })
// } else {
// listMydoJob(this.queryParams).then(response => {
// this.mydoJobList = response.rows
// this.total = response.total
// this.loading = false
// })
// }
}, },
// 取消按钮 // 取消按钮
@@ -328,6 +318,7 @@ export default {
jobId: null, jobId: null,
status: null, status: null,
taskNo: null, taskNo: null,
wmsTaskNo: null, //@@@ FT568 入库请求wms返回的任务号
roadwayId: null, roadwayId: null,
cargoSpaceId: null, cargoSpaceId: null,
targetRoadwayId: null, targetRoadwayId: null,
@@ -359,7 +350,7 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.jobId) this.ids = selection.map(item => item.jobId)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
@@ -401,15 +392,33 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const jobIds = row.jobId || this.ids const jobIds = row.jobId || this.ids
this.$modal.confirm('是否确认删除作业信息编号为"' + jobIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除编号为"' + jobIds + '"的任务?(此操作可能影响任务回传,需要人工向wms维护人员通知作业处理情况)').then(function () {
return delMydoJob(jobIds) return delMydoJob(jobIds)
}).then(() => { }).then(() => {
this.getList() this.getList()
this.$modal.msgSuccess("操作成功") this.$modal.msgSuccess("操作成功")
}).catch(() => {}) }).catch(() => { })
}, },
OuthandFinish() {
cancelTask() {
if (this.ids.length === 0) {
this.$modal.msgError("请选择需要手动作废的任务");
return;
}
console.log(this.ids.join(','))
this.$modal.confirm('是否确认手动作废选中的任务?').then(() => {
return delMydoJob(this.ids.join(','))
}).then(() => {
this.getList();
this.$modal.msgSuccess("手动作废成功");
}).catch(error => {
// console.error('手动作废失败:', error);
// this.$modal.msgError(`手动作废失败:${error.message || '未知错误'}`);
});
},
outhandFinish() {
if (this.ids.length === 0) { if (this.ids.length === 0) {
this.$modal.msgError("请选择需要手动完成的任务"); this.$modal.msgError("请选择需要手动完成的任务");
return; return;
@@ -422,8 +431,24 @@ export default {
}).then(() => { }).then(() => {
this.$modal.msgSuccess("手动完成成功"); this.$modal.msgSuccess("手动完成成功");
this.getList(); this.getList();
}).catch(() => {}); }).catch(() => { });
}, },
onResendTaskClicked() {
if (!this.ids || this.ids.length === 0) {
this.$modal.msgError("请选择需要重新下发的任务");
return;
}
const jobId = this.ids[0];
console.log(jobId)
this.$modal.confirm('是否确认重新下发选中的任务?').then(() => {
return resendTaskToEntrance(jobId);
}).then(() => {
this.$modal.msgSuccess("重新下发成功");
this.getList();
}).catch(() => { });
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('job/mydoJob/export', { this.download('job/mydoJob/export', {