init commit
47
RuoYi-Vue/.gitignore
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
######################################################################
|
||||
# Build Tools
|
||||
|
||||
.gradle
|
||||
/build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
######################################################################
|
||||
# IDE
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### JRebel ###
|
||||
rebel.xml
|
||||
|
||||
### NetBeans ###
|
||||
nbproject/private/
|
||||
build/*
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
######################################################################
|
||||
# Others
|
||||
*.log
|
||||
*.xml.versionsBackup
|
||||
*.swp
|
||||
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
1
RuoYi-Vue/.svn/entries
Normal file
@ -0,0 +1 @@
|
||||
12
|
1
RuoYi-Vue/.svn/format
Normal file
@ -0,0 +1 @@
|
||||
12
|
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.skyscreamer:jsonassert:1.5.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/skyscreamer/jsonassert/1.5.0/jsonassert-1.5.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/skyscreamer/jsonassert/1.5.0/jsonassert-1.5.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/skyscreamer/jsonassert/1.5.0/jsonassert-1.5.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,125 @@
|
||||
package com.ruoyi.web.core.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import com.ruoyi.ruiYiController.config.RuoYiConfig;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.models.auth.In;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.ApiKey;
|
||||
import springfox.documentation.service.AuthorizationScope;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.service.SecurityReference;
|
||||
import springfox.documentation.service.SecurityScheme;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
/**
|
||||
* Swagger2的接口配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class SwaggerConfig
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
@Autowired
|
||||
private RuoYiConfig ruoyiConfig;
|
||||
|
||||
/** 是否开启swagger */
|
||||
@Value("${swagger.enabled}")
|
||||
private boolean enabled;
|
||||
|
||||
/** 设置请求的统一前缀 */
|
||||
@Value("${swagger.pathMapping}")
|
||||
private String pathMapping;
|
||||
|
||||
/**
|
||||
* 创建API
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi()
|
||||
{
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
// 是否启用Swagger
|
||||
.enable(enabled)
|
||||
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||
.apiInfo(apiInfo())
|
||||
// 设置哪些接口暴露给Swagger展示
|
||||
.select()
|
||||
// 扫描所有有注解的api,用这种方式更灵活
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
// 扫描指定包中的swagger注解
|
||||
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
|
||||
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
/* 设置安全模式,swagger可以设置访问token */
|
||||
.securitySchemes(securitySchemes())
|
||||
.securityContexts(securityContexts())
|
||||
.pathMapping(pathMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||
*/
|
||||
private List<SecurityScheme> securitySchemes()
|
||||
{
|
||||
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
||||
return apiKeyList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全上下文
|
||||
*/
|
||||
private List<SecurityContext> securityContexts()
|
||||
{
|
||||
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||
securityContexts.add(
|
||||
SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||
.build());
|
||||
return securityContexts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认的安全上引用
|
||||
*/
|
||||
private List<SecurityReference> defaultAuth()
|
||||
{
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||
return securityReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加摘要信息
|
||||
*/
|
||||
private ApiInfo apiInfo()
|
||||
{
|
||||
// 用ApiInfoBuilder进行定制
|
||||
return new ApiInfoBuilder()
|
||||
// 设置标题
|
||||
.title("标题:若依管理系统_接口文档")
|
||||
// 描述
|
||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||
// 作者信息
|
||||
.contact(new Contact(ruoyiConfig.getName(), null, null))
|
||||
// 版本
|
||||
.version("版本号:" + ruoyiConfig.getVersion())
|
||||
.build();
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.javassist:javassist:3.27.0-GA">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/javassist/javassist/3.27.0-GA/javassist-3.27.0-GA.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/javassist/javassist/3.27.0-GA/javassist-3.27.0-GA-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/javassist/javassist/3.27.0-GA/javassist-3.27.0-GA-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,3 @@
|
||||
<template >
|
||||
<router-view />
|
||||
</template>
|
@ -0,0 +1,131 @@
|
||||
<template>
|
||||
<el-form size="small">
|
||||
<el-form-item>
|
||||
<el-radio :label="1" v-model='radioValue'>
|
||||
不填,允许的通配符[, - * /]
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-radio :label="2" v-model='radioValue'>
|
||||
每年
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-radio :label="3" v-model='radioValue'>
|
||||
周期从
|
||||
<el-input-number v-model='cycle01' :min='fullYear' :max="2098" /> -
|
||||
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : fullYear + 1" :max="2099" />
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-radio :label="4" v-model='radioValue'>
|
||||
从
|
||||
<el-input-number v-model='average01' :min='fullYear' :max="2098"/> 年开始,每
|
||||
<el-input-number v-model='average02' :min="1" :max="2099 - average01 || fullYear" /> 年执行一次
|
||||
</el-radio>
|
||||
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-radio :label="5" v-model='radioValue'>
|
||||
指定
|
||||
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple>
|
||||
<el-option v-for="item in 9" :key="item" :value="item - 1 + fullYear" :label="item -1 + fullYear" />
|
||||
</el-select>
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
fullYear: 0,
|
||||
radioValue: 1,
|
||||
cycle01: 0,
|
||||
cycle02: 0,
|
||||
average01: 0,
|
||||
average02: 1,
|
||||
checkboxList: [],
|
||||
checkNum: this.$options.propsData.check
|
||||
}
|
||||
},
|
||||
name: 'crontab-year',
|
||||
props: ['check', 'month', 'cron'],
|
||||
methods: {
|
||||
// 单选按钮值变化时
|
||||
radioChange() {
|
||||
switch (this.radioValue) {
|
||||
case 1:
|
||||
this.$emit('update', 'year', '');
|
||||
break;
|
||||
case 2:
|
||||
this.$emit('update', 'year', '*');
|
||||
break;
|
||||
case 3:
|
||||
this.$emit('update', 'year', this.cycleTotal);
|
||||
break;
|
||||
case 4:
|
||||
this.$emit('update', 'year', this.averageTotal);
|
||||
break;
|
||||
case 5:
|
||||
this.$emit('update', 'year', this.checkboxString);
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 周期两个值变化时
|
||||
cycleChange() {
|
||||
if (this.radioValue == '3') {
|
||||
this.$emit('update', 'year', this.cycleTotal);
|
||||
}
|
||||
},
|
||||
// 平均两个值变化时
|
||||
averageChange() {
|
||||
if (this.radioValue == '4') {
|
||||
this.$emit('update', 'year', this.averageTotal);
|
||||
}
|
||||
},
|
||||
// checkbox值变化时
|
||||
checkboxChange() {
|
||||
if (this.radioValue == '5') {
|
||||
this.$emit('update', 'year', this.checkboxString);
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'radioValue': 'radioChange',
|
||||
'cycleTotal': 'cycleChange',
|
||||
'averageTotal': 'averageChange',
|
||||
'checkboxString': 'checkboxChange'
|
||||
},
|
||||
computed: {
|
||||
// 计算两个周期值
|
||||
cycleTotal: function () {
|
||||
const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098)
|
||||
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099)
|
||||
return cycle01 + '-' + cycle02;
|
||||
},
|
||||
// 计算平均用到的值
|
||||
averageTotal: function () {
|
||||
const average01 = this.checkNum(this.average01, this.fullYear, 2098)
|
||||
const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear)
|
||||
return average01 + '/' + average02;
|
||||
},
|
||||
// 计算勾选的checkbox值合集
|
||||
checkboxString: function () {
|
||||
let str = this.checkboxList.join();
|
||||
return str;
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
// 仅获取当前年份
|
||||
this.fullYear = Number(new Date().getFullYear());
|
||||
this.cycle01 = this.fullYear
|
||||
this.average01 = this.fullYear
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.ruiYiController.utils;
|
||||
|
||||
/**
|
||||
* 处理并记录日志文件
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class LogUtils
|
||||
{
|
||||
public static String getBlock(Object msg)
|
||||
{
|
||||
if (msg == null)
|
||||
{
|
||||
msg = "";
|
||||
}
|
||||
return "[" + msg.toString() + "]";
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.quartz-scheduler:quartz:2.3.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/quartz-scheduler/quartz/2.3.2/quartz-2.3.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/quartz-scheduler/quartz/2.3.2/quartz-2.3.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/quartz-scheduler/quartz/2.3.2/quartz-2.3.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,913 @@
|
||||
package com.ruoyi.wms.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cmeim.common.core.utils.BeanUtil;
|
||||
import com.cmeim.common.core.utils.DateUtil;
|
||||
import com.cmeim.common.core.utils.StringUtils;
|
||||
import com.cmeim.common.core.web.domain.RespondEnum;
|
||||
import com.ruoyi.ruiYiController.exception.ServiceException;
|
||||
import com.ruoyi.wms.enums.AgvTaskEnum;
|
||||
import com.ruoyi.wms.enums.RequestEnum;
|
||||
import com.ruoyi.wms.po.*;
|
||||
import com.ruoyi.wms.repository.*;
|
||||
import com.ruoyi.wms.util.HttpRequest;
|
||||
import com.ruoyi.wms.vo.AgvRequestVo;
|
||||
import com.ruoyi.wms.vo.ContainerArrivedVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Map.Entry.comparingByValue;
|
||||
import static org.springframework.data.util.Pair.toMap;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/6/26
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AGVService {
|
||||
@Autowired
|
||||
private AgvTaskRepository agvTaskRepository;
|
||||
|
||||
@Autowired
|
||||
private ContainerInfoRepository containerInfoRepository;
|
||||
@Autowired
|
||||
private StationInfoRepository stationInfoRepository;
|
||||
@Autowired
|
||||
private StoreInfoRepository storeInfoRepository;
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
@Autowired
|
||||
private AreaConfigRepository areaConfigRepository;
|
||||
@Autowired
|
||||
private ShelfInfoRepository shelfInfoRepository;
|
||||
@Autowired
|
||||
private SensorStoreBindRepository sensorStoreBindRepository;
|
||||
|
||||
/**
|
||||
* 生成AGV搬运请求参数
|
||||
*
|
||||
* @param requestVo
|
||||
*/
|
||||
public String taskParamCreate(AgvRequestVo requestVo) {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String taskCode = uuid.toString();
|
||||
JSONObject data = new JSONObject(true);
|
||||
//搬运方式
|
||||
if (requestVo.getType() == 1) {
|
||||
//货架方式
|
||||
data.put("taskType", "putaway");
|
||||
} else {
|
||||
//搬运方式
|
||||
data.put("taskType", "carry");
|
||||
}
|
||||
//任务组优先级
|
||||
data.put("groupPriority", 2);
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
JSONObject data1 = new JSONObject(true);
|
||||
//任务单号
|
||||
data1.put("taskCode", taskCode);
|
||||
//任务优先级
|
||||
data1.put("taskPriority", 0);
|
||||
JSONObject data2 = new JSONObject(true);
|
||||
//容器编码
|
||||
data2.put("containerCode", requestVo.getContainerCode());
|
||||
//容器类型
|
||||
data2.put("containerType", "CT_KUBOT_STANDARD");
|
||||
if (requestVo.getRequestType() > 3) {
|
||||
data2.put("containerType", "CT_KIVA_STANDARD");
|
||||
}
|
||||
//工作为标签
|
||||
final AreaConfig areaConfig = areaConfigRepository.findByAreaType(requestVo.getRequestType());
|
||||
if (areaConfig == null) {
|
||||
data2.put("storageTag", "10");
|
||||
}
|
||||
//起始工作位
|
||||
data2.put("fromLocationCode", requestVo.getFromLocationCode());
|
||||
//目标工作位
|
||||
data2.put("toLocationCode", requestVo.getToLocationCode());
|
||||
//目标工作站
|
||||
data2.put("toStationCode", requestVo.getToStationCode());
|
||||
data1.put("taskDescribe", data2);
|
||||
taskList.add(data1);
|
||||
data.put("tasks", taskList);
|
||||
log.info("param:" + JSONObject.toJSONString(data));
|
||||
final String result = taskCreate(JSONObject.toJSONString(data), requestVo.getRequestType());
|
||||
//呼叫空箱或入水测调用容器送达接口
|
||||
if (requestVo.getRequestType() == 0 || requestVo.getRequestType() == 2) {
|
||||
ContainerArrivedVo containerArrivedVo = new ContainerArrivedVo();
|
||||
containerArrivedVo.setSlotCode(requestVo.getFromLocationCode());
|
||||
containerArrivedVo.setContainerCode(requestVo.getContainerCode());
|
||||
JSONObject data3 = new JSONObject(true);
|
||||
data3.put("containerCode", requestVo.getContainerCode());
|
||||
data3.put("slotCode", requestVo.getFromLocationCode());
|
||||
log.info("param2:" + JSONObject.toJSONString(data3));
|
||||
containerArrived(JSONObject.toJSONString(data3));
|
||||
}
|
||||
//出库调用容器离场接口
|
||||
//if (requestVo.getRequestType() == 9) {
|
||||
// moveOut(requestVo.getContainerCode(), requestVo.getToLocationCode());
|
||||
//}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送AGV搬运请求
|
||||
*
|
||||
* @param param 请求参数
|
||||
* @param requestType 请求类型
|
||||
*/
|
||||
@Transactional
|
||||
public String taskCreate(String param, Integer requestType) {
|
||||
final String result = HttpRequest.doPost("http://192.168.33.45:9046/task/create", param);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//根据任务列表存入调用记录
|
||||
JSONObject.parseObject(param).getJSONArray("tasks").forEach(e -> {
|
||||
String taskCode = JSONObject.parseObject(JSONObject.toJSONString(e)).getString("taskCode");
|
||||
updateAgvTask(taskCode, requestType, JSONObject.toJSONString(e), AgvTaskEnum.ONGOING.getCode(), "");
|
||||
});
|
||||
} else {
|
||||
String taskCode = JSONObject.parseObject(JSONObject.toJSONString(JSONObject.parseObject(param)
|
||||
.getJSONArray("tasks").get(0))).getString("taskCode");
|
||||
updateAgvTask(taskCode, requestType, param, AgvTaskEnum.FAIL.getCode(), JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送容器到达通知
|
||||
*
|
||||
* @param param 请求参数
|
||||
*/
|
||||
@Transactional
|
||||
public void containerArrived(String param) {
|
||||
HttpRequest.doPost("http://192.168.33.45:9046/conveyor/containerArrived", param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否允许取走/放置周转箱
|
||||
*
|
||||
* @param param 请求参数
|
||||
*/
|
||||
@Transactional
|
||||
public String allowOperation(String param) {
|
||||
final String result = HttpRequest.doPost("http://192.168.33.211:8081/AllowOperation", param);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新agv任务表
|
||||
*
|
||||
* @param taskCode 请求单号
|
||||
* @param requestType 请求类型
|
||||
* @param param 请求参数
|
||||
* @param status 请求状态
|
||||
*/
|
||||
public void updateAgvTask(String taskCode, Integer requestType, String param, Integer status, String message) {
|
||||
AgvTask agvTask = new AgvTask();
|
||||
agvTask = agvTaskRepository.findByRequestCode(taskCode);
|
||||
if (agvTask == null) {
|
||||
AgvTask task = new AgvTask();
|
||||
agvTask = BeanUtil.copyProperties(task, AgvTask.class);
|
||||
agvTask.setCreatedBy("admin");
|
||||
agvTask.setCreatedDt(DateUtil.getCurrentDate());
|
||||
agvTask.setDictType(requestType);
|
||||
} else {
|
||||
agvTask.setUpdatedBy("admin");
|
||||
agvTask.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
|
||||
}
|
||||
agvTask.setJson(param);
|
||||
agvTask.setRequestCode(taskCode);
|
||||
agvTask.setStatus(status);
|
||||
agvTask.setMessage(message);
|
||||
agvTaskRepository.save(agvTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消修改周转箱
|
||||
*
|
||||
* @param param json
|
||||
*/
|
||||
public void updateContainer(String param, Integer dictType) {
|
||||
final String containerCode = JSONObject.parseObject(param).getString("containerCode");
|
||||
if (dictType == 3) {
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerCode);
|
||||
String productionTask = containerInfo.getProductionTask();
|
||||
//修改生产任务单的出库中数量和出库数量
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(productionTask);
|
||||
orderInfo.setOnoutingCheckQty(orderInfo.getOnoutingCheckQty() - containerInfo.getQty());
|
||||
orderInfo.setOutQty(orderInfo.getOutQty() + containerInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
//修改对应周转箱为空闲(库外)
|
||||
containerInfo.setQty(0);
|
||||
containerInfo.setContainerStatus(5);
|
||||
containerInfo.setStoreCode(null);
|
||||
containerInfo.setOnInstoreTime(null);
|
||||
containerInfo.setProductionTask(null);
|
||||
containerInfo.setIsPdaEdit(0);
|
||||
containerInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
containerInfoRepository.save(containerInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消AGV任务
|
||||
*
|
||||
* @param taskCode
|
||||
*/
|
||||
|
||||
public void taskCancel(String taskCode) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(taskCode);
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("taskCodes", list);
|
||||
final AgvTask agvTask = agvTaskRepository.findByRequestCodeAndStatus(taskCode, 2);
|
||||
if (null == agvTask) {
|
||||
throw new com.ruoyi.ruiYiController.exception.ServiceException( "没有该待执行任务",10000);
|
||||
}
|
||||
final String result = HttpRequest.doPost("http://192.168.33.45:9046/task/cancel", JSONObject.toJSONString(data));
|
||||
log.info("取消任务result:" + JSONObject.toJSONString(result));
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.CANCEL.getCode(), "");
|
||||
updateContainer(agvTask.getJson(), agvTask.getDictType());
|
||||
} else {
|
||||
updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.FAIL.getCode(), JSONObject.parseObject(result).getString("msg"));
|
||||
updateContainer(agvTask.getJson(), agvTask.getDictType());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 容器移入
|
||||
* @param containerCode
|
||||
* @param positionCode
|
||||
*/
|
||||
public String moveIn(String containerCode, String positionCode) {
|
||||
JSONObject data1 = new JSONObject(true);
|
||||
data1.put("containerCode", containerCode);
|
||||
data1.put("positionCode", positionCode);
|
||||
JSONObject data = new JSONObject();
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
taskList.add(data1);
|
||||
data.put("containerMoveIns", taskList);
|
||||
log.info("容器移入:" + JSONObject.toJSONString(data));
|
||||
final String result = HttpRequest.doPost("http://192.168.33.45:9046/expand/api/moveIn/Container", JSONObject.toJSONString(data));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 容器离场
|
||||
* @param containerCode
|
||||
* @param positionCode
|
||||
*/
|
||||
public void moveOut(String containerCode, String positionCode) {
|
||||
JSONObject data1 = new JSONObject(true);
|
||||
data1.put("containerCode", containerCode);
|
||||
data1.put("positionCode", positionCode);
|
||||
JSONObject data = new JSONObject();
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
taskList.add(data1);
|
||||
data.put("containerMoveOuts", taskList);
|
||||
final String result = HttpRequest.doPost("http://192.168.33.45:9046/expand/api/container/moveOut", JSONObject.toJSONString(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 告知滚筒线箱子已取走/已放下
|
||||
* @param param
|
||||
*/
|
||||
public void noticeToPlc(String param)
|
||||
{
|
||||
HttpRequest.doPost("http://192.168.33.211:8081/OperationSucceed", param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【取】点位的状态
|
||||
* @param locationCode
|
||||
*/
|
||||
public void updateStationStatus(String locationCode)
|
||||
{
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求空箱
|
||||
*
|
||||
* @param requestVo
|
||||
*/
|
||||
@Transactional
|
||||
public void EmptyContainerOutStore(AgvRequestVo requestVo) {
|
||||
final List<ContainerInfo> containerInfos = containerInfoRepository.findByContainerStatus(10);
|
||||
//优化筛选逻辑,按货架的序号分组,取最多的一组
|
||||
for (ContainerInfo containerInfo : containerInfos) {
|
||||
if (StringUtils.isNotBlank(containerInfo.getStoreCode())) {
|
||||
containerInfo.setArea(containerInfo.getStoreCode().substring(6, 8));
|
||||
}
|
||||
}
|
||||
Map<String, List<ContainerInfo>> collect = containerInfos.stream().collect(Collectors.groupingBy(ContainerInfo::getArea));
|
||||
List<Map.Entry<String, List<ContainerInfo>>> sortedList = collect.entrySet().stream()
|
||||
.sorted(Comparator.comparingInt(entry -> entry.getValue().size()))
|
||||
.collect(Collectors.toList());
|
||||
final List<ContainerInfo> value = sortedList.get(sortedList.size()-1).getValue();
|
||||
//判断请求空箱数量是否大约仓库空箱数量
|
||||
if (value.size() < requestVo.getBoxNumber()) {
|
||||
requestVo.setBoxNumber(value.size());
|
||||
}
|
||||
List<ContainerInfo> sendContainer = new ArrayList<>();
|
||||
JSONObject data = new JSONObject(true);
|
||||
//搬运方式
|
||||
if (requestVo.getType() == 1) {
|
||||
//货架方式
|
||||
data.put("taskType", "putaway");
|
||||
} else {
|
||||
//搬运方式
|
||||
data.put("taskType", "carry");
|
||||
}
|
||||
//任务组优先级
|
||||
data.put("groupPriority", 1);
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
for (int i = 0; i < requestVo.boxNumber; i++) {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String taskCode = uuid.toString();
|
||||
ContainerInfo containerInfo = value.get(i);
|
||||
JSONObject data1 = new JSONObject(true);
|
||||
//任务单号
|
||||
data1.put("taskCode", taskCode);
|
||||
//任务优先级
|
||||
data1.put("taskPriority", 1);
|
||||
JSONObject data2 = new JSONObject(true);
|
||||
//容器编码
|
||||
data2.put("containerCode", containerInfo.getContainerNumber());
|
||||
//容器类型
|
||||
data2.put("containerType", "CT_KUBOT_STANDARD");
|
||||
//工作为标签
|
||||
data2.put("storageTag", "");
|
||||
//起始工作位
|
||||
data2.put("fromLocationCode", requestVo.getFromLocationCode());
|
||||
//目标工作位
|
||||
data2.put("toLocationCode", requestVo.getToLocationCode());
|
||||
//目标工作站
|
||||
data2.put("toStationCode", "");
|
||||
data1.put("taskDescribe", data2);
|
||||
taskList.add(data1);
|
||||
sendContainer.add(containerInfo);
|
||||
}
|
||||
if (taskList.size() == 0) {
|
||||
throw new ServiceException("仓库暂无空料箱!");
|
||||
}
|
||||
data.put("tasks", taskList);
|
||||
log.info("param:" + JSONObject.toJSONString(data));
|
||||
final String result = taskCreate(JSONObject.toJSONString(data), requestVo.getRequestType());
|
||||
int code = JSONObject.parseObject(result).getInteger("code");
|
||||
//请求发送成功
|
||||
if (code == 0) {
|
||||
sendContainer.forEach(e -> {
|
||||
//修改为出库中状态
|
||||
e.setContainerStatus(35);
|
||||
containerInfoRepository.save(e);
|
||||
//修改库位状态,待空闲
|
||||
StoreInfo storeInfo = storeInfoRepository.findByStoreCode(e.getStoreCode());
|
||||
if (storeInfo != null) {
|
||||
storeInfo.setStoreStatus(20);
|
||||
storeInfoRepository.save(storeInfo);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new ServiceException( "任务发起失败",10000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AGV回调处理成功信息
|
||||
*
|
||||
* @param agvTask AGV任务列表数据
|
||||
* @param jsonObject 回调信息
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackSuccess(AgvTask agvTask, JSONObject jsonObject) {
|
||||
Integer type = agvTask.getDictType();
|
||||
switch (type) {
|
||||
//空箱
|
||||
case 1:
|
||||
callBackNullBox(jsonObject);
|
||||
break;
|
||||
//入恒温区
|
||||
case 2:
|
||||
callBackInStore(jsonObject);
|
||||
break;
|
||||
//出恒温区
|
||||
case 3:
|
||||
callBackOutStore(jsonObject);
|
||||
break;
|
||||
//送待检缓存区
|
||||
case 4:
|
||||
callBackSendWaitCheck(jsonObject);
|
||||
break;
|
||||
//送检验
|
||||
case 5:
|
||||
callBackSendCheck(jsonObject);
|
||||
break;
|
||||
//回待检区
|
||||
case 6:
|
||||
callBackBackWaitCheck(jsonObject);
|
||||
break;
|
||||
//送抽检
|
||||
case 7:
|
||||
callBackSendPortCheck(jsonObject);
|
||||
break;
|
||||
//送成品库
|
||||
case 8:
|
||||
callBackSendProdStore(jsonObject);
|
||||
break;
|
||||
//成品出库
|
||||
case 9:
|
||||
callBackOutProdStore(jsonObject);
|
||||
break;
|
||||
//空货架入库
|
||||
case 10:
|
||||
callBackSendNullShelf(jsonObject);
|
||||
break;
|
||||
//呼叫空货架
|
||||
case 11:
|
||||
callBackCallNullShelf(jsonObject);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求空箱子成功回调
|
||||
*
|
||||
* @param jsonObject 回调参数
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackNullBox(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String containerCode = jsonObject.getString("containerCode");
|
||||
final ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerCode);
|
||||
//修改库位状态
|
||||
final StoreInfo storeInfo = storeInfoRepository.findByStoreCode(containerInfo.getStoreCode());
|
||||
if (null != storeInfo) {
|
||||
storeInfo.setStoreStatus(5);
|
||||
storeInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
storeInfoRepository.save(storeInfo);
|
||||
}
|
||||
//修改箱子状态为库外空闲
|
||||
containerInfo.setContainerStatus(5);
|
||||
containerInfo.setStoreCode(null);
|
||||
containerInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
containerInfoRepository.save(containerInfo);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 入恒温区成功回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackInStore(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String containerCode = jsonObject.getString("containerCode");
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
final ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerCode);
|
||||
containerInfo.setStoreCode(locationCode);
|
||||
//修改箱子状态在库
|
||||
if (containerInfo.getContainerStatus() == 25) {
|
||||
containerInfo.setContainerStatus(10);
|
||||
} else {
|
||||
containerInfo.setContainerStatus(30);
|
||||
}
|
||||
containerInfo.setInstoreTime(DateUtil.getCurrentDate());
|
||||
containerInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
containerInfoRepository.save(containerInfo);
|
||||
//修改库位信息状态在库
|
||||
final StoreInfo storeInfo = storeInfoRepository.findByStoreCode(locationCode);
|
||||
if (storeInfo != null) {
|
||||
storeInfo.setStoreStatus(15);
|
||||
storeInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
storeInfoRepository.save(storeInfo);
|
||||
}
|
||||
//修改单据出库数据
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(containerInfo.getProductionTask());
|
||||
if (orderInfo != null) {
|
||||
if (orderInfo.getInQty() == null) {
|
||||
orderInfo.setInQty(0);
|
||||
}
|
||||
orderInfo.setInQty(orderInfo.getInQty() + containerInfo.getQty());
|
||||
orderInfo.setOngoingQty(orderInfo.getOngoingQty() - containerInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
if (orderInfo.getInQty().equals(orderInfo.getPlanQty())) {
|
||||
orderInfo.setOrderStatus(15);
|
||||
} else {
|
||||
orderInfo.setOrderStatus(10);
|
||||
}
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 出恒温区成功回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackOutStore(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String containerCode = jsonObject.getString("containerCode");
|
||||
final ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerCode);
|
||||
//修改库位状态
|
||||
final StoreInfo storeInfo = storeInfoRepository.findByStoreCode(containerInfo.getStoreCode());
|
||||
if (null != storeInfo) {
|
||||
storeInfo.setStoreStatus(5);
|
||||
storeInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
storeInfoRepository.save(storeInfo);
|
||||
}
|
||||
//修改单据出库数据
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(containerInfo.getProductionTask());
|
||||
if (orderInfo != null) {
|
||||
orderInfo.setOutQty(orderInfo.getOutQty() + containerInfo.getQty());
|
||||
orderInfo.setOnoutingCheckQty(orderInfo.getOnoutingCheckQty() - containerInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
//修改箱子状态为库外空闲
|
||||
containerInfo.setContainerStatus(5);
|
||||
containerInfo.setOutstoreTime(DateUtil.getCurrentDate());
|
||||
containerInfo.setStoreCode(null);
|
||||
containerInfo.setQty(0);
|
||||
containerInfo.setProductionTask(null);
|
||||
containerInfo.setOutstoreTime(null);
|
||||
containerInfo.setUpdatedDt(null);
|
||||
containerInfo.setOnInstoreTime(null);
|
||||
containerInfo.setInstoreTime(null);
|
||||
containerInfoRepository.save(containerInfo);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 送待检区回调
|
||||
*
|
||||
* @param jsonObject 回调参数
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackSendWaitCheck(JSONObject jsonObject) {
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
|
||||
//修改终点库位状态
|
||||
final StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//修改货架状态为待检
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setShelfStatus(5);
|
||||
shelfInfo.setOrderStatus(5);
|
||||
shelfInfo.setStationCode(locationCode);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
//修改单据出库数据
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
orderInfo.setWaitCheckQty(orderInfo.getWaitCheckQty() + shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 送检验回调
|
||||
*
|
||||
* @param jsonObject 回调参数
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackSendCheck(JSONObject jsonObject) {
|
||||
//库位码
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
//修改库位状态
|
||||
final StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//修改货架状态为待检
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setShelfStatus(5);
|
||||
shelfInfo.setOrderStatus(20);
|
||||
shelfInfo.setStationCode(locationCode);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 送回待检区回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackBackWaitCheck(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
//修改货架信息检验完成
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setOrderStatus(15);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
//修改库位状态
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
final StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
//修改任务单检验数量
|
||||
if (orderInfo != null) {
|
||||
orderInfo.setCheckQty(orderInfo.getCheckQty() - shelfInfo.getQty());
|
||||
orderInfo.setFinishCheckQty(orderInfo.getFinishCheckQty() + shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 送抽检回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
|
||||
@Transactional
|
||||
public void callBackSendPortCheck(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
//修改货架信息待抽检
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setOrderStatus(20);
|
||||
shelfInfo.setStationCode(locationCode);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
//修改库位状态
|
||||
final StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
//修改任务单检验数量
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
if (orderInfo != null) {
|
||||
orderInfo.setCheckQty(orderInfo.getCheckQty() - shelfInfo.getQty());
|
||||
orderInfo.setFinishCheckQty(orderInfo.getFinishCheckQty() + shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 送成品区回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackSendProdStore(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
//终点位置
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//修改抽检工位状态为空闲
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
//修改货架状态为待出库
|
||||
shelfInfo.setOrderStatus(25);
|
||||
shelfInfo.setStationCode(locationCode);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
if (orderInfo != null) {
|
||||
//修改成品入库数量
|
||||
orderInfo.setProductInQty(orderInfo.getProductInQty() + shelfInfo.getQty());
|
||||
orderInfo.setProductOngoingQty(orderInfo.getProductOngoingQty() - shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 成品出库回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackOutProdStore(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setProductionTask(null);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
final StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//调用海柔离场接口
|
||||
moveOut(shelfCode, locationCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 空货架入库
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackSendNullShelf(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
//清空货架信息,空货架入库
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setUpdatedDt(null);
|
||||
shelfInfo.setOrderStatus(40);
|
||||
shelfInfo.setPriority(0);
|
||||
shelfInfo.setProductionTask(null);
|
||||
shelfInfo.setQty(0);
|
||||
shelfInfo.setStationCode(jsonObject.getString("locationCode"));
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 呼叫空货架
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackCallNullShelf(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setOrderStatus(40);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfo.setStationCode(jsonObject.getString("locationCode"));
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 成品出库
|
||||
*/
|
||||
public void outProdStore(String code) {
|
||||
final SensorStoreBind sensor = sensorStoreBindRepository.findBySensor(code);
|
||||
List<AgvTask> agvTasks=new ArrayList<>();
|
||||
//判断当前库位是否已存在任务
|
||||
//查找任务类型为成品出库,状态为进行中的任务
|
||||
agvTasks = agvTaskRepository.findByDictTypeAndStatus(RequestEnum.OUTPRODSTORE.getCode(), AgvTaskEnum.ONGOING.getCode());
|
||||
if(agvTasks.size()>0){
|
||||
agvTasks.forEach(e->{
|
||||
String toLocationCode = JSONObject.parseObject(e.getJson()).getJSONObject("taskDescribe").getString("toLocationCode");
|
||||
if(sensor.getStationCode().equals(toLocationCode)){
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (sensor == null) {
|
||||
return;
|
||||
}
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(sensor.getStationCode());
|
||||
//查询在成品库的货架
|
||||
final List<ShelfInfo> shelfInfos = shelfInfoRepository.findByOrderStatus(25);
|
||||
if (shelfInfos.size() == 0) {
|
||||
return;
|
||||
}
|
||||
//根据优先级和入库时间排序
|
||||
final List<ShelfInfo> sorted = shelfInfos.stream().sorted(Comparator.comparing(ShelfInfo::getPriority, Comparator.reverseOrder()).thenComparing(ShelfInfo::getUpdatedDt)).collect(Collectors.toList());
|
||||
|
||||
AgvRequestVo agvRequestVo = new AgvRequestVo();
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setToLocationCode(sensor.getStationCode());
|
||||
agvRequestVo.setFromLocationCode(sorted.get(0).getStationCode());
|
||||
agvRequestVo.setContainerCode(sorted.get(0).getShelfCode());
|
||||
agvRequestVo.setRequestType(RequestEnum.OUTPRODSTORE.getCode());
|
||||
final String result = taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//修改出库工位状态为作业中
|
||||
stationInfo.setStationStatus(10);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
//修改货架状态为出库位待出库
|
||||
sorted.get(0).setOrderStatus(30);
|
||||
shelfInfoRepository.save(sorted.get(0));
|
||||
//修改订单出库中数量
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfos.get(0).getProductionTask());
|
||||
orderInfo.setProductOnoutingQty(orderInfo.getProductOnoutingQty() + shelfInfos.get(0).getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void sendNullShelf(String code) {
|
||||
AgvRequestVo agvRequestVo = new AgvRequestVo();
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDNULLSHELF.getCode());
|
||||
final SensorStoreBind sensor = sensorStoreBindRepository.findBySensor(code);
|
||||
List<AgvTask> agvTasks=new ArrayList<>();
|
||||
//查找任务类型为空货架入库,状态为进行中的任务
|
||||
agvTasks = agvTaskRepository.findByDictTypeAndStatus(RequestEnum.SENDNULLSHELF.getCode(), AgvTaskEnum.ONGOING.getCode());
|
||||
if(agvTasks.size()>0){
|
||||
agvTasks.forEach(e->{
|
||||
String toLocationCode = JSONObject.parseObject(e.getJson()).getJSONObject("taskDescribe").getString("fromLocationCode");
|
||||
//当任务起点相同时,不再发送命令
|
||||
if(sensor.getStationCode().equals(toLocationCode)){
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
agvRequestVo.setFromLocationCode(sensor.getStationCode());
|
||||
//查找空闲终点位置(先找缓存库位待检区,再找成品缓存库位)
|
||||
String toLocationCode = null;
|
||||
List<StationInfo> stationInfoList = stationInfoRepository.findByStationTypeAndStationStatus(15, 5);
|
||||
if (stationInfoList.size() > 0) {
|
||||
toLocationCode = stationInfoList.get(0).getStationCode();
|
||||
} else {
|
||||
List<StationInfo> stationInfoList2 = stationInfoRepository.findByStationTypeAndStationStatus(30, 5);
|
||||
toLocationCode = stationInfoList2.get(0).getStationCode();
|
||||
}
|
||||
agvRequestVo.setToLocationCode(toLocationCode);
|
||||
taskParamCreate(agvRequestVo);
|
||||
}
|
||||
|
||||
public String sendNullShelf2(String fromLocationCode, String shelfCode) {
|
||||
AgvRequestVo agvRequestVo = new AgvRequestVo();
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDNULLSHELF.getCode());
|
||||
agvRequestVo.setContainerCode(shelfCode);
|
||||
agvRequestVo.setFromLocationCode(fromLocationCode);
|
||||
//查找空闲终点位置(先找缓存库位待检区,再找成品缓存库位)
|
||||
String toLocationCode = null;
|
||||
List<StationInfo> stationInfoList = stationInfoRepository.findByStationTypeAndStationStatus(15, 5);
|
||||
if (stationInfoList.size() > 0) {
|
||||
toLocationCode = stationInfoList.get(0).getStationCode();
|
||||
} else {
|
||||
List<StationInfo> stationInfoList2 = stationInfoRepository.findByStationTypeAndStationStatus(30, 5);
|
||||
toLocationCode = stationInfoList2.get(0).getStationCode();
|
||||
}
|
||||
agvRequestVo.setToLocationCode(toLocationCode);
|
||||
String result = taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(toLocationCode);
|
||||
stationInfo.setStationStatus(10);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
package com.ruoyi.framework.config;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.sql.DataSource;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
||||
import com.alibaba.druid.util.Utils;
|
||||
import com.ruoyi.ruiYiController.enums.DataSourceType;
|
||||
import com.ruoyi.ruiYiController.utils.spring.SpringUtils;
|
||||
import com.ruoyi.framework.config.properties.DruidProperties;
|
||||
import com.ruoyi.framework.datasource.DynamicDataSource;
|
||||
|
||||
/**
|
||||
* druid 配置多数据源
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class DruidConfig
|
||||
{
|
||||
@Bean
|
||||
@ConfigurationProperties("spring.datasource.druid.master")
|
||||
public DataSource masterDataSource(DruidProperties druidProperties)
|
||||
{
|
||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||
return druidProperties.dataSource(dataSource);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("spring.datasource.druid.slave")
|
||||
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
|
||||
public DataSource slaveDataSource(DruidProperties druidProperties)
|
||||
{
|
||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||
return druidProperties.dataSource(dataSource);
|
||||
}
|
||||
|
||||
@Bean(name = "dynamicDataSource")
|
||||
@Primary
|
||||
public DynamicDataSource dataSource(DataSource masterDataSource)
|
||||
{
|
||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
||||
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
|
||||
return new DynamicDataSource(masterDataSource, targetDataSources);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据源
|
||||
*
|
||||
* @param targetDataSources 备选数据源集合
|
||||
* @param sourceName 数据源名称
|
||||
* @param beanName bean名称
|
||||
*/
|
||||
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataSource dataSource = SpringUtils.getBean(beanName);
|
||||
targetDataSources.put(sourceName, dataSource);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除监控页面底部的广告
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
|
||||
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
|
||||
{
|
||||
// 获取web监控页面的参数
|
||||
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
||||
// 提取common.js的配置路径
|
||||
String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
|
||||
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
|
||||
final String filePath = "support/http/resources/js/common.js";
|
||||
// 创建filter进行过滤
|
||||
Filter filter = new Filter()
|
||||
{
|
||||
@Override
|
||||
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
|
||||
{
|
||||
}
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
chain.doFilter(request, response);
|
||||
// 重置缓冲区,响应头不会被重置
|
||||
response.resetBuffer();
|
||||
// 获取common.js
|
||||
String text = Utils.readFromResource(filePath);
|
||||
// 正则替换banner, 除去底部的广告信息
|
||||
text = text.replaceAll("<a.*?banner\"></a><br/>", "");
|
||||
text = text.replaceAll("powered.*?shrek.wang</a>", "");
|
||||
response.getWriter().write(text);
|
||||
}
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
}
|
||||
};
|
||||
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
||||
registrationBean.setFilter(filter);
|
||||
registrationBean.addUrlPatterns(commonJsPattern);
|
||||
return registrationBean;
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
xm<><6D>J1<10><><EFBFBD><14>Uw<55><77>8<04>C<10>
|
||||
A<EFBFBD>N<EFBFBD>̮<EFBFBD><0C>eB2<42><15><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><07><><EFBFBD><EFBFBD>}<1C>{
|
@ -0,0 +1,64 @@
|
||||
package com.ruoyi.quartz.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.quartz.domain.SysJobLog;
|
||||
|
||||
/**
|
||||
* 调度任务日志信息 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysJobLogMapper
|
||||
{
|
||||
/**
|
||||
* 获取quartz调度器日志的计划任务
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
* @return 调度任务日志集合
|
||||
*/
|
||||
public List<SysJobLog> selectJobLogList(SysJobLog jobLog);
|
||||
|
||||
/**
|
||||
* 查询所有调度任务日志
|
||||
*
|
||||
* @return 调度任务日志列表
|
||||
*/
|
||||
public List<SysJobLog> selectJobLogAll();
|
||||
|
||||
/**
|
||||
* 通过调度任务日志ID查询调度信息
|
||||
*
|
||||
* @param jobLogId 调度任务日志ID
|
||||
* @return 调度任务日志对象信息
|
||||
*/
|
||||
public SysJobLog selectJobLogById(Long jobLogId);
|
||||
|
||||
/**
|
||||
* 新增任务日志
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJobLog(SysJobLog jobLog);
|
||||
|
||||
/**
|
||||
* 批量删除调度日志信息
|
||||
*
|
||||
* @param logIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobLogByIds(Long[] logIds);
|
||||
|
||||
/**
|
||||
* 删除任务日志
|
||||
*
|
||||
* @param jobId 调度日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobLogById(Long jobId);
|
||||
|
||||
/**
|
||||
* 清空任务日志
|
||||
*/
|
||||
public void cleanJobLog();
|
||||
}
|
@ -0,0 +1,913 @@
|
||||
package com.ruoyi.wms.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cmeim.common.core.utils.BeanUtil;
|
||||
import com.cmeim.common.core.utils.DateUtil;
|
||||
import com.cmeim.common.core.utils.StringUtils;
|
||||
import com.cmeim.common.core.web.domain.RespondEnum;
|
||||
import com.ruoyi.ruiYiController.exception.ServiceException;
|
||||
import com.ruoyi.wms.enums.AgvTaskEnum;
|
||||
import com.ruoyi.wms.enums.RequestEnum;
|
||||
import com.ruoyi.wms.po.*;
|
||||
import com.ruoyi.wms.repository.*;
|
||||
import com.ruoyi.wms.util.HttpRequest;
|
||||
import com.ruoyi.wms.vo.AgvRequestVo;
|
||||
import com.ruoyi.wms.vo.ContainerArrivedVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Map.Entry.comparingByValue;
|
||||
import static org.springframework.data.util.Pair.toMap;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/6/26
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AGVService {
|
||||
@Autowired
|
||||
private AgvTaskRepository agvTaskRepository;
|
||||
|
||||
@Autowired
|
||||
private ContainerInfoRepository containerInfoRepository;
|
||||
@Autowired
|
||||
private StationInfoRepository stationInfoRepository;
|
||||
@Autowired
|
||||
private StoreInfoRepository storeInfoRepository;
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
@Autowired
|
||||
private AreaConfigRepository areaConfigRepository;
|
||||
@Autowired
|
||||
private ShelfInfoRepository shelfInfoRepository;
|
||||
@Autowired
|
||||
private SensorStoreBindRepository sensorStoreBindRepository;
|
||||
|
||||
/**
|
||||
* 生成AGV搬运请求参数
|
||||
*
|
||||
* @param requestVo
|
||||
*/
|
||||
public String taskParamCreate(AgvRequestVo requestVo) {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String taskCode = uuid.toString();
|
||||
JSONObject data = new JSONObject(true);
|
||||
//搬运方式
|
||||
if (requestVo.getType() == 1) {
|
||||
//货架方式
|
||||
data.put("taskType", "putaway");
|
||||
} else {
|
||||
//搬运方式
|
||||
data.put("taskType", "carry");
|
||||
}
|
||||
//任务组优先级
|
||||
data.put("groupPriority", 0);
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
JSONObject data1 = new JSONObject(true);
|
||||
//任务单号
|
||||
data1.put("taskCode", taskCode);
|
||||
//任务优先级
|
||||
data1.put("taskPriority", 2);
|
||||
JSONObject data2 = new JSONObject(true);
|
||||
//容器编码
|
||||
data2.put("containerCode", requestVo.getContainerCode());
|
||||
//容器类型
|
||||
data2.put("containerType", "CT_KUBOT_STANDARD");
|
||||
if (requestVo.getRequestType() > 3) {
|
||||
data2.put("containerType", "CT_KIVA_STANDARD");
|
||||
}
|
||||
//工作为标签
|
||||
final AreaConfig areaConfig = areaConfigRepository.findByAreaType(requestVo.getRequestType());
|
||||
if (areaConfig == null) {
|
||||
data2.put("storageTag", "10");
|
||||
}
|
||||
//起始工作位
|
||||
data2.put("fromLocationCode", requestVo.getFromLocationCode());
|
||||
//目标工作位
|
||||
data2.put("toLocationCode", requestVo.getToLocationCode());
|
||||
//目标工作站
|
||||
data2.put("toStationCode", requestVo.getToStationCode());
|
||||
data1.put("taskDescribe", data2);
|
||||
taskList.add(data1);
|
||||
data.put("tasks", taskList);
|
||||
log.info("param:" + JSONObject.toJSONString(data));
|
||||
final String result = taskCreate(JSONObject.toJSONString(data), requestVo.getRequestType());
|
||||
//呼叫空箱或入水测调用容器送达接口
|
||||
if (requestVo.getRequestType() == 0 || requestVo.getRequestType() == 2) {
|
||||
ContainerArrivedVo containerArrivedVo = new ContainerArrivedVo();
|
||||
containerArrivedVo.setSlotCode(requestVo.getFromLocationCode());
|
||||
containerArrivedVo.setContainerCode(requestVo.getContainerCode());
|
||||
JSONObject data3 = new JSONObject(true);
|
||||
data3.put("containerCode", requestVo.getContainerCode());
|
||||
data3.put("slotCode", requestVo.getFromLocationCode());
|
||||
log.info("param2:" + JSONObject.toJSONString(data3));
|
||||
containerArrived(JSONObject.toJSONString(data3));
|
||||
}
|
||||
//出库调用容器离场接口
|
||||
//if (requestVo.getRequestType() == 9) {
|
||||
// moveOut(requestVo.getContainerCode(), requestVo.getToLocationCode());
|
||||
//}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送AGV搬运请求
|
||||
*
|
||||
* @param param 请求参数
|
||||
* @param requestType 请求类型
|
||||
*/
|
||||
@Transactional
|
||||
public String taskCreate(String param, Integer requestType) {
|
||||
final String result = HttpRequest.doPost("http://192.168.33.45:9046/task/create", param);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//根据任务列表存入调用记录
|
||||
JSONObject.parseObject(param).getJSONArray("tasks").forEach(e -> {
|
||||
String taskCode = JSONObject.parseObject(JSONObject.toJSONString(e)).getString("taskCode");
|
||||
updateAgvTask(taskCode, requestType, JSONObject.toJSONString(e), AgvTaskEnum.ONGOING.getCode(), "");
|
||||
});
|
||||
} else {
|
||||
String taskCode = JSONObject.parseObject(JSONObject.toJSONString(JSONObject.parseObject(param)
|
||||
.getJSONArray("tasks").get(0))).getString("taskCode");
|
||||
updateAgvTask(taskCode, requestType, param, AgvTaskEnum.FAIL.getCode(), JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送容器到达通知
|
||||
*
|
||||
* @param param 请求参数
|
||||
*/
|
||||
@Transactional
|
||||
public void containerArrived(String param) {
|
||||
HttpRequest.doPost("http://192.168.33.45:9046/conveyor/containerArrived", param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否允许取走/放置周转箱
|
||||
*
|
||||
* @param param 请求参数
|
||||
*/
|
||||
@Transactional
|
||||
public String allowOperation(String param) {
|
||||
final String result = HttpRequest.doPost("http://192.168.33.211:8081/AllowOperation", param);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新agv任务表
|
||||
*
|
||||
* @param taskCode 请求单号
|
||||
* @param requestType 请求类型
|
||||
* @param param 请求参数
|
||||
* @param status 请求状态
|
||||
*/
|
||||
public void updateAgvTask(String taskCode, Integer requestType, String param, Integer status, String message) {
|
||||
AgvTask agvTask = new AgvTask();
|
||||
agvTask = agvTaskRepository.findByRequestCode(taskCode);
|
||||
if (agvTask == null) {
|
||||
AgvTask task = new AgvTask();
|
||||
agvTask = BeanUtil.copyProperties(task, AgvTask.class);
|
||||
agvTask.setCreatedBy("admin");
|
||||
agvTask.setCreatedDt(DateUtil.getCurrentDate());
|
||||
agvTask.setDictType(requestType);
|
||||
} else {
|
||||
agvTask.setUpdatedBy("admin");
|
||||
agvTask.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
|
||||
}
|
||||
agvTask.setJson(param);
|
||||
agvTask.setRequestCode(taskCode);
|
||||
agvTask.setStatus(status);
|
||||
agvTask.setMessage(message);
|
||||
agvTaskRepository.save(agvTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消修改周转箱
|
||||
*
|
||||
* @param param json
|
||||
*/
|
||||
public void updateContainer(String param, Integer dictType) {
|
||||
final String containerCode = JSONObject.parseObject(param).getString("containerCode");
|
||||
if (dictType == 3) {
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerCode);
|
||||
String productionTask = containerInfo.getProductionTask();
|
||||
//修改生产任务单的出库中数量和出库数量
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(productionTask);
|
||||
orderInfo.setOnoutingCheckQty(orderInfo.getOnoutingCheckQty() - containerInfo.getQty());
|
||||
orderInfo.setOutQty(orderInfo.getOutQty() + containerInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
//修改对应周转箱为空闲(库外)
|
||||
containerInfo.setQty(0);
|
||||
containerInfo.setContainerStatus(5);
|
||||
containerInfo.setStoreCode(null);
|
||||
containerInfo.setOnInstoreTime(null);
|
||||
containerInfo.setProductionTask(null);
|
||||
containerInfo.setIsPdaEdit(0);
|
||||
containerInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
containerInfoRepository.save(containerInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消AGV任务
|
||||
*
|
||||
* @param taskCode
|
||||
*/
|
||||
|
||||
public void taskCancel(String taskCode) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(taskCode);
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("taskCodes", list);
|
||||
final AgvTask agvTask = agvTaskRepository.findByRequestCodeAndStatus(taskCode, 2);
|
||||
if (null == agvTask) {
|
||||
throw new com.ruoyi.ruiYiController.exception.ServiceException( "没有该待执行任务",10000);
|
||||
}
|
||||
final String result = HttpRequest.doPost("http://192.168.33.45:9046/task/cancel", JSONObject.toJSONString(data));
|
||||
log.info("取消任务result:" + JSONObject.toJSONString(result));
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.CANCEL.getCode(), "");
|
||||
updateContainer(agvTask.getJson(), agvTask.getDictType());
|
||||
} else {
|
||||
updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.FAIL.getCode(), JSONObject.parseObject(result).getString("msg"));
|
||||
updateContainer(agvTask.getJson(), agvTask.getDictType());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 容器移入
|
||||
* @param containerCode
|
||||
* @param positionCode
|
||||
*/
|
||||
public String moveIn(String containerCode, String positionCode) {
|
||||
JSONObject data1 = new JSONObject(true);
|
||||
data1.put("containerCode", containerCode);
|
||||
data1.put("positionCode", positionCode);
|
||||
JSONObject data = new JSONObject();
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
taskList.add(data1);
|
||||
data.put("containerMoveIns", taskList);
|
||||
log.info("容器移入:" + JSONObject.toJSONString(data));
|
||||
final String result = HttpRequest.doPost("http://192.168.33.45:9046/expand/api/moveIn/Container", JSONObject.toJSONString(data));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 容器离场
|
||||
* @param containerCode
|
||||
* @param positionCode
|
||||
*/
|
||||
public void moveOut(String containerCode, String positionCode) {
|
||||
JSONObject data1 = new JSONObject(true);
|
||||
data1.put("containerCode", containerCode);
|
||||
data1.put("positionCode", positionCode);
|
||||
JSONObject data = new JSONObject();
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
taskList.add(data1);
|
||||
data.put("containerMoveOuts", taskList);
|
||||
final String result = HttpRequest.doPost("http://192.168.33.45:9046/expand/api/moveOut/Container", JSONObject.toJSONString(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 告知滚筒线箱子已取走/已放下
|
||||
* @param param
|
||||
*/
|
||||
public void noticeToPlc(String param)
|
||||
{
|
||||
HttpRequest.doPost("http://192.168.33.211:8081/OperationSucceed", param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【取】点位的状态
|
||||
* @param locationCode
|
||||
*/
|
||||
public void updateStationStatus(String locationCode)
|
||||
{
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求空箱
|
||||
*
|
||||
* @param requestVo
|
||||
*/
|
||||
@Transactional
|
||||
public void EmptyContainerOutStore(AgvRequestVo requestVo) {
|
||||
final List<ContainerInfo> containerInfos = containerInfoRepository.findByContainerStatus(10);
|
||||
//优化筛选逻辑,按货架的序号分组,取最多的一组
|
||||
for (ContainerInfo containerInfo : containerInfos) {
|
||||
if (StringUtils.isNotBlank(containerInfo.getStoreCode())) {
|
||||
containerInfo.setArea(containerInfo.getStoreCode().substring(6, 8));
|
||||
}
|
||||
}
|
||||
Map<String, List<ContainerInfo>> collect = containerInfos.stream().collect(Collectors.groupingBy(ContainerInfo::getArea));
|
||||
List<Map.Entry<String, List<ContainerInfo>>> sortedList = collect.entrySet().stream()
|
||||
.sorted(Comparator.comparingInt(entry -> entry.getValue().size()))
|
||||
.collect(Collectors.toList());
|
||||
final List<ContainerInfo> value = sortedList.get(sortedList.size()-1).getValue();
|
||||
//判断请求空箱数量是否大约仓库空箱数量
|
||||
if (value.size() < requestVo.getBoxNumber()) {
|
||||
requestVo.setBoxNumber(value.size());
|
||||
}
|
||||
List<ContainerInfo> sendContainer = new ArrayList<>();
|
||||
JSONObject data = new JSONObject(true);
|
||||
//搬运方式
|
||||
if (requestVo.getType() == 1) {
|
||||
//货架方式
|
||||
data.put("taskType", "putaway");
|
||||
} else {
|
||||
//搬运方式
|
||||
data.put("taskType", "carry");
|
||||
}
|
||||
//任务组优先级
|
||||
data.put("groupPriority", 0);
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
for (int i = 0; i < requestVo.boxNumber; i++) {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String taskCode = uuid.toString();
|
||||
ContainerInfo containerInfo = value.get(i);
|
||||
JSONObject data1 = new JSONObject(true);
|
||||
//任务单号
|
||||
data1.put("taskCode", taskCode);
|
||||
//任务优先级
|
||||
data1.put("taskPriority", 1);
|
||||
JSONObject data2 = new JSONObject(true);
|
||||
//容器编码
|
||||
data2.put("containerCode", containerInfo.getContainerNumber());
|
||||
//容器类型
|
||||
data2.put("containerType", "CT_KUBOT_STANDARD");
|
||||
//工作为标签
|
||||
data2.put("storageTag", "");
|
||||
//起始工作位
|
||||
data2.put("fromLocationCode", requestVo.getFromLocationCode());
|
||||
//目标工作位
|
||||
data2.put("toLocationCode", requestVo.getToLocationCode());
|
||||
//目标工作站
|
||||
data2.put("toStationCode", "");
|
||||
data1.put("taskDescribe", data2);
|
||||
taskList.add(data1);
|
||||
sendContainer.add(containerInfo);
|
||||
}
|
||||
if (taskList.size() == 0) {
|
||||
throw new ServiceException("仓库暂无空料箱!");
|
||||
}
|
||||
data.put("tasks", taskList);
|
||||
log.info("param:" + JSONObject.toJSONString(data));
|
||||
final String result = taskCreate(JSONObject.toJSONString(data), requestVo.getRequestType());
|
||||
int code = JSONObject.parseObject(result).getInteger("code");
|
||||
//请求发送成功
|
||||
if (code == 0) {
|
||||
sendContainer.forEach(e -> {
|
||||
//修改为出库中状态
|
||||
e.setContainerStatus(35);
|
||||
containerInfoRepository.save(e);
|
||||
//修改库位状态,待空闲
|
||||
StoreInfo storeInfo = storeInfoRepository.findByStoreCode(e.getStoreCode());
|
||||
if (storeInfo != null) {
|
||||
storeInfo.setStoreStatus(20);
|
||||
storeInfoRepository.save(storeInfo);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new ServiceException( "任务发起失败",10000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AGV回调处理成功信息
|
||||
*
|
||||
* @param agvTask AGV任务列表数据
|
||||
* @param jsonObject 回调信息
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackSuccess(AgvTask agvTask, JSONObject jsonObject) {
|
||||
Integer type = agvTask.getDictType();
|
||||
switch (type) {
|
||||
//空箱
|
||||
case 1:
|
||||
callBackNullBox(jsonObject);
|
||||
break;
|
||||
//入恒温区
|
||||
case 2:
|
||||
callBackInStore(jsonObject);
|
||||
break;
|
||||
//出恒温区
|
||||
case 3:
|
||||
callBackOutStore(jsonObject);
|
||||
break;
|
||||
//送待检缓存区
|
||||
case 4:
|
||||
callBackSendWaitCheck(jsonObject);
|
||||
break;
|
||||
//送检验
|
||||
case 5:
|
||||
callBackSendCheck(jsonObject);
|
||||
break;
|
||||
//回待检区
|
||||
case 6:
|
||||
callBackBackWaitCheck(jsonObject);
|
||||
break;
|
||||
//送抽检
|
||||
case 7:
|
||||
callBackSendPortCheck(jsonObject);
|
||||
break;
|
||||
//送成品库
|
||||
case 8:
|
||||
callBackSendProdStore(jsonObject);
|
||||
break;
|
||||
//成品出库
|
||||
case 9:
|
||||
callBackOutProdStore(jsonObject);
|
||||
break;
|
||||
//空货架入库
|
||||
case 10:
|
||||
callBackSendNullShelf(jsonObject);
|
||||
break;
|
||||
//呼叫空货架
|
||||
case 11:
|
||||
callBackCallNullShelf(jsonObject);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求空箱子成功回调
|
||||
*
|
||||
* @param jsonObject 回调参数
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackNullBox(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String containerCode = jsonObject.getString("containerCode");
|
||||
final ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerCode);
|
||||
//修改库位状态
|
||||
final StoreInfo storeInfo = storeInfoRepository.findByStoreCode(containerInfo.getStoreCode());
|
||||
if (null != storeInfo) {
|
||||
storeInfo.setStoreStatus(5);
|
||||
storeInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
storeInfoRepository.save(storeInfo);
|
||||
}
|
||||
//修改箱子状态为库外空闲
|
||||
containerInfo.setContainerStatus(5);
|
||||
containerInfo.setStoreCode(null);
|
||||
containerInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
containerInfoRepository.save(containerInfo);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 入恒温区成功回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackInStore(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String containerCode = jsonObject.getString("containerCode");
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
final ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerCode);
|
||||
containerInfo.setStoreCode(locationCode);
|
||||
//修改箱子状态在库
|
||||
if (containerInfo.getContainerStatus() == 25) {
|
||||
containerInfo.setContainerStatus(10);
|
||||
} else {
|
||||
containerInfo.setContainerStatus(30);
|
||||
}
|
||||
containerInfo.setInstoreTime(DateUtil.getCurrentDate());
|
||||
containerInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
containerInfoRepository.save(containerInfo);
|
||||
//修改库位信息状态在库
|
||||
final StoreInfo storeInfo = storeInfoRepository.findByStoreCode(locationCode);
|
||||
if (storeInfo != null) {
|
||||
storeInfo.setStoreStatus(15);
|
||||
storeInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
storeInfoRepository.save(storeInfo);
|
||||
}
|
||||
//修改单据出库数据
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(containerInfo.getProductionTask());
|
||||
if (orderInfo != null) {
|
||||
if (orderInfo.getInQty() == null) {
|
||||
orderInfo.setInQty(0);
|
||||
}
|
||||
orderInfo.setInQty(orderInfo.getInQty() + containerInfo.getQty());
|
||||
orderInfo.setOngoingQty(orderInfo.getOngoingQty() - containerInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
if (orderInfo.getInQty().equals(orderInfo.getPlanQty())) {
|
||||
orderInfo.setOrderStatus(15);
|
||||
} else {
|
||||
orderInfo.setOrderStatus(10);
|
||||
}
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 出恒温区成功回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackOutStore(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String containerCode = jsonObject.getString("containerCode");
|
||||
final ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerCode);
|
||||
//修改库位状态
|
||||
final StoreInfo storeInfo = storeInfoRepository.findByStoreCode(containerInfo.getStoreCode());
|
||||
if (null != storeInfo) {
|
||||
storeInfo.setStoreStatus(5);
|
||||
storeInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
storeInfoRepository.save(storeInfo);
|
||||
}
|
||||
//修改单据出库数据
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(containerInfo.getProductionTask());
|
||||
if (orderInfo != null) {
|
||||
orderInfo.setOutQty(orderInfo.getOutQty() + containerInfo.getQty());
|
||||
orderInfo.setOnoutingCheckQty(orderInfo.getOnoutingCheckQty() - containerInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
//修改箱子状态为库外空闲
|
||||
containerInfo.setContainerStatus(5);
|
||||
containerInfo.setOutstoreTime(DateUtil.getCurrentDate());
|
||||
containerInfo.setStoreCode(null);
|
||||
containerInfo.setQty(0);
|
||||
containerInfo.setProductionTask(null);
|
||||
containerInfo.setOutstoreTime(null);
|
||||
containerInfo.setUpdatedDt(null);
|
||||
containerInfo.setOnInstoreTime(null);
|
||||
containerInfo.setInstoreTime(null);
|
||||
containerInfoRepository.save(containerInfo);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 送待检区回调
|
||||
*
|
||||
* @param jsonObject 回调参数
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackSendWaitCheck(JSONObject jsonObject) {
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
|
||||
//修改终点库位状态
|
||||
final StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//修改货架状态为待检
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setShelfStatus(5);
|
||||
shelfInfo.setOrderStatus(5);
|
||||
shelfInfo.setStationCode(locationCode);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
//修改单据出库数据
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
orderInfo.setWaitCheckQty(orderInfo.getWaitCheckQty() + shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 送检验回调
|
||||
*
|
||||
* @param jsonObject 回调参数
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackSendCheck(JSONObject jsonObject) {
|
||||
//库位码
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
//修改库位状态
|
||||
final StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//修改货架状态为待检
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setShelfStatus(5);
|
||||
shelfInfo.setOrderStatus(20);
|
||||
shelfInfo.setStationCode(locationCode);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 送回待检区回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackBackWaitCheck(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
//修改货架信息检验完成
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setOrderStatus(15);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
//修改库位状态
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
final StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
//修改任务单检验数量
|
||||
if (orderInfo != null) {
|
||||
orderInfo.setCheckQty(orderInfo.getCheckQty() - shelfInfo.getQty());
|
||||
orderInfo.setFinishCheckQty(orderInfo.getFinishCheckQty() + shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 送抽检回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
|
||||
@Transactional
|
||||
public void callBackSendPortCheck(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
//修改货架信息待抽检
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setOrderStatus(20);
|
||||
shelfInfo.setStationCode(locationCode);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
//修改库位状态
|
||||
final StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
//修改任务单检验数量
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
if (orderInfo != null) {
|
||||
orderInfo.setCheckQty(orderInfo.getCheckQty() - shelfInfo.getQty());
|
||||
orderInfo.setFinishCheckQty(orderInfo.getFinishCheckQty() + shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 送成品区回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackSendProdStore(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
//终点位置
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//修改抽检工位状态为空闲
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
//修改货架状态为待出库
|
||||
shelfInfo.setOrderStatus(25);
|
||||
shelfInfo.setStationCode(locationCode);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
if (orderInfo != null) {
|
||||
//修改成品入库数量
|
||||
orderInfo.setProductInQty(orderInfo.getProductInQty() + shelfInfo.getQty());
|
||||
orderInfo.setProductOngoingQty(orderInfo.getProductOngoingQty() - shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 成品出库回调
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackOutProdStore(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setProductionTask(null);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
final StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//调用海柔离场接口
|
||||
moveOut(shelfCode, locationCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 空货架入库
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackSendNullShelf(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final String locationCode = jsonObject.getString("locationCode");
|
||||
//清空货架信息,空货架入库
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setUpdatedDt(null);
|
||||
shelfInfo.setOrderStatus(40);
|
||||
shelfInfo.setPriority(0);
|
||||
shelfInfo.setProductionTask(null);
|
||||
shelfInfo.setQty(0);
|
||||
shelfInfo.setStationCode(jsonObject.getString("locationCode"));
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(locationCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 呼叫空货架
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
@Transactional
|
||||
public void callBackCallNullShelf(JSONObject jsonObject) {
|
||||
//容器编码
|
||||
final String shelfCode = jsonObject.getString("containerCode");
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setOrderStatus(40);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfo.setStationCode(jsonObject.getString("locationCode"));
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 成品出库
|
||||
*/
|
||||
public void outProdStore(String code) {
|
||||
final SensorStoreBind sensor = sensorStoreBindRepository.findBySensor(code);
|
||||
List<AgvTask> agvTasks=new ArrayList<>();
|
||||
//判断当前库位是否已存在任务
|
||||
//查找任务类型为成品出库,状态为进行中的任务
|
||||
agvTasks = agvTaskRepository.findByDictTypeAndStatus(RequestEnum.OUTPRODSTORE.getCode(), AgvTaskEnum.ONGOING.getCode());
|
||||
if(agvTasks.size()>0){
|
||||
agvTasks.forEach(e->{
|
||||
String toLocationCode = JSONObject.parseObject(e.getJson()).getJSONObject("taskDescribe").getString("toLocationCode");
|
||||
if(sensor.getStationCode().equals(toLocationCode)){
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (sensor == null) {
|
||||
return;
|
||||
}
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(sensor.getStationCode());
|
||||
//查询在成品库的货架
|
||||
final List<ShelfInfo> shelfInfos = shelfInfoRepository.findByOrderStatus(25);
|
||||
if (shelfInfos.size() == 0) {
|
||||
return;
|
||||
}
|
||||
//根据优先级和入库时间排序
|
||||
final List<ShelfInfo> sorted = shelfInfos.stream().sorted(Comparator.comparing(ShelfInfo::getPriority, Comparator.reverseOrder()).thenComparing(ShelfInfo::getUpdatedDt)).collect(Collectors.toList());
|
||||
|
||||
AgvRequestVo agvRequestVo = new AgvRequestVo();
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setToLocationCode(sensor.getStationCode());
|
||||
agvRequestVo.setFromLocationCode(sorted.get(0).getStationCode());
|
||||
agvRequestVo.setContainerCode(sorted.get(0).getShelfCode());
|
||||
agvRequestVo.setRequestType(RequestEnum.OUTPRODSTORE.getCode());
|
||||
final String result = taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//修改出库工位状态为作业中
|
||||
stationInfo.setStationStatus(10);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
//修改货架状态为出库位待出库
|
||||
sorted.get(0).setOrderStatus(30);
|
||||
shelfInfoRepository.save(sorted.get(0));
|
||||
//修改订单出库中数量
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfos.get(0).getProductionTask());
|
||||
orderInfo.setProductOnoutingQty(orderInfo.getProductOnoutingQty() + shelfInfos.get(0).getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void sendNullShelf(String code) {
|
||||
AgvRequestVo agvRequestVo = new AgvRequestVo();
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDNULLSHELF.getCode());
|
||||
final SensorStoreBind sensor = sensorStoreBindRepository.findBySensor(code);
|
||||
List<AgvTask> agvTasks=new ArrayList<>();
|
||||
//查找任务类型为空货架入库,状态为进行中的任务
|
||||
agvTasks = agvTaskRepository.findByDictTypeAndStatus(RequestEnum.SENDNULLSHELF.getCode(), AgvTaskEnum.ONGOING.getCode());
|
||||
if(agvTasks.size()>0){
|
||||
agvTasks.forEach(e->{
|
||||
String toLocationCode = JSONObject.parseObject(e.getJson()).getJSONObject("taskDescribe").getString("fromLocationCode");
|
||||
//当任务起点相同时,不再发送命令
|
||||
if(sensor.getStationCode().equals(toLocationCode)){
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
agvRequestVo.setFromLocationCode(sensor.getStationCode());
|
||||
//查找空闲终点位置(先找缓存库位待检区,再找成品缓存库位)
|
||||
String toLocationCode = null;
|
||||
List<StationInfo> stationInfoList = stationInfoRepository.findByStationTypeAndStationStatus(15, 5);
|
||||
if (stationInfoList.size() > 0) {
|
||||
toLocationCode = stationInfoList.get(0).getStationCode();
|
||||
} else {
|
||||
List<StationInfo> stationInfoList2 = stationInfoRepository.findByStationTypeAndStationStatus(30, 5);
|
||||
toLocationCode = stationInfoList2.get(0).getStationCode();
|
||||
}
|
||||
agvRequestVo.setToLocationCode(toLocationCode);
|
||||
taskParamCreate(agvRequestVo);
|
||||
}
|
||||
|
||||
public String sendNullShelf2(String fromLocationCode, String shelfCode) {
|
||||
AgvRequestVo agvRequestVo = new AgvRequestVo();
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDNULLSHELF.getCode());
|
||||
agvRequestVo.setContainerCode(shelfCode);
|
||||
agvRequestVo.setFromLocationCode(fromLocationCode);
|
||||
//查找空闲终点位置(先找缓存库位待检区,再找成品缓存库位)
|
||||
String toLocationCode = null;
|
||||
List<StationInfo> stationInfoList = stationInfoRepository.findByStationTypeAndStationStatus(15, 5);
|
||||
if (stationInfoList.size() > 0) {
|
||||
toLocationCode = stationInfoList.get(0).getStationCode();
|
||||
} else {
|
||||
List<StationInfo> stationInfoList2 = stationInfoRepository.findByStationTypeAndStationStatus(30, 5);
|
||||
toLocationCode = stationInfoList2.get(0).getStationCode();
|
||||
}
|
||||
agvRequestVo.setToLocationCode(toLocationCode);
|
||||
String result = taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(toLocationCode);
|
||||
stationInfo.setStationStatus(10);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,638 @@
|
||||
package com.ruoyi.wms.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cmeim.common.core.utils.BeanUtil;
|
||||
import com.cmeim.common.core.utils.DateUtil;
|
||||
import com.cmeim.common.core.utils.ExcelExportUtil;
|
||||
import com.cmeim.common.core.web.controller.GenericController;
|
||||
import com.cmeim.common.core.web.domain.Respond;
|
||||
import com.cmeim.common.core.web.page.PageVo;
|
||||
|
||||
import com.ruoyi.ruiYiController.exception.ServiceException;
|
||||
import com.ruoyi.wms.enums.AgvTaskEnum;
|
||||
import com.ruoyi.wms.enums.RequestEnum;
|
||||
import com.ruoyi.wms.po.*;
|
||||
import com.ruoyi.wms.repository.*;
|
||||
import com.ruoyi.wms.service.AGVService;
|
||||
import com.ruoyi.wms.service.ScheduleService;
|
||||
import com.ruoyi.wms.vo.*;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/6/26
|
||||
**/
|
||||
@Api(tags = "数据采集接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping(value = "agv")
|
||||
public class AgvController extends GenericController {
|
||||
|
||||
@Autowired
|
||||
private AgvTaskRepository agvTaskRepository;
|
||||
@Autowired
|
||||
private AGVService agvService;
|
||||
@Autowired
|
||||
private ContainerInfoRepository containerInfoRepository;
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
@Autowired
|
||||
private StationInfoRepository stationInfoRepository;
|
||||
@Autowired
|
||||
private ShelfInfoRepository shelfInfoRepository;
|
||||
@Autowired
|
||||
private ScheduleService scheduleService;
|
||||
|
||||
@ApiOperation(value = "列表")
|
||||
@GetMapping(value = "list")
|
||||
public Respond list(PageVo pv, AgvTask agvTask) {
|
||||
PageRequest pageRequest = PageRequest.of(pv.getPageNo() - 1, pv.getPageSize(),
|
||||
Sort.by(sortOrder(agvTask.getOrders())));
|
||||
Page page = agvTaskRepository.findAll(buildSpecification(agvTask), pageRequest);
|
||||
List<AgvTask> list = page.getContent();
|
||||
pv.setRecordsTotal(page.getTotalElements());
|
||||
pv.setData(list);
|
||||
return buildSuccess(pv);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出excel")
|
||||
@PostMapping("exportExcel")
|
||||
public void export(AgvTask agvTask, HttpServletResponse response) throws Exception {
|
||||
List<AgvTask> list = agvTaskRepository.findAll(buildSpecification(agvTask));
|
||||
List<AgvTaskExportVo> exportList = new ArrayList<>();
|
||||
for (AgvTask task : list) {
|
||||
AgvTaskExportVo agvTaskExportVo = BeanUtil.copyProperties(task, AgvTaskExportVo.class);
|
||||
exportList.add(agvTaskExportVo);
|
||||
}
|
||||
// 创建工作簿对象
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
|
||||
// 创建工作表
|
||||
SXSSFSheet sheet = workbook.createSheet("AGV任务列表");
|
||||
|
||||
String[] rowsName = new String[]{"序号", "请求单号", "类型", "json", "任务状态", "处理结果", "创建人", "创建时间"};
|
||||
List<Object[]> dataList = new ArrayList<Object[]>();
|
||||
Object[] objs = null;
|
||||
int i = 1;
|
||||
for (AgvTaskExportVo agvTaskExportVo : exportList) {
|
||||
if (agvTaskExportVo.getDictType() == 1) {
|
||||
agvTaskExportVo.setDictTypeShow("请求空箱");
|
||||
} else if (agvTaskExportVo.getDictType() == 2) {
|
||||
agvTaskExportVo.setDictTypeShow("入水测");
|
||||
} else if (agvTaskExportVo.getDictType() == 3) {
|
||||
agvTaskExportVo.setDictTypeShow("出水测");
|
||||
} else if (agvTaskExportVo.getDictType() == 4) {
|
||||
agvTaskExportVo.setDictTypeShow("送待检");
|
||||
} else if (agvTaskExportVo.getDictType() == 5) {
|
||||
agvTaskExportVo.setDictTypeShow("送检验");
|
||||
} else if (agvTaskExportVo.getDictType() == 6) {
|
||||
agvTaskExportVo.setDictTypeShow("回待检");
|
||||
} else if (agvTaskExportVo.getDictType() == 7) {
|
||||
agvTaskExportVo.setDictTypeShow("送抽检");
|
||||
} else if (agvTaskExportVo.getDictType() == 8) {
|
||||
agvTaskExportVo.setDictTypeShow("送成品库");
|
||||
} else if (agvTaskExportVo.getDictType() == 9) {
|
||||
agvTaskExportVo.setDictTypeShow("出成品库");
|
||||
} else if (agvTaskExportVo.getDictType() == 10) {
|
||||
agvTaskExportVo.setDictTypeShow("空箱入库");
|
||||
} else if (agvTaskExportVo.getDictType() == 11) {
|
||||
agvTaskExportVo.setDictTypeShow("呼叫空货架");
|
||||
}
|
||||
if (agvTaskExportVo.getStatus() == 1) {
|
||||
agvTaskExportVo.setStatusShow("未发起");
|
||||
} else if (agvTaskExportVo.getDictType() == 2) {
|
||||
agvTaskExportVo.setStatusShow("进行中");
|
||||
} else if (agvTaskExportVo.getDictType() == 3) {
|
||||
agvTaskExportVo.setStatusShow("已完成");
|
||||
} else if (agvTaskExportVo.getDictType() == 4) {
|
||||
agvTaskExportVo.setStatusShow("失败");
|
||||
} else if (agvTaskExportVo.getDictType() == 5) {
|
||||
agvTaskExportVo.setStatusShow("取消");
|
||||
} else if (agvTaskExportVo.getStatus() == 6) {
|
||||
agvTaskExportVo.setStatusShow("挂起");
|
||||
}
|
||||
|
||||
objs = new Object[rowsName.length];
|
||||
objs[0] = i;
|
||||
objs[1] = agvTaskExportVo.getRequestCode();
|
||||
objs[2] = agvTaskExportVo.getDictTypeShow();
|
||||
objs[3] = agvTaskExportVo.getJson();
|
||||
objs[4] = agvTaskExportVo.getStatusShow();
|
||||
objs[5] = agvTaskExportVo.getMessage();
|
||||
objs[6] = agvTaskExportVo.getCreatedBy();
|
||||
objs[7] = agvTaskExportVo.getCreatedDt();
|
||||
dataList.add(objs);
|
||||
i += 1;
|
||||
}
|
||||
ExcelExportUtil.getExportWorkbook(workbook, sheet, rowsName, dataList);
|
||||
ExcelExportUtil.sendHttpResponse(response, "Agv", workbook);
|
||||
}
|
||||
|
||||
private Specification buildSpecification(AgvTask agvTask) {
|
||||
Specification<AgvTask> specification = new Specification<AgvTask>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<AgvTask> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> predicates = Lists.newArrayList();
|
||||
if (agvTask.getRequestCode() != null) {
|
||||
predicates.add(cb.like(root.get("requestCode").as(String.class), "%" + agvTask.getRequestCode() + "%"));
|
||||
}
|
||||
if (agvTask.getMessage() != null) {
|
||||
predicates.add(cb.like(root.get("message").as(String.class), "%" + agvTask.getMessage() + "%"));
|
||||
}
|
||||
if (agvTask.getDictType() != null) {
|
||||
predicates.add(cb.equal(root.get("dictType").as(Integer.class), agvTask.getDictType()));
|
||||
}
|
||||
if (agvTask.getStatus() != null) {
|
||||
predicates.add(cb.equal(root.get("status").as(Integer.class), agvTask.getStatus()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(agvTask.getCreatedDtStart())) {
|
||||
predicates.add(cb.greaterThanOrEqualTo(root.get("createdDt").as(String.class), agvTask.getCreatedDtStart()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(agvTask.getCreatedDtEnd())) {
|
||||
predicates.add(cb.lessThanOrEqualTo(root.get("createdDt").as(String.class), agvTask.getCreatedDtEnd()));
|
||||
}
|
||||
if (agvTask.getStatusArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("status").as(Integer.class));
|
||||
for (Integer status : agvTask.getStatusArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
if (agvTask.getDictTypeArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("dictType").as(Integer.class));
|
||||
for (Integer status : agvTask.getDictTypeArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||
}
|
||||
};
|
||||
|
||||
return specification;
|
||||
}
|
||||
|
||||
/**
|
||||
* AGV任务回调
|
||||
*
|
||||
* @param jsonObject 回调参数
|
||||
* @return 结果返回
|
||||
*/
|
||||
@ApiOperation(value = "AGV任务回调")
|
||||
@PostMapping(value = "TaskStatusCallback")
|
||||
public JSONObject TaskStatusCallback(@RequestBody JSONObject jsonObject) {
|
||||
//log.info("回调任务all:" + jsonObject);
|
||||
String taskCode = jsonObject.getString("taskCode");
|
||||
final AgvTask agvTask = agvTaskRepository.findByRequestCode(taskCode);
|
||||
String status = jsonObject.getString("status");
|
||||
if (StringUtils.isNotBlank(status)) {
|
||||
if (status.equals("fail")) {
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.FAIL.getCode(), jsonObject.getString("message"));
|
||||
} else if (status.equals("success")) {
|
||||
//获取回调类型
|
||||
String eventType = jsonObject.getString("eventType");
|
||||
if (eventType.equals("task")) {
|
||||
log.info("回调任务task:" + jsonObject);
|
||||
//更新任务状态
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.FINISH.getCode(), jsonObject.getString("message"));
|
||||
//成功回调
|
||||
agvService.callBackSuccess(agvTask, jsonObject);
|
||||
}
|
||||
//取箱完成时,修改工位状态
|
||||
else if (eventType.equals("tote_load") && agvTask.getDictType() > 3) {
|
||||
String locationCode = jsonObject.getString("locationCode");
|
||||
agvService.updateStationStatus(locationCode);
|
||||
}
|
||||
//放箱完成回调,滚筒线请求空箱
|
||||
else if (eventType.equals("tote_unload") && agvTask.getDictType() == 1) {
|
||||
String param = jsonObject.toJSONString();
|
||||
agvService.noticeToPlc(param);
|
||||
}
|
||||
|
||||
} else if (status.equals("cancel")) {
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.CANCEL.getCode(), jsonObject.getString("message"));
|
||||
} else if (status.equals("suspend")) {
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.PENDING.getCode(), jsonObject.getString("message"));
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", 0);
|
||||
result.put("msg", "success");
|
||||
result.put("data", "");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空箱入库")
|
||||
@PostMapping(value = "EmptyContainerInStore")
|
||||
@Transactional
|
||||
public Respond EmptyContainerInStore(@RequestBody AgvRequestVo requestVo) {
|
||||
//校验周转箱是否存在以及状态
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(requestVo.getContainerCode());
|
||||
if (containerInfo == null) {
|
||||
throw new ServiceException("周转箱号不存在:" + requestVo.getContainerCode());
|
||||
}
|
||||
if (containerInfo.getContainerStatus() != 15 && containerInfo.getContainerStatus() != 20 && containerInfo.getContainerStatus() != 25) {
|
||||
throw new ServiceException("周转箱号状态不是入库中的状态:" + requestVo.getContainerCode());
|
||||
}
|
||||
requestVo.setType(1);
|
||||
requestVo.setRequestType(RequestEnum.NULLBOXINSTORE.getCode());
|
||||
requestVo.setFromLocationCode(requestVo.getFromLocationCode());
|
||||
requestVo.setToLocationCode("LA_SHELF_STORAGE");
|
||||
requestVo.setContainerCode(requestVo.getContainerCode());
|
||||
String result = agvService.taskParamCreate(requestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空料箱出库")
|
||||
@PostMapping(value = "EmptyContainerOutStore")
|
||||
public Respond EmptyContainerOutStore(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//判断空箱出库任务是否唯一
|
||||
List<AgvTask> agvTaskList = agvTaskRepository.findByDictTypeAndStatus(RequestEnum.NULLBOX.getCode(), 2);
|
||||
if (agvTaskList.size() > 6) {
|
||||
return buildFailure("还有正在执行的出库任务:" + agvTaskList);
|
||||
}
|
||||
//设置agv请求类型
|
||||
agvRequestVo.setRequestType(RequestEnum.NULLBOX.getCode());
|
||||
agvRequestVo.setType(0);
|
||||
agvService.EmptyContainerOutStore(agvRequestVo);
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "料箱入库")
|
||||
@PostMapping(value = "ContainerInStore")
|
||||
public Respond ContainerInStore(@RequestBody AgvRequestVo requestVo) {
|
||||
//校验周转箱是否存在以及状态
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(requestVo.getContainerCode());
|
||||
if (containerInfo == null) {
|
||||
throw new ServiceException("周转箱号不存在:" + requestVo.getContainerCode());
|
||||
}
|
||||
if (containerInfo.getContainerStatus() != 15 && containerInfo.getContainerStatus() != 20 && containerInfo.getContainerStatus() != 25) {
|
||||
throw new ServiceException("该料箱在入库状态!" + requestVo.getContainerCode());
|
||||
}
|
||||
requestVo.setType(1);
|
||||
requestVo.setRequestType(RequestEnum.INSTORE.getCode());
|
||||
requestVo.setToStationCode("LA_SHELF_STORAGE");
|
||||
String result = agvService.taskParamCreate(requestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//final ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(requestVo.getContainerCode());
|
||||
//containerInfo.setProductionTask(requestVo.productionTask);
|
||||
//containerInfo.setOnInstoreTime(DateUtil.getCurrentDate());
|
||||
//final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(requestVo.getProductionTask());
|
||||
//Integer qty = orderInfo.getPlanQty() - (orderInfo.getInQty() + orderInfo.getOngoingQty() + orderInfo.getOutQty() + orderInfo.getOnoutingCheckQty());
|
||||
//if (qty > 6) {
|
||||
// qty = 6;
|
||||
//}
|
||||
////入库中数量
|
||||
//orderInfo.setOngoingQty(orderInfo.getOngoingQty() + qty);
|
||||
//containerInfo.setQty(qty);
|
||||
//orderInfoRepository.save(orderInfo);
|
||||
//containerInfoRepository.save(containerInfo);
|
||||
return buildSuccess("请求成功");
|
||||
} else {
|
||||
return buildSuccess(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "送待检缓存区")
|
||||
@PostMapping(value = "sendWaitCheck")
|
||||
public Respond sendWaitCheck(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//校验
|
||||
if (StringUtils.isBlank(agvRequestVo.getContainerCode())) {
|
||||
throw new ServiceException("无货架编码,请检查!");
|
||||
}
|
||||
if (StringUtils.isBlank(agvRequestVo.getProductionTask())) {
|
||||
throw new ServiceException("无生产工单号,请检查!");
|
||||
}
|
||||
if (StringUtils.isBlank(agvRequestVo.getFromLocationCode())) {
|
||||
throw new ServiceException("无起始点位置,请检查!");
|
||||
}
|
||||
if (agvRequestVo.getBoxNumber() == null) {
|
||||
throw new ServiceException("无货架数量,请检查!");
|
||||
}
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDWAITCHECK.getCode());
|
||||
String toLocationCode = findToLocationCode(15);
|
||||
agvRequestVo.setToLocationCode(toLocationCode);
|
||||
final String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//修改起点位状态为空闲
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//修改终点点位状态为待占用
|
||||
StationInfo stationInfo1 = stationInfoRepository.findByStationCode(toLocationCode);
|
||||
stationInfo1.setStationStatus(10);
|
||||
stationInfo1.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo1);
|
||||
//修改货架信息
|
||||
ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(agvRequestVo.getContainerCode());
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setStationCode(agvRequestVo.getFromLocationCode());
|
||||
shelfInfo.setProductionTask(agvRequestVo.getProductionTask());
|
||||
shelfInfo.setQty(agvRequestVo.getBoxNumber());
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfo.setPriority(0);
|
||||
shelfInfo.setStationCode(agvRequestVo.getFromLocationCode());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
} else {
|
||||
ShelfInfo shelfInfo1 = new ShelfInfo();
|
||||
shelfInfo1.setShelfCode(agvRequestVo.getContainerCode());
|
||||
shelfInfo1.setStationCode(agvRequestVo.getFromLocationCode());
|
||||
shelfInfo1.setProductionTask(agvRequestVo.getProductionTask());
|
||||
shelfInfo1.setQty(agvRequestVo.getBoxNumber());
|
||||
shelfInfo1.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfo1.setPriority(0);
|
||||
shelfInfo1.setStationCode(agvRequestVo.getFromLocationCode());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "从缓存库位到检验库位")
|
||||
@PostMapping(value = "sendCheck")
|
||||
@Transactional
|
||||
public Respond sendCheck(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//校验
|
||||
if (StringUtils.isNotBlank(agvRequestVo.getLastRequestCode())) {
|
||||
AgvTask agvTask = agvTaskRepository.findByRequestCode(agvRequestVo.getLastRequestCode());
|
||||
if (agvTask != null) {
|
||||
if (agvTask.getStatus() <= 2) {
|
||||
throw new ServiceException("上次任务还在执行中,任务号:" + agvRequestVo.getLastRequestCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(agvRequestVo.getProductionTask())) {
|
||||
throw new ServiceException("无生产工单号,请检查!");
|
||||
}
|
||||
if (StringUtils.isBlank(agvRequestVo.getToLocationCode())) {
|
||||
throw new ServiceException("无终点位置,请检查!");
|
||||
}
|
||||
List<ShelfInfo> shelfInfoList = shelfInfoRepository.findByProductionTaskAndOrderStatus(agvRequestVo.getProductionTask(), 5);
|
||||
if (shelfInfoList.size() == 0) {
|
||||
throw new ServiceException("该订单没有货架在缓存库位!");
|
||||
}
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setContainerCode(shelfInfoList.get(0).getShelfCode());
|
||||
agvRequestVo.setFromLocationCode(shelfInfoList.get(0).getStationCode());
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDCHECK.getCode());
|
||||
String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//修改起始点位状态为空闲
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//修改终点工位待占用状态
|
||||
StationInfo stationInfo1 = stationInfoRepository.findByStationCode(agvRequestVo.getToLocationCode());
|
||||
if (stationInfo1 != null) {
|
||||
stationInfo1.setStationStatus(10);
|
||||
stationInfo1.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo1);
|
||||
}
|
||||
//修改货架的工单状态
|
||||
ShelfInfo shelfInfo = shelfInfoList.get(0);
|
||||
shelfInfo.setOrderStatus(10);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
ShelfInfo save = shelfInfoRepository.save(shelfInfo);
|
||||
String data = JSONObject.parseObject(result).getString("data");
|
||||
SpotCheckVo spotCheckVo = BeanUtil.copyProperties(save, SpotCheckVo.class);
|
||||
data = data.replaceAll("\\\"","");
|
||||
data = data.replace("{", "").replace("}","");
|
||||
spotCheckVo.setRequestCode(data.substring(0, data.indexOf(":")));
|
||||
return buildSuccess(spotCheckVo);
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
Lock lock = new ReentrantLock();
|
||||
|
||||
@ApiOperation(value = "送抽检")
|
||||
@PostMapping(value = "sendSpotCheck")
|
||||
public Respond sendSpotCheck(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
if (StringUtils.isBlank(agvRequestVo.getFromLocationCode())) {
|
||||
throw new ServiceException("无起始位置,请检查!");
|
||||
}
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDSPOTCHECK.getCode());
|
||||
String result = null;
|
||||
lock.lock();
|
||||
try {
|
||||
//查起始点位对应的货架编码
|
||||
List<ShelfInfo> shelfInfoList = shelfInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
if (shelfInfoList.size() > 0) {
|
||||
agvRequestVo.setContainerCode(shelfInfoList.get(0).getShelfCode());
|
||||
} else {
|
||||
throw new ServiceException("该位置无货架:" + agvRequestVo.getFromLocationCode());
|
||||
}
|
||||
final List<StationInfo> stationInfos = stationInfoRepository.findByStationTypeAndStationStatus(25, 5);
|
||||
if (stationInfos.size() > 0) {
|
||||
agvRequestVo.setToLocationCode(stationInfos.get(0).getStationCode());
|
||||
} else {
|
||||
agvRequestVo.setRequestType(RequestEnum.BACKWAITCHECK.getCode());
|
||||
}
|
||||
result = agvService.taskParamCreate(agvRequestVo);
|
||||
//查找任务单号
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
if (stationInfos.size() > 0) {
|
||||
//修改起始点位状态为空闲
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
//修改抽检工位待占用状态
|
||||
stationInfos.get(0).setStationStatus(10);
|
||||
stationInfoRepository.save(stationInfos.get(0));
|
||||
}
|
||||
String data = JSONObject.parseObject(result).getString("data");
|
||||
SpotCheckVo spotCheckVo = BeanUtil.copyProperties(shelfInfoList.get(0), SpotCheckVo.class);
|
||||
data = data.replaceAll("\\\"","");
|
||||
data = data.replace("{", "").replace("}","");
|
||||
spotCheckVo.setRequestCode(data.substring(0, data.indexOf(":")));
|
||||
return buildSuccess(spotCheckVo);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "送成品库")
|
||||
@PostMapping(value = "sendProdStore")
|
||||
@Transactional
|
||||
public Respond sendProdStore(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//校验
|
||||
if (StringUtils.isBlank(agvRequestVo.getContainerCode())) {
|
||||
throw new ServiceException("无货架编码,请检查!");
|
||||
}
|
||||
|
||||
ShelfInfo byShelfCode = shelfInfoRepository.findByShelfCode(agvRequestVo.getContainerCode());
|
||||
agvRequestVo.setFromLocationCode(byShelfCode.getStationCode());
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDPRODSTORE.getCode());
|
||||
String toLocationCode = findToLocationCode(30);
|
||||
agvRequestVo.setToLocationCode(toLocationCode);
|
||||
final String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//修改起始点位状态为空闲
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
//修改终点点位状态为待占用
|
||||
StationInfo stationInfo1 = stationInfoRepository.findByStationCode(toLocationCode);
|
||||
stationInfo1.setStationStatus(10);
|
||||
stationInfo1.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo1);
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(agvRequestVo.getContainerCode());
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
orderInfo.setProductOngoingQty(orderInfo.getProductOngoingQty() + shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空货架送回(不用,用tcpUtil的空箱入库方法)")
|
||||
@PostMapping(value = "sendNullShelf")
|
||||
public Respond sendNullShelf(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDNULLSHELF.getCode());
|
||||
final String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "呼叫空货架")
|
||||
@PostMapping(value = "callNullShelf")
|
||||
public Respond callNullShelf(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//校验
|
||||
if (StringUtils.isBlank(agvRequestVo.getToLocationCode())) {
|
||||
throw new ServiceException("无终点位置,请检查!");
|
||||
}
|
||||
if (StringUtils.isBlank(agvRequestVo.getContainerCode())) {
|
||||
throw new ServiceException("无货架编码,请检查!");
|
||||
}
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.CALLNULLSHELF.getCode());
|
||||
String result = null;
|
||||
lock.lock();
|
||||
try {
|
||||
final List<ShelfInfo> shelfInfos = shelfInfoRepository.findByProductionTaskIsNullAndStationCodeIsNotNull();
|
||||
if (shelfInfos.size() == 0) {
|
||||
return buildFailure("暂无空货架");
|
||||
}
|
||||
agvRequestVo.setContainerCode(shelfInfos.get(0).getShelfCode());
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(shelfInfos.get(0).getStationCode());
|
||||
agvRequestVo.setFromLocationCode(stationInfo.getStationCode());
|
||||
result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
shelfInfos.get(0).setProductionTask("待绑定");
|
||||
shelfInfoRepository.save(shelfInfos.get(0));
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "取消AGV任务")
|
||||
@GetMapping(value = "cancelTask")
|
||||
public Respond cancelTask(@RequestParam("taskCode") String taskCode) {
|
||||
agvService.taskCancel(taskCode);
|
||||
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "机器人是否允许取走/放置周转箱")
|
||||
@PostMapping(value = "allowOperation")
|
||||
public String allowOperation(@RequestBody String Bash) {
|
||||
String result = agvService.allowOperation(Bash);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "料箱出库(定时任务测试)")
|
||||
@PostMapping(value = "waterTest")
|
||||
public void waterTest() {
|
||||
scheduleService.waterTest();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "成品出库(测试)")
|
||||
@GetMapping(value = "outProdStore")
|
||||
public void outProdStore(String status) {
|
||||
agvService.outProdStore(status);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空货架入库(测试)")
|
||||
@GetMapping(value = "sendNullShelf")
|
||||
public void sendNullShelf(String status) {
|
||||
agvService.sendNullShelf(status);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空车入库(PDA)")
|
||||
@GetMapping(value = "nullShelfIn")
|
||||
public Respond nullShelfIn(@RequestParam("containerCode") String containerCode, @RequestParam("positionCode") String positionCode) {
|
||||
String result = agvService.moveIn(containerCode, positionCode);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(containerCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setStationCode(positionCode);
|
||||
}
|
||||
String result2 = agvService.sendNullShelf2(positionCode, containerCode);
|
||||
} else {
|
||||
return buildFailure("海柔报错:" + JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "找终点位置")
|
||||
@PostMapping(value = "findToLocationCode")
|
||||
public String findToLocationCode(Integer storeType) {
|
||||
String toLocationCode = null;
|
||||
List<StationInfo> stationInfoList = stationInfoRepository.findByStationTypeAndStationStatus(storeType, 5);
|
||||
if (stationInfoList.size() > 0) {
|
||||
toLocationCode = stationInfoList.get(0).getStationCode();
|
||||
} else {
|
||||
throw new ServiceException("暂无空闲的点位!");
|
||||
}
|
||||
return toLocationCode;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
restart.include.json=/com.alibaba.fastjson.*.jar
|
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询库位信息,记录周装货架存放库位信息列表
|
||||
export function listInfo(query) {
|
||||
return request({
|
||||
url: '/container/infoList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询库位信息,记录周装货架存放库位信息详细
|
||||
export function getInfo(id) {
|
||||
return request({
|
||||
url: 'store/list' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增库位信息,记录周装货架存放库位信息
|
||||
export function addInfo(data) {
|
||||
return request({
|
||||
url: '/system/info',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改库位信息,记录周装货架存放库位信息
|
||||
export function updateInfo(data) {
|
||||
return request({
|
||||
url: '/system/info',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除库位信息,记录周装货架存放库位信息
|
||||
export function delInfo(id) {
|
||||
return request({
|
||||
url: '/system/info/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1579774825624" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1248" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M498.595712 482.290351 345.420077 482.290351l0 57.307194 210.477712 0L555.897789 274.196942l-57.301054 0L498.596735 482.290351zM498.595712 482.290351" p-id="1249"></path><path d="M577.685002 644.98478l379.879913 0 0 57.302077L577.685002 702.286858 577.685002 644.98478 577.685002 644.98478zM577.685002 644.98478" p-id="1250"></path><path d="M577.685002 773.764795l379.879913 0 0 57.307194L577.685002 831.071989 577.685002 773.764795 577.685002 773.764795zM577.685002 773.764795" p-id="1251"></path><path d="M577.685002 902.549927l379.879913 0 0 57.307194L577.685002 959.857121 577.685002 902.549927 577.685002 902.549927zM577.685002 902.549927" p-id="1252"></path><path d="M102.523001 382.290823c4.450359 2.615571 9.470699 3.954055 14.530948 3.954055 2.969635 0 5.952572-0.461511 8.836249-1.394766l190.809767-61.886489c15.052834-4.882194 23.297612-21.040199 18.415418-36.08894-4.882194-15.052834-21.040199-23.297612-36.093033-18.415418L175.676092 308.458257c15.994276-26.115797 35.170011-50.537 57.370639-72.743768 73.767074-73.767074 171.845857-114.388237 276.16783-114.388237 104.32095 0 202.39564 40.622186 276.16169 114.388237s114.393353 171.845857 114.393353 276.16783c0 26.427906-2.615571 52.449559-7.709589 77.780481l58.302871 0c4.464685-25.499767 6.708795-51.470255 6.708795-77.780481 0-60.449767-11.845793-119.102608-35.204803-174.336584-22.559808-53.334719-54.850236-101.226472-95.968725-142.349055-41.122583-41.122583-89.017406-73.408917-142.348032-95.968725C628.317169 75.866898 569.659211 64.021106 509.215584 64.021106c-60.448744 0-119.106702 11.845793-174.336584 35.207873-53.334719 22.559808-101.230566 54.846142-142.349055 95.968725-23.980157 23.980157-44.934398 50.278103-62.727647 78.601172l-20.738323-105.655342c-3.043313-15.527648-18.105357-25.642007-33.631982-22.599717-15.527648 3.048429-25.64303 18.105357-22.599717 33.637098l36.102243 183.932126C90.51348 371.153158 95.460142 378.13313 102.523001 382.290823L102.523001 382.290823zM102.523001 382.290823" p-id="1253"></path><path d="M126.020158 587.9416 67.768453 587.9416c5.759167 33.679054 15.368012 66.544579 28.789697 98.278327 22.559808 53.333696 54.850236 101.225449 95.971795 142.348032 41.122583 41.122583 89.014336 73.408917 142.349055 95.968725 54.112432 22.88829 111.517863 34.71157 170.668031 35.18229L505.547031 902.395408c-102.94972-0.941442-199.594851-41.445948-272.499277-114.349351C177.545672 732.543975 140.810003 663.275355 126.020158 587.9416L126.020158 587.9416zM126.020158 587.9416" p-id="1254"></path></svg>
|
After Width: | Height: | Size: 2.8 KiB |
@ -0,0 +1,337 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="请求单号" prop="requestCode">
|
||||
<el-input
|
||||
v-model="queryParams.requestCode"
|
||||
placeholder="请输入请求单号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="任务状态"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.agv_request_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间起" prop="createdDtStart">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.createdDtStart"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间止" prop="createdDtEnd">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.createdDtEnd"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<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-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:task:export']"
|
||||
>导出</el-button>
|
||||
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="taskList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="请求单号" align="center" prop="requestCode" />
|
||||
<el-table-column label="类型" align="center" prop="dictType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.agv_request_type" :value="scope.row.dictType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="json" align="center" prop="json" show-overflow-tooltip/>
|
||||
<el-table-column label="任务状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.agv_request_status" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理结果" align="center" prop="message" />
|
||||
<el-table-column label="创建人" align="center" prop="createdBy" />
|
||||
<el-table-column label="创建时间" align="center" prop="createdDt" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createdDt) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新人" align="center" prop="updatedBy" />
|
||||
<el-table-column label="更新时间" align="center" prop="updatedDt" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.updatedDt) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
width="160"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope" v-if="scope.row.userId !== 1">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="cancelTask(scope.row)"
|
||||
v-hasPermi="['system:user:remove']"
|
||||
>取消任务</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改【请填写功能名称】对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="请求单号" prop="requestCode">
|
||||
<el-input v-model="form.requestCode" placeholder="请输入请求单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="json" prop="json">
|
||||
<el-input v-model="form.json" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="处理结果" prop="message">
|
||||
<el-input v-model="form.message" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="createdBy">
|
||||
<el-input v-model="form.createdBy" placeholder="请输入创建人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createdDt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.createdDt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updatedBy">
|
||||
<el-input v-model="form.updatedBy" placeholder="请输入更新人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updatedDt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.updatedDt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择更新时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listTask, cancelTask, delTask, addTask, updateTask } from "@/api/wms/agvTaskInfo";
|
||||
|
||||
export default {
|
||||
name: "Task",
|
||||
dicts:['agv_request_status','agv_request_type'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 【请填写功能名称】表格数据
|
||||
taskList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
requestCode: null,
|
||||
dictType: null,
|
||||
json: null,
|
||||
status: null,
|
||||
message: null,
|
||||
createdBy: null,
|
||||
createdDt: null,
|
||||
updatedBy: null,
|
||||
updatedDt: null,
|
||||
createdDtStart:null,
|
||||
createdDtEnd:null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询【请填写功能名称】列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.dateHandle();
|
||||
listTask(this.queryParams).then(response => {
|
||||
this.taskList = response.data.data;
|
||||
this.total = response.data.recordsTotal;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
dateHandle(){
|
||||
if(this.queryParams.createdDtEnd!=null)
|
||||
{
|
||||
this.queryParams.createdDtEnd=this.queryParams.createdDtEnd+" 23:59:59"
|
||||
}
|
||||
},
|
||||
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
requestCode: null,
|
||||
dictType: null,
|
||||
json: null,
|
||||
status: null,
|
||||
message: null,
|
||||
createdBy: null,
|
||||
createdDt: null,
|
||||
updatedBy: null,
|
||||
updatedDt: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加【请填写功能名称】";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
console.log("修改"+row.id)
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getTask(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改【请填写功能名称】";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delTask(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.dateHandle()
|
||||
this.download('agv/exportExcel', {
|
||||
...this.queryParams
|
||||
}, `AGV任务列表_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 取消agv任务
|
||||
*/
|
||||
cancelTask(row){
|
||||
this.$modal.confirm('是否确认取消任务单号为"' + row.requestCode + '"的数据项?').then(function() {
|
||||
return cancelTask(row.requestCode);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("取消成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.SysUserPostMapper">
|
||||
|
||||
<resultMap type="SysUserPost" id="SysUserPostResult">
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="postId" column="post_id" />
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteUserPostByUserId" parameterType="Long">
|
||||
delete from sys_user_post where user_id=#{userId}
|
||||
</delete>
|
||||
|
||||
<select id="countUserPostById" resultType="Integer">
|
||||
select count(1) from sys_user_post where post_id=#{postId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserPost" parameterType="Long">
|
||||
delete from sys_user_post where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchUserPost">
|
||||
insert into sys_user_post(user_id, post_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.userId},#{item.postId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,39 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<HTMLCodeStyleSettings>
|
||||
<option name="HTML_ENFORCE_QUOTES" value="true" />
|
||||
<option name="HTML_NEWLINE_AFTER_LAST_ATTRIBUTE" value="When multiline" />
|
||||
</HTMLCodeStyleSettings>
|
||||
<JSCodeStyleSettings version="0">
|
||||
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_GENERATOR_MULT" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="USE_DOUBLE_QUOTES" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
<option name="SPACE_BEFORE_ASYNC_ARROW_LPAREN" value="false" />
|
||||
</JSCodeStyleSettings>
|
||||
<codeStyleSettings language="HTML">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
||||
<option name="IF_BRACE_FORCE" value="1" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
||||
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
@ -0,0 +1,26 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询调度日志列表
|
||||
export function listJobLog(query) {
|
||||
return request({
|
||||
url: '/monitor/jobLog/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 删除调度日志
|
||||
export function delJobLog(jobLogId) {
|
||||
return request({
|
||||
url: '/monitor/jobLog/' + jobLogId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 清空调度日志
|
||||
export function cleanJobLog() {
|
||||
return request({
|
||||
url: '/monitor/jobLog/clean',
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
x<01>R<EFBFBD>KA<14><<>Ub<55>K^Vt#I+l=x<>qurwF<77><46>B<EFBFBD>C<EFBFBD>"<10>D;t(<28>q<EFBFBD><71><EFBFBD><EFBFBD><EFBFBD>/<2F>]u<>H<EFBFBD><06><><EFBFBD><EFBFBD>{<7B><><EFBFBD>T-^<5E>[<5B>ɵ66[<5B>A<EFBFBD><41>m$ޥ<><DEA5><EFBFBD>i<EFBFBD>3)<29>e<11>0c\bI9K@<40>6<1E>c<EFBFBD>,<2C><1A>,<2C>rӱ <09><><EFBFBD>
|
||||
<EFBFBD><EFBFBD>qaF<61>ME"<15>+Vׇp<><70><EFBFBD>pN<03><06>>&<26>u<EFBFBD><75><EFBFBD><EFBFBD>L<EFBFBD>6<>Dy<44><79>:<3A>|M<><4D><EFBFBD><EFBFBD>S<EFBFBD><53>{<05>X<0C><18>^_<>_<EFBFBD><5F><EFBFBD><EFBFBD>_<EFBFBD>;<3B><>n
|
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to verify what is about to be committed.
|
||||
# Called by "git merge" with no arguments. The hook should
|
||||
# exit with non-zero status after issuing an appropriate message to
|
||||
# stderr if it wants to stop the merge commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-merge-commit".
|
||||
|
||||
. git-sh-setup
|
||||
test -x "$GIT_DIR/hooks/pre-commit" &&
|
||||
exec "$GIT_DIR/hooks/pre-commit"
|
||||
:
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,127 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.ruiYiController.core.domain.entity.SysUser;
|
||||
|
||||
/**
|
||||
* 用户表 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysUserMapper
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
* @param sysUser 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectUserList(SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectAllocatedList(SysUser user);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectUnallocatedList(SysUser user);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUser(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUser(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserByIds(Long[] userIds);
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param userName 用户名称
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkUserNameUnique(String userName);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param phonenumber 手机号码
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkPhoneUnique(String phonenumber);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param email 用户邮箱
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkEmailUnique(String email);
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div :class="className" :style="{height:height,width:width}" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as echarts from 'echarts';
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import resize from './mixins/resize'
|
||||
|
||||
const animationDuration = 3000
|
||||
|
||||
export default {
|
||||
mixins: [resize],
|
||||
props: {
|
||||
className: {
|
||||
type: String,
|
||||
default: 'chart'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.initChart()
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
methods: {
|
||||
initChart() {
|
||||
this.chart = echarts.init(this.$el, 'macarons')
|
||||
|
||||
this.chart.setOption({
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
radar: {
|
||||
radius: '66%',
|
||||
center: ['50%', '42%'],
|
||||
splitNumber: 8,
|
||||
splitArea: {
|
||||
areaStyle: {
|
||||
color: 'rgba(127,95,132,.3)',
|
||||
opacity: 1,
|
||||
shadowBlur: 45,
|
||||
shadowColor: 'rgba(0,0,0,.5)',
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 15
|
||||
}
|
||||
},
|
||||
indicator: [
|
||||
{ name: 'Sales', max: 10000 },
|
||||
{ name: 'Administration', max: 20000 },
|
||||
{ name: 'Information Techology', max: 20000 },
|
||||
{ name: 'Customer Support', max: 20000 },
|
||||
{ name: 'Development', max: 20000 },
|
||||
{ name: 'Marketing', max: 20000 }
|
||||
]
|
||||
},
|
||||
legend: {
|
||||
left: 'center',
|
||||
bottom: '10',
|
||||
data: ['Allocated Budget', 'Expected Spending', 'Actual Spending']
|
||||
},
|
||||
series: [{
|
||||
type: 'radar',
|
||||
symbolSize: 0,
|
||||
areaStyle: {
|
||||
normal: {
|
||||
shadowBlur: 13,
|
||||
shadowColor: 'rgba(0,0,0,.2)',
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 10,
|
||||
opacity: 1
|
||||
}
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: [5000, 7000, 12000, 11000, 15000, 14000],
|
||||
name: 'Allocated Budget'
|
||||
},
|
||||
{
|
||||
value: [4000, 9000, 15000, 15000, 13000, 11000],
|
||||
name: 'Expected Spending'
|
||||
},
|
||||
{
|
||||
value: [5500, 11000, 12000, 15000, 12000, 12000],
|
||||
name: 'Actual Spending'
|
||||
}
|
||||
],
|
||||
animationDuration: animationDuration
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1575802859706" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3102" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M896 224H128c-35.2 0-64 28.8-64 64v448c0 35.2 28.8 64 64 64h768c35.2 0 64-28.8 64-64V288c0-35.2-28.8-64-64-64z m0 480c0 19.2-12.8 32-32 32H160c-19.2 0-32-12.8-32-32V320c0-19.2 12.8-32 32-32h704c19.2 0 32 12.8 32 32v384z" p-id="3103"></path><path d="M224 352c-19.2 0-32 12.8-32 32v256c0 16 12.8 32 32 32s32-12.8 32-32V384c0-16-12.8-32-32-32z" p-id="3104"></path></svg>
|
After Width: | Height: | Size: 744 B |
@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="库位编码" prop="storeCode">
|
||||
<el-input
|
||||
v-model="queryParams.storeCode"
|
||||
placeholder="请输入库位编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工位编码" prop="stationCode">
|
||||
<el-input
|
||||
v-model="queryParams.stationCode"
|
||||
placeholder="请输入库位属于的工位编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="货架编码" prop="shelfCode">
|
||||
<el-input
|
||||
v-model="queryParams.shelfCode"
|
||||
placeholder="请输入货架编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<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-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:info:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="库位编码" align="center" prop="storeCode" />
|
||||
<el-table-column label="库位类型" align="center" prop="storeType" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.store_type" :value="scope.row.storeType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库位状态" align="center" prop="storeStatus" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.store_status" :value="scope.row.storeStatus"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工位编码" align="center" prop="stationCode" />
|
||||
<el-table-column label="货架编码" align="center" prop="shelfCode" />
|
||||
<el-table-column label="创建人" align="center" prop="createdBy" />
|
||||
<el-table-column label="创建时间" align="center" prop="createdDt" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createdDt) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新人" align="center" prop="updatedBy" />
|
||||
<el-table-column label="更新时间" align="center" prop="updatedDt" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.updatedDt) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改库位信息,记录周装货架存放库位信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="库位编码" prop="storeCode">
|
||||
<el-input v-model="form.storeCode" placeholder="请输入库位编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="库位属于的工位编码" prop="stationCode">
|
||||
<el-input v-model="form.stationCode" placeholder="请输入库位属于的工位编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="货架编码" prop="shelfCode">
|
||||
<el-input v-model="form.shelfCode" placeholder="请输入货架编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="createdBy">
|
||||
<el-input v-model="form.createdBy" placeholder="请输入创建人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createdDt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.createdDt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updatedBy">
|
||||
<el-input v-model="form.updatedBy" placeholder="请输入更新人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updatedDt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.updatedDt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择更新时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/wms/storeInfo";
|
||||
|
||||
export default {
|
||||
name: "Info",
|
||||
dicts: ['store_type', 'store_status'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 库位信息,记录周装货架存放库位信息表格数据
|
||||
infoList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
storeCode: null,
|
||||
storeType: null,
|
||||
storeStatus: null,
|
||||
stationCode: null,
|
||||
shelfCode: null,
|
||||
createdBy: null,
|
||||
createdDt: null,
|
||||
updatedBy: null,
|
||||
updatedDt: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询库位信息,记录周装货架存放库位信息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listInfo(this.queryParams).then(response => {
|
||||
this.infoList = response.data.data;
|
||||
this.total = response.data.recordsTotal;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
storeCode: null,
|
||||
storeType: null,
|
||||
storeStatus: null,
|
||||
stationCode: null,
|
||||
shelfCode: null,
|
||||
createdBy: null,
|
||||
createdDt: null,
|
||||
updatedBy: null,
|
||||
updatedDt: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加库位信息,记录周装货架存放库位信息";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = '?id='+row.id || this.ids
|
||||
getInfo(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改库位信息,记录周装货架存放库位信息";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除库位信息,记录周装货架存放库位信息编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delInfo(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('store/exportExcel', {
|
||||
...this.queryParams
|
||||
}, `库位列表_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,182 @@
|
||||
@import './variables.scss';
|
||||
@import './mixin.scss';
|
||||
@import './transition.scss';
|
||||
@import './element-ui.scss';
|
||||
@import './sidebar.scss';
|
||||
@import './btn.scss';
|
||||
|
||||
body {
|
||||
height: 100%;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
|
||||
}
|
||||
|
||||
label {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#app {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
.no-padding {
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
.padding-content {
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
a:focus,
|
||||
a:active {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a,
|
||||
a:focus,
|
||||
a:hover {
|
||||
cursor: pointer;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.fr {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.fl {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.pr-5 {
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.pl-5 {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.block {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.inlineBlock {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.clearfix {
|
||||
&:after {
|
||||
visibility: hidden;
|
||||
display: block;
|
||||
font-size: 0;
|
||||
content: " ";
|
||||
clear: both;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
aside {
|
||||
background: #eef1f6;
|
||||
padding: 8px 24px;
|
||||
margin-bottom: 20px;
|
||||
border-radius: 2px;
|
||||
display: block;
|
||||
line-height: 32px;
|
||||
font-size: 16px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
||||
color: #2c3e50;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
a {
|
||||
color: #337ab7;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: rgb(32, 160, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//main-container全局样式
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.components-container {
|
||||
margin: 30px 50px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.sub-navbar {
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
padding-right: 20px;
|
||||
transition: 600ms ease position;
|
||||
background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%);
|
||||
|
||||
.subtitle {
|
||||
font-size: 20px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&.draft {
|
||||
background: #d0d0d0;
|
||||
}
|
||||
|
||||
&.deleted {
|
||||
background: #d0d0d0;
|
||||
}
|
||||
}
|
||||
|
||||
.link-type,
|
||||
.link-type:focus {
|
||||
color: #337ab7;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: rgb(32, 160, 255);
|
||||
}
|
||||
}
|
||||
|
||||
.filter-container {
|
||||
padding-bottom: 10px;
|
||||
|
||||
.filter-item {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M0 54.857h54.796v18.286H36.531V128H18.265V73.143H0V54.857zm127.857-36.571H91.935V128H72.456V18.286H36.534V0h91.326l-.003 18.286z"/></svg>
|
After Width: | Height: | Size: 211 B |
@ -0,0 +1 @@
|
||||
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M119.88 49.674h-7.987V39.52C111.893 17.738 90.45.08 63.996.08 37.543.08 16.1 17.738 16.1 39.52v10.154H8.113c-4.408 0-7.987 2.94-7.987 6.577v65.13c0 3.637 3.57 6.577 7.987 6.577H119.88c4.407 0 7.987-2.94 7.987-6.577v-65.13c-.008-3.636-3.58-6.577-7.987-6.577zm-23.953 0H32.065V39.52c0-14.524 14.301-26.295 31.931-26.295 17.63 0 31.932 11.777 31.932 26.295v10.153z"/></svg>
|
After Width: | Height: | Size: 444 B |
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="CheckStyle-IDEA-Module" serialisationVersion="2">
|
||||
<option name="activeLocationsIds" />
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,86 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
import Element from 'element-ui'
|
||||
import './assets/styles/element-variables.scss'
|
||||
|
||||
import '@/assets/styles/index.scss' // global css
|
||||
import '@/assets/styles/ruoyi.scss' // ruoyi css
|
||||
import App from './App'
|
||||
import store from './store'
|
||||
import router from './router'
|
||||
import directive from './directive' // directive
|
||||
import plugins from './plugins' // plugins
|
||||
import { download } from '@/utils/request'
|
||||
|
||||
import './assets/icons' // icon
|
||||
import './permission' // permission control
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import { getConfigKey } from "@/api/system/config";
|
||||
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
|
||||
// 分页组件
|
||||
import Pagination from "@/components/Pagination";
|
||||
// 自定义表格工具组件
|
||||
import RightToolbar from "@/components/RightToolbar"
|
||||
// 富文本组件
|
||||
import Editor from "@/components/Editor"
|
||||
// 文件上传组件
|
||||
import FileUpload from "@/components/FileUpload"
|
||||
// 图片上传组件
|
||||
import ImageUpload from "@/components/ImageUpload"
|
||||
// 图片预览组件
|
||||
import ImagePreview from "@/components/ImagePreview"
|
||||
// 字典标签组件
|
||||
import DictTag from '@/components/DictTag'
|
||||
// 头部标签组件
|
||||
import VueMeta from 'vue-meta'
|
||||
// 字典数据组件
|
||||
import DictData from '@/components/DictData'
|
||||
|
||||
// 全局方法挂载
|
||||
Vue.prototype.getDicts = getDicts
|
||||
Vue.prototype.getConfigKey = getConfigKey
|
||||
Vue.prototype.parseTime = parseTime
|
||||
Vue.prototype.resetForm = resetForm
|
||||
Vue.prototype.addDateRange = addDateRange
|
||||
Vue.prototype.selectDictLabel = selectDictLabel
|
||||
Vue.prototype.selectDictLabels = selectDictLabels
|
||||
Vue.prototype.download = download
|
||||
Vue.prototype.handleTree = handleTree
|
||||
|
||||
// 全局组件挂载
|
||||
Vue.component('DictTag', DictTag)
|
||||
Vue.component('Pagination', Pagination)
|
||||
Vue.component('RightToolbar', RightToolbar)
|
||||
Vue.component('Editor', Editor)
|
||||
Vue.component('FileUpload', FileUpload)
|
||||
Vue.component('ImageUpload', ImageUpload)
|
||||
Vue.component('ImagePreview', ImagePreview)
|
||||
|
||||
Vue.use(directive)
|
||||
Vue.use(plugins)
|
||||
Vue.use(VueMeta)
|
||||
DictData.install()
|
||||
|
||||
/**
|
||||
* If you don't want to use mock-server
|
||||
* you want to use MockJs for mock api
|
||||
* you can execute: mockXHR()
|
||||
*
|
||||
* Currently MockJs will be used in the production environment,
|
||||
* please remove it before going online! ! !
|
||||
*/
|
||||
|
||||
Vue.use(Element, {
|
||||
size: Cookies.get('size') || 'medium' // set element-ui default size
|
||||
})
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
})
|
@ -0,0 +1,34 @@
|
||||
package com.ruoyi.ruiYiController.xss;
|
||||
|
||||
import com.ruoyi.ruiYiController.utils.StringUtils;
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 自定义xss校验注解实现
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class XssValidator implements ConstraintValidator<Xss, String>
|
||||
{
|
||||
private static final String HTML_PATTERN = "<(\\S*?)[^>]*>.*?|<.*? />";
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext)
|
||||
{
|
||||
if (StringUtils.isBlank(value))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return !containsHtml(value);
|
||||
}
|
||||
|
||||
public static boolean containsHtml(String value)
|
||||
{
|
||||
Pattern pattern = Pattern.compile(HTML_PATTERN);
|
||||
Matcher matcher = pattern.matcher(value);
|
||||
return matcher.matches();
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ruiYiController.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.ruiYiController.core.domain.entity.SysDictType;
|
||||
|
||||
/**
|
||||
* 字典 业务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysDictTypeService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询字典类型
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
public List<SysDictType> selectDictTypeList(SysDictType dictType);
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
*
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
public List<SysDictType> selectDictTypeAll();
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
public List<SysDictData> selectDictDataByType(String dictType);
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
* @param dictId 字典类型ID
|
||||
* @return 字典类型
|
||||
*/
|
||||
public SysDictType selectDictTypeById(Long dictId);
|
||||
|
||||
/**
|
||||
* 根据字典类型查询信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
public SysDictType selectDictTypeByType(String dictType);
|
||||
|
||||
/**
|
||||
* 批量删除字典信息
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
*/
|
||||
public void deleteDictTypeByIds(Long[] dictIds);
|
||||
|
||||
/**
|
||||
* 加载字典缓存数据
|
||||
*/
|
||||
public void loadingDictCache();
|
||||
|
||||
/**
|
||||
* 清空字典缓存数据
|
||||
*/
|
||||
public void clearDictCache();
|
||||
|
||||
/**
|
||||
* 重置字典缓存数据
|
||||
*/
|
||||
public void resetDictCache();
|
||||
|
||||
/**
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictType(SysDictType dictType);
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictType(SysDictType dictType);
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkDictTypeUnique(SysDictType dictType);
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
package com.ruoyi.wms.service;
|
||||
|
||||
import com.ruoyi.wms.util.TcpUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/7/5
|
||||
**/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class TcpService implements CommandLineRunner {
|
||||
private ServerSocket serverSocket;
|
||||
public DatagramSocket clientSocket;
|
||||
private DatagramPacket packet;
|
||||
@Autowired
|
||||
private AGVService agvService;
|
||||
public void start(int port) throws IOException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void stop() throws IOException
|
||||
{
|
||||
serverSocket.close();
|
||||
}
|
||||
|
||||
private static AGVService userService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
if (userService == null) {
|
||||
setDateSource(agvService);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized static void setDateSource(AGVService userInterfaceService) {
|
||||
userService = userInterfaceService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
clientSocket = new DatagramSocket(8085);
|
||||
//创建字节数组,指定接收的数据包的大小
|
||||
byte[] data = new byte[10];
|
||||
DatagramPacket packet = new DatagramPacket(data, data.length);
|
||||
// 3.接收客户端发送的数据
|
||||
while (true) {
|
||||
//通过循环不停的向客户端发送数据和接收数据
|
||||
try {
|
||||
// 此方法在接收到数据报之前会一直阻塞
|
||||
clientSocket.receive(packet);
|
||||
//创建字符串对象
|
||||
final String s = BinaryToHexString(data);
|
||||
final String[] s1 = s.split(" ");
|
||||
log.info("tcps:" + s);
|
||||
//设备信号 02:空车入库 01:出库1 04:出库2
|
||||
String status = s1[3];
|
||||
if (status.equals("06") || status.equals("04") || status.equals("00") || status.equals("02")) {
|
||||
//成品出库
|
||||
agvService.outProdStore("04");
|
||||
} else if (status.equals("03") || status.equals("01")) {
|
||||
//成品出库
|
||||
agvService.outProdStore("02");
|
||||
}
|
||||
}
|
||||
catch (Exception ex){
|
||||
System.out.println("我是服务器,客户端说:" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "*/5 * * * * ?")
|
||||
private void configureTasks() throws IOException {
|
||||
byte[] bytes = new byte[8];
|
||||
bytes[0] = 1;
|
||||
bytes[1] = 2;
|
||||
bytes[2] = 0;
|
||||
bytes[3] = 0;
|
||||
bytes[4] = 0;
|
||||
bytes[5] = 0;
|
||||
bytes[6] = 121;
|
||||
bytes[7] = -55;
|
||||
//log.info("发送数据:" + bytes.toString());
|
||||
DatagramPacket packet2 = new DatagramPacket(bytes, 8, InetAddress.getByName("192.168.33.39"),1030);
|
||||
try {
|
||||
clientSocket.send(packet2);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字节数组转换成十六进制的字符串
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String BinaryToHexString(byte[] bytes) {
|
||||
String hexStr = "0123456789ABCDEF";
|
||||
String result = "";
|
||||
String hex = "";
|
||||
for (byte b : bytes) {
|
||||
hex = String.valueOf(hexStr.charAt((b & 0xF0) >> 4));
|
||||
hex += String.valueOf(hexStr.charAt(b & 0x0F));
|
||||
result += hex + " ";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
x<01>RMkSAu=<3D>b<EFBFBD>I(SwEBA<42><0B>hit<69>r<EFBFBD><72><EFBFBD>epޛ<70><DE9B><EFBFBD><EFBFBD>%<1B>Ui7<69><37>΅<EFBFBD>*څD<14><>$<24><>Νy<CE9D><79>6<EFBFBD><36><07>;<3B><>{νɤ<CEBD>譍<EFBFBD>7j<37>?<3F><05>\<5C>L;<3B>'س<><D8B3>J<wTe<54><65>4sVH<56>'D<><44><EFBFBD>6<EFBFBD>aG.c<>'<27>@<40><1E><><EFBFBD>{<7B><><EFBFBD><EFBFBD>ժ<EFBFBD><D5AA><02><>*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>g<06>Fc<46>Hi<>K6<18><>><3E>O<EFBFBD><4F><EFBFBD>ڣ<><DAA3>G<EFBFBD><47><EFBFBD><EFBFBD>g懳<><E687B3>;<3B><><EFBFBD>͝)MC<16>X'<27>ˤ<EFBFBD>i.<2E>1<14><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B5<42><35><EFBFBD>r@<40><>},z<>b<EFBFBD><62><EFBFBD>1<EFBFBD><31>4[<5B><><EFBFBD><EFBFBD><16><>o<><01><>k<><6B><EFBFBD>֏<EFBFBD>UbH}<7D>-<2D><>t$
|
||||
#<18>q}<7D>^<5E><>4<EFBFBD>
|
||||
˜<EFBFBD>CD<EFBFBD><EFBFBD><EFBFBD><EFBFBD>n?N<><02>+<05><>~<7E>J<EFBFBD><4A><EFBFBD><EFBFBD><02>T<EFBFBD>_E<19>}<7D><><EFBFBD>)i`<60><>
|
@ -0,0 +1,637 @@
|
||||
package com.ruoyi.wms.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cmeim.common.core.utils.BeanUtil;
|
||||
import com.cmeim.common.core.utils.DateUtil;
|
||||
import com.cmeim.common.core.utils.ExcelExportUtil;
|
||||
import com.cmeim.common.core.web.controller.GenericController;
|
||||
import com.cmeim.common.core.web.domain.Respond;
|
||||
import com.cmeim.common.core.web.page.PageVo;
|
||||
|
||||
import com.ruoyi.ruiYiController.exception.ServiceException;
|
||||
import com.ruoyi.wms.enums.AgvTaskEnum;
|
||||
import com.ruoyi.wms.enums.RequestEnum;
|
||||
import com.ruoyi.wms.po.*;
|
||||
import com.ruoyi.wms.repository.*;
|
||||
import com.ruoyi.wms.service.AGVService;
|
||||
import com.ruoyi.wms.service.ScheduleService;
|
||||
import com.ruoyi.wms.vo.*;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/6/26
|
||||
**/
|
||||
@Api(tags = "数据采集接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping(value = "agv")
|
||||
public class AgvController extends GenericController {
|
||||
|
||||
@Autowired
|
||||
private AgvTaskRepository agvTaskRepository;
|
||||
@Autowired
|
||||
private AGVService agvService;
|
||||
@Autowired
|
||||
private ContainerInfoRepository containerInfoRepository;
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
@Autowired
|
||||
private StationInfoRepository stationInfoRepository;
|
||||
@Autowired
|
||||
private ShelfInfoRepository shelfInfoRepository;
|
||||
@Autowired
|
||||
private ScheduleService scheduleService;
|
||||
|
||||
@ApiOperation(value = "列表")
|
||||
@GetMapping(value = "list")
|
||||
public Respond list(PageVo pv, AgvTask agvTask) {
|
||||
PageRequest pageRequest = PageRequest.of(pv.getPageNo() - 1, pv.getPageSize(),
|
||||
Sort.by(sortOrder(agvTask.getOrders())));
|
||||
Page page = agvTaskRepository.findAll(buildSpecification(agvTask), pageRequest);
|
||||
List<AgvTask> list = page.getContent();
|
||||
pv.setRecordsTotal(page.getTotalElements());
|
||||
pv.setData(list);
|
||||
return buildSuccess(pv);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出excel")
|
||||
@PostMapping("exportExcel")
|
||||
public void export(AgvTask agvTask, HttpServletResponse response) throws Exception {
|
||||
List<AgvTask> list = agvTaskRepository.findAll(buildSpecification(agvTask));
|
||||
List<AgvTaskExportVo> exportList = new ArrayList<>();
|
||||
for (AgvTask task : list) {
|
||||
AgvTaskExportVo agvTaskExportVo = BeanUtil.copyProperties(task, AgvTaskExportVo.class);
|
||||
exportList.add(agvTaskExportVo);
|
||||
}
|
||||
// 创建工作簿对象
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
|
||||
// 创建工作表
|
||||
SXSSFSheet sheet = workbook.createSheet("AGV任务列表");
|
||||
|
||||
String[] rowsName = new String[]{"序号", "请求单号", "类型", "json", "任务状态", "处理结果", "创建人", "创建时间"};
|
||||
List<Object[]> dataList = new ArrayList<Object[]>();
|
||||
Object[] objs = null;
|
||||
int i = 1;
|
||||
for (AgvTaskExportVo agvTaskExportVo : exportList) {
|
||||
if (agvTaskExportVo.getDictType() == 1) {
|
||||
agvTaskExportVo.setDictTypeShow("请求空箱");
|
||||
} else if (agvTaskExportVo.getDictType() == 2) {
|
||||
agvTaskExportVo.setDictTypeShow("入水测");
|
||||
} else if (agvTaskExportVo.getDictType() == 3) {
|
||||
agvTaskExportVo.setDictTypeShow("出水测");
|
||||
} else if (agvTaskExportVo.getDictType() == 4) {
|
||||
agvTaskExportVo.setDictTypeShow("送待检");
|
||||
} else if (agvTaskExportVo.getDictType() == 5) {
|
||||
agvTaskExportVo.setDictTypeShow("送检验");
|
||||
} else if (agvTaskExportVo.getDictType() == 6) {
|
||||
agvTaskExportVo.setDictTypeShow("回待检");
|
||||
} else if (agvTaskExportVo.getDictType() == 7) {
|
||||
agvTaskExportVo.setDictTypeShow("送抽检");
|
||||
} else if (agvTaskExportVo.getDictType() == 8) {
|
||||
agvTaskExportVo.setDictTypeShow("送成品库");
|
||||
} else if (agvTaskExportVo.getDictType() == 9) {
|
||||
agvTaskExportVo.setDictTypeShow("出成品库");
|
||||
} else if (agvTaskExportVo.getDictType() == 10) {
|
||||
agvTaskExportVo.setDictTypeShow("空箱入库");
|
||||
} else if (agvTaskExportVo.getDictType() == 11) {
|
||||
agvTaskExportVo.setDictTypeShow("呼叫空货架");
|
||||
}
|
||||
if (agvTaskExportVo.getStatus() == 1) {
|
||||
agvTaskExportVo.setStatusShow("未发起");
|
||||
} else if (agvTaskExportVo.getDictType() == 2) {
|
||||
agvTaskExportVo.setStatusShow("进行中");
|
||||
} else if (agvTaskExportVo.getDictType() == 3) {
|
||||
agvTaskExportVo.setStatusShow("已完成");
|
||||
} else if (agvTaskExportVo.getDictType() == 4) {
|
||||
agvTaskExportVo.setStatusShow("失败");
|
||||
} else if (agvTaskExportVo.getDictType() == 5) {
|
||||
agvTaskExportVo.setStatusShow("取消");
|
||||
} else if (agvTaskExportVo.getStatus() == 6) {
|
||||
agvTaskExportVo.setStatusShow("挂起");
|
||||
}
|
||||
|
||||
objs = new Object[rowsName.length];
|
||||
objs[0] = i;
|
||||
objs[1] = agvTaskExportVo.getRequestCode();
|
||||
objs[2] = agvTaskExportVo.getDictTypeShow();
|
||||
objs[3] = agvTaskExportVo.getJson();
|
||||
objs[4] = agvTaskExportVo.getStatusShow();
|
||||
objs[5] = agvTaskExportVo.getMessage();
|
||||
objs[6] = agvTaskExportVo.getCreatedBy();
|
||||
objs[7] = agvTaskExportVo.getCreatedDt();
|
||||
dataList.add(objs);
|
||||
i += 1;
|
||||
}
|
||||
ExcelExportUtil.getExportWorkbook(workbook, sheet, rowsName, dataList);
|
||||
ExcelExportUtil.sendHttpResponse(response, "Agv", workbook);
|
||||
}
|
||||
|
||||
private Specification buildSpecification(AgvTask agvTask) {
|
||||
Specification<AgvTask> specification = new Specification<AgvTask>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<AgvTask> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> predicates = Lists.newArrayList();
|
||||
if (agvTask.getRequestCode() != null) {
|
||||
predicates.add(cb.like(root.get("requestCode").as(String.class), "%" + agvTask.getRequestCode() + "%"));
|
||||
}
|
||||
if (agvTask.getMessage() != null) {
|
||||
predicates.add(cb.like(root.get("message").as(String.class), "%" + agvTask.getMessage() + "%"));
|
||||
}
|
||||
if (agvTask.getDictType() != null) {
|
||||
predicates.add(cb.equal(root.get("dictType").as(Integer.class), agvTask.getDictType()));
|
||||
}
|
||||
if (agvTask.getStatus() != null) {
|
||||
predicates.add(cb.equal(root.get("status").as(Integer.class), agvTask.getStatus()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(agvTask.getCreatedDtStart())) {
|
||||
predicates.add(cb.greaterThanOrEqualTo(root.get("createdDt").as(String.class), agvTask.getCreatedDtStart()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(agvTask.getCreatedDtEnd())) {
|
||||
predicates.add(cb.lessThanOrEqualTo(root.get("createdDt").as(String.class), agvTask.getCreatedDtEnd()));
|
||||
}
|
||||
if (agvTask.getStatusArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("status").as(Integer.class));
|
||||
for (Integer status : agvTask.getStatusArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
if (agvTask.getDictTypeArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("dictType").as(Integer.class));
|
||||
for (Integer status : agvTask.getDictTypeArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||
}
|
||||
};
|
||||
|
||||
return specification;
|
||||
}
|
||||
|
||||
/**
|
||||
* AGV任务回调
|
||||
*
|
||||
* @param jsonObject 回调参数
|
||||
* @return 结果返回
|
||||
*/
|
||||
@ApiOperation(value = "AGV任务回调")
|
||||
@PostMapping(value = "TaskStatusCallback")
|
||||
public JSONObject TaskStatusCallback(@RequestBody JSONObject jsonObject) {
|
||||
//log.info("回调任务all:" + jsonObject);
|
||||
String taskCode = jsonObject.getString("taskCode");
|
||||
final AgvTask agvTask = agvTaskRepository.findByRequestCode(taskCode);
|
||||
String status = jsonObject.getString("status");
|
||||
if (StringUtils.isNotBlank(status)) {
|
||||
if (status.equals("fail")) {
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.FAIL.getCode(), jsonObject.getString("message"));
|
||||
} else if (status.equals("success")) {
|
||||
//获取回调类型
|
||||
String eventType = jsonObject.getString("eventType");
|
||||
if (eventType.equals("task")) {
|
||||
log.info("回调任务task:" + jsonObject);
|
||||
//更新任务状态
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.FINISH.getCode(), jsonObject.getString("message"));
|
||||
//成功回调
|
||||
agvService.callBackSuccess(agvTask, jsonObject);
|
||||
}
|
||||
//取箱完成时,修改工位状态
|
||||
else if (eventType.equals("tote_load") && agvTask.getDictType() > 3) {
|
||||
String locationCode = jsonObject.getString("locationCode");
|
||||
agvService.updateStationStatus(locationCode);
|
||||
}
|
||||
//放箱完成回调,滚筒线请求空箱
|
||||
else if (eventType.equals("tote_unload") && agvTask.getDictType() == 1) {
|
||||
String param = jsonObject.toJSONString();
|
||||
agvService.noticeToPlc(param);
|
||||
}
|
||||
|
||||
} else if (status.equals("cancel")) {
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.CANCEL.getCode(), jsonObject.getString("message"));
|
||||
} else if (status.equals("suspend")) {
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.PENDING.getCode(), jsonObject.getString("message"));
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", 0);
|
||||
result.put("msg", "success");
|
||||
result.put("data", "");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空箱入库")
|
||||
@PostMapping(value = "EmptyContainerInStore")
|
||||
@Transactional
|
||||
public Respond EmptyContainerInStore(@RequestBody AgvRequestVo requestVo) {
|
||||
//校验周转箱是否存在以及状态
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(requestVo.getContainerCode());
|
||||
if (containerInfo == null) {
|
||||
throw new ServiceException("周转箱号不存在:" + requestVo.getContainerCode());
|
||||
}
|
||||
if (containerInfo.getContainerStatus() != 15 && containerInfo.getContainerStatus() != 20 && containerInfo.getContainerStatus() != 25) {
|
||||
throw new ServiceException("周转箱号状态不是入库中的状态:" + requestVo.getContainerCode());
|
||||
}
|
||||
requestVo.setType(1);
|
||||
requestVo.setRequestType(RequestEnum.NULLBOXINSTORE.getCode());
|
||||
requestVo.setFromLocationCode(requestVo.getFromLocationCode());
|
||||
requestVo.setToLocationCode("LA_SHELF_STORAGE");
|
||||
requestVo.setContainerCode(requestVo.getContainerCode());
|
||||
String result = agvService.taskParamCreate(requestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空料箱出库")
|
||||
@PostMapping(value = "EmptyContainerOutStore")
|
||||
public Respond EmptyContainerOutStore(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//判断空箱出库任务是否唯一
|
||||
List<AgvTask> agvTaskList = agvTaskRepository.findByDictTypeAndStatus(RequestEnum.NULLBOX.getCode(), 2);
|
||||
if (agvTaskList.size() > 6) {
|
||||
return buildFailure("还有正在执行的出库任务:" + agvTaskList);
|
||||
}
|
||||
//设置agv请求类型
|
||||
agvRequestVo.setRequestType(RequestEnum.NULLBOX.getCode());
|
||||
agvRequestVo.setType(0);
|
||||
agvService.EmptyContainerOutStore(agvRequestVo);
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "料箱入库")
|
||||
@PostMapping(value = "ContainerInStore")
|
||||
public Respond ContainerInStore(@RequestBody AgvRequestVo requestVo) {
|
||||
//校验周转箱是否存在以及状态
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(requestVo.getContainerCode());
|
||||
if (containerInfo == null) {
|
||||
throw new ServiceException("周转箱号不存在:" + requestVo.getContainerCode());
|
||||
}
|
||||
if (containerInfo.getContainerStatus() != 15 && containerInfo.getContainerStatus() != 20 && containerInfo.getContainerStatus() != 25) {
|
||||
throw new ServiceException("该料箱在入库状态!" + requestVo.getContainerCode());
|
||||
}
|
||||
requestVo.setType(1);
|
||||
requestVo.setRequestType(RequestEnum.INSTORE.getCode());
|
||||
requestVo.setToStationCode("LA_SHELF_STORAGE");
|
||||
String result = agvService.taskParamCreate(requestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//final ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(requestVo.getContainerCode());
|
||||
//containerInfo.setProductionTask(requestVo.productionTask);
|
||||
//containerInfo.setOnInstoreTime(DateUtil.getCurrentDate());
|
||||
//final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(requestVo.getProductionTask());
|
||||
//Integer qty = orderInfo.getPlanQty() - (orderInfo.getInQty() + orderInfo.getOngoingQty() + orderInfo.getOutQty() + orderInfo.getOnoutingCheckQty());
|
||||
//if (qty > 6) {
|
||||
// qty = 6;
|
||||
//}
|
||||
////入库中数量
|
||||
//orderInfo.setOngoingQty(orderInfo.getOngoingQty() + qty);
|
||||
//containerInfo.setQty(qty);
|
||||
//orderInfoRepository.save(orderInfo);
|
||||
//containerInfoRepository.save(containerInfo);
|
||||
return buildSuccess("请求成功");
|
||||
} else {
|
||||
return buildSuccess(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "送待检缓存区")
|
||||
@PostMapping(value = "sendWaitCheck")
|
||||
public Respond sendWaitCheck(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//校验
|
||||
if (StringUtils.isBlank(agvRequestVo.getContainerCode())) {
|
||||
throw new ServiceException("无货架编码,请检查!");
|
||||
}
|
||||
if (StringUtils.isBlank(agvRequestVo.getProductionTask())) {
|
||||
throw new ServiceException("无生产工单号,请检查!");
|
||||
}
|
||||
if (StringUtils.isBlank(agvRequestVo.getFromLocationCode())) {
|
||||
throw new ServiceException("无起始点位置,请检查!");
|
||||
}
|
||||
if (agvRequestVo.getBoxNumber() == null) {
|
||||
throw new ServiceException("无货架数量,请检查!");
|
||||
}
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDWAITCHECK.getCode());
|
||||
String toLocationCode = findToLocationCode(15);
|
||||
agvRequestVo.setToLocationCode(toLocationCode);
|
||||
final String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//修改起点位状态为空闲
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//修改终点点位状态为待占用
|
||||
StationInfo stationInfo1 = stationInfoRepository.findByStationCode(toLocationCode);
|
||||
stationInfo1.setStationStatus(10);
|
||||
stationInfo1.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo1);
|
||||
//修改货架信息
|
||||
ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(agvRequestVo.getContainerCode());
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setStationCode(agvRequestVo.getFromLocationCode());
|
||||
shelfInfo.setProductionTask(agvRequestVo.getProductionTask());
|
||||
shelfInfo.setQty(agvRequestVo.getBoxNumber());
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfo.setPriority(0);
|
||||
shelfInfo.setStationCode(agvRequestVo.getFromLocationCode());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
} else {
|
||||
ShelfInfo shelfInfo1 = new ShelfInfo();
|
||||
shelfInfo1.setShelfCode(agvRequestVo.getContainerCode());
|
||||
shelfInfo1.setStationCode(agvRequestVo.getFromLocationCode());
|
||||
shelfInfo1.setProductionTask(agvRequestVo.getProductionTask());
|
||||
shelfInfo1.setQty(agvRequestVo.getBoxNumber());
|
||||
shelfInfo1.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfo1.setPriority(0);
|
||||
shelfInfo1.setStationCode(agvRequestVo.getFromLocationCode());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
}
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "从缓存库位到检验库位")
|
||||
@PostMapping(value = "sendCheck")
|
||||
@Transactional
|
||||
public Respond sendCheck(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//校验
|
||||
if (StringUtils.isNotBlank(agvRequestVo.getLastRequestCode())) {
|
||||
AgvTask agvTask = agvTaskRepository.findByRequestCode(agvRequestVo.getLastRequestCode());
|
||||
if (agvTask != null) {
|
||||
if (agvTask.getStatus() <= 2) {
|
||||
throw new ServiceException("上次任务还在执行中,任务号:" + agvRequestVo.getLastRequestCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(agvRequestVo.getProductionTask())) {
|
||||
throw new ServiceException("无生产工单号,请检查!");
|
||||
}
|
||||
if (StringUtils.isBlank(agvRequestVo.getToLocationCode())) {
|
||||
throw new ServiceException("无终点位置,请检查!");
|
||||
}
|
||||
List<ShelfInfo> shelfInfoList = shelfInfoRepository.findByProductionTaskAndOrderStatus(agvRequestVo.getProductionTask(), 5);
|
||||
if (shelfInfoList.size() == 0) {
|
||||
throw new ServiceException("该订单没有货架在缓存库位!");
|
||||
}
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setContainerCode(shelfInfoList.get(0).getShelfCode());
|
||||
agvRequestVo.setFromLocationCode(shelfInfoList.get(0).getStationCode());
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDCHECK.getCode());
|
||||
String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//修改起始点位状态为空闲
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
//修改终点工位待占用状态
|
||||
StationInfo stationInfo1 = stationInfoRepository.findByStationCode(agvRequestVo.getToLocationCode());
|
||||
if (stationInfo1 != null) {
|
||||
stationInfo1.setStationStatus(10);
|
||||
stationInfo1.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo1);
|
||||
}
|
||||
//修改货架的工单状态
|
||||
ShelfInfo shelfInfo = shelfInfoList.get(0);
|
||||
shelfInfo.setOrderStatus(10);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
ShelfInfo save = shelfInfoRepository.save(shelfInfo);
|
||||
String data = JSONObject.parseObject(result).getString("data");
|
||||
SpotCheckVo spotCheckVo = BeanUtil.copyProperties(save, SpotCheckVo.class);
|
||||
data = data.replaceAll("\\\"","");
|
||||
data = data.replace("{", "").replace("}","");
|
||||
spotCheckVo.setRequestCode(data.substring(0, data.indexOf(":")));
|
||||
return buildSuccess(spotCheckVo);
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
Lock lock = new ReentrantLock();
|
||||
|
||||
@ApiOperation(value = "送抽检")
|
||||
@PostMapping(value = "sendSpotCheck")
|
||||
public Respond sendSpotCheck(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
if (StringUtils.isBlank(agvRequestVo.getFromLocationCode())) {
|
||||
throw new ServiceException("无起始位置,请检查!");
|
||||
}
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDSPOTCHECK.getCode());
|
||||
String result = null;
|
||||
lock.lock();
|
||||
try {
|
||||
//查起始点位对应的货架编码
|
||||
List<ShelfInfo> shelfInfoList = shelfInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
if (shelfInfoList.size() > 0) {
|
||||
agvRequestVo.setContainerCode(shelfInfoList.get(0).getShelfCode());
|
||||
} else {
|
||||
throw new ServiceException("该位置无货架:" + agvRequestVo.getFromLocationCode());
|
||||
}
|
||||
final List<StationInfo> stationInfos = stationInfoRepository.findByStationTypeAndStationStatus(25, 5);
|
||||
if (stationInfos.size() > 0) {
|
||||
agvRequestVo.setToLocationCode(stationInfos.get(0).getStationCode());
|
||||
} else {
|
||||
agvRequestVo.setRequestType(RequestEnum.BACKWAITCHECK.getCode());
|
||||
}
|
||||
result = agvService.taskParamCreate(agvRequestVo);
|
||||
//查找任务单号
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
if (stationInfos.size() > 0) {
|
||||
//修改起始点位状态为空闲
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
//修改抽检工位待占用状态
|
||||
stationInfos.get(0).setStationStatus(10);
|
||||
stationInfoRepository.save(stationInfos.get(0));
|
||||
}
|
||||
String data = JSONObject.parseObject(result).getString("data");
|
||||
SpotCheckVo spotCheckVo = BeanUtil.copyProperties(shelfInfoList.get(0), SpotCheckVo.class);
|
||||
data = data.replaceAll("\\\"","");
|
||||
data = data.replace("{", "").replace("}","");
|
||||
spotCheckVo.setRequestCode(data.substring(0, data.indexOf(":")));
|
||||
return buildSuccess(spotCheckVo);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "送成品库")
|
||||
@PostMapping(value = "sendProdStore")
|
||||
@Transactional
|
||||
public Respond sendProdStore(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//校验
|
||||
if (StringUtils.isBlank(agvRequestVo.getContainerCode())) {
|
||||
throw new ServiceException("无货架编码,请检查!");
|
||||
}
|
||||
|
||||
ShelfInfo byShelfCode = shelfInfoRepository.findByShelfCode(agvRequestVo.getContainerCode());
|
||||
agvRequestVo.setFromLocationCode(byShelfCode.getStationCode());
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDPRODSTORE.getCode());
|
||||
String toLocationCode = findToLocationCode(30);
|
||||
agvRequestVo.setToLocationCode(toLocationCode);
|
||||
final String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//修改起始点位状态为空闲
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
//修改终点点位状态为待占用
|
||||
StationInfo stationInfo1 = stationInfoRepository.findByStationCode(toLocationCode);
|
||||
stationInfo1.setStationStatus(10);
|
||||
stationInfo1.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo1);
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(agvRequestVo.getContainerCode());
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
orderInfo.setProductOngoingQty(orderInfo.getProductOngoingQty() + shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空货架送回(不用,用tcpUtil的空箱入库方法)")
|
||||
@PostMapping(value = "sendNullShelf")
|
||||
public Respond sendNullShelf(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDNULLSHELF.getCode());
|
||||
final String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "呼叫空货架")
|
||||
@PostMapping(value = "callNullShelf")
|
||||
public Respond callNullShelf(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//校验
|
||||
if (StringUtils.isBlank(agvRequestVo.getToLocationCode())) {
|
||||
throw new ServiceException("无终点位置,请检查!");
|
||||
}
|
||||
if (StringUtils.isBlank(agvRequestVo.getContainerCode())) {
|
||||
throw new ServiceException("无货架编码,请检查!");
|
||||
}
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.CALLNULLSHELF.getCode());
|
||||
String result = null;
|
||||
lock.lock();
|
||||
try {
|
||||
final List<ShelfInfo> shelfInfos = shelfInfoRepository.findByProductionTaskIsNullAndStationCodeIsNotNull();
|
||||
if (shelfInfos.size() == 0) {
|
||||
return buildFailure("暂无空货架");
|
||||
}
|
||||
agvRequestVo.setContainerCode(shelfInfos.get(0).getShelfCode());
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(shelfInfos.get(0).getStationCode());
|
||||
agvRequestVo.setFromLocationCode(stationInfo.getStationCode());
|
||||
result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
shelfInfos.get(0).setProductionTask("待绑定");
|
||||
shelfInfoRepository.save(shelfInfos.get(0));
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "取消AGV任务")
|
||||
@GetMapping(value = "cancelTask")
|
||||
public Respond cancelTask(@RequestParam("taskCode") String taskCode) {
|
||||
agvService.taskCancel(taskCode);
|
||||
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "机器人是否允许取走/放置周转箱")
|
||||
@PostMapping(value = "allowOperation")
|
||||
public String allowOperation(@RequestBody String Bash) {
|
||||
String result = agvService.allowOperation(Bash);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "料箱出库(定时任务测试)")
|
||||
@PostMapping(value = "waterTest")
|
||||
public void waterTest() {
|
||||
scheduleService.waterTest();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "成品出库(测试)")
|
||||
@GetMapping(value = "outProdStore")
|
||||
public void outProdStore(String status) {
|
||||
agvService.outProdStore(status);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空货架入库(测试)")
|
||||
@GetMapping(value = "sendNullShelf")
|
||||
public void sendNullShelf(String status) {
|
||||
agvService.sendNullShelf(status);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空车入库(PDA)")
|
||||
@GetMapping(value = "nullShelfIn")
|
||||
public Respond nullShelfIn(@RequestParam("containerCode") String containerCode, @RequestParam("positionCode") String positionCode) {
|
||||
String result = agvService.moveIn(containerCode, positionCode);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(containerCode);
|
||||
if (shelfInfo != null) {
|
||||
shelfInfo.setStationCode(positionCode);
|
||||
}
|
||||
} else {
|
||||
return buildFailure("海柔报错:" + JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "找终点位置")
|
||||
@PostMapping(value = "findToLocationCode")
|
||||
public String findToLocationCode(Integer storeType) {
|
||||
String toLocationCode = null;
|
||||
List<StationInfo> stationInfoList = stationInfoRepository.findByStationTypeAndStationStatus(storeType, 5);
|
||||
if (stationInfoList.size() > 0) {
|
||||
toLocationCode = stationInfoList.get(0).getStationCode();
|
||||
} else {
|
||||
throw new ServiceException("暂无空闲的点位!");
|
||||
}
|
||||
return toLocationCode;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M73.137 29.08h-9.209 29.7L63.886.093 34.373 29.08h20.49v27.035H27.238v17.948h27.625v27.133h18.274V74.063h27.41V56.115h-27.41V29.08zm-9.245 98.827l27.518-26.711H36.59l27.302 26.71zM.042 64.982l27.196 27.029V38.167L.042 64.982zm100.505-26.815V92.01l27.41-27.029-27.41-26.815z"/></svg>
|
After Width: | Height: | Size: 356 B |
@ -0,0 +1,60 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
|
||||
/**
|
||||
* 通知公告表 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysNoticeMapper
|
||||
{
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 公告信息
|
||||
*/
|
||||
public SysNotice selectNoticeById(Long noticeId);
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 公告集合
|
||||
*/
|
||||
public List<SysNotice> selectNoticeList(SysNotice notice);
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNotice(SysNotice notice);
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNotice(SysNotice notice);
|
||||
|
||||
/**
|
||||
* 批量删除公告
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeById(Long noticeId);
|
||||
|
||||
/**
|
||||
* 批量删除公告信息
|
||||
*
|
||||
* @param noticeIds 需要删除的公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds(Long[] noticeIds);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.ruoyi.wms.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public enum RequestEnum {
|
||||
|
||||
NULLBOX(1, "请求空箱"),
|
||||
INSTORE(2, "入恒温区"),
|
||||
OUTSTORE(3, "出恒温区"),
|
||||
SENDWAITCHECK(4, "送待检区"),
|
||||
SENDCHECK(5, "送检验"),
|
||||
BACKWAITCHECK(6, "回待检区"),
|
||||
SENDSPOTCHECK(7, "送抽检"),
|
||||
SENDPRODSTORE(8, "送成品库"),
|
||||
OUTPRODSTORE(9, "出成品库"),
|
||||
SENDNULLSHELF(10,"空货架入库"),
|
||||
CALLNULLSHELF(11,"呼叫空货架")
|
||||
;
|
||||
|
||||
@Getter
|
||||
private int code;
|
||||
@Getter
|
||||
private String message;
|
||||
|
||||
private RequestEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1581238998885" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4187" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M511.542857 14.057143C228.914286 13.942857 0 242.742857 0 525.142857 0 748.457143 143.2 938.285714 342.628571 1008c26.857143 6.742857 22.742857-12.342857 22.742858-25.371429v-88.571428c-155.085714 18.171429-161.371429-84.457143-171.771429-101.6C172.571429 756.571429 122.857143 747.428571 137.714286 730.285714c35.314286-18.171429 71.314286 4.571429 113.028571 66.171429 30.171429 44.685714 89.028571 37.142857 118.857143 29.714286 6.514286-26.857143 20.457143-50.857143 39.657143-69.485715-160.685714-28.8-227.657143-126.857143-227.657143-243.428571 0-56.571429 18.628571-108.571429 55.2-150.514286-23.314286-69.142857 2.171429-128.342857 5.6-137.142857 66.4-5.942857 135.428571 47.542857 140.8 51.771429 37.714286-10.171429 80.8-15.542857 129.028571-15.542858 48.457143 0 91.657143 5.6 129.714286 15.885715 12.914286-9.828571 76.914286-55.771429 138.628572-50.171429 3.314286 8.8 28.228571 66.628571 6.285714 134.857143 37.028571 42.057143 55.885714 94.514286 55.885714 151.2 0 116.8-67.428571 214.971429-228.571428 243.314286a145.714286 145.714286 0 0 1 43.542857 104v128.571428c0.914286 10.285714 0 20.457143 17.142857 20.457143 202.4-68.228571 348.114286-259.428571 348.114286-484.685714 0-282.514286-229.028571-511.2-511.428572-511.2z" p-id="4188"></path></svg>
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.springframework:spring-core:5.2.12.RELEASE">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/springframework/spring-core/5.2.12.RELEASE/spring-core-5.2.12.RELEASE.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/springframework/spring-core/5.2.12.RELEASE/spring-core-5.2.12.RELEASE-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/springframework/spring-core/5.2.12.RELEASE/spring-core-5.2.12.RELEASE-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.wms.repository;
|
||||
|
||||
import com.ruoyi.wms.po.ShelfInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/6/27
|
||||
**/
|
||||
@Repository
|
||||
public interface ShelfInfoRepository extends JpaRepository<ShelfInfo,Long>, JpaSpecificationExecutor {
|
||||
ShelfInfo findByShelfCode(String shelfCode);
|
||||
List<ShelfInfo> findByProductionTaskAndOrderStatus(String task,Integer status);
|
||||
List<ShelfInfo> findByProductionTaskIsNull();
|
||||
List<ShelfInfo> findByOrderStatus(Integer Status);
|
||||
// List<ShelfInfo> findByShelfStatus(Integer status, Sort sort);
|
||||
List<ShelfInfo> findByProductionTask(String productionTask);
|
||||
|
||||
}
|
@ -0,0 +1,268 @@
|
||||
package com.ruoyi.ruiYiController.core.redis;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.BoundSetOperations;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* spring redis 工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
**/
|
||||
@SuppressWarnings(value = { "unchecked", "rawtypes" })
|
||||
@Component
|
||||
public class RedisCache
|
||||
{
|
||||
@Autowired
|
||||
public RedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 缓存基本的对象,Integer、String、实体类等
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @param value 缓存的值
|
||||
*/
|
||||
public <T> void setCacheObject(final String key, final T value)
|
||||
{
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存基本的对象,Integer、String、实体类等
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @param value 缓存的值
|
||||
* @param timeout 时间
|
||||
* @param timeUnit 时间颗粒度
|
||||
*/
|
||||
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
|
||||
{
|
||||
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置有效时间
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param timeout 超时时间
|
||||
* @return true=设置成功;false=设置失败
|
||||
*/
|
||||
public boolean expire(final String key, final long timeout)
|
||||
{
|
||||
return expire(key, timeout, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置有效时间
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param timeout 超时时间
|
||||
* @param unit 时间单位
|
||||
* @return true=设置成功;false=设置失败
|
||||
*/
|
||||
public boolean expire(final String key, final long timeout, final TimeUnit unit)
|
||||
{
|
||||
return redisTemplate.expire(key, timeout, unit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取有效时间
|
||||
*
|
||||
* @param key Redis键
|
||||
* @return 有效时间
|
||||
*/
|
||||
public long getExpire(final String key)
|
||||
{
|
||||
return redisTemplate.getExpire(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断 key是否存在
|
||||
*
|
||||
* @param key 键
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public Boolean hasKey(String key)
|
||||
{
|
||||
return redisTemplate.hasKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的基本对象。
|
||||
*
|
||||
* @param key 缓存键值
|
||||
* @return 缓存键值对应的数据
|
||||
*/
|
||||
public <T> T getCacheObject(final String key)
|
||||
{
|
||||
ValueOperations<String, T> operation = redisTemplate.opsForValue();
|
||||
return operation.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单个对象
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
public boolean deleteObject(final String key)
|
||||
{
|
||||
return redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除集合对象
|
||||
*
|
||||
* @param collection 多个对象
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteObject(final Collection collection)
|
||||
{
|
||||
return redisTemplate.delete(collection) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存List数据
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @param dataList 待缓存的List数据
|
||||
* @return 缓存的对象
|
||||
*/
|
||||
public <T> long setCacheList(final String key, final List<T> dataList)
|
||||
{
|
||||
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
|
||||
return count == null ? 0 : count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的list对象
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @return 缓存键值对应的数据
|
||||
*/
|
||||
public <T> List<T> getCacheList(final String key)
|
||||
{
|
||||
return redisTemplate.opsForList().range(key, 0, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存Set
|
||||
*
|
||||
* @param key 缓存键值
|
||||
* @param dataSet 缓存的数据
|
||||
* @return 缓存数据的对象
|
||||
*/
|
||||
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
|
||||
{
|
||||
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
|
||||
Iterator<T> it = dataSet.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
setOperation.add(it.next());
|
||||
}
|
||||
return setOperation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的set
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public <T> Set<T> getCacheSet(final String key)
|
||||
{
|
||||
return redisTemplate.opsForSet().members(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存Map
|
||||
*
|
||||
* @param key
|
||||
* @param dataMap
|
||||
*/
|
||||
public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
|
||||
{
|
||||
if (dataMap != null) {
|
||||
redisTemplate.opsForHash().putAll(key, dataMap);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的Map
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public <T> Map<String, T> getCacheMap(final String key)
|
||||
{
|
||||
return redisTemplate.opsForHash().entries(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 往Hash中存入数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param hKey Hash键
|
||||
* @param value 值
|
||||
*/
|
||||
public <T> void setCacheMapValue(final String key, final String hKey, final T value)
|
||||
{
|
||||
redisTemplate.opsForHash().put(key, hKey, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Hash中的数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param hKey Hash键
|
||||
* @return Hash中的对象
|
||||
*/
|
||||
public <T> T getCacheMapValue(final String key, final String hKey)
|
||||
{
|
||||
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
|
||||
return opsForHash.get(key, hKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多个Hash中的数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param hKeys Hash键集合
|
||||
* @return Hash对象集合
|
||||
*/
|
||||
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
|
||||
{
|
||||
return redisTemplate.opsForHash().multiGet(key, hKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除Hash中的某条数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param hKey Hash键
|
||||
* @return 是否成功
|
||||
*/
|
||||
public boolean deleteCacheMapValue(final String key, final String hKey)
|
||||
{
|
||||
return redisTemplate.opsForHash().delete(key, hKey) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的基本对象列表
|
||||
*
|
||||
* @param pattern 字符串前缀
|
||||
* @return 对象列表
|
||||
*/
|
||||
public Collection<String> keys(final String pattern)
|
||||
{
|
||||
return redisTemplate.keys(pattern);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: io.swagger.core.v3:swagger-annotations:2.1.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/io/swagger/core/v3/swagger-annotations/2.1.2/swagger-annotations-2.1.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/io/swagger/core/v3/swagger-annotations/2.1.2/swagger-annotations-2.1.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/io/swagger/core/v3/swagger-annotations/2.1.2/swagger-annotations-2.1.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,2 @@
|
||||
xe<><65>JAƭ<>)<29>T<EFBFBD>.h<>!<21><><08><><EFBFBD>`<60><><19>!<21>β$"i<>Z<> v<><76>:<3A><>ٻ<><D9BB>3<>7<EFBFBD><37><EFBFBD><EFBFBD>X*89;=r<>,u<>`<60><><EFBFBD>I<EFBFBD>)O<><4F>K<EFBFBD><4B>3<>W]$<24>e
|
||||
<EFBFBD><EFBFBD>J<EFBFBD><EFBFBD>BA?<3F><><EFBFBD>m<EFBFBD>l><3E>7<EFBFBD><37>k<EFBFBD><6B>~<>Z<EFBFBD><5A><EFBFBD>N<EFBFBD>A<t<>,<2C><>K<15><01>:<04><><EFBFBD>:<3A><10>ـ<7F><D980>v`<60>3<EFBFBD>T<EFBFBD><54> <20><><EFBFBD><EFBFBD>#B<>:f<>=Y<><59>bk<62>f<EFBFBD>|<7C>><3E><><EFBFBD><EFBFBD>+8<><38>Y~<7E><>:$<24><><EFBFBD><0F><><EFBFBD><EFBFBD>:Cr<43><72>=<3D><>lY<6C><59>%.zC<7A><43>y0<79><30>k<EFBFBD>V{<7B><>j
|
@ -0,0 +1,465 @@
|
||||
package com.ruoyi.wms.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cmeim.common.core.utils.BeanUtil;
|
||||
import com.cmeim.common.core.utils.DateUtil;
|
||||
import com.cmeim.common.core.utils.ExcelExportUtil;
|
||||
import com.cmeim.common.core.web.controller.GenericController;
|
||||
import com.cmeim.common.core.web.domain.Respond;
|
||||
import com.cmeim.common.core.web.domain.RespondEnum;
|
||||
import com.cmeim.common.core.web.page.PageVo;
|
||||
|
||||
import com.ruoyi.ruiYiController.annotation.Log;
|
||||
import com.ruoyi.ruiYiController.enums.BusinessType;
|
||||
import com.ruoyi.ruiYiController.exception.ServiceException;
|
||||
import com.ruoyi.wms.enums.AgvTaskEnum;
|
||||
import com.ruoyi.wms.enums.RequestEnum;
|
||||
import com.ruoyi.wms.repository.AgvTaskRepository;
|
||||
import com.ruoyi.wms.repository.OrderInfoRepository;
|
||||
import com.ruoyi.wms.repository.ShelfInfoRepository;
|
||||
import com.ruoyi.wms.repository.StoreInfoRepository;
|
||||
import com.ruoyi.wms.service.AGVService;
|
||||
import com.ruoyi.wms.po.AgvTask;
|
||||
import com.ruoyi.wms.po.ContainerInfo;
|
||||
import com.ruoyi.wms.po.OrderInfo;
|
||||
import com.ruoyi.wms.po.ShelfInfo;
|
||||
import com.ruoyi.wms.po.StoreInfo;
|
||||
import com.ruoyi.wms.repository.ContainerInfoRepository;
|
||||
import com.ruoyi.wms.service.ScheduleService;
|
||||
import com.ruoyi.wms.vo.AgvRequestVo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.ruoyi.wms.vo.AgvTaskExportVo;
|
||||
import com.ruoyi.wms.vo.DataVo;
|
||||
import com.ruoyi.wms.vo.ReturnVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/6/26
|
||||
**/
|
||||
@Api(tags = "数据采集接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping(value = "agv")
|
||||
public class AgvController extends GenericController {
|
||||
|
||||
@Autowired
|
||||
private AgvTaskRepository agvTaskRepository;
|
||||
@Autowired
|
||||
private AGVService agvService;
|
||||
@Autowired
|
||||
private ContainerInfoRepository containerInfoRepository;
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
@Autowired
|
||||
private StoreInfoRepository storeInfoRepository;
|
||||
@Autowired
|
||||
private ShelfInfoRepository shelfInfoRepository;
|
||||
@Autowired
|
||||
private ScheduleService scheduleService;
|
||||
|
||||
@ApiOperation(value = "列表")
|
||||
@GetMapping(value = "list")
|
||||
public Respond list(PageVo pv, AgvTask agvTask) {
|
||||
PageRequest pageRequest = PageRequest.of(pv.getPageNo() - 1, pv.getPageSize(),
|
||||
Sort.by(sortOrder(agvTask.getOrders())));
|
||||
Page page = agvTaskRepository.findAll(buildSpecification(agvTask), pageRequest);
|
||||
List<AgvTask> list = page.getContent();
|
||||
pv.setRecordsTotal(page.getTotalElements());
|
||||
pv.setData(list);
|
||||
return buildSuccess(pv);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出excel")
|
||||
@PostMapping("exportExcel")
|
||||
public void export(AgvTask agvTask, HttpServletResponse response) throws Exception {
|
||||
List<AgvTask> list = agvTaskRepository.findAll(buildSpecification(agvTask));
|
||||
List<AgvTaskExportVo> exportList = new ArrayList<>();
|
||||
for (AgvTask task : list) {
|
||||
AgvTaskExportVo agvTaskExportVo = BeanUtil.copyProperties(task, AgvTaskExportVo.class);
|
||||
exportList.add(agvTaskExportVo);
|
||||
}
|
||||
// 创建工作簿对象
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
|
||||
// 创建工作表
|
||||
SXSSFSheet sheet = workbook.createSheet("AGV任务列表");
|
||||
|
||||
String[] rowsName = new String[]{"序号", "请求单号", "类型", "json", "任务状态", "处理结果", "创建人", "创建时间"};
|
||||
List<Object[]> dataList = new ArrayList<Object[]>();
|
||||
Object[] objs = null;
|
||||
int i = 1;
|
||||
for (AgvTaskExportVo agvTaskExportVo : exportList) {
|
||||
if (agvTaskExportVo.getDictType() == 1) {
|
||||
agvTaskExportVo.setDictTypeShow("请求空箱");
|
||||
} else if (agvTaskExportVo.getDictType() == 2) {
|
||||
agvTaskExportVo.setDictTypeShow("入水测");
|
||||
} else if (agvTaskExportVo.getDictType() == 3) {
|
||||
agvTaskExportVo.setDictTypeShow("出水测");
|
||||
} else if (agvTaskExportVo.getDictType() == 4) {
|
||||
agvTaskExportVo.setDictTypeShow("送待检");
|
||||
} else if (agvTaskExportVo.getDictType() == 5) {
|
||||
agvTaskExportVo.setDictTypeShow("送检验");
|
||||
} else if (agvTaskExportVo.getDictType() == 6) {
|
||||
agvTaskExportVo.setDictTypeShow("回待检");
|
||||
} else if (agvTaskExportVo.getDictType() == 7) {
|
||||
agvTaskExportVo.setDictTypeShow("送抽检");
|
||||
} else if (agvTaskExportVo.getDictType() == 8) {
|
||||
agvTaskExportVo.setDictTypeShow("送成品库");
|
||||
} else if (agvTaskExportVo.getDictType() == 9) {
|
||||
agvTaskExportVo.setDictTypeShow("出成品库");
|
||||
} else if (agvTaskExportVo.getDictType() == 10) {
|
||||
agvTaskExportVo.setDictTypeShow("空箱入库");
|
||||
} else if (agvTaskExportVo.getDictType() == 11) {
|
||||
agvTaskExportVo.setDictTypeShow("呼叫空货架");
|
||||
}
|
||||
if (agvTaskExportVo.getStatus() == 1) {
|
||||
agvTaskExportVo.setStatusShow("未发起");
|
||||
} else if (agvTaskExportVo.getDictType() == 2) {
|
||||
agvTaskExportVo.setStatusShow("进行中");
|
||||
} else if (agvTaskExportVo.getDictType() == 3) {
|
||||
agvTaskExportVo.setStatusShow("已完成");
|
||||
} else if (agvTaskExportVo.getDictType() == 4) {
|
||||
agvTaskExportVo.setStatusShow("失败");
|
||||
} else if (agvTaskExportVo.getDictType() == 5) {
|
||||
agvTaskExportVo.setStatusShow("取消");
|
||||
} else if (agvTaskExportVo.getStatus() == 6) {
|
||||
agvTaskExportVo.setStatusShow("挂起");
|
||||
}
|
||||
|
||||
objs = new Object[rowsName.length];
|
||||
objs[0] = i;
|
||||
objs[1] = agvTaskExportVo.getRequestCode();
|
||||
objs[2] = agvTaskExportVo.getDictTypeShow();
|
||||
objs[3] = agvTaskExportVo.getJson();
|
||||
objs[4] = agvTaskExportVo.getStatusShow();
|
||||
objs[5] = agvTaskExportVo.getMessage();
|
||||
objs[6] = agvTaskExportVo.getCreatedBy();
|
||||
objs[7] = agvTaskExportVo.getCreatedDt();
|
||||
dataList.add(objs);
|
||||
i += 1;
|
||||
}
|
||||
ExcelExportUtil.getExportWorkbook(workbook, sheet, rowsName, dataList);
|
||||
ExcelExportUtil.sendHttpResponse(response, "Agv", workbook);
|
||||
}
|
||||
|
||||
private Specification buildSpecification(AgvTask agvTask) {
|
||||
Specification<AgvTask> specification = new Specification<AgvTask>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<AgvTask> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> predicates = Lists.newArrayList();
|
||||
if (agvTask.getRequestCode() != null) {
|
||||
predicates.add(cb.like(root.get("requestCode").as(String.class), "%" + agvTask.getRequestCode() + "%"));
|
||||
}
|
||||
if (agvTask.getMessage() != null) {
|
||||
predicates.add(cb.like(root.get("message").as(String.class), "%" + agvTask.getMessage() + "%"));
|
||||
}
|
||||
if (agvTask.getDictType() != null) {
|
||||
predicates.add(cb.equal(root.get("dictType").as(Integer.class), agvTask.getDictType()));
|
||||
}
|
||||
if (agvTask.getStatus() != null) {
|
||||
predicates.add(cb.equal(root.get("status").as(Integer.class), agvTask.getStatus()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(agvTask.getCreatedDtStart())) {
|
||||
predicates.add(cb.greaterThanOrEqualTo(root.get("createdDt").as(String.class), agvTask.getCreatedDtStart()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(agvTask.getCreatedDtEnd())) {
|
||||
predicates.add(cb.lessThanOrEqualTo(root.get("createdDt").as(String.class), agvTask.getCreatedDtEnd()));
|
||||
}
|
||||
if (agvTask.getStatusArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("status").as(Integer.class));
|
||||
for (Integer status : agvTask.getStatusArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
if (agvTask.getDictTypeArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("dictType").as(Integer.class));
|
||||
for (Integer status : agvTask.getDictTypeArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||
}
|
||||
};
|
||||
|
||||
return specification;
|
||||
}
|
||||
|
||||
/**
|
||||
* AGV任务回调
|
||||
*
|
||||
* @param jsonObject 回调参数
|
||||
* @return 结果返回
|
||||
*/
|
||||
@ApiOperation(value = "AGV任务回调")
|
||||
@PostMapping(value = "TaskStatusCallback")
|
||||
public JSONObject TaskStatusCallback(@RequestBody JSONObject jsonObject) {
|
||||
log.info("回调任务all:" + jsonObject);
|
||||
String taskCode = jsonObject.getString("taskCode");
|
||||
final AgvTask agvTask = agvTaskRepository.findByRequestCode(taskCode);
|
||||
String status = jsonObject.getString("status");
|
||||
if (StringUtils.isNotBlank(status)) {
|
||||
if (status.equals("fail")) {
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.FAIL.getCode(), jsonObject.getString("message"));
|
||||
} else if (status.equals("success")) {
|
||||
//获取回调类型
|
||||
String eventType = jsonObject.getString("eventType");
|
||||
if (eventType.equals("task")) {
|
||||
log.info("回调任务task:" + jsonObject);
|
||||
//更新任务状态
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.FINISH.getCode(), jsonObject.getString("message"));
|
||||
//成功回调
|
||||
agvService.callBackSuccess(agvTask, jsonObject);
|
||||
}
|
||||
//取箱完成回调,滚筒线下线
|
||||
else if (eventType.equals("tote_load") && agvTask.getDictType() == 2) {
|
||||
String param = jsonObject.toJSONString();
|
||||
agvService.noticeToPlc(param);
|
||||
}
|
||||
//放箱完成回调,滚筒线请求空箱
|
||||
else if (eventType.equals("tote_unload") && agvTask.getDictType() == 1) {
|
||||
String param = jsonObject.toJSONString();
|
||||
agvService.noticeToPlc(param);
|
||||
}
|
||||
|
||||
} else if (status.equals("cancel")) {
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.CANCEL.getCode(), jsonObject.getString("message"));
|
||||
} else if (status.equals("suspend")) {
|
||||
agvService.updateAgvTask(taskCode, agvTask.getDictType(), agvTask.getJson(), AgvTaskEnum.PENDING.getCode(), jsonObject.getString("message"));
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", 0);
|
||||
result.put("msg", "success");
|
||||
result.put("data", "");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空箱入库")
|
||||
@PostMapping(value = "EmptyContainerInStore")
|
||||
@Transactional
|
||||
public Respond EmptyContainerInStore(@RequestBody AgvRequestVo requestVo) {
|
||||
//校验周转箱是否存在以及状态
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(requestVo.getContainerCode());
|
||||
if (containerInfo == null) {
|
||||
throw new ServiceException("周转箱号不存在:" + requestVo.getContainerCode());
|
||||
}
|
||||
if (containerInfo.getContainerStatus() != 15 && containerInfo.getContainerStatus() != 20 && containerInfo.getContainerStatus() != 25) {
|
||||
throw new ServiceException("周转箱号状态不是入库中的状态:" + requestVo.getContainerCode());
|
||||
}
|
||||
requestVo.setType(1);
|
||||
requestVo.setRequestType(RequestEnum.NULLBOXINSTORE.getCode());
|
||||
requestVo.setFromLocationCode(requestVo.getFromLocationCode());
|
||||
requestVo.setToLocationCode("LA_SHELF_STORAGE");
|
||||
requestVo.setContainerCode(requestVo.getContainerCode());
|
||||
String result = agvService.taskParamCreate(requestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空料箱出库")
|
||||
@PostMapping(value = "EmptyContainerOutStore")
|
||||
public Respond EmptyContainerOutStore(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//判断空箱出库任务是否唯一
|
||||
List<AgvTask> agvTaskList = agvTaskRepository.findByDictTypeAndStatus(RequestEnum.NULLBOX.getCode(), 2);
|
||||
if (agvTaskList.size() > 0) {
|
||||
return buildFailure("还有正在执行的出库任务:" + agvTaskList);
|
||||
}
|
||||
//设置agv请求类型
|
||||
agvRequestVo.setRequestType(RequestEnum.NULLBOX.getCode());
|
||||
agvRequestVo.setType(0);
|
||||
agvService.EmptyContainerOutStore(agvRequestVo);
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "料箱入库")
|
||||
@PostMapping(value = "ContainerInStore")
|
||||
public Respond ContainerInStore(@RequestBody AgvRequestVo requestVo) {
|
||||
//校验周转箱是否存在以及状态
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(requestVo.getContainerCode());
|
||||
if (containerInfo == null) {
|
||||
throw new ServiceException("周转箱号不存在:" + requestVo.getContainerCode());
|
||||
}
|
||||
if (containerInfo.getContainerStatus() != 15 && containerInfo.getContainerStatus() != 20 && containerInfo.getContainerStatus() != 25) {
|
||||
throw new ServiceException("仓库暂无空料箱!" + requestVo.getContainerCode());
|
||||
}
|
||||
requestVo.setType(1);
|
||||
requestVo.setRequestType(RequestEnum.INSTORE.getCode());
|
||||
requestVo.setToStationCode("LA_SHELF_STORAGE");
|
||||
String result = agvService.taskParamCreate(requestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//final ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(requestVo.getContainerCode());
|
||||
//containerInfo.setProductionTask(requestVo.productionTask);
|
||||
//containerInfo.setOnInstoreTime(DateUtil.getCurrentDate());
|
||||
//final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(requestVo.getProductionTask());
|
||||
//Integer qty = orderInfo.getPlanQty() - (orderInfo.getInQty() + orderInfo.getOngoingQty() + orderInfo.getOutQty() + orderInfo.getOnoutingCheckQty());
|
||||
//if (qty > 6) {
|
||||
// qty = 6;
|
||||
//}
|
||||
////入库中数量
|
||||
//orderInfo.setOngoingQty(orderInfo.getOngoingQty() + qty);
|
||||
//containerInfo.setQty(qty);
|
||||
//orderInfoRepository.save(orderInfo);
|
||||
//containerInfoRepository.save(containerInfo);
|
||||
return buildSuccess("请求成功");
|
||||
} else {
|
||||
return buildSuccess(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "送待检区")
|
||||
@PostMapping(value = "sendWaitCheck")
|
||||
public Respond sendWaitCheck(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDWAITCHECK.getCode());
|
||||
final String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
Lock lock = new ReentrantLock();
|
||||
|
||||
@ApiOperation(value = "送抽检")
|
||||
@PostMapping(value = "sendSpotCheck")
|
||||
public Respond sendSpotCheck(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDSPOTCHECK.getCode());
|
||||
String result = null;
|
||||
lock.lock();
|
||||
try {
|
||||
final List<StoreInfo> storeInfos = storeInfoRepository.findByStoreTypeAndStoreStatus(20, 5);
|
||||
if (storeInfos.size() > 0) {
|
||||
agvRequestVo.setToLocationCode(storeInfos.get(0).getStoreCode());
|
||||
} else {
|
||||
agvRequestVo.setRequestType(RequestEnum.BACKWAITCHECK.getCode());
|
||||
}
|
||||
result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
if (storeInfos.size() > 0) {
|
||||
//修改抽检工位待占用状态
|
||||
storeInfos.get(0).setStoreStatus(10);
|
||||
storeInfoRepository.save(storeInfos.get(0));
|
||||
}
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "送成品库")
|
||||
@PostMapping(value = "sendProdStore")
|
||||
@Transactional
|
||||
public Respond sendProdStore(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDPRODSTORE.getCode());
|
||||
final String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
final ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(agvRequestVo.getContainerCode());
|
||||
final OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
orderInfo.setProductOngoingQty(orderInfo.getProductOngoingQty() + shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空货架送回")
|
||||
@PostMapping(value = "sendNullShelf")
|
||||
public Respond sendNullShelf(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDNULLSHELF.getCode());
|
||||
final String result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "呼叫空货架")
|
||||
@PostMapping(value = "callNullShelf")
|
||||
public Respond callNullShelf(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.CALLNULLSHELF.getCode());
|
||||
String result = null;
|
||||
lock.lock();
|
||||
try {
|
||||
final List<ShelfInfo> shelfInfos = shelfInfoRepository.findByProductionTaskIsNull();
|
||||
if (shelfInfos.size() == 0) {
|
||||
return buildFailure("暂无空货架");
|
||||
}
|
||||
agvRequestVo.setContainerCode(shelfInfos.get(0).getShelfCode());
|
||||
result = agvService.taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
shelfInfos.get(0).setProductionTask("待绑定");
|
||||
shelfInfoRepository.save(shelfInfos.get(0));
|
||||
return buildSuccess("请求成功");
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
return buildFailure(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "取消AGV任务")
|
||||
@GetMapping(value = "cancelTask")
|
||||
public Respond cancelTask(@RequestParam("taskCode") String taskCode) {
|
||||
agvService.taskCancel(taskCode);
|
||||
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "机器人是否允许取走/放置周转箱")
|
||||
@PostMapping(value = "allowOperation")
|
||||
public String allowOperation(@RequestBody String Bash) {
|
||||
String result = agvService.allowOperation(Bash);
|
||||
//DataVo data = new DataVo();
|
||||
//data.setAllow(true);
|
||||
//ReturnVo vo = new ReturnVo();
|
||||
//vo.setCode(0);
|
||||
//vo.setMsg(null);
|
||||
//vo.setData(data);
|
||||
//String result = JSONObject.toJSONString(vo);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "料箱出库(定时任务测试)")
|
||||
@PostMapping(value = "waterTest")
|
||||
public void waterTest() {
|
||||
scheduleService.waterTest();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/6/26
|
||||
**/
|
||||
@Data
|
||||
public class AgvRequestVo {
|
||||
//搬运类型
|
||||
public Integer type;
|
||||
//容器编码
|
||||
public String ContainerCode;
|
||||
//起始库位
|
||||
public String fromLocationCode;
|
||||
//目标库位
|
||||
public String toLocationCode;
|
||||
//请求类型 0:呼叫空箱 1:请求空箱 2:入水测 3:出水测 4:送待检 5:送检验 6:回待检 7:送抽检 8:送成品库 9:出成品库
|
||||
public Integer requestType;
|
||||
//请求箱数
|
||||
public Integer boxNumber;
|
||||
//生产单号
|
||||
public String productionTask;
|
||||
//??
|
||||
public String toStationCode;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/2.2.2/mybatis-spring-boot-autoconfigure-2.2.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/2.2.2/mybatis-spring-boot-autoconfigure-2.2.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/2.2.2/mybatis-spring-boot-autoconfigure-2.2.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,58 @@
|
||||
package com.ruoyi.ruiYiController.exception;
|
||||
|
||||
/**
|
||||
* 全局异常
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class GlobalException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 错误明细,内部调试错误
|
||||
*
|
||||
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||
*/
|
||||
private String detailMessage;
|
||||
|
||||
/**
|
||||
* 空构造方法,避免反序列化问题
|
||||
*/
|
||||
public GlobalException()
|
||||
{
|
||||
}
|
||||
|
||||
public GlobalException(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getDetailMessage()
|
||||
{
|
||||
return detailMessage;
|
||||
}
|
||||
|
||||
public GlobalException setDetailMessage(String detailMessage)
|
||||
{
|
||||
this.detailMessage = detailMessage;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
public GlobalException setMessage(String message)
|
||||
{
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<div class="wscn-http404-container">
|
||||
<div class="wscn-http404">
|
||||
<div class="pic-404">
|
||||
<img class="pic-404__parent" src="@/assets/404_images/404.png" alt="404">
|
||||
<img class="pic-404__child left" src="@/assets/404_images/404_cloud.png" alt="404">
|
||||
<img class="pic-404__child mid" src="@/assets/404_images/404_cloud.png" alt="404">
|
||||
<img class="pic-404__child right" src="@/assets/404_images/404_cloud.png" alt="404">
|
||||
</div>
|
||||
<div class="bullshit">
|
||||
<div class="bullshit__oops">
|
||||
404错误!
|
||||
</div>
|
||||
<div class="bullshit__headline">
|
||||
{{ message }}
|
||||
</div>
|
||||
<div class="bullshit__info">
|
||||
对不起,您正在寻找的页面不存在。尝试检查URL的错误,然后按浏览器上的刷新按钮或尝试在我们的应用程序中找到其他内容。
|
||||
</div>
|
||||
<router-link to="/" class="bullshit__return-home">
|
||||
返回首页
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'Page404',
|
||||
computed: {
|
||||
message() {
|
||||
return '找不到网页!'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.wscn-http404-container{
|
||||
transform: translate(-50%,-50%);
|
||||
position: absolute;
|
||||
top: 40%;
|
||||
left: 50%;
|
||||
}
|
||||
.wscn-http404 {
|
||||
position: relative;
|
||||
width: 1200px;
|
||||
padding: 0 50px;
|
||||
overflow: hidden;
|
||||
.pic-404 {
|
||||
position: relative;
|
||||
float: left;
|
||||
width: 600px;
|
||||
overflow: hidden;
|
||||
&__parent {
|
||||
width: 100%;
|
||||
}
|
||||
&__child {
|
||||
position: absolute;
|
||||
&.left {
|
||||
width: 80px;
|
||||
top: 17px;
|
||||
left: 220px;
|
||||
opacity: 0;
|
||||
animation-name: cloudLeft;
|
||||
animation-duration: 2s;
|
||||
animation-timing-function: linear;
|
||||
animation-fill-mode: forwards;
|
||||
animation-delay: 1s;
|
||||
}
|
||||
&.mid {
|
||||
width: 46px;
|
||||
top: 10px;
|
||||
left: 420px;
|
||||
opacity: 0;
|
||||
animation-name: cloudMid;
|
||||
animation-duration: 2s;
|
||||
animation-timing-function: linear;
|
||||
animation-fill-mode: forwards;
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
&.right {
|
||||
width: 62px;
|
||||
top: 100px;
|
||||
left: 500px;
|
||||
opacity: 0;
|
||||
animation-name: cloudRight;
|
||||
animation-duration: 2s;
|
||||
animation-timing-function: linear;
|
||||
animation-fill-mode: forwards;
|
||||
animation-delay: 1s;
|
||||
}
|
||||
@keyframes cloudLeft {
|
||||
0% {
|
||||
top: 17px;
|
||||
left: 220px;
|
||||
opacity: 0;
|
||||
}
|
||||
20% {
|
||||
top: 33px;
|
||||
left: 188px;
|
||||
opacity: 1;
|
||||
}
|
||||
80% {
|
||||
top: 81px;
|
||||
left: 92px;
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
top: 97px;
|
||||
left: 60px;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
@keyframes cloudMid {
|
||||
0% {
|
||||
top: 10px;
|
||||
left: 420px;
|
||||
opacity: 0;
|
||||
}
|
||||
20% {
|
||||
top: 40px;
|
||||
left: 360px;
|
||||
opacity: 1;
|
||||
}
|
||||
70% {
|
||||
top: 130px;
|
||||
left: 180px;
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
top: 160px;
|
||||
left: 120px;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
@keyframes cloudRight {
|
||||
0% {
|
||||
top: 100px;
|
||||
left: 500px;
|
||||
opacity: 0;
|
||||
}
|
||||
20% {
|
||||
top: 120px;
|
||||
left: 460px;
|
||||
opacity: 1;
|
||||
}
|
||||
80% {
|
||||
top: 180px;
|
||||
left: 340px;
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
top: 200px;
|
||||
left: 300px;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.bullshit {
|
||||
position: relative;
|
||||
float: left;
|
||||
width: 300px;
|
||||
padding: 30px 0;
|
||||
overflow: hidden;
|
||||
&__oops {
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
line-height: 40px;
|
||||
color: #1482f0;
|
||||
opacity: 0;
|
||||
margin-bottom: 20px;
|
||||
animation-name: slideUp;
|
||||
animation-duration: 0.5s;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
&__headline {
|
||||
font-size: 20px;
|
||||
line-height: 24px;
|
||||
color: #222;
|
||||
font-weight: bold;
|
||||
opacity: 0;
|
||||
margin-bottom: 10px;
|
||||
animation-name: slideUp;
|
||||
animation-duration: 0.5s;
|
||||
animation-delay: 0.1s;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
&__info {
|
||||
font-size: 13px;
|
||||
line-height: 21px;
|
||||
color: grey;
|
||||
opacity: 0;
|
||||
margin-bottom: 30px;
|
||||
animation-name: slideUp;
|
||||
animation-duration: 0.5s;
|
||||
animation-delay: 0.2s;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
&__return-home {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 110px;
|
||||
height: 36px;
|
||||
background: #1482f0;
|
||||
border-radius: 100px;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
opacity: 0;
|
||||
font-size: 14px;
|
||||
line-height: 36px;
|
||||
cursor: pointer;
|
||||
animation-name: slideUp;
|
||||
animation-duration: 0.5s;
|
||||
animation-delay: 0.3s;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
@keyframes slideUp {
|
||||
0% {
|
||||
transform: translateY(60px);
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
After Width: | Height: | Size: 5.5 KiB |
@ -0,0 +1,15 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/7/22
|
||||
*/
|
||||
@Data
|
||||
public class ReturnVo {
|
||||
private int code;
|
||||
private String msg;
|
||||
private DataVo data;
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
x<01><>Oo<4F>0<14>9<EFBFBD>S<EFBFBD><53><EFBFBD><EFBFBD><EFBFBD>qB<1D>%h<>8"nb6o<36><6F><EFBFBD>L<EFBFBD>R<07><>H<13>mT<6D>j<EFBFBD><6A><EFBFBD>pZ;n<><6E><EFBFBD>ej/<2F><16>N2<02>(<12><>D<EFBFBD>{~<7E><>^^<5E><>j<EFBFBD><6A><EFBFBD><EFBFBD><EFBFBD>[>4<><34>
|
||||
<02><><EFBFBD>$<24><>XBB7u<07>>"<0B><><1D>#<14><>
|
||||
<EFBFBD><EFBFBD><14><>2<0E>B<EFBFBD><<3C>gyĮ<><C4AE><<3C>j"<22>R.k<><0C><>+<2B><>l<<1C><><EFBFBD><EFBFBD><EFBFBD>˷z<CBB7><7A><EFBFBD><EFBFBD><EFBFBD><05>|)<29><>]<5D>!]<5D>Pb<><62><EFBFBD>a<EFBFBD><61>&<26>.E<>)4H<>}<7D>ش<EFBFBD><10>* _ʀ<1F>F<EFBFBD><46>|)<29>>e<>v<EFBFBD><76>
|
||||
{<7B>TѪT]<5D>!<21>X*<2A>ŕ<>U <09>!q<01><>_u
|
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: commons-fileupload:commons-fileupload:1.3.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/commons-fileupload/commons-fileupload/1.3.3/commons-fileupload-1.3.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/commons-fileupload/commons-fileupload/1.3.3/commons-fileupload-1.3.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.m2/repository/commons-fileupload/commons-fileupload/1.3.3/commons-fileupload-1.3.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,3 @@
|
||||
x<01>R<EFBFBD>N<EFBFBD>0䜯<><E49CAF>D<EFBFBD>S<EFBFBD>(<28>EU<45>r(<28><10> n[g<13>6^<5E>v<EFBFBD><11><>qB $|<7C><><EFBFBD><EFBFBD><EFBFBD>c<EFBFBD><63>9띜hKH<4B> ʸɩ<CAB8>ܠ&+<1D>b2<>d\<5C>W<13>"<22>@*4<13><>`!<21>r<EFBFBD><72>Tib <20>72K<1E><03><>P<EFBFBD><50>7<1A>k
|
||||
<1B>T<7F>4
|
||||
<EFBFBD>HN<><4E>^<5E>Ƚ<EFBFBD>?mX<6D><06>y]z<>|<01><>s'W|*<2A><>MGa<18><><EFBFBD>р<>"<22>#ީ<17>{!<21>??U<><1C><><EFBFBD><EFBFBD>qԋ<71><D48B>>F<>h<EFBFBD><10>|<7C><><EFBFBD>I<EFBFBD><49><10><1A><><19><1D>ز<EFBFBD>l<EFBFBD><1B><><EFBFBD>T:l<><6C><07><><03>_<EFBFBD>A<EFBFBD>p<EFBFBD><12><><EFBFBD>b<EFBFBD>6s<36>rۚxW)f<><66>pP<70><50>@<40>j<EFBFBD><17><><EFBFBD>Mk<4D><6B>%<25><><EFBFBD>\<5C>WzC<7A><43><EFBFBD><EFBFBD><EFBFBD>8<17><><1E>.<2E>,<2C><><EFBFBD>$<1F>'f<><66><EFBFBD>
|
@ -0,0 +1,345 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="请求单号" prop="requestCode">
|
||||
<el-input
|
||||
v-model="queryParams.requestCode"
|
||||
placeholder="请输入请求单号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="请求内容" prop="json">
|
||||
<el-input
|
||||
v-model="queryParams.json"
|
||||
placeholder="请输入请求内容"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="任务状态"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.agv_request_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间起" prop="createdDtStart">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.createdDtStart"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间止" prop="createdDtEnd">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.createdDtEnd"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<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-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:task:export']"
|
||||
>导出</el-button>
|
||||
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="taskList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="请求单号" align="center" prop="requestCode" />
|
||||
<el-table-column label="类型" align="center" prop="dictType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.agv_request_type" :value="scope.row.dictType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="json" align="center" prop="json" show-overflow-tooltip/>
|
||||
<el-table-column label="任务状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.agv_request_status" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理结果" align="center" prop="message" />
|
||||
<el-table-column label="创建人" align="center" prop="createdBy" />
|
||||
<el-table-column label="创建时间" align="center" prop="createdDt" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createdDt) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新人" align="center" prop="updatedBy" />
|
||||
<el-table-column label="更新时间" align="center" prop="updatedDt" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.updatedDt) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
width="160"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope" v-if="scope.row.userId !== 1">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="cancelTask(scope.row)"
|
||||
v-hasPermi="['system:user:remove']"
|
||||
>取消任务</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改【请填写功能名称】对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="请求单号" prop="requestCode">
|
||||
<el-input v-model="form.requestCode" placeholder="请输入请求单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="json" prop="json">
|
||||
<el-input v-model="form.json" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="处理结果" prop="message">
|
||||
<el-input v-model="form.message" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="createdBy">
|
||||
<el-input v-model="form.createdBy" placeholder="请输入创建人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createdDt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.createdDt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updatedBy">
|
||||
<el-input v-model="form.updatedBy" placeholder="请输入更新人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updatedDt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.updatedDt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择更新时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listTask, cancelTask, delTask, addTask, updateTask } from "@/api/wms/agvTaskInfo";
|
||||
|
||||
export default {
|
||||
name: "Task",
|
||||
dicts:['agv_request_status','agv_request_type'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 【请填写功能名称】表格数据
|
||||
taskList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
requestCode: null,
|
||||
dictType: null,
|
||||
json: null,
|
||||
status: null,
|
||||
message: null,
|
||||
createdBy: null,
|
||||
createdDt: null,
|
||||
updatedBy: null,
|
||||
updatedDt: null,
|
||||
createdDtStart:null,
|
||||
createdDtEnd:null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询【请填写功能名称】列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.dateHandle();
|
||||
listTask(this.queryParams).then(response => {
|
||||
this.taskList = response.data.data;
|
||||
this.total = response.data.recordsTotal;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
dateHandle(){
|
||||
if(this.queryParams.createdDtEnd!=null)
|
||||
{
|
||||
this.queryParams.createdDtEnd=this.queryParams.createdDtEnd+" 23:59:59"
|
||||
}
|
||||
},
|
||||
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
requestCode: null,
|
||||
dictType: null,
|
||||
json: null,
|
||||
status: null,
|
||||
message: null,
|
||||
createdBy: null,
|
||||
createdDt: null,
|
||||
updatedBy: null,
|
||||
updatedDt: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加【请填写功能名称】";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
console.log("修改"+row.id)
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getTask(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改【请填写功能名称】";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delTask(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.dateHandle()
|
||||
this.download('agv/exportExcel', {
|
||||
...this.queryParams
|
||||
}, `AGV任务列表_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 取消agv任务
|
||||
*/
|
||||
cancelTask(row){
|
||||
this.$modal.confirm('是否确认取消任务单号为"' + row.requestCode + '"的数据项?').then(function() {
|
||||
return cancelTask(row.requestCode);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("取消成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,102 @@
|
||||
package com.ruoyi.framework.manager.factory;
|
||||
|
||||
import java.util.TimerTask;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.ruoyi.ruiYiController.constant.Constants;
|
||||
import com.ruoyi.ruiYiController.utils.LogUtils;
|
||||
import com.ruoyi.ruiYiController.utils.ServletUtils;
|
||||
import com.ruoyi.ruiYiController.utils.StringUtils;
|
||||
import com.ruoyi.ruiYiController.utils.ip.AddressUtils;
|
||||
import com.ruoyi.ruiYiController.utils.ip.IpUtils;
|
||||
import com.ruoyi.ruiYiController.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.domain.SysLogininfor;
|
||||
import com.ruoyi.system.domain.SysOperLog;
|
||||
import com.ruoyi.system.service.ISysLogininforService;
|
||||
import com.ruoyi.system.service.ISysOperLogService;
|
||||
import eu.bitwalker.useragentutils.UserAgent;
|
||||
|
||||
/**
|
||||
* 异步工厂(产生任务用)
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class AsyncFactory
|
||||
{
|
||||
private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user");
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param status 状态
|
||||
* @param message 消息
|
||||
* @param args 列表
|
||||
* @return 任务task
|
||||
*/
|
||||
public static TimerTask recordLogininfor(final String username, final String status, final String message,
|
||||
final Object... args)
|
||||
{
|
||||
final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
|
||||
final String ip = IpUtils.getIpAddr();
|
||||
return new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
String address = AddressUtils.getRealAddressByIP(ip);
|
||||
StringBuilder s = new StringBuilder();
|
||||
s.append(LogUtils.getBlock(ip));
|
||||
s.append(address);
|
||||
s.append(LogUtils.getBlock(username));
|
||||
s.append(LogUtils.getBlock(status));
|
||||
s.append(LogUtils.getBlock(message));
|
||||
// 打印信息到日志
|
||||
sys_user_logger.info(s.toString(), args);
|
||||
// 获取客户端操作系统
|
||||
String os = userAgent.getOperatingSystem().getName();
|
||||
// 获取客户端浏览器
|
||||
String browser = userAgent.getBrowser().getName();
|
||||
// 封装对象
|
||||
SysLogininfor logininfor = new SysLogininfor();
|
||||
logininfor.setUserName(username);
|
||||
logininfor.setIpaddr(ip);
|
||||
logininfor.setLoginLocation(address);
|
||||
logininfor.setBrowser(browser);
|
||||
logininfor.setOs(os);
|
||||
logininfor.setMsg(message);
|
||||
// 日志状态
|
||||
if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER))
|
||||
{
|
||||
logininfor.setStatus(Constants.SUCCESS);
|
||||
}
|
||||
else if (Constants.LOGIN_FAIL.equals(status))
|
||||
{
|
||||
logininfor.setStatus(Constants.FAIL);
|
||||
}
|
||||
// 插入数据
|
||||
SpringUtils.getBean(ISysLogininforService.class).insertLogininfor(logininfor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @param operLog 操作日志信息
|
||||
* @return 任务task
|
||||
*/
|
||||
public static TimerTask recordOper(final SysOperLog operLog)
|
||||
{
|
||||
return new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// 远程查询操作地点
|
||||
operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
|
||||
SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package com.ruoyi.wms.po;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "shelf_info")
|
||||
public class ShelfInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@ApiParam(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 货架编码
|
||||
*/
|
||||
@Column(name = "shelf_code")
|
||||
@ApiParam(value = "货架编码")
|
||||
private String shelfCode;
|
||||
|
||||
/**
|
||||
* 货架状态
|
||||
空闲
|
||||
占用
|
||||
禁用(预留功能)
|
||||
50 ---已出库
|
||||
*/
|
||||
@Column(name = "shelf_status")
|
||||
@ApiParam(value = "货架状态空闲占用禁用(预留功能)")
|
||||
private Integer shelfStatus;
|
||||
|
||||
/**
|
||||
* 生产任务单
|
||||
*/
|
||||
@Column(name = "production_task")
|
||||
@ApiParam(value = "生产任务单")
|
||||
private String productionTask;
|
||||
|
||||
/**
|
||||
* 存放表数量
|
||||
*/
|
||||
@Column(name = "qty")
|
||||
@ApiParam(value = "存放表数量")
|
||||
private Integer qty;
|
||||
|
||||
/**
|
||||
* 当前货架存放任务单状态:
|
||||
5-待校验
|
||||
10-校验中
|
||||
15-校验完成
|
||||
20-待抽检
|
||||
25-待出库(缓存区)
|
||||
30-待出库(出库位)
|
||||
35-出库完成
|
||||
40-空箱
|
||||
*/
|
||||
@Column(name = "order_status")
|
||||
@ApiParam(value = "当前货架存放任务单状态:5-待校验10-校验中15-校验完成20-待抽检25-待出库(缓存区)30-待出库(出库位)35-出库完成40-空箱")
|
||||
private Integer orderStatus;
|
||||
|
||||
/**40
|
||||
* 创建人
|
||||
*/
|
||||
@Column(name = "created_by")
|
||||
@ApiParam(value = "创建人")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "created_dt")
|
||||
@ApiParam(value = "创建时间")
|
||||
private String createdDt;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Column(name = "updated_by")
|
||||
@ApiParam(value = "更新人")
|
||||
private String updatedBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "updated_dt")
|
||||
@ApiParam(value = "更新时间")
|
||||
private String updatedDt;
|
||||
|
||||
/**
|
||||
* 是否优先处理(0-不优先;1-优先)
|
||||
*/
|
||||
@Column(name = "priority")
|
||||
@ApiParam(value = "是否优先处理(0-不优先;1-优先)")
|
||||
private Integer priority;
|
||||
|
||||
/**
|
||||
* 工位编码
|
||||
*/
|
||||
@Column(name = "station_code")
|
||||
@ApiParam(value = "工位编码")
|
||||
private String stationCode;
|
||||
|
||||
@Transient
|
||||
@ApiParam("排序")
|
||||
private String[] orders;
|
||||
|
||||
@Transient
|
||||
@ApiParam("单据状态集合")
|
||||
private Integer[] orderStatusArr;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/7/25
|
||||
*/
|
||||
@Data
|
||||
public class ContainerArrivedVo {
|
||||
private String slotCode;
|
||||
private String containerCode;
|
||||
}
|
@ -0,0 +1 @@
|
||||
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M18.448 57.545l-.244-.744-.198-.968-.132-.53v-2.181l.236-.859.24-.908.317-.953.428-1.06.561-1.103.794-1.104v-.773l.077-.724.123-.984.34-1.106.313-1.194.25-.548.289-.511.371-.569.405-.423v-2.73l.234-1.407.236-1.633.42-1.955.577-2.035.43-1.118.426-1.217.468-1.135.559-1.216.57-1.332.655-1.247.737-1.331.929-1.33.43-.762.457-.624.995-1.406 1.025-1.403 1.163-1.444 1.246-1.405 1.352-1.384 1.41-1.423 1.708-1.536 1.083-.934 1.322-1.008 1.34-.89 1.448-.855 1.392-.76 1.57-.63 1.667-.775 1.657-.532 1.653-.552 1.787-.548 1.785-.417 1.876-.347L59.128.68l1.879-.245 1.876-.252 2.002-.106h5.912l1.97.243 1.981.231 2.019.207 1.874.441 1.979.413 1.857.475 2.035.53 1.862.646 1.782.738 1.904.78 1.736.853 1.689.95 1.655 1.044 1.425.971.662.548.693.401 1.323 1.1 1.115 1.064 1.112 1.1 1.083 1.214.894 1.178 1.064 1.217.74 1.306.752 1.162.798 1.352.661 1.175 1.113 2.489.546 1.286.428 1.192.428 1.294.384 1.217.267 1.047.347 1.231.607 2.198.388 1.924.253 1.861.217 1.497.342 2.28.077.362.274.41.737 1.18.473.8.42.832.534.892.472 1.07.307 1.093.334 1.2.252 1.232.115.605.106.746v.648l-.106.643v.8l-.192.774-.35 1.5-.403.76-.299.852v.213l.142.264.4.623 1.746 2.53 1.377 1.9.66 1.267.889 1.389.774 1.52.893 1.627.894 1.828 1.006 2.069.567 1.268.518 1.239.447 1.307.44 1.175.336 1.235.342 1.16.432 2.261.343 2.31.235 2.05v2.891l-.158 1.025-.226 1.768-.308 1.59-.48 1.44-.18.588-.336.707-.28.493-.375.607-.33.383-.42.494-.375.4-.401.34-.48.207-.432.207-.355.114h-.543l-.346-.114-.66-.32-.302-.212-.317-.223-.347-.304-.35-.342-.579-.63-.684-.89-.539-.917-.538-.734-.526-.855-.741-1.517-.833-1.579-.098-.055h-.138l-.338.247-.196.415-.326.516-.567 1.533-.856 2.182-1.096 2.626-.824 1.308-.864 1.366-1.027 1.536-1.09 1.503-.557.68-.676.743-1.555 1.497.136.135.21.214.777.446 3.235 1.524 1.41.779 1.347.756 1.332.953 1.187.982.574.443.432.511.445.593.367.643.198.533.242.64.105.554.115.647-.115.433v.44l-.105.454-.242.415-.092.325-.22.394-.587.784-.543.627-.42.47-.35.348-.893.638-1.01.556-1.077.532-1.155.511-1.287.495-.693.207-.608.167-1.496.342-1.545.325-1.552.323-1.689.27-1.74.072-1.785.21h-5.539l-1.998-.114-1.86-.168-2.005-.27-1.99-.209-2.095-.286-2.03-.495-1.981-.374-1.968-.552-2.019-.707-1.98-.585-1.044-.342-.927-.323-.586-.223-.582-.12h-1.647l-1.904-.131-.962-.096-1.24-.135-.795.705-1.085.665-1.471.701-1.628.875-.99.475-1.033.376-2.281.914-1.24.305-1.3.343-1.803.344-1.13.086-1.193.1-1.246.135-1.45.053h-5.926l-3.346-.053-3.25-.321-1.644-.23-1.589-.23-1.546-.227-1.547-.305-1.442-.456-1.434-.325-1.294-.51-1.223-.474-1.142-.533-.99-.583-.984-.71-.336-.343-.44-.415-.334-.362-.3-.417-.278-.415-.215-.42-.311-.89-.109-.46-.138-.51v-.473l.138-.533v-.53l.109-.53v-1.069l.052-.564.259-.647.215-.646.39-.779.286-.3.236-.348.615-.738.49-.38.464-.266.428-.338.676-.21.543-.324.676-.341.77-.227.775-.231.897-.192.85-.11 1.008-.13 1.093-.081.284-.092h.063l.137-.115v-.13l-.2-.266-.58-.27-1.45-1.231-.975-.761-1.127-.967-1.136-1.082-1.181-1.382-1.36-1.558-.508-.843-.672-.87-.58-1.007-.522-1.1-.704-1.047-.459-1.194-.547-1.192-.546-1.33-.397-1.273-.378-1.575-.112-.057h-.115l-.059-.113h-.14l-.23.113-.114.057-.158.264-.057.321-.119.286-.206.477-.664 1.157-.345.701-.546.612-.58.736-.641.816-.677.724-.795.701-.734.658-.814.524-.89.546-.855.325-1.008.247-.99.095h-.233l-.228-.095-.18-.384-.29-.188-.38-.912-.237-.493-.255-.707-.21-.734-.113-.724-.313-1.648-.12-.972v-3.185l.12-2.379.196-1.214.23-1.252.21-1.347.374-1.254.42-1.443.431-1.407.578-1.448.545-1.38.754-1.4.699-1.52.855-1.425 1.006-1.538 1.023-1.382 1.069-1.538.891-1.071 1.142-1.227 1.202-1.237.56-.59.678-.662.985-.836 1.012-.853 1.647-1.446 1.242-.889z"/></svg>
|
After Width: | Height: | Size: 3.6 KiB |
@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
// https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
],
|
||||
'env': {
|
||||
'development': {
|
||||
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
|
||||
// This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
|
||||
'plugins': ['dynamic-import-node']
|
||||
}
|
||||
}
|
||||
}
|