init commit
This commit is contained in:
112
RuoYi-Vue/ruoyi-wms/pom.xml
Normal file
112
RuoYi-Vue/ruoyi-wms/pom.xml
Normal file
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.8.6</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-wms</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringBoot JPA -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.hikvision.ga</groupId>
|
||||
<artifactId>artemis-http-client</artifactId>
|
||||
<version>1.1.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<version>1.7.26</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-annotation</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.24</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cmeim</groupId>
|
||||
<artifactId>cmeim-common-core</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.14</version>
|
||||
</dependency>
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<!-- <dependencyManagement>-->
|
||||
<!-- <dependencies>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-dependencies</artifactId>-->
|
||||
<!-- <version>2021.0.0</version>-->
|
||||
<!-- <type>pom</type>-->
|
||||
<!-- <scope>import</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- </dependencies>-->
|
||||
<!-- </dependencyManagement>-->
|
||||
|
||||
</project>
|
@ -0,0 +1,760 @@
|
||||
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;
|
||||
@Autowired
|
||||
private ContainerRecoderRepository containerRecoderRepository;
|
||||
|
||||
@ApiOperation(value = "test")
|
||||
@PostMapping(value = "test")
|
||||
public List<AgvTask> test(PageVo pv, AgvTask agvTask) {
|
||||
List<AgvTask> agvTaskList = new ArrayList<>();
|
||||
List<ContainerRecoder> containerRecoderList = containerRecoderRepository.findByProductionTask("WORK027548");
|
||||
for (ContainerRecoder containerRecoder : containerRecoderList) {
|
||||
List<AgvTask> agvTasks = agvTaskRepository.findByJsonLikeAndCreatedDtAfterAndCreatedDtBeforeAndDictTypeAndStatus(containerRecoder.getContainerNumber(), "2023-11-08 00:12:35", "2023-11-08 23:12:35", 3, 3);
|
||||
agvTaskList.addAll(agvTasks);
|
||||
}
|
||||
return agvTaskList;
|
||||
}
|
||||
|
||||
@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.getJson() != null) {
|
||||
predicates.add(cb.like(root.get("json").as(String.class), "%" + agvTask.getJson() + "%"));
|
||||
}
|
||||
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);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", 0);
|
||||
result.put("msg", "success");
|
||||
result.put("data", "");
|
||||
String taskCode = jsonObject.getString("taskCode");
|
||||
final AgvTask agvTask = agvTaskRepository.findByRequestCode(taskCode);
|
||||
if (agvTask == null) {
|
||||
return result;
|
||||
}
|
||||
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");
|
||||
log.info("取箱完成任务单号:" + taskCode + "," + 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"));
|
||||
}
|
||||
}
|
||||
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() > 5) {
|
||||
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(shelfInfo1);
|
||||
}
|
||||
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);
|
||||
for (ShelfInfo shelfInfo : shelfInfoList) {
|
||||
if (shelfInfo.getShelfStatus() == 55) {
|
||||
shelfInfoList.remove(shelfInfo);
|
||||
}
|
||||
}
|
||||
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());
|
||||
//修改货架对应的送抽检工位编码
|
||||
ShelfInfo shelfInfo = shelfInfoList.get(0);
|
||||
shelfInfo.setStationCodeSpotCheck(agvRequestVo.getFromLocationCode());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
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 {
|
||||
List<StationInfo> stationInfos1 = stationInfoRepository.findByStationTypeAndStationStatus(15, 5);
|
||||
if (stationInfos1.size() == 0) {
|
||||
throw new ServiceException("抽检工位和成品缓存库位待检区都无空闲位置!");
|
||||
}
|
||||
agvRequestVo.setToLocationCode(stationInfos1.get(0).getStationCode());
|
||||
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")
|
||||
public Respond sendProdStore(@RequestBody AgvRequestVo agvRequestVo) {
|
||||
//校验
|
||||
if (StringUtils.isBlank(agvRequestVo.getContainerCode())) {
|
||||
throw new ServiceException("无货架编码,请检查!");
|
||||
}
|
||||
ShelfInfo byShelfCode = shelfInfoRepository.findByShelfCode(agvRequestVo.getContainerCode());
|
||||
if (StringUtils.isBlank(byShelfCode.getProductionTask())) {
|
||||
throw new ServiceException("无生产任务单,请从工作台处绑定!");
|
||||
}
|
||||
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("无终点位置,请检查!");
|
||||
}
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setRequestType(RequestEnum.CALLNULLSHELF.getCode());
|
||||
String result = null;
|
||||
lock.lock();
|
||||
try {
|
||||
//查找状态为空的货架
|
||||
final List<ShelfInfo> shelfInfos = shelfInfoRepository.findByShelfStatus(55);
|
||||
if (shelfInfos.size() == 0) {
|
||||
return buildFailure("暂无空货架");
|
||||
}
|
||||
agvRequestVo.setContainerCode(shelfInfos.get(0).getShelfCode());
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(shelfInfos.get(0).getStationCode());
|
||||
if (stationInfo == null) {
|
||||
return buildFailure("位置不存在:" + 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);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfo.setShelfStatus(55);
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
} else {
|
||||
ShelfInfo shelfInfo1 = new ShelfInfo();
|
||||
shelfInfo.setShelfStatus(55);
|
||||
shelfInfo1.setShelfCode(containerCode);
|
||||
shelfInfo1.setStationCode(positionCode);
|
||||
shelfInfo1.setProductionTask(null);
|
||||
shelfInfo1.setQty(0);
|
||||
shelfInfo1.setCreatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfo1.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfo1.setPriority(0);
|
||||
shelfInfoRepository.save(shelfInfo1);
|
||||
}
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(positionCode);
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
String result2 = agvService.sendNullShelf2(positionCode, containerCode);
|
||||
} else {
|
||||
return buildFailure("海柔报错:" + JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "容器离场(PDA)")
|
||||
@GetMapping(value = "nullShelfOut")
|
||||
public Respond nullShelfOut(@RequestParam("containerCode") String containerCode, @RequestParam("positionCode") String positionCode) {
|
||||
agvService.moveOut(containerCode, positionCode);
|
||||
ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(containerCode);
|
||||
shelfInfo.setStationCode(null);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfo.setShelfStatus(0);
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
if (StringUtils.isNotBlank(shelfInfo.getStationCode())) {
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(shelfInfo.getStationCode());
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
if (StringUtils.isNotBlank(positionCode)) {
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(positionCode);
|
||||
stationInfo.setStationStatus(5);
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
return buildSuccess("离场成功:" + containerCode);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "容器移入(PDA)")
|
||||
@GetMapping(value = "shelfIn")
|
||||
public Respond shelfIn(@RequestParam("containerCode") String containerCode, @RequestParam("positionCode") String positionCode, @RequestParam("productionTask") String productionTask, @RequestParam("qty") Integer qty) {
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(positionCode);
|
||||
if (stationInfo == null) {
|
||||
return buildFailure("位置不存在:" + positionCode);
|
||||
}
|
||||
if (stationInfo.getStationType() == 15 && StringUtils.isBlank(productionTask)) {
|
||||
ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(containerCode);
|
||||
if (shelfInfo != null) {
|
||||
agvService.moveOut(containerCode, shelfInfo.getStationCode());
|
||||
}
|
||||
//入场
|
||||
agvService.moveIn(containerCode, positionCode);
|
||||
shelfInfo.setShelfStatus(55);
|
||||
shelfInfo.setQty(0);
|
||||
shelfInfo.setStationCode(positionCode);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfoRepository.save(stationInfo);
|
||||
return buildSuccess("移入成功:" + containerCode);
|
||||
}
|
||||
if (stationInfo.getStationType() != 40 && StringUtils.isBlank(productionTask)) {
|
||||
return buildFailure("除空车缓存区外必传工单");
|
||||
}
|
||||
//容器先离场
|
||||
ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(containerCode);
|
||||
if (shelfInfo != null) {
|
||||
agvService.moveOut(containerCode, shelfInfo.getStationCode());
|
||||
}
|
||||
//入场
|
||||
agvService.moveIn(containerCode, positionCode);
|
||||
shelfInfo.setQty(qty);
|
||||
shelfInfo.setStationCode(positionCode);
|
||||
shelfInfo.setProductionTask(productionTask);
|
||||
shelfInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
stationInfo.setStationStatus(20);
|
||||
stationInfoRepository.save(stationInfo);
|
||||
return buildSuccess("移入成功:" + containerCode);
|
||||
}
|
||||
|
||||
@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,366 @@
|
||||
package com.ruoyi.wms.controller;
|
||||
|
||||
import com.cmeim.common.core.exception.ServiceException;
|
||||
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.wms.po.*;
|
||||
import com.ruoyi.wms.repository.OrderInfoRepository;
|
||||
import com.ruoyi.wms.repository.StationInfoRepository;
|
||||
import com.ruoyi.wms.repository.ContainerInfoRepository;
|
||||
import com.ruoyi.wms.repository.ContainerRecoderRepository;
|
||||
import com.ruoyi.wms.service.ContainerService;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.ruoyi.ruiYiController.annotation.Log;
|
||||
import com.ruoyi.ruiYiController.enums.BusinessType;
|
||||
import com.ruoyi.wms.vo.AgvTaskExportVo;
|
||||
import com.ruoyi.wms.vo.ContainerInfoExportVo;
|
||||
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.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.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/27
|
||||
*/
|
||||
@Api(tags = "周转箱")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping(value = "container")
|
||||
public class ContainerController extends GenericController {
|
||||
@Autowired
|
||||
private ContainerInfoRepository containerInfoRepository;
|
||||
@Autowired
|
||||
private ContainerRecoderRepository containerRecoderRepository;
|
||||
@Autowired
|
||||
private ContainerService containerService;
|
||||
@Autowired
|
||||
private StationInfoRepository stationInfoRepository;
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
|
||||
private String hour="8";
|
||||
|
||||
@ApiOperation(value = "列表")
|
||||
@GetMapping(value = "infoList")
|
||||
public Respond infoList(PageVo pv, ContainerInfo containerInfo) {
|
||||
PageRequest pageRequest = PageRequest.of(pv.getPageNo() - 1, pv.getPageSize(),
|
||||
Sort.by(sortOrder(containerInfo.getOrders())));
|
||||
Page page = containerInfoRepository.findAll(buildSpecification(containerInfo), pageRequest);
|
||||
List<ContainerInfo> list = page.getContent();
|
||||
pv.setRecordsTotal(page.getTotalElements());
|
||||
pv.setData(list);
|
||||
return buildSuccess(pv);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "列表")
|
||||
@GetMapping(value = "findByContainerNumber")
|
||||
public Respond findByContainerNumber(String containerNumber) {
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerNumber);
|
||||
return buildSuccess(containerInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询周转箱绑定工单的物料信息")
|
||||
@GetMapping(value = "findOrderByContainerNumber")
|
||||
public Respond findOrderByContainerNumber(String containerNumber) {
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerNumber);
|
||||
if (containerInfo != null) {
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(containerInfo.getProductionTask());
|
||||
return buildSuccess(orderInfo);
|
||||
} else {
|
||||
return buildFailure("未找到该周转箱号:" + containerNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出excel")
|
||||
@PostMapping("exportExcel")
|
||||
public void export(ContainerInfo containerInfo, HttpServletResponse response) throws Exception {
|
||||
List<ContainerInfo> list = containerInfoRepository.findAll(buildSpecification(containerInfo));
|
||||
List<ContainerInfoExportVo> exportList = new ArrayList<>();
|
||||
for(ContainerInfo container:list){
|
||||
ContainerInfoExportVo containerInfoExportVo = BeanUtil.copyProperties(container, ContainerInfoExportVo.class);
|
||||
exportList.add(containerInfoExportVo);
|
||||
}
|
||||
// 创建工作簿对象
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
|
||||
// 创建工作表
|
||||
SXSSFSheet sheet = workbook.createSheet("周转箱列表");
|
||||
|
||||
String[] rowsName = new String[]{"序号","周装箱号","周装箱状态","装表数量","库位编码","开始入库时间","机器人放到库位上时间","开始出库时间","出库时间","生产任务单","创建人","创建时间","更新人","更新时间"};
|
||||
List<Object[]> dataList = new ArrayList<Object[]>();
|
||||
Object[] objs = null;
|
||||
int i = 1;
|
||||
for (ContainerInfoExportVo vo : exportList) {
|
||||
if(vo.getContainerStatus() == 5){
|
||||
vo.setContainerStatusShow("空闲(库外)");
|
||||
}else if(vo.getContainerStatus() == 10){
|
||||
vo.setContainerStatusShow("空闲(库内)");
|
||||
}else if(vo.getContainerStatus() == 15){
|
||||
vo.setContainerStatusShow("入库中(手动)");
|
||||
}else if(vo.getContainerStatus() == 20){
|
||||
vo.setContainerStatusShow("入库中(自动)");
|
||||
}else if(vo.getContainerStatus() == 25){
|
||||
vo.setContainerStatusShow("入库中(空箱)");
|
||||
}else if(vo.getContainerStatus() == 30){
|
||||
vo.setContainerStatusShow("在库");
|
||||
} else if(vo.getContainerStatus() == 35){
|
||||
vo.setContainerStatusShow("出库中");
|
||||
}
|
||||
|
||||
objs = new Object[rowsName.length];
|
||||
objs[0] = i;
|
||||
objs[1] = vo.getContainerNumber();
|
||||
objs[2] = vo.getContainerStatusShow();
|
||||
objs[3] = vo.getQty();
|
||||
objs[4] = vo.getStoreCode();
|
||||
objs[5] = vo.getOnInstoreTime();
|
||||
objs[6] = vo.getInstoreTime();
|
||||
objs[7] = vo.getOnOutstoreTime();
|
||||
objs[8] = vo.getOutstoreTime();
|
||||
objs[9] = vo.getProductionTask();
|
||||
objs[10] = vo.getCreatedBy();
|
||||
objs[11] = vo.getCreatedDt();
|
||||
objs[12] = vo.getUpdatedBy();
|
||||
objs[13] = vo.getUpdatedDt();
|
||||
dataList.add(objs);
|
||||
i += 1;
|
||||
}
|
||||
ExcelExportUtil.getExportWorkbook(workbook, sheet, rowsName, dataList);
|
||||
ExcelExportUtil.sendHttpResponse(response, "Container", workbook);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "列表")
|
||||
@GetMapping(value = "recorderList")
|
||||
public Respond recorderList(PageVo pv, ContainerRecoder containerRecoder) {
|
||||
PageRequest pageRequest = PageRequest.of(pv.getPageNo() - 1, pv.getPageSize(),
|
||||
Sort.by(sortOrder(containerRecoder.getOrders())));
|
||||
Page page = containerInfoRepository.findAll(buildSpecification2(containerRecoder), pageRequest);
|
||||
List<ContainerRecoder> list = page.getContent();
|
||||
pv.setRecordsTotal(page.getTotalElements());
|
||||
pv.setData(list);
|
||||
return buildSuccess(pv);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改周转箱状态,修订周转箱数量,绑定任务单,修改任务单入库中数量")
|
||||
@Log(title = "周转箱", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "updateContainerStatus")
|
||||
public Respond updateContainerStatus(@RequestBody ContainerInfo containerInfo) {
|
||||
ContainerInfo container = containerInfoRepository.findByContainerNumber(containerInfo.getContainerNumber());
|
||||
if (container == null) {
|
||||
ContainerInfo newContainerInfo = new ContainerInfo();
|
||||
newContainerInfo.setContainerNumber(containerInfo.getContainerNumber());
|
||||
newContainerInfo.setQty(0);
|
||||
newContainerInfo.setIsPdaEdit(0);
|
||||
newContainerInfo.setCreatedBy(containerInfo.getUpdatedBy());
|
||||
newContainerInfo.setCreatedDt(DateUtil.getCurrentDate());
|
||||
newContainerInfo.setContainerStatus(5);
|
||||
container = containerInfoRepository.save(newContainerInfo);
|
||||
}
|
||||
if (containerInfo.getContainerStatus() == 10 || containerInfo.getContainerStatus() == 30 || containerInfo.getContainerStatus() == 35) {
|
||||
throw new ServiceException(RespondEnum.PARAMETER_ERROR, "该周转箱状态不能进行入库");
|
||||
}
|
||||
if (container.getContainerStatus() == 15 || container.getContainerStatus() == 20 ||container.getContainerStatus() == 25) {
|
||||
return buildSuccess();
|
||||
}
|
||||
if (StringUtils.isBlank(containerInfo.getStationCode())) {
|
||||
throw new ServiceException(RespondEnum.PARAMETER_ERROR, "站位编码为空");
|
||||
}
|
||||
if (StringUtils.isBlank(containerInfo.getProductionTask())) {
|
||||
containerInfo.setProductionTask(null);
|
||||
} else {
|
||||
//查询正在执行的任务单,绑定任务单
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(containerInfo.getStationCode());
|
||||
containerInfo.setProductionTask(stationInfo.getProductionTask());
|
||||
//修订周转箱数量
|
||||
List<ContainerInfo> containerInfoList = containerInfoRepository.findByProductionTask(stationInfo.getProductionTask());
|
||||
Integer sumQty = containerInfoList.stream().collect(Collectors.summingInt(ContainerInfo::getQty));
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(stationInfo.getProductionTask());
|
||||
if (orderInfo.getPlanQty() - sumQty == 0) {
|
||||
throw new ServiceException(RespondEnum.PARAMETER_ERROR, "该生产任务单已经入库完毕,请切换工单!");
|
||||
}
|
||||
if (orderInfo.getPlanQty() - sumQty < 6) {
|
||||
container.setQty(orderInfo.getPlanQty() - sumQty);
|
||||
} else {
|
||||
container.setQty(containerInfo.getQty());
|
||||
}
|
||||
//修改任务单中的入库中数量
|
||||
if (orderInfo != null) {
|
||||
orderInfo.setOngoingQty(orderInfo.getOngoingQty() + container.getQty());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
}
|
||||
//赋值其他属性
|
||||
container.setContainerStatus(containerInfo.getContainerStatus());
|
||||
container.setProductionTask(containerInfo.getProductionTask());
|
||||
container.setUpdatedBy(containerInfo.getUpdatedBy());
|
||||
container.setUpdatedDt(containerInfo.getUpdatedDt());
|
||||
ContainerInfo save = containerInfoRepository.save(container);
|
||||
|
||||
|
||||
return buildSuccess(save);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "PDA修改周转箱状态,修订周转箱数量,绑定任务单,修改任务单入库中数量")
|
||||
@Log(title = "周转箱", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "updateContainerStatusForPda")
|
||||
public Respond updateContainerStatusForPda(@RequestBody ContainerInfo containerInfo) {
|
||||
ContainerInfo container = containerInfoRepository.findByContainerNumber(containerInfo.getContainerNumber());
|
||||
if (container == null) {
|
||||
throw new ServiceException(RespondEnum.PARAMETER_ERROR, "未找到该周转箱");
|
||||
}
|
||||
if (containerInfo.getContainerStatus() == 10 || containerInfo.getContainerStatus() == 30 || containerInfo.getContainerStatus() == 35) {
|
||||
throw new ServiceException(RespondEnum.PARAMETER_ERROR, "该周转箱状态不能进行入库");
|
||||
}
|
||||
if (StringUtils.isBlank(containerInfo.getStationCode())) {
|
||||
throw new ServiceException(RespondEnum.PARAMETER_ERROR, "站位编码为空");
|
||||
}
|
||||
if (StringUtils.isBlank(containerInfo.getProductionTask())) {
|
||||
throw new ServiceException(RespondEnum.PARAMETER_ERROR, "生产任务单为空");
|
||||
}
|
||||
//查询正在执行的任务单,绑定任务单
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(containerInfo.getStationCode());
|
||||
containerInfo.setProductionTask(stationInfo.getProductionTask());
|
||||
//修订周转箱数量
|
||||
List<ContainerInfo> containerInfoList = containerInfoRepository.findByProductionTask(stationInfo.getProductionTask());
|
||||
Integer sumQty = containerInfoList.stream().collect(Collectors.summingInt(ContainerInfo::getQty));
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(stationInfo.getProductionTask());
|
||||
//赋值其他属性
|
||||
container.setContainerStatus(containerInfo.getContainerStatus());
|
||||
container.setQty(containerInfo.getQty());
|
||||
if (orderInfo.getPlanQty() - sumQty < 6) {
|
||||
container.setQty(orderInfo.getPlanQty() - sumQty);
|
||||
}
|
||||
container.setIsPdaEdit(1);
|
||||
container.setProductionTask(containerInfo.getProductionTask());
|
||||
container.setUpdatedBy(containerInfo.getUpdatedBy());
|
||||
container.setUpdatedDt(containerInfo.getUpdatedDt());
|
||||
ContainerInfo save = containerInfoRepository.save(container);
|
||||
|
||||
//修改任务单中的入库中数量
|
||||
if (orderInfo != null) {
|
||||
orderInfo.setOngoingQty(orderInfo.getOngoingQty() + save.getQty());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
return buildSuccess(save);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "清空周转箱")
|
||||
@GetMapping(value = "modifyContainerInfo")
|
||||
public Respond modifyContainerInfo(String containerNumber, String updatedBy) {
|
||||
ContainerInfo containerInfo = containerInfoRepository.findByContainerNumber(containerNumber);
|
||||
if (containerInfo != null) {
|
||||
if (StringUtils.isNotBlank(containerInfo.getProductionTask())) {
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(containerInfo.getProductionTask());
|
||||
if (containerInfo.getContainerStatus() == 35) {
|
||||
orderInfo.setOutQty(orderInfo.getOutQty() + containerInfo.getQty());
|
||||
orderInfo.setUpdatedBy(updatedBy);
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
} else if (containerInfo.getContainerStatus() == 20 || containerInfo.getContainerStatus() == 15) {
|
||||
orderInfo.setOngoingQty(orderInfo.getOngoingQty() - containerInfo.getQty());
|
||||
orderInfo.setUpdatedBy(updatedBy);
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
}
|
||||
containerInfo.setQty(0);
|
||||
containerInfo.setContainerStatus(5);
|
||||
containerInfo.setStoreCode(null);
|
||||
containerInfo.setProductionTask(null);
|
||||
containerInfo.setInstoreTime(null);
|
||||
containerInfo.setUpdatedBy(updatedBy);
|
||||
containerInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
containerInfoRepository.save(containerInfo);
|
||||
}
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询大于规定小时的任务单及数量")
|
||||
@PostMapping(value = "findGreaterThanEightHours")
|
||||
public Respond findGreaterThanEightHours() {
|
||||
List<ContainerInfo> containerInfoList = containerService.queryGreaterThanEightHours();
|
||||
//根据生产任务单进行分组求和
|
||||
Map<String, Integer> sumMap = containerInfoList.stream()
|
||||
.collect(Collectors.groupingBy(ContainerInfo::getProductionTask, Collectors.summingInt(ContainerInfo::getQty)));
|
||||
return buildSuccess(sumMap);
|
||||
}
|
||||
|
||||
private Specification buildSpecification(ContainerInfo containerInfo) {
|
||||
Specification<ContainerInfo> specification = new Specification<ContainerInfo>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<ContainerInfo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> predicates = Lists.newArrayList();
|
||||
if (containerInfo.getContainerNumber() != null) {
|
||||
predicates.add(cb.like(root.get("containerNumber").as(String.class), "%" + containerInfo.getContainerNumber() + "%"));
|
||||
}
|
||||
if (containerInfo.getStoreCode() != null) {
|
||||
predicates.add(cb.like(root.get("storeCode").as(String.class), "%" + containerInfo.getStoreCode() + "%"));
|
||||
}
|
||||
if(containerInfo.getProductionTask()!=null)
|
||||
{
|
||||
predicates.add(cb.like(root.get("productionTask").as(String.class), "%" + containerInfo.getProductionTask() + "%"));
|
||||
}
|
||||
if (containerInfo.getContainerStatus() != null) {
|
||||
predicates.add(cb.equal(root.get("containerStatus").as(Integer.class), containerInfo.getContainerStatus()));
|
||||
}
|
||||
if (containerInfo.getContainerStatusArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("containerStatus").as(Integer.class));
|
||||
for (Integer status : containerInfo.getContainerStatusArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||
}
|
||||
};
|
||||
return specification;
|
||||
}
|
||||
|
||||
private Specification buildSpecification2(ContainerRecoder containerRecoder) {
|
||||
Specification<ContainerRecoder> specification = new Specification<ContainerRecoder>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<ContainerRecoder> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> predicates = Lists.newArrayList();
|
||||
if (containerRecoder.getContainerNumber() != null) {
|
||||
predicates.add(cb.like(root.get("containerNumber").as(String.class), "%" + containerRecoder.getContainerNumber() + "%"));
|
||||
}
|
||||
if (containerRecoder.getContainerStatus() != null) {
|
||||
predicates.add(cb.equal(root.get("containerStatus").as(Integer.class), containerRecoder.getContainerStatus()));
|
||||
}
|
||||
if (containerRecoder.getContainerStatusArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("containerStatus").as(Integer.class));
|
||||
for (Integer status : containerRecoder.getContainerStatusArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||
}
|
||||
};
|
||||
return specification;
|
||||
}
|
||||
}
|
@ -0,0 +1,292 @@
|
||||
package com.ruoyi.wms.controller;
|
||||
|
||||
import com.cmeim.common.core.utils.BeanUtil;
|
||||
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.wms.po.ContainerInfo;
|
||||
import com.ruoyi.wms.repository.OrderInfoRepository;
|
||||
import com.ruoyi.wms.repository.StationInfoRepository;
|
||||
import com.ruoyi.wms.service.ContainerService;
|
||||
import com.ruoyi.wms.service.OrderService;
|
||||
import com.ruoyi.wms.vo.ContainerInfoExportVo;
|
||||
import com.ruoyi.wms.vo.FindOrderByStationVo;
|
||||
import com.ruoyi.wms.po.OrderInfo;
|
||||
import com.ruoyi.wms.po.StationInfo;
|
||||
import com.ruoyi.wms.vo.OrderInfoExportVo;
|
||||
import com.ruoyi.wms.vo.OrderQueryVo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.ruoyi.ruiYiController.annotation.Log;
|
||||
import com.ruoyi.ruiYiController.enums.BusinessType;
|
||||
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.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.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/26
|
||||
*/
|
||||
@Api(tags = "生产任务单")
|
||||
@RestController
|
||||
@RequestMapping(value = "order")
|
||||
@Slf4j
|
||||
public class OrderController extends GenericController {
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
@Autowired
|
||||
private StationInfoRepository stationInfoRepository;
|
||||
@Autowired
|
||||
private ContainerService containerService;
|
||||
|
||||
@ApiOperation(value = "列表")
|
||||
@GetMapping(value = "list")
|
||||
public Respond list(PageVo pv, OrderInfo orderInfo) {
|
||||
PageRequest pageRequest = PageRequest.of(pv.getPageNo() - 1, pv.getPageSize(),
|
||||
Sort.by(sortOrder(orderInfo.getOrders())));
|
||||
Page page = orderInfoRepository.findAll(buildSpecification(orderInfo), pageRequest);
|
||||
List<OrderInfo> list = page.getContent();
|
||||
pv.setRecordsTotal(page.getTotalElements());
|
||||
pv.setData(list);
|
||||
return buildSuccess(pv);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询可出库订单")
|
||||
@GetMapping(value = "findStockableOrder")
|
||||
public Respond findStockableOrder() {
|
||||
//查询符合要求的周转箱
|
||||
List<ContainerInfo> containerInfoList = containerService.queryGreaterThanEightHours();
|
||||
List<OrderInfo> orderInfoList = new ArrayList<>();
|
||||
for (ContainerInfo containerInfo : containerInfoList) {
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(containerInfo.getProductionTask());
|
||||
if (orderInfo == null) {
|
||||
continue;
|
||||
}
|
||||
if (orderInfo.getOrderStatus() == 5) {
|
||||
orderInfo.setOrderStatusShow("已录入");
|
||||
} else if (orderInfo.getOrderStatus() == 10) {
|
||||
orderInfo.setOrderStatusShow("部分入库");
|
||||
} else if (orderInfo.getOrderStatus() == 15) {
|
||||
orderInfo.setOrderStatusShow("全部入库");
|
||||
}
|
||||
orderInfoList.add(orderInfo);
|
||||
}
|
||||
|
||||
List<OrderInfo> list = orderInfoList.stream()
|
||||
.collect(Collectors.collectingAndThen(Collectors.toCollection(
|
||||
() -> new TreeSet<>(Comparator.comparing(OrderInfo::getProductionTask))), ArrayList::new));
|
||||
|
||||
return buildSuccess(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询可送待检缓存区的订单")
|
||||
@GetMapping(value = "findSendWaitCheckOrder")
|
||||
public Respond findSendWaitCheckOrder() {
|
||||
List<OrderInfo> orderInfoList = new ArrayList<>();
|
||||
List<OrderInfo> orderInfos = orderInfoRepository.findAll();
|
||||
for (OrderInfo orderInfo : orderInfos) {
|
||||
//对比出库数量和待校验数量的值
|
||||
if (orderInfo.getOutQty() > orderInfo.getWaitCheckQty()) {
|
||||
orderInfoList.add(orderInfo);
|
||||
}
|
||||
}
|
||||
return buildSuccess(orderInfoList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询可从缓存库位到检验库位的订单")
|
||||
@GetMapping(value = "findSendCheckOrder")
|
||||
public Respond findSendCheckOrder() {
|
||||
List<OrderInfo> orderInfoList = new ArrayList<>();
|
||||
List<OrderInfo> orderInfos = orderInfoRepository.findAll();
|
||||
for (OrderInfo orderInfo : orderInfos) {
|
||||
//对比出库数量和待校验数量的值
|
||||
if (orderInfo.getWaitCheckQty() > 0) {
|
||||
orderInfoList.add(orderInfo);
|
||||
}
|
||||
}
|
||||
return buildSuccess(orderInfoList);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "导出excel")
|
||||
@PostMapping("exportExcel")
|
||||
public void export(OrderInfo orderInfo, HttpServletResponse response) throws Exception {
|
||||
List<OrderInfo> list = orderInfoRepository.findAll(buildSpecification(orderInfo));
|
||||
List<OrderInfoExportVo> exportList = new ArrayList<>();
|
||||
for(OrderInfo order:list){
|
||||
OrderInfoExportVo orderInfoExportVo = BeanUtil.copyProperties(order, OrderInfoExportVo.class);
|
||||
exportList.add(orderInfoExportVo);
|
||||
}
|
||||
// 创建工作簿对象
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
|
||||
// 创建工作表
|
||||
SXSSFSheet sheet = workbook.createSheet("生产任务单列表");
|
||||
|
||||
String[] rowsName = new String[]{"序号","生产任务单","单据状态","销售订单","物料编码","物料名称","物料规格","计划完工日期","计划数量","已入库数","入库中数量","出库数量","出库中数量","待校验数","已校验数","校验中数","成品区已入库数","成品区入库中数量","成品区出库数量","成品区出库中数量","创建人","创建时间","更新人","更新时间"};
|
||||
List<Object[]> dataList = new ArrayList<Object[]>();
|
||||
Object[] objs = null;
|
||||
int i = 1;
|
||||
for (OrderInfoExportVo vo : exportList) {
|
||||
if(vo.getOrderStatus() == 5){
|
||||
vo.setOrderStatusShow("未录入");
|
||||
}else if(vo.getOrderStatus() == 10){
|
||||
vo.setOrderStatusShow("部分入库");
|
||||
}else if(vo.getOrderStatus() == 15){
|
||||
vo.setOrderStatusShow("全部入库");
|
||||
}
|
||||
|
||||
objs = new Object[rowsName.length];
|
||||
objs[0] = i;
|
||||
objs[1] = vo.getProductionTask();
|
||||
objs[2] = vo.getOrderStatusShow();
|
||||
objs[3] = vo.getSaleOrder();
|
||||
objs[4] = vo.getMaterialCode();
|
||||
objs[5] = vo.getMaterialName();
|
||||
objs[6] = vo.getMaterialSpec();
|
||||
objs[7] = vo.getPlannedCompletionDate();
|
||||
objs[8] = vo.getPlanQty();
|
||||
objs[9] = vo.getInQty();
|
||||
objs[10] = vo.getOngoingQty();
|
||||
objs[11] = vo.getOutQty();
|
||||
objs[12] = vo.getOnoutingCheckQty();
|
||||
objs[13] = vo.getWaitCheckQty();
|
||||
objs[14] = vo.getFinishCheckQty();
|
||||
objs[15] = vo.getCheckQty();
|
||||
objs[16] = vo.getProductInQty();
|
||||
objs[17] = vo.getProductOngoingQty();
|
||||
objs[18] = vo.getProductOutQty();
|
||||
objs[19] = vo.getProductOnoutingQty();
|
||||
objs[20] = vo.getCreatedBy();
|
||||
objs[21] = vo.getCreatedDt();
|
||||
objs[22] = vo.getUpdatedBy();
|
||||
objs[23] = vo.getUpdatedDt();
|
||||
dataList.add(objs);
|
||||
i += 1;
|
||||
}
|
||||
ExcelExportUtil.getExportWorkbook(workbook, sheet, rowsName, dataList);
|
||||
ExcelExportUtil.sendHttpResponse(response, "Order", workbook);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过站位查询工单信息")
|
||||
@GetMapping(value = "findOrderByStation")
|
||||
public Respond findOrderByStation(String stationCode) {
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(stationCode);
|
||||
if (stationInfo == null) {
|
||||
return buildFailure("无该站位信息:" + stationCode);
|
||||
}
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(stationInfo.getProductionTask());
|
||||
if (orderInfo == null) {
|
||||
return buildSuccess("该站位无工单信息");
|
||||
}
|
||||
FindOrderByStationVo vo = BeanUtil.copyProperties(orderInfo, FindOrderByStationVo.class);
|
||||
vo.setStationStatus(stationInfo.getStationStatus());
|
||||
vo.setStationCode(stationInfo.getStationCode());
|
||||
vo.setStationName(stationInfo.getStationName());
|
||||
vo.setStationType(stationInfo.getStationType());
|
||||
return buildSuccess(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增")
|
||||
@Log(title = "生产任务单", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "add")
|
||||
public Respond add(@RequestBody OrderInfo orderInfo) {
|
||||
OrderInfo info = orderInfoRepository.findByProductionTask(orderInfo.getProductionTask());
|
||||
if (info == null) {
|
||||
orderInfo.setInQty(0);
|
||||
orderInfo.setOngoingQty(0);
|
||||
orderInfo.setOutQty(0);
|
||||
orderInfo.setOnoutingCheckQty(0);
|
||||
orderInfo.setWaitCheckQty(0);
|
||||
orderInfo.setFinishCheckQty(0);
|
||||
orderInfo.setCheckQty(0);
|
||||
orderInfo.setProductInQty(0);
|
||||
orderInfo.setProductOngoingQty(0);
|
||||
orderInfo.setProductOutQty(0);
|
||||
orderInfo.setProductOnoutingQty(0);
|
||||
orderInfoRepository.save(orderInfo);
|
||||
}
|
||||
//绑定工位和任务单
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(orderInfo.getStationCode());
|
||||
if (stationInfo != null) {
|
||||
stationInfo.setStationStatus(orderInfo.getStationStatus());
|
||||
stationInfo.setProductionTask(orderInfo.getProductionTask());
|
||||
stationInfo.setUpdatedDt(orderInfo.getCreatedDt());
|
||||
stationInfo.setUpdatedBy(orderInfo.getCreatedBy());
|
||||
stationInfoRepository.save(stationInfo);
|
||||
}
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过甲方接口获取单据列表")
|
||||
@PostMapping(value = "findByOrderQueryVo")
|
||||
public Respond findByOrderQueryVo(@RequestBody OrderQueryVo orderQueryVo) {
|
||||
List<OrderInfo> orderInfoList = orderService.findByOrderQueryVo(orderQueryVo);
|
||||
return buildSuccess(orderInfoList);
|
||||
}
|
||||
|
||||
private Specification buildSpecification(OrderInfo orderInfo) {
|
||||
Specification<OrderInfo> specification = new Specification<OrderInfo>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<OrderInfo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> predicates = Lists.newArrayList();
|
||||
if (orderInfo.getMaterialCode() != null) {
|
||||
predicates.add(cb.like(root.get("materialCode").as(String.class), "%" + orderInfo.getMaterialCode() + "%"));
|
||||
}
|
||||
if (orderInfo.getMaterialName() != null) {
|
||||
predicates.add(cb.like(root.get("materialName").as(String.class), "%" + orderInfo.getMaterialName() + "%"));
|
||||
}
|
||||
if (orderInfo.getMaterialSpec() != null) {
|
||||
predicates.add(cb.like(root.get("materialSpec").as(String.class), "%" + orderInfo.getMaterialSpec() + "%"));
|
||||
}
|
||||
if (orderInfo.getOrderStatus() != null) {
|
||||
predicates.add(cb.equal(root.get("orderStatus").as(Integer.class), orderInfo.getOrderStatus()));
|
||||
}
|
||||
if (orderInfo.getProductionTask() != null) {
|
||||
predicates.add(cb.like(root.get("productionTask").as(String.class), "%" + orderInfo.getProductionTask() + "%"));
|
||||
}
|
||||
if (orderInfo.getSaleOrder() != null) {
|
||||
predicates.add(cb.like(root.get("saleOrder").as(String.class), "%" + orderInfo.getSaleOrder() + "%"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(orderInfo.getPlannedCompletionDateStart())) {
|
||||
predicates.add(cb.greaterThanOrEqualTo(root.get("plannedCompletionDate").as(String.class), orderInfo.getPlannedCompletionDateStart()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(orderInfo.getPlannedCompletionDateEnd())) {
|
||||
predicates.add(cb.lessThanOrEqualTo(root.get("plannedCompletionDate").as(String.class), orderInfo.getPlannedCompletionDateEnd()));
|
||||
}
|
||||
if (orderInfo.getOrderStatusArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("orderStatus").as(Integer.class));
|
||||
for (Integer dictStatus : orderInfo.getOrderStatusArr()) {
|
||||
in.value(dictStatus);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||
}
|
||||
};
|
||||
|
||||
return specification;
|
||||
}
|
||||
}
|
@ -0,0 +1,217 @@
|
||||
package com.ruoyi.wms.controller;
|
||||
|
||||
import com.cmeim.common.core.exception.ServiceException;
|
||||
import com.cmeim.common.core.utils.BeanUtil;
|
||||
import com.cmeim.common.core.utils.ExcelExportUtil;
|
||||
import com.cmeim.common.core.utils.StringUtils;
|
||||
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.wms.repository.OrderInfoRepository;
|
||||
import com.ruoyi.wms.repository.ShelfInfoRepository;
|
||||
import com.ruoyi.wms.po.OrderInfo;
|
||||
import com.ruoyi.wms.po.ShelfInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.ruoyi.ruiYiController.annotation.Log;
|
||||
import com.ruoyi.ruiYiController.enums.BusinessType;
|
||||
import com.ruoyi.wms.vo.ContainerInfoExportVo;
|
||||
import com.ruoyi.wms.vo.ShelfInfoExportVo;
|
||||
import com.ruoyi.wms.vo.ShelfVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/28
|
||||
*/
|
||||
@Api(tags = "货架")
|
||||
@RestController
|
||||
@RequestMapping(value = "shelf")
|
||||
@Slf4j
|
||||
public class ShelfController extends GenericController {
|
||||
@Autowired
|
||||
private ShelfInfoRepository shelfInfoRepository;
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
|
||||
@ApiOperation(value = "列表")
|
||||
@GetMapping(value = "list")
|
||||
public Respond list(PageVo pv, ShelfInfo shelfInfo) {
|
||||
PageRequest pageRequest = PageRequest.of(pv.getPageNo() - 1, pv.getPageSize(),
|
||||
Sort.by(sortOrder(shelfInfo.getOrders())));
|
||||
Page page = shelfInfoRepository.findAll(buildSpecification(shelfInfo), pageRequest);
|
||||
List<ShelfInfo> list = page.getContent();
|
||||
pv.setRecordsTotal(page.getTotalElements());
|
||||
pv.setData(list);
|
||||
return buildSuccess(pv);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据货架编码查询")
|
||||
@GetMapping(value = "listWithoutPage")
|
||||
public Respond listWithoutPage(String shelfCode) {
|
||||
ShelfInfo shelfInfo = shelfInfoRepository.findByShelfCode(shelfCode);
|
||||
ShelfVo shelfVo = BeanUtil.copyProperties(shelfInfo, ShelfVo.class);
|
||||
if (StringUtils.isNotBlank(shelfInfo.getProductionTask())) {
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelfInfo.getProductionTask());
|
||||
shelfVo.setOrderInfo(orderInfo);
|
||||
}
|
||||
return buildSuccess(shelfVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出excel")
|
||||
@PostMapping("exportExcel")
|
||||
public void export(ShelfInfo shelfInfo, HttpServletResponse response) throws Exception {
|
||||
List<ShelfInfo> list = shelfInfoRepository.findAll(buildSpecification(shelfInfo));
|
||||
List<ShelfInfoExportVo> exportList = new ArrayList<>();
|
||||
for(ShelfInfo shelf:list){
|
||||
ShelfInfoExportVo shelfInfoExportVo = BeanUtil.copyProperties(shelf, ShelfInfoExportVo.class);
|
||||
exportList.add(shelfInfoExportVo);
|
||||
}
|
||||
// 创建工作簿对象
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
|
||||
// 创建工作表
|
||||
SXSSFSheet sheet = workbook.createSheet("周转箱列表");
|
||||
|
||||
String[] rowsName = new String[]{"序号","货架编码","货架状态","生产任务单","存放表数量","当前货架存放任务单状态","创建人","创建时间","更新人","更新时间"};
|
||||
List<Object[]> dataList = new ArrayList<Object[]>();
|
||||
Object[] objs = null;
|
||||
int i = 1;
|
||||
for (ShelfInfoExportVo vo : exportList) {
|
||||
if(vo.getShelfStatus() == 5){
|
||||
vo.setShelfStatusShow("空闲");
|
||||
}else if(vo.getShelfStatus() == 10){
|
||||
vo.setShelfStatusShow("占用");
|
||||
}else if(vo.getShelfStatus() == 15){
|
||||
vo.setShelfStatusShow("禁用");
|
||||
}
|
||||
|
||||
if(vo.getOrderStatus() == 5){
|
||||
vo.setOrderStatusShow("待校验");
|
||||
}else if(vo.getOrderStatus() == 10){
|
||||
vo.setOrderStatusShow("校验中");
|
||||
}else if(vo.getOrderStatus() == 15){
|
||||
vo.setOrderStatusShow("校验完成");
|
||||
}else if(vo.getOrderStatus() == 20){
|
||||
vo.setOrderStatusShow("待抽检");
|
||||
}else if(vo.getOrderStatus() == 25){
|
||||
vo.setOrderStatusShow("待出库(缓存区)");
|
||||
}else if(vo.getOrderStatus() == 30){
|
||||
vo.setOrderStatusShow("待出库(出库位)");
|
||||
}else if(vo.getOrderStatus() == 35){
|
||||
vo.setOrderStatusShow("出库完成");
|
||||
}else if(vo.getOrderStatus() == 40){
|
||||
vo.setOrderStatusShow("空箱");
|
||||
}
|
||||
|
||||
objs = new Object[rowsName.length];
|
||||
objs[0] = i;
|
||||
objs[1] = vo.getShelfCode();
|
||||
objs[2] = vo.getShelfStatusShow();
|
||||
objs[3] = vo.getProductionTask();
|
||||
objs[4] = vo.getQty();
|
||||
objs[5] = vo.getOrderStatusShow();
|
||||
objs[6] = vo.getCreatedBy();
|
||||
objs[7] = vo.getCreatedDt();
|
||||
objs[8] = vo.getUpdatedBy();
|
||||
objs[9] = vo.getUpdatedDt();
|
||||
dataList.add(objs);
|
||||
i += 1;
|
||||
}
|
||||
ExcelExportUtil.getExportWorkbook(workbook, sheet, rowsName, dataList);
|
||||
ExcelExportUtil.sendHttpResponse(response, "Shelf", workbook);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改货架状态")
|
||||
@Log(title = "货架", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "updateShelfStatus")
|
||||
public Respond updateStationStatus(@RequestBody ShelfInfo shelfInfo) {
|
||||
ShelfInfo shelf = shelfInfoRepository.findByShelfCode(shelfInfo.getShelfCode());
|
||||
if (shelf == null) {
|
||||
throw new ServiceException(RespondEnum.PARAMETER_ERROR, "未找到该货架");
|
||||
}
|
||||
//出库完成则清空任务单和优先级
|
||||
if (shelfInfo.getShelfStatus() == 35) {
|
||||
//修改任务单的出库中数量和出库数量
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(shelf.getProductionTask());
|
||||
orderInfo.setProductOnoutingQty(orderInfo.getProductOnoutingQty() - shelfInfo.getQty());
|
||||
orderInfo.setProductOutQty(orderInfo.getProductOutQty() + shelfInfo.getQty());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
shelf.setQty(0);
|
||||
shelf.setProductionTask(null);
|
||||
shelf.setPriority(0);
|
||||
shelf.setUpdatedBy(shelfInfo.getUpdatedBy());
|
||||
shelf.setUpdatedDt(shelfInfo.getUpdatedDt());
|
||||
shelfInfoRepository.save(shelf);
|
||||
} else {
|
||||
shelf.setQty(shelfInfo.getQty());
|
||||
shelf.setUpdatedBy(shelfInfo.getUpdatedBy());
|
||||
shelf.setUpdatedDt(shelfInfo.getUpdatedDt());
|
||||
shelfInfoRepository.save(shelf);
|
||||
}
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改任务单优先级")
|
||||
@Log(title = "货架", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "updateShelfPriority")
|
||||
public Respond updateShelfPriority(String productionTask) {
|
||||
List<ShelfInfo> shelfInfoList = shelfInfoRepository.findByProductionTask(productionTask);
|
||||
if (shelfInfoList.size() == 0) {
|
||||
throw new ServiceException(RespondEnum.PARAMETER_ERROR, "未找到该该任务对应的货架");
|
||||
}
|
||||
for (ShelfInfo shelfInfo : shelfInfoList) {
|
||||
shelfInfo.setPriority(1);
|
||||
}
|
||||
shelfInfoRepository.saveAll(shelfInfoList);
|
||||
return buildSuccess();
|
||||
}
|
||||
|
||||
private Specification buildSpecification(ShelfInfo shelfInfo) {
|
||||
Specification<ShelfInfo> specification = new Specification<ShelfInfo>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<ShelfInfo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> predicates = Lists.newArrayList();
|
||||
if (shelfInfo.getShelfCode() != null) {
|
||||
predicates.add(cb.like(root.get("shelfCode").as(String.class), "%" + shelfInfo.getShelfCode() + "%"));
|
||||
}
|
||||
if (shelfInfo.getProductionTask() != null) {
|
||||
predicates.add(cb.like(root.get("productionTask").as(String.class), "%" + shelfInfo.getProductionTask() + "%"));
|
||||
}
|
||||
if (shelfInfo.getShelfStatus() != null) {
|
||||
predicates.add(cb.equal(root.get("shelfStatus").as(Integer.class), shelfInfo.getShelfStatus()));
|
||||
}
|
||||
if (shelfInfo.getOrderStatus() != null) {
|
||||
predicates.add(cb.equal(root.get("orderStatus").as(Integer.class), shelfInfo.getOrderStatus()));
|
||||
}
|
||||
if (shelfInfo.getOrderStatusArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("orderStatus").as(Integer.class));
|
||||
for (Integer status : shelfInfo.getOrderStatusArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||
}
|
||||
};
|
||||
return specification;
|
||||
}
|
||||
}
|
@ -0,0 +1,237 @@
|
||||
package com.ruoyi.wms.controller;
|
||||
|
||||
|
||||
import com.cmeim.common.core.utils.BeanUtil;
|
||||
import com.cmeim.common.core.utils.ExcelExportUtil;
|
||||
import com.cmeim.common.core.utils.StringUtils;
|
||||
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.exception.ServiceException;
|
||||
import com.ruoyi.wms.po.ContainerInfo;
|
||||
import com.ruoyi.wms.po.OrderInfo;
|
||||
import com.ruoyi.wms.po.ShelfInfo;
|
||||
import com.ruoyi.wms.repository.OrderInfoRepository;
|
||||
import com.ruoyi.wms.repository.StationInfoRepository;
|
||||
import com.ruoyi.wms.po.StationInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.ruoyi.ruiYiController.annotation.Log;
|
||||
import com.ruoyi.ruiYiController.enums.BusinessType;
|
||||
import com.ruoyi.wms.vo.ShelfInfoExportVo;
|
||||
import com.ruoyi.wms.vo.StationInfoExportVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.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.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/28
|
||||
*/
|
||||
@Api(tags = "工位")
|
||||
@RestController
|
||||
@RequestMapping(value = "station")
|
||||
@Slf4j
|
||||
public class StationController extends GenericController {
|
||||
@Autowired
|
||||
private StationInfoRepository stationInfoRepository;
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
|
||||
@ApiOperation(value = "列表")
|
||||
@GetMapping(value = "list")
|
||||
public Respond list(PageVo pv, StationInfo stationInfo) {
|
||||
PageRequest pageRequest = PageRequest.of(pv.getPageNo() - 1, pv.getPageSize(),
|
||||
Sort.by(sortOrder(stationInfo.getOrders())));
|
||||
Page page = stationInfoRepository.findAll(buildSpecification(stationInfo), pageRequest);
|
||||
List<StationInfo> list = page.getContent();
|
||||
pv.setRecordsTotal(page.getTotalElements());
|
||||
pv.setData(list);
|
||||
return buildSuccess(pv);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出excel")
|
||||
@PostMapping("exportExcel")
|
||||
public void export(StationInfo stationInfo, HttpServletResponse response) throws Exception {
|
||||
List<StationInfo> list = stationInfoRepository.findAll(buildSpecification(stationInfo));
|
||||
List<StationInfoExportVo> exportList = new ArrayList<>();
|
||||
for(StationInfo station:list){
|
||||
StationInfoExportVo stationInfoExportVo = BeanUtil.copyProperties(station, StationInfoExportVo.class);
|
||||
exportList.add(stationInfoExportVo);
|
||||
}
|
||||
// 创建工作簿对象
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
|
||||
// 创建工作表
|
||||
SXSSFSheet sheet = workbook.createSheet("周转箱列表");
|
||||
|
||||
String[] rowsName = new String[]{"序号","工位编码","对应地码","工位名称","工位类型","工位状态","工位子编码","生产任务单","创建人","创建时间","更新人","更新时间"};
|
||||
List<Object[]> dataList = new ArrayList<Object[]>();
|
||||
Object[] objs = null;
|
||||
int i = 1;
|
||||
for (StationInfoExportVo vo : exportList) {
|
||||
if(vo.getStationStatus() == 5){
|
||||
vo.setStationStatusShow("空闲");
|
||||
}else if(vo.getStationStatus() == 10){
|
||||
vo.setStationStatusShow("作业中");
|
||||
}else if(vo.getStationStatus() == 15){
|
||||
vo.setStationStatusShow("停止作业");
|
||||
}else if(vo.getStationStatus() == 20){
|
||||
vo.setStationStatusShow("作业完成");
|
||||
}
|
||||
|
||||
if(vo.getStationType() == 5){
|
||||
vo.setStationTypeShow("入库工位");
|
||||
}else if(vo.getStationType() == 10){
|
||||
vo.setStationTypeShow("出库工位");
|
||||
}else if(vo.getStationType() == 15){
|
||||
vo.setStationTypeShow("校验工位");
|
||||
}else if(vo.getStationType() == 20){
|
||||
vo.setStationTypeShow("抽检工位");
|
||||
}else if(vo.getStationType() == 25){
|
||||
vo.setStationTypeShow("发货库位");
|
||||
}
|
||||
|
||||
objs = new Object[rowsName.length];
|
||||
objs[0] = i;
|
||||
objs[1] = vo.getStationCode();
|
||||
objs[2] = vo.getStoreCode();
|
||||
objs[3] = vo.getStationName();
|
||||
objs[4] = vo.getStationTypeShow();
|
||||
objs[5] = vo.getStationStatusShow();
|
||||
objs[6] = vo.getStationSubnumber();
|
||||
objs[7] = vo.getProductionTask();
|
||||
objs[8] = vo.getCreatedBy();
|
||||
objs[9] = vo.getCreatedDt();
|
||||
objs[10] = vo.getUpdatedBy();
|
||||
objs[11] = vo.getUpdatedDt();
|
||||
dataList.add(objs);
|
||||
i += 1;
|
||||
}
|
||||
ExcelExportUtil.getExportWorkbook(workbook, sheet, rowsName, dataList);
|
||||
ExcelExportUtil.sendHttpResponse(response, "Station", workbook);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据工位编码查询生产任务单")
|
||||
@GetMapping(value = "findOrderByStationCode")
|
||||
public Respond findOrderByStationCode(String stationCode) {
|
||||
StationInfo stationInfo = stationInfoRepository.findByStationCode(stationCode);
|
||||
if (stationInfo == null || StringUtils.isBlank(stationInfo.getProductionTask())) {
|
||||
return buildFailure("未找到该库位编码或该库位编码没有绑定生产任务单!");
|
||||
}
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(stationInfo.getProductionTask());
|
||||
if (orderInfo == null) {
|
||||
return buildFailure("未找到生产任务单:" + stationInfo.getProductionTask());
|
||||
}
|
||||
orderInfo.setStationStatus(stationInfo.getStationStatus());
|
||||
if (stationInfo.getStationStatus() == 5) {
|
||||
orderInfo.setStationStatusShow("空闲");
|
||||
} else if (stationInfo.getStationStatus() == 10) {
|
||||
orderInfo.setStationStatusShow("作业中");
|
||||
} else if (stationInfo.getStationStatus() == 15) {
|
||||
orderInfo.setStationStatusShow("停止作业");
|
||||
} else if (stationInfo.getStationStatus() == 20) {
|
||||
orderInfo.setStationStatusShow("作业完成");
|
||||
}
|
||||
if (orderInfo.getOrderStatus() == 5) {
|
||||
orderInfo.setOrderStatusShow("已录入");
|
||||
} else if (orderInfo.getOrderStatus() == 10) {
|
||||
orderInfo.setOrderStatusShow("部分入库");
|
||||
} else if (orderInfo.getOrderStatus() == 15) {
|
||||
orderInfo.setOrderStatusShow("全部入库");
|
||||
}
|
||||
return buildSuccess(orderInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改工位状态")
|
||||
@Log(title = "工位", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "updateStationStatus")
|
||||
public Respond updateStationStatus(@RequestBody StationInfo stationInfo) {
|
||||
StationInfo station = stationInfoRepository.findByStationCode(stationInfo.getStationCode());
|
||||
if (station == null) {
|
||||
throw new ServiceException("未找到该工位号对应的工位");
|
||||
}
|
||||
station.setStationStatus(stationInfo.getStationStatus());
|
||||
station.setUpdatedBy(stationInfo.getUpdatedBy());
|
||||
station.setUpdatedDt(stationInfo.getUpdatedDt());
|
||||
StationInfo save = stationInfoRepository.save(station);
|
||||
return buildSuccess(save);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据站位号修改单据")
|
||||
@Log(title = "工位", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "updateProductionTask")
|
||||
public Respond updateProductionTask(@RequestBody StationInfo stationInfo) {
|
||||
StationInfo station = stationInfoRepository.findByStationCode(stationInfo.getStationCode());
|
||||
if (station == null) {
|
||||
throw new ServiceException("未找到该工位号对应的工位");
|
||||
}
|
||||
station.setProductionTask(stationInfo.getProductionTask());
|
||||
station.setUpdatedBy(stationInfo.getUpdatedBy());
|
||||
station.setUpdatedDt(stationInfo.getUpdatedDt());
|
||||
StationInfo save = stationInfoRepository.save(station);
|
||||
return buildSuccess(save);
|
||||
}
|
||||
|
||||
private Specification buildSpecification(StationInfo stationInfo) {
|
||||
Specification<StationInfo> specification = new Specification<StationInfo>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<StationInfo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> predicates = Lists.newArrayList();
|
||||
if (stationInfo.getStationCode() != null) {
|
||||
predicates.add(cb.like(root.get("stationCode").as(String.class), "%" + stationInfo.getStationCode() + "%"));
|
||||
}
|
||||
if (stationInfo.getStationName() != null) {
|
||||
predicates.add(cb.like(root.get("stationName").as(String.class), "%" + stationInfo.getStationName() + "%"));
|
||||
}
|
||||
if (stationInfo.getStationSubnumber() != null) {
|
||||
predicates.add(cb.equal(root.get("stationSubnumber").as(Integer.class), stationInfo.getStationSubnumber()));
|
||||
}
|
||||
if (stationInfo.getProductionTask() != null) {
|
||||
predicates.add(cb.equal(root.get("productionTask").as(Integer.class), stationInfo.getProductionTask()));
|
||||
}
|
||||
if (stationInfo.getStationStatus() != null) {
|
||||
predicates.add(cb.equal(root.get("stationStatus").as(Integer.class), stationInfo.getStationStatus()));
|
||||
}
|
||||
if (stationInfo.getStationType() != null) {
|
||||
predicates.add(cb.equal(root.get("stationType").as(Integer.class), stationInfo.getStationType()));
|
||||
}
|
||||
if (stationInfo.getStationStatusArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("stationStatus").as(Integer.class));
|
||||
for (Integer status : stationInfo.getStationStatusArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
if (stationInfo.getStationTypeArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("stationType").as(Integer.class));
|
||||
for (Integer status : stationInfo.getStationTypeArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||
}
|
||||
};
|
||||
return specification;
|
||||
}
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
package com.ruoyi.wms.controller;
|
||||
|
||||
import com.cmeim.common.core.utils.BeanUtil;
|
||||
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.wms.po.StationInfo;
|
||||
import com.ruoyi.wms.repository.StoreInfoRepository;
|
||||
import com.ruoyi.wms.po.StoreInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.ruoyi.wms.vo.StationInfoExportVo;
|
||||
import com.ruoyi.wms.vo.StoreInfoExportVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/28
|
||||
*/
|
||||
@Api(tags = "库位")
|
||||
@RestController
|
||||
@RequestMapping(value = "store")
|
||||
@Slf4j
|
||||
public class StoreController extends GenericController {
|
||||
@Autowired
|
||||
private StoreInfoRepository storeInfoRepository;
|
||||
|
||||
@ApiOperation(value = "列表")
|
||||
@GetMapping(value = "list")
|
||||
public Respond list(PageVo pv, StoreInfo storeInfo) {
|
||||
PageRequest pageRequest = PageRequest.of(pv.getPageNo() - 1, pv.getPageSize(),
|
||||
Sort.by(sortOrder(storeInfo.getOrders())));
|
||||
Page page = storeInfoRepository.findAll(buildSpecification(storeInfo), pageRequest);
|
||||
List<StoreInfo> list = page.getContent();
|
||||
pv.setRecordsTotal(page.getTotalElements());
|
||||
pv.setData(list);
|
||||
return buildSuccess(pv);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出excel")
|
||||
@PostMapping("exportExcel")
|
||||
public void export(StoreInfo storeInfo, HttpServletResponse response) throws Exception {
|
||||
List<StoreInfo> list = storeInfoRepository.findAll(buildSpecification(storeInfo));
|
||||
List<StoreInfoExportVo> exportList = new ArrayList<>();
|
||||
for(StoreInfo store:list){
|
||||
StoreInfoExportVo storeInfoExportVo = BeanUtil.copyProperties(store, StoreInfoExportVo.class);
|
||||
exportList.add(storeInfoExportVo);
|
||||
}
|
||||
// 创建工作簿对象
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
|
||||
// 创建工作表
|
||||
SXSSFSheet sheet = workbook.createSheet("周转箱列表");
|
||||
|
||||
String[] rowsName = new String[]{"序号","库位编码","库位类型","库位状态","库位属于的工位编码","货架编码","创建人","创建时间","更新人","更新时间"};
|
||||
List<Object[]> dataList = new ArrayList<Object[]>();
|
||||
Object[] objs = null;
|
||||
int i = 1;
|
||||
for (StoreInfoExportVo vo : exportList) {
|
||||
if(vo.getStoreStatus() == 5){
|
||||
vo.setStoreStatusShow("空闲");
|
||||
}else if(vo.getStoreStatus() == 10){
|
||||
vo.setStoreStatusShow("待占用");
|
||||
}else if(vo.getStoreStatus() == 15){
|
||||
vo.setStoreStatusShow("占用");
|
||||
}else if(vo.getStoreStatus() == 20){
|
||||
vo.setStoreStatusShow("待空闲");
|
||||
}
|
||||
|
||||
if(vo.getStoreType() == 5){
|
||||
vo.setStoreTypeShow("干湿库位");
|
||||
}else if(vo.getStoreType() == 10){
|
||||
vo.setStoreTypeShow("缓存库位");
|
||||
}else if(vo.getStoreType() == 15){
|
||||
vo.setStoreTypeShow("检验库位");
|
||||
}else if(vo.getStoreType() == 20){
|
||||
vo.setStoreTypeShow("抽检库位");
|
||||
}else if(vo.getStoreType() == 25){
|
||||
vo.setStoreTypeShow("成品缓存库位");
|
||||
} else if(vo.getStoreType() == 30){
|
||||
vo.setStoreTypeShow("成品出库库位");
|
||||
}else if(vo.getStoreType() == 35){
|
||||
vo.setStoreTypeShow("空车回库库位");
|
||||
}
|
||||
|
||||
objs = new Object[rowsName.length];
|
||||
objs[0] = i;
|
||||
objs[1] = vo.getStoreCode();
|
||||
objs[2] = vo.getStoreTypeShow();
|
||||
objs[3] = vo.getStoreStatusShow();
|
||||
objs[4] = vo.getStationCode();
|
||||
objs[5] = vo.getShelfCode();
|
||||
objs[6] = vo.getCreatedBy();
|
||||
objs[7] = vo.getCreatedDt();
|
||||
objs[8] = vo.getUpdatedBy();
|
||||
objs[9] = vo.getUpdatedDt();
|
||||
dataList.add(objs);
|
||||
i += 1;
|
||||
}
|
||||
ExcelExportUtil.getExportWorkbook(workbook, sheet, rowsName, dataList);
|
||||
ExcelExportUtil.sendHttpResponse(response, "Store", workbook);
|
||||
}
|
||||
|
||||
private Specification buildSpecification(StoreInfo storeInfo) {
|
||||
Specification<StoreInfo> specification = new Specification<StoreInfo>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<StoreInfo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> predicates = Lists.newArrayList();
|
||||
if (storeInfo.getStationCode() != null) {
|
||||
predicates.add(cb.like(root.get("stationCode").as(String.class), "%" + storeInfo.getStationCode() + "%"));
|
||||
}
|
||||
if (storeInfo.getStoreCode() != null) {
|
||||
predicates.add(cb.like(root.get("storeCode").as(String.class), "%" + storeInfo.getStoreCode() + "%"));
|
||||
}
|
||||
if (storeInfo.getShelfCode() != null) {
|
||||
predicates.add(cb.like(root.get("shelfCode").as(String.class), "%" + storeInfo.getShelfCode() + "%"));
|
||||
}
|
||||
if (storeInfo.getStoreStatus() != null) {
|
||||
predicates.add(cb.equal(root.get("storeStatus").as(Integer.class), storeInfo.getStoreStatus()));
|
||||
}
|
||||
if (storeInfo.getStoreType() != null) {
|
||||
predicates.add(cb.equal(root.get("storeType").as(Integer.class), storeInfo.getStoreType()));
|
||||
}
|
||||
if (storeInfo.getStoreStatusArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("storeStatus").as(Integer.class));
|
||||
for (Integer status : storeInfo.getStoreStatusArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
if (storeInfo.getStoreTypeArr() != null) {
|
||||
CriteriaBuilder.In<Integer> in = cb.in(root.get("storeType").as(Integer.class));
|
||||
for (Integer status : storeInfo.getStoreTypeArr()) {
|
||||
in.value(status);
|
||||
}
|
||||
predicates.add(in);
|
||||
}
|
||||
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||
}
|
||||
};
|
||||
return specification;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.ruoyi.wms.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public enum AgvTaskEnum {
|
||||
|
||||
NOTINITIATED(1, "未发起"),
|
||||
ONGOING(2, "进行中"),
|
||||
FINISH(3, "已完成"),
|
||||
FAIL(4, "失败"),
|
||||
CANCEL(5, "取消"),
|
||||
PENDING(6, "挂起"),
|
||||
;
|
||||
|
||||
@Getter
|
||||
private int code;
|
||||
@Getter
|
||||
private String message;
|
||||
|
||||
private AgvTaskEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.ruoyi.wms.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public enum RequestEnum {
|
||||
NULLBOXINSTORE(0, "空箱入库"),
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
107
RuoYi-Vue/ruoyi-wms/src/main/java/com/ruoyi/wms/po/AgvTask.java
Normal file
107
RuoYi-Vue/ruoyi-wms/src/main/java/com/ruoyi/wms/po/AgvTask.java
Normal file
@ -0,0 +1,107 @@
|
||||
package com.ruoyi.wms.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "agv_task")
|
||||
public class AgvTask implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@ApiParam(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 请求单号
|
||||
*/
|
||||
@Column(name = "request_code")
|
||||
@ApiParam(value = "请求单号")
|
||||
private String requestCode;
|
||||
|
||||
/**
|
||||
* 类型 1:请求空箱 2:入水测 3:出水测 4:送待检 5:送检验 6:回待检 7:送抽检 8:送成品库 9:出成品库
|
||||
*/
|
||||
@Column(name = "dict_type")
|
||||
@ApiParam(value = "类型 1:请求空箱 2:入水测 3:出水测 4:送待检 5:送检验 6:回待检 7:送抽检 8:送成品库 9:出成品库")
|
||||
private Integer dictType;
|
||||
|
||||
@Transient
|
||||
@ApiParam("单据状态集合")
|
||||
private Integer[] dictTypeArr;
|
||||
|
||||
/**
|
||||
* json
|
||||
*/
|
||||
@Column(name = "json")
|
||||
@ApiParam(value = "json")
|
||||
private String json;
|
||||
|
||||
/**
|
||||
* 任务状态 1:未发起 2:进行中 3:已完成 4:失败 5:取消 6:挂起
|
||||
*/
|
||||
@Column(name = "status")
|
||||
@ApiParam(value = "任务状态 1:未发起 2:进行中 3:已完成 4:失败 5:取消 6:挂起")
|
||||
private Integer status;
|
||||
|
||||
@Transient
|
||||
@ApiParam("单据状态集合")
|
||||
private Integer[] statusArr;
|
||||
|
||||
/**
|
||||
* 处理结果
|
||||
*/
|
||||
@Column(name = "message")
|
||||
@ApiParam(value = "处理结果")
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Column(name = "created_by")
|
||||
@ApiParam(value = "创建人")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "created_dt")
|
||||
@ApiParam(value = "创建时间")
|
||||
private String createdDt;
|
||||
|
||||
@Transient
|
||||
@ApiParam(value = "创建时间-开始")
|
||||
private String createdDtStart;
|
||||
|
||||
@Transient
|
||||
@ApiParam(value = "创建时间-结束")
|
||||
private String createdDtEnd;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Column(name = "updated_by")
|
||||
@ApiParam(value = "更新人")
|
||||
private String updatedBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "updated_dt")
|
||||
@ApiParam(value = "更新时间")
|
||||
private String updatedDt;
|
||||
|
||||
@Transient
|
||||
@ApiParam("排序")
|
||||
private String[] orders;
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.ruoyi.wms.po;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "area_config")
|
||||
public class AreaConfig implements Serializable {
|
||||
|
||||
/**
|
||||
* null
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@ApiParam(value = "null")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 区域编码
|
||||
*/
|
||||
@Column(name = "area_code")
|
||||
@ApiParam(value = "区域编码")
|
||||
private String areaCode;
|
||||
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
@Column(name = "area_name")
|
||||
@ApiParam(value = "区域名称")
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 区域类型
|
||||
*/
|
||||
@Column(name = "area_type")
|
||||
@ApiParam(value = "区域类型")
|
||||
private Integer areaType;
|
||||
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package com.ruoyi.wms.po;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "container_info")
|
||||
public class ContainerInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@ApiParam(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 周装箱号(入库时不存在,自动增加)
|
||||
*/
|
||||
@Column(name = "container_number")
|
||||
@ApiParam(value = "周装箱号(入库时不存在,自动增加)")
|
||||
private String containerNumber;
|
||||
|
||||
/**
|
||||
* 周装箱状态:
|
||||
5-空闲(库外),从出库工位完成出库后标记为该状态
|
||||
10-空闲(库内),空箱完成入库上架后的状态
|
||||
15-入库中(手动),PDA扫描确认数量的
|
||||
20-入库中(自动),滚筒线扫描枪扫描后确认数量的
|
||||
25-入库中(空箱),夜班模式空箱入库
|
||||
30-在库,非空空箱在库
|
||||
35-出库中,发送出库调度任务后
|
||||
*/
|
||||
@Column(name = "container_status")
|
||||
@ApiParam(value = "周装箱状态:5-空闲(库外),从出库工位完成出库后标记为该状态10-空闲(库内),空箱完成入库上架后的状态15-入库中(手动),PDA扫描确认数量的20-入库中(自动),滚筒线扫描枪扫描后确认数量的25-入库中(空箱),夜班模式空箱入库30-在库,非空空箱在库35-出库中,发送出库调度任务后")
|
||||
private Integer containerStatus;
|
||||
|
||||
/**
|
||||
* 周装箱装表数量
|
||||
*/
|
||||
@Column(name = "qty")
|
||||
@ApiParam(value = "周装箱装表数量")
|
||||
private Integer qty;
|
||||
|
||||
/**
|
||||
* 库位编码(iCMX-A01-05-03)
|
||||
*/
|
||||
@Column(name = "store_code")
|
||||
@ApiParam(value = "库位编码(iCMX-A01-05-03)")
|
||||
private String storeCode;
|
||||
|
||||
/**
|
||||
* 开始入库时间(人工扫描或自动扫描时间)
|
||||
*/
|
||||
@Column(name = "on_instore_time")
|
||||
@ApiParam(value = "开始入库时间(人工扫描或自动扫描时间)")
|
||||
private String onInstoreTime;
|
||||
|
||||
/**
|
||||
* 入库时间(机器人放到库位上时间)
|
||||
*/
|
||||
@Column(name = "instore_time")
|
||||
@ApiParam(value = "入库时间(机器人放到库位上时间)")
|
||||
private String instoreTime;
|
||||
|
||||
/**
|
||||
* 开始出库时间(机器人开始出库作业时间)
|
||||
*/
|
||||
@Column(name = "on_outstore_time")
|
||||
@ApiParam(value = "开始出库时间(机器人开始出库作业时间)")
|
||||
private String onOutstoreTime;
|
||||
|
||||
/**
|
||||
* 出库时间(机器人取货到出库工位完成时间)
|
||||
*/
|
||||
@Column(name = "outstore_time")
|
||||
@ApiParam(value = "出库时间(机器人取货到出库工位完成时间)")
|
||||
private String outstoreTime;
|
||||
|
||||
/**
|
||||
* 生产任务单
|
||||
*/
|
||||
@Column(name = "production_task")
|
||||
@ApiParam(value = "生产任务单")
|
||||
private String productionTask;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
|
||||
@Transient
|
||||
@ApiParam("排序")
|
||||
private String[] orders;
|
||||
|
||||
@Transient
|
||||
@ApiParam("状态集合")
|
||||
private Integer[] containerStatusArr;
|
||||
|
||||
@Transient
|
||||
@ApiParam("站位编码")
|
||||
private String stationCode;
|
||||
|
||||
/**
|
||||
* 是否为pda修改
|
||||
*/
|
||||
@Column(name = "is_pda_edit")
|
||||
@ApiParam(value = "是否为pda修改")
|
||||
private Integer isPdaEdit;
|
||||
|
||||
@Transient
|
||||
@ApiParam("区域")
|
||||
private String area;
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.ruoyi.wms.po;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "container_recoder")
|
||||
public class ContainerRecoder implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@ApiParam(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 周装箱号(入库时不存在,自动增加)
|
||||
*/
|
||||
@Column(name = "container_number")
|
||||
@ApiParam(value = "周装箱号(入库时不存在,自动增加)")
|
||||
private String containerNumber;
|
||||
|
||||
/**
|
||||
* 周装箱状态:
|
||||
5-空闲(库外),从出库工位完成出库后标记为该状态
|
||||
10-空闲(库内),空箱完成入库上架后的状态
|
||||
15-入库中(手动),PDA扫描确认数量的
|
||||
20-入库中(自动),滚筒线扫描枪扫描后确认数量的
|
||||
25-入库中(空箱),夜班模式空箱入库
|
||||
30-在库,非空空箱在库
|
||||
35-出库中,发送出库调度任务后
|
||||
*/
|
||||
@Column(name = "container_status")
|
||||
@ApiParam(value = "周装箱状态:5-空闲(库外),从出库工位完成出库后标记为该状态10-空闲(库内),空箱完成入库上架后的状态15-入库中(手动),PDA扫描确认数量的20-入库中(自动),滚筒线扫描枪扫描后确认数量的25-入库中(空箱),夜班模式空箱入库30-在库,非空空箱在库35-出库中,发送出库调度任务后")
|
||||
private Integer containerStatus;
|
||||
|
||||
/**
|
||||
* 周装箱装表数量
|
||||
*/
|
||||
@Column(name = "qty")
|
||||
@ApiParam(value = "周装箱装表数量")
|
||||
private Integer qty;
|
||||
|
||||
/**
|
||||
* 库位编码(iCMX-A01-05-03)
|
||||
*/
|
||||
@Column(name = "store_code")
|
||||
@ApiParam(value = "库位编码(iCMX-A01-05-03)")
|
||||
private String storeCode;
|
||||
|
||||
/**
|
||||
* 开始入库时间(人工扫描或自动扫描时间)
|
||||
*/
|
||||
@Column(name = "on_instore_time")
|
||||
@ApiParam(value = "开始入库时间(人工扫描或自动扫描时间)")
|
||||
private String onInstoreTime;
|
||||
|
||||
/**
|
||||
* 入库时间(机器人放到库位上时间)
|
||||
*/
|
||||
@Column(name = "instore_time")
|
||||
@ApiParam(value = "入库时间(机器人放到库位上时间)")
|
||||
private String instoreTime;
|
||||
|
||||
/**
|
||||
* 开始出库时间(机器人开始出库作业时间)
|
||||
*/
|
||||
@Column(name = "on_outstore_time")
|
||||
@ApiParam(value = "开始出库时间(机器人开始出库作业时间)")
|
||||
private String onOutstoreTime;
|
||||
|
||||
/**
|
||||
* 出库时间(机器人取货到出库工位完成时间)
|
||||
*/
|
||||
@Column(name = "outstore_time")
|
||||
@ApiParam(value = "出库时间(机器人取货到出库工位完成时间)")
|
||||
private String outstoreTime;
|
||||
|
||||
/**
|
||||
* 生产任务单
|
||||
*/
|
||||
@Column(name = "production_task")
|
||||
@ApiParam(value = "生产任务单")
|
||||
private String productionTask;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
|
||||
@Transient
|
||||
@ApiParam("排序")
|
||||
private String[] orders;
|
||||
|
||||
@Transient
|
||||
@ApiParam("状态集合")
|
||||
private Integer[] containerStatusArr;
|
||||
|
||||
@Transient
|
||||
@ApiParam("站位编码")
|
||||
private String stationCode;
|
||||
|
||||
/**
|
||||
* 是否为pda修改
|
||||
*/
|
||||
@Column(name = "is_pda_edit")
|
||||
@ApiParam(value = "是否为pda修改")
|
||||
private Integer isPdaEdit;
|
||||
|
||||
}
|
@ -0,0 +1,217 @@
|
||||
package com.ruoyi.wms.po;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "order_info")
|
||||
public class OrderInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* null
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@ApiParam(value = "null")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 生产任务单
|
||||
*/
|
||||
@Column(name = "production_task")
|
||||
@ApiParam(value = "生产任务单")
|
||||
private String productionTask;
|
||||
|
||||
/**
|
||||
* 单据状态(5-已录入、10-部分入库、15-全部入库)
|
||||
*/
|
||||
@Column(name = "order_status")
|
||||
@ApiParam(value = "单据状态(5-已录入、10-部分入库、15-全部入库)")
|
||||
private Integer orderStatus;
|
||||
|
||||
/**
|
||||
* 销售订单
|
||||
*/
|
||||
@Column(name = "sale_order")
|
||||
@ApiParam(value = "销售订单")
|
||||
private String saleOrder;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@Column(name = "material_code")
|
||||
@ApiParam(value = "物料编码")
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@Column(name = "material_name")
|
||||
@ApiParam(value = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 物料规格
|
||||
*/
|
||||
@Column(name = "material_spec")
|
||||
@ApiParam(value = "物料规格")
|
||||
private String materialSpec;
|
||||
|
||||
/**
|
||||
* 计划完工日期
|
||||
*/
|
||||
@Column(name = "planned_completion_date")
|
||||
@ApiParam(value = "计划完工日期")
|
||||
private String plannedCompletionDate;
|
||||
|
||||
/**
|
||||
* 计划数量
|
||||
*/
|
||||
@Column(name = "plan_qty")
|
||||
@ApiParam(value = "计划数量")
|
||||
private Integer planQty;
|
||||
|
||||
/**
|
||||
* 已入库数
|
||||
*/
|
||||
@Column(name = "in_qty")
|
||||
@ApiParam(value = "已入库数")
|
||||
private Integer inQty;
|
||||
|
||||
/**
|
||||
* 入库中数量
|
||||
*/
|
||||
@Column(name = "ongoing_qty")
|
||||
@ApiParam(value = "入库中数量")
|
||||
private Integer ongoingQty;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@Column(name = "out_qty")
|
||||
@ApiParam(value = "出库数量")
|
||||
private Integer outQty;
|
||||
|
||||
/**
|
||||
* 出库中数量
|
||||
*/
|
||||
@Column(name = "onouting_check_qty")
|
||||
@ApiParam(value = "出库中数量")
|
||||
private Integer onoutingCheckQty;
|
||||
|
||||
/**
|
||||
* 待校验数
|
||||
*/
|
||||
@Column(name = "wait_check_qty")
|
||||
@ApiParam(value = "待校验数")
|
||||
private Integer waitCheckQty;
|
||||
|
||||
/**
|
||||
* 已校验数
|
||||
*/
|
||||
@Column(name = "finish_check_qty")
|
||||
@ApiParam(value = "已校验数")
|
||||
private Integer finishCheckQty;
|
||||
|
||||
/**
|
||||
* 校验中数
|
||||
*/
|
||||
@Column(name = "check_qty")
|
||||
@ApiParam(value = "校验中数")
|
||||
private Integer checkQty;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 成品区已入库数
|
||||
*/
|
||||
@Column(name = "product_in_qty")
|
||||
@ApiParam(value = "成品区已入库数")
|
||||
private Integer productInQty;
|
||||
|
||||
/**
|
||||
* 成品区入库中数量
|
||||
*/
|
||||
@Column(name = "product_ongoing_qty")
|
||||
@ApiParam(value = "成品区入库中数量")
|
||||
private Integer productOngoingQty;
|
||||
|
||||
/**
|
||||
* 成品区出库数量
|
||||
*/
|
||||
@Column(name = "product_out_qty")
|
||||
@ApiParam(value = "成品区出库数量")
|
||||
private Integer productOutQty;
|
||||
|
||||
/**
|
||||
* 成品区出库中数量
|
||||
*/
|
||||
@Column(name = "product_onouting_qty")
|
||||
@ApiParam(value = "成品区出库中数量")
|
||||
private Integer productOnoutingQty;
|
||||
|
||||
@Transient
|
||||
@ApiParam(value = "计划完工日期-开始")
|
||||
private String plannedCompletionDateStart;
|
||||
|
||||
@Transient
|
||||
@ApiParam(value = "计划完工日期-结束")
|
||||
private String plannedCompletionDateEnd;
|
||||
|
||||
@Transient
|
||||
@ApiParam("单据状态集合")
|
||||
private Integer[] orderStatusArr;
|
||||
|
||||
@Transient
|
||||
@ApiParam("排序")
|
||||
private String[] orders;
|
||||
|
||||
@Transient
|
||||
@ApiParam(value = "工位编码")
|
||||
private String stationCode;
|
||||
|
||||
@Transient
|
||||
@ApiParam(value = "工位状态(5-空闲(默认)、10-作业中、15-停止作业、20-作业完成)")
|
||||
private Integer stationStatus;
|
||||
|
||||
@Transient
|
||||
@ApiParam(value = "工位状态(5-空闲(默认)、10-作业中、15-停止作业、20-作业完成)")
|
||||
private String stationStatusShow;
|
||||
|
||||
@Transient
|
||||
@ApiParam(value = "单据状态(5-已录入、10-部分入库、15-全部入库)")
|
||||
private String orderStatusShow;
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.ruoyi.wms.po;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sensor_store_bind")
|
||||
public class SensorStoreBind implements Serializable {
|
||||
|
||||
/**
|
||||
* null
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@ApiParam(value = "null")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 传感器
|
||||
*/
|
||||
@Column(name = "sensor")
|
||||
@ApiParam(value = "传感器")
|
||||
private String sensor;
|
||||
|
||||
/**
|
||||
* 库位编码
|
||||
*/
|
||||
@Column(name = "station_code")
|
||||
@ApiParam(value = "库位编码")
|
||||
private String stationCode;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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,0 +1,125 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 送抽检的工位编码
|
||||
*/
|
||||
@Column(name = "station_code_spot_check")
|
||||
@ApiParam(value = "送抽检的工位编码")
|
||||
private String stationCodeSpotCheck;
|
||||
|
||||
@Transient
|
||||
@ApiParam("排序")
|
||||
private String[] orders;
|
||||
|
||||
@Transient
|
||||
@ApiParam("单据状态集合")
|
||||
private Integer[] orderStatusArr;
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com.ruoyi.wms.po;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "station_info")
|
||||
public class StationInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@ApiParam(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工位编码
|
||||
*/
|
||||
@Column(name = "station_code")
|
||||
@ApiParam(value = "工位编码")
|
||||
private String stationCode;
|
||||
|
||||
/**
|
||||
* 对应地码
|
||||
*/
|
||||
@Column(name = "store_code")
|
||||
@ApiParam(value = "对应地码")
|
||||
private String storeCode;
|
||||
|
||||
/**
|
||||
* 工位类型:
|
||||
5-入库工位
|
||||
10-出库工位
|
||||
15-缓存库位(待检区)
|
||||
20-检验库位
|
||||
25-抽检库位
|
||||
30-成品缓存库位
|
||||
35-成品出库库位
|
||||
40-空车回库库位
|
||||
13-工作台
|
||||
*/
|
||||
@Column(name = "station_type")
|
||||
@ApiParam(value = "工位类型:5-入库工位10-出库工位15-校验工位20-抽检工位25-发货库位")
|
||||
private Integer stationType;
|
||||
|
||||
/**
|
||||
* 工位名称
|
||||
*/
|
||||
@Column(name = "station_name")
|
||||
@ApiParam(value = "工位名称")
|
||||
private String stationName;
|
||||
|
||||
/**
|
||||
* 工位状态(5-空闲(默认)、10-作业中、15-停止作业、20-作业完成)
|
||||
*/
|
||||
@Column(name = "station_status")
|
||||
@ApiParam(value = "工位状态(5-空闲(默认)、10-作业中、15-停止作业、20-作业完成)")
|
||||
private Integer stationStatus;
|
||||
|
||||
/**
|
||||
* 工位子编码
|
||||
*/
|
||||
@Column(name = "station_subnumber")
|
||||
@ApiParam(value = "工位子编码")
|
||||
private String stationSubnumber;
|
||||
|
||||
/**
|
||||
* 生产任务单
|
||||
*/
|
||||
@Column(name = "production_task")
|
||||
@ApiParam(value = "生产任务单")
|
||||
private String productionTask;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
|
||||
@Transient
|
||||
@ApiParam("排序")
|
||||
private String[] orders;
|
||||
|
||||
@Transient
|
||||
@ApiParam("状态集合")
|
||||
private Integer[] stationStatusArr;
|
||||
|
||||
@Transient
|
||||
@ApiParam("类型集合")
|
||||
private Integer[] stationTypeArr;
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package com.ruoyi.wms.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "store_info")
|
||||
public class StoreInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@ApiParam(value = "id")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 库位编码
|
||||
*/
|
||||
@Column(name = "store_code")
|
||||
@ApiParam(value = "库位编码")
|
||||
private String storeCode;
|
||||
|
||||
/**
|
||||
* 库位类型:5-干湿库位 10-缓存库位 15-检验库位 20-抽检库位 25-成品缓存库位 30-成品出库库位 35-空车回库库位
|
||||
*/
|
||||
@Column(name = "store_type")
|
||||
@ApiParam(value = "库位类型:5-干湿库位 10-缓存库位 15-检验库位 20-抽检库位 25-成品缓存库位 30-成品出库库位 35-空车回库库位 ")
|
||||
private Integer storeType;
|
||||
|
||||
/**
|
||||
* 库位状态
|
||||
* 5-空闲:机器人任务回调后
|
||||
* 10-待占用:机器人任务发起后
|
||||
* 15-占用:机器人任务回调后
|
||||
* 20-待空闲:机器人任务发起后
|
||||
*/
|
||||
@Column(name = "store_status")
|
||||
@ApiParam(value = "库位状态 5-空闲:机器人任务回调后10-待占用:机器人任务发起后15-占用:机器人任务回调后20-待空闲:机器人任务发起后")
|
||||
private Integer storeStatus;
|
||||
|
||||
/**
|
||||
* 库位属于的工位编码
|
||||
*/
|
||||
@Column(name = "station_code")
|
||||
@ApiParam(value = "库位属于的工位编码")
|
||||
private String stationCode;
|
||||
|
||||
/**
|
||||
* 货架编码
|
||||
*/
|
||||
@Column(name = "shelf_code")
|
||||
@ApiParam(value = "货架编码")
|
||||
private String shelfCode;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
|
||||
@Transient
|
||||
@ApiParam("排序")
|
||||
private String[] orders;
|
||||
|
||||
@Transient
|
||||
@ApiParam("状态集合")
|
||||
private Integer[] storeStatusArr;
|
||||
|
||||
@Transient
|
||||
@ApiParam("类型集合")
|
||||
private Integer[] storeTypeArr;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.wms.repository;
|
||||
|
||||
import com.ruoyi.wms.po.AgvTask;
|
||||
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/26
|
||||
**/
|
||||
@Repository
|
||||
public interface AgvTaskRepository extends JpaRepository<AgvTask,Long>, JpaSpecificationExecutor {
|
||||
AgvTask findByRequestCode(String requestCode);
|
||||
|
||||
AgvTask findByRequestCodeAndStatus(String requestCode,Integer status);
|
||||
|
||||
List<AgvTask> findByDictTypeAndStatus(Integer type, Integer status);
|
||||
|
||||
List<AgvTask> findByJsonLikeAndCreatedDtAfterAndCreatedDtBeforeAndDictTypeAndStatus(String json, String dt1, String dt2, Integer dictType, Integer status);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.wms.repository;
|
||||
|
||||
import com.ruoyi.wms.po.AreaConfig;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/6/30
|
||||
**/
|
||||
@Repository
|
||||
public interface AreaConfigRepository extends JpaRepository<AreaConfig,Long>, JpaSpecificationExecutor {
|
||||
AreaConfig findByAreaType(Integer type);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.ruoyi.wms.repository;
|
||||
|
||||
import com.ruoyi.wms.po.ContainerInfo;
|
||||
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 ContainerInfoRepository extends JpaRepository<ContainerInfo,Long>, JpaSpecificationExecutor {
|
||||
List<ContainerInfo> findByContainerStatus(Integer status);
|
||||
ContainerInfo findByContainerNumber(String containerNumber);
|
||||
List<ContainerInfo> findByProductionTask(String productionTask);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.wms.repository;
|
||||
|
||||
import com.ruoyi.wms.po.ContainerRecoder;
|
||||
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 ContainerRecoderRepository extends JpaRepository<ContainerRecoder,Long>, JpaSpecificationExecutor {
|
||||
List<ContainerRecoder> findByProductionTask(String productionTask);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.wms.repository;
|
||||
|
||||
import com.ruoyi.wms.po.OrderInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/26
|
||||
*/
|
||||
@Repository
|
||||
public interface OrderInfoRepository extends JpaRepository<OrderInfo,Long>, JpaSpecificationExecutor {
|
||||
OrderInfo findByProductionTask(String productionTask);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.wms.repository;
|
||||
|
||||
import com.ruoyi.wms.po.SensorStoreBind;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/7/5
|
||||
*/
|
||||
@Repository
|
||||
public interface SensorStoreBindRepository extends JpaRepository<SensorStoreBind,Long>, JpaSpecificationExecutor {
|
||||
SensorStoreBind findBySensor(String code);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
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.data.jpa.repository.Lock;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.persistence.LockModeType;
|
||||
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);
|
||||
/**
|
||||
* 新增悲观锁
|
||||
* @param task
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
@Lock(LockModeType.PESSIMISTIC_WRITE)
|
||||
List<ShelfInfo> findByProductionTaskAndOrderStatus(String task,Integer status);
|
||||
List<ShelfInfo> findByProductionTaskIsNullAndStationCodeIsNotNull();
|
||||
List<ShelfInfo> findByOrderStatus(Integer Status);
|
||||
List<ShelfInfo> findByProductionTask(String productionTask);
|
||||
List<ShelfInfo> findByStationCode(String stationCode);
|
||||
List<ShelfInfo> findByProductionTaskAndOrderStatusOrderByUpdatedDtDesc(String productionTask, Integer orderStatus);
|
||||
List<ShelfInfo> findByShelfStatus(Integer shelfStatus);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.ruoyi.wms.repository;
|
||||
|
||||
import com.ruoyi.wms.po.StationInfo;
|
||||
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 StationInfoRepository extends JpaRepository<StationInfo,Long>, JpaSpecificationExecutor {
|
||||
StationInfo findByStationCode(String stationCode);
|
||||
List<StationInfo> findByStationTypeAndStationStatus(Integer type,Integer status);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.ruoyi.wms.repository;
|
||||
|
||||
import com.ruoyi.wms.po.StoreInfo;
|
||||
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 StoreInfoRepository extends JpaRepository<StoreInfo,Long>, JpaSpecificationExecutor {
|
||||
StoreInfo findByStoreCode(String code);
|
||||
StoreInfo findByShelfCode(String shelfCode);
|
||||
List<StoreInfo> findByStoreTypeAndStoreStatus(Integer type,Integer status);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.ruoyi.wms.schedule;
|
||||
|
||||
import com.ruoyi.wms.util.TcpUtil;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.net.InetAddress;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2022/8/2
|
||||
**/
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
@Service
|
||||
public class SendToErpSchedule {
|
||||
|
||||
|
||||
// @Scheduled(cron = "*/1 * * * * ?")
|
||||
// private void configureTasks() {
|
||||
//
|
||||
// System.err.println("定时任务");
|
||||
// }
|
||||
|
||||
|
||||
//@Scheduled(cron = "*/5 * * * * ?")
|
||||
//private void configureTasks() {
|
||||
// InetAddress address = packet.getAddress();//获取发送端的地址
|
||||
// int port = packet.getPort();//获取 发送端进程所绑定的端口
|
||||
// Scanner scanner = new Scanner(System.in);//从键盘接受数据
|
||||
// String send = scanner.nextLine();//nextLine方式接受字符串
|
||||
// byte[] data2 = send.getBytes();//将接收到的数据转换为字节数组
|
||||
// DatagramPacket packet2 = new DatagramPacket(data2, data2.length,address,port);// 2.创建数据报,包含响应的数据信息
|
||||
// socket.send(packet2); // 3.响应客户端
|
||||
//}
|
||||
}
|
@ -0,0 +1,948 @@
|
||||
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.io.IOException;
|
||||
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;
|
||||
@Autowired
|
||||
private ContainerRecoderRepository containerRecoderRepository;
|
||||
|
||||
/**
|
||||
* 生成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());
|
||||
log.info("result:" + result);
|
||||
//呼叫空箱或入水测调用容器送达接口
|
||||
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);
|
||||
if (containerInfos.size() == 0) {
|
||||
return;
|
||||
}
|
||||
//优化筛选逻辑,按货架的序号分组,取最多的一组
|
||||
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());
|
||||
ContainerInfo save1 = containerInfoRepository.save(containerInfo);
|
||||
//增加历史记录表
|
||||
ContainerRecoder containerRecoder = BeanUtil.copyProperties(save1, ContainerRecoder.class);
|
||||
containerRecoder.setCreatedDt(DateUtil.getCurrentDate());
|
||||
containerRecoder.setId(null);
|
||||
containerRecoderRepository.save(containerRecoder);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 入恒温区成功回调
|
||||
*
|
||||
* @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());
|
||||
ContainerInfo save = containerInfoRepository.save(containerInfo);
|
||||
//增加历史记录表
|
||||
ContainerRecoder containerRecoder = BeanUtil.copyProperties(save, ContainerRecoder.class);
|
||||
containerRecoder.setCreatedDt(DateUtil.getCurrentDate());
|
||||
containerRecoder.setId(null);
|
||||
containerRecoderRepository.save(containerRecoder);
|
||||
//修改库位信息状态在库
|
||||
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);
|
||||
//如果容器现在状态是入库中则不更新
|
||||
//if (containerInfo.getContainerStatus() == 15 || containerInfo.getContainerStatus() == 20 ||containerInfo.getContainerStatus() == 25) {
|
||||
// return;
|
||||
//}
|
||||
//修改单据出库数据
|
||||
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());
|
||||
|
||||
//增加历史记录表
|
||||
ContainerRecoder containerRecoder = BeanUtil.copyProperties(containerInfo, ContainerRecoder.class);
|
||||
containerRecoder.setId(null);
|
||||
containerRecoder.setCreatedDt(DateUtil.getCurrentDate());
|
||||
containerRecoderRepository.save(containerRecoder);
|
||||
|
||||
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 回调参数
|
||||
*/
|
||||
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);
|
||||
}
|
||||
//修改单据出库数据
|
||||
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 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.setStationCode(null);
|
||||
shelfInfo.setShelfStatus(50);
|
||||
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);
|
||||
if (sensor == null) {
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
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);
|
||||
if (sorted.size() > 0) {
|
||||
agvRequestVo.setToLocationCode(sensor.getStationCode());
|
||||
agvRequestVo.setFromLocationCode(sorted.get(0).getStationCode());
|
||||
agvRequestVo.setContainerCode(sorted.get(0).getShelfCode());
|
||||
}
|
||||
agvRequestVo.setRequestType(RequestEnum.OUTPRODSTORE.getCode());
|
||||
try {
|
||||
final String result = taskParamCreate(agvRequestVo);
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
//修改起点工位为空闲
|
||||
StationInfo byStationCode = stationInfoRepository.findByStationCode(agvRequestVo.getFromLocationCode());
|
||||
byStationCode.setStationStatus(5);
|
||||
byStationCode.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
stationInfoRepository.save(byStationCode);
|
||||
//修改出库工位状态为作业中
|
||||
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);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
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,58 @@
|
||||
package com.ruoyi.wms.service;
|
||||
|
||||
import com.cmeim.common.core.utils.DateUtil;
|
||||
import com.ruoyi.wms.po.ContainerInfo;
|
||||
import com.ruoyi.wms.repository.ContainerInfoRepository;
|
||||
import com.ruoyi.wms.repository.ContainerRecoderRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/28
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ContainerService {
|
||||
@Autowired
|
||||
private ContainerInfoRepository containerInfoRepository;
|
||||
@Autowired
|
||||
private ContainerRecoderRepository containerRecoderRepository;
|
||||
|
||||
private String hour="8";
|
||||
|
||||
public List<ContainerInfo> queryGreaterThanEightHours()
|
||||
{
|
||||
List<ContainerInfo> all = containerInfoRepository.findAll();
|
||||
List<ContainerInfo> containerInfoList = new ArrayList<>();
|
||||
for (ContainerInfo containerInfo : all) {
|
||||
if (containerInfo.getInstoreTime() == null) {
|
||||
continue;
|
||||
}
|
||||
//筛出生产任务单号为空的箱子
|
||||
if (containerInfo.getProductionTask() == null) {
|
||||
continue;
|
||||
}
|
||||
//筛出状态不为非空空箱在库的箱子
|
||||
if (containerInfo.getContainerStatus() != 30) {
|
||||
continue;
|
||||
}
|
||||
Long end = DateUtil.string2Date(DateUtil.getCurrentDate(), DateUtil.PATTERN_yyyyMMddHHmmss).getTime();
|
||||
Long start = DateUtil.string2Date(containerInfo.getInstoreTime(), DateUtil.PATTERN_yyyyMMddHHmmss).getTime();
|
||||
long count = end - start;
|
||||
int i = Integer.parseInt(hour);
|
||||
int j = 3600000;
|
||||
long x = (long)i*j;
|
||||
//超过8小时则筛选出来出库
|
||||
if (count >= x) {
|
||||
containerInfoList.add(containerInfo);
|
||||
}
|
||||
}
|
||||
return containerInfoList;
|
||||
}
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package com.ruoyi.wms.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.wms.po.OrderInfo;
|
||||
import com.ruoyi.wms.repository.OrderInfoRepository;
|
||||
import com.ruoyi.wms.util.HttpRequest;
|
||||
import com.ruoyi.wms.vo.OrderQueryVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/26
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OrderService {
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
|
||||
/**
|
||||
* 获取甲方任务单列表
|
||||
* @param orderQueryVo 请求参数
|
||||
*/
|
||||
public List<OrderInfo> findByOrderQueryVo(OrderQueryVo orderQueryVo) {
|
||||
String newBillCode = orderQueryVo.getBillCode().concat("scrq_znbyfb");
|
||||
final String token = string2MD5(newBillCode);
|
||||
orderQueryVo.setToken(token);
|
||||
List<OrderInfo> orderInfoList = getSeOrder(JSONObject.toJSONString(orderQueryVo));
|
||||
return orderInfoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用甲方查找任务单接口
|
||||
* @param param 请求参数
|
||||
*/
|
||||
public List<OrderInfo> getSeOrder(String param) {
|
||||
final String result = HttpRequest.doPost("http://192.168.1.3:9528/getSeOrder", param);
|
||||
//log.info(result);
|
||||
List<OrderInfo> orderInfoList = new ArrayList<>();
|
||||
if (JSONObject.parseObject(result).getInteger("code") == 0) {
|
||||
for (int i = 0; i < JSONObject.parseObject(result).getJSONArray("data").size(); i++) {
|
||||
String productionTask = JSONObject.parseObject(JSONObject.toJSONString(JSONObject.parseObject(result)
|
||||
.getJSONArray("data").get(i))).getString("生产任务单");
|
||||
Integer planQty = Integer.parseInt(JSONObject.parseObject(JSONObject.toJSONString(JSONObject.parseObject(result)
|
||||
.getJSONArray("data").get(i))).getString("数量"));
|
||||
String materialSpec = JSONObject.parseObject(JSONObject.toJSONString(JSONObject.parseObject(result)
|
||||
.getJSONArray("data").get(i))).getString("状态");
|
||||
String materialCode = JSONObject.parseObject(JSONObject.toJSONString(JSONObject.parseObject(result)
|
||||
.getJSONArray("data").get(i))).getString("型号");
|
||||
String materialName = JSONObject.parseObject(JSONObject.toJSONString(JSONObject.parseObject(result)
|
||||
.getJSONArray("data").get(i))).getString("物料名称");
|
||||
String saleOrder = JSONObject.parseObject(JSONObject.toJSONString(JSONObject.parseObject(result)
|
||||
.getJSONArray("data").get(i))).getString("销售订单");
|
||||
String plannedCompletionDate = JSONObject.parseObject(JSONObject.toJSONString(JSONObject.parseObject(result)
|
||||
.getJSONArray("data").get(i))).getString("计划完工日期");
|
||||
OrderInfo orderInfo = new OrderInfo();
|
||||
orderInfo.setProductionTask(productionTask);
|
||||
orderInfo.setPlanQty(planQty);
|
||||
orderInfo.setMaterialCode(materialCode);
|
||||
orderInfo.setMaterialName(materialName);
|
||||
orderInfo.setMaterialSpec(materialSpec);
|
||||
orderInfo.setSaleOrder(saleOrder);
|
||||
orderInfo.setPlannedCompletionDate(plannedCompletionDate);
|
||||
orderInfoList.add(orderInfo);
|
||||
}
|
||||
}
|
||||
return orderInfoList;
|
||||
}
|
||||
|
||||
/***
|
||||
* MD5加码 生成32位md5码
|
||||
*/
|
||||
public static String string2MD5(String inStr) {
|
||||
MessageDigest md5 = null;
|
||||
try {
|
||||
md5 = MessageDigest.getInstance("MD5");
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
char[] charArray = inStr.toCharArray();
|
||||
byte[] byteArray = new byte[charArray.length];
|
||||
|
||||
for (int i = 0; i < charArray.length; i++) {
|
||||
byteArray[i] = (byte) charArray[i];
|
||||
}
|
||||
byte[] md5Bytes = md5.digest(byteArray);
|
||||
StringBuffer hexValue = new StringBuffer();
|
||||
for (int i = 0; i < md5Bytes.length; i++) {
|
||||
int val = ((int) md5Bytes[i]) & 0xff;
|
||||
if (val < 16) {
|
||||
hexValue.append("0");
|
||||
}
|
||||
hexValue.append(Integer.toHexString(val));
|
||||
}
|
||||
return hexValue.toString();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,299 @@
|
||||
package com.ruoyi.wms.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cmeim.common.core.exception.ServiceException;
|
||||
import com.cmeim.common.core.utils.DateUtil;
|
||||
import com.cmeim.common.core.web.domain.RespondEnum;
|
||||
import com.ruoyi.wms.enums.AgvTaskEnum;
|
||||
import com.ruoyi.wms.enums.RequestEnum;
|
||||
import com.ruoyi.wms.repository.AgvTaskRepository;
|
||||
import com.ruoyi.wms.repository.AreaConfigRepository;
|
||||
import com.ruoyi.wms.repository.OrderInfoRepository;
|
||||
import com.ruoyi.wms.repository.ShelfInfoRepository;
|
||||
import com.ruoyi.wms.repository.StationInfoRepository;
|
||||
import com.ruoyi.wms.repository.StoreInfoRepository;
|
||||
import com.ruoyi.wms.po.AgvTask;
|
||||
import com.ruoyi.wms.po.AreaConfig;
|
||||
import com.ruoyi.wms.po.ContainerInfo;
|
||||
import com.ruoyi.wms.po.OrderInfo;
|
||||
import com.ruoyi.wms.po.ShelfInfo;
|
||||
import com.ruoyi.wms.po.StationInfo;
|
||||
import com.ruoyi.wms.po.StoreInfo;
|
||||
import com.ruoyi.wms.repository.ContainerInfoRepository;
|
||||
import com.ruoyi.wms.vo.AgvRequestVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/6/30
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ScheduleService {
|
||||
@Autowired
|
||||
private StationInfoRepository stationInfoRepository;
|
||||
@Autowired
|
||||
private AgvTaskRepository agvTaskRepository;
|
||||
@Autowired
|
||||
private ContainerInfoRepository containerInfoRepository;
|
||||
@Autowired
|
||||
private ContainerService containerService;
|
||||
@Autowired
|
||||
private AGVService agvService;
|
||||
@Autowired
|
||||
private StoreInfoRepository storeInfoRepository;
|
||||
@Autowired
|
||||
private OrderInfoRepository orderInfoRepository;
|
||||
@Autowired
|
||||
private ShelfInfoRepository shelfInfoRepository;
|
||||
@Autowired
|
||||
private AreaConfigRepository areaConfigRepository;
|
||||
|
||||
/**
|
||||
* 出库工位任务
|
||||
*/
|
||||
public void waterTest() {
|
||||
//查询出库工位状态
|
||||
final List<StationInfo> stationInfos = stationInfoRepository.findByStationTypeAndStationStatus(10, 10);
|
||||
stationInfos.forEach(e -> {
|
||||
//判断AGV任务列表是否存在该类型并正在进行中的任务
|
||||
AtomicReference<Boolean> flag = new AtomicReference<>(true);
|
||||
List<AgvTask> agvTasks = new ArrayList<>();
|
||||
agvTasks = agvTaskRepository.findByDictTypeAndStatus(RequestEnum.OUTSTORE.getCode(), AgvTaskEnum.ONGOING.getCode());
|
||||
if (agvTasks.size() > 0) {
|
||||
agvTasks.forEach(m -> {
|
||||
//取未完成任务目标工作位的值,如果和当前工作为一致,则不新建任务。
|
||||
JSONObject jsonObject = JSONObject.parseObject(m.getJson());
|
||||
String taskDescribe = jsonObject.getString("taskDescribe");
|
||||
final String toLocationCode = JSONObject.parseObject(taskDescribe).getString("toStationCode");
|
||||
if (toLocationCode.equals(e.getStationCode())) {
|
||||
flag.set(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
waterRequestParam(e.getStationCode(), e.getProductionTask());
|
||||
return;
|
||||
}
|
||||
if (flag.get() && null != agvTasks) {
|
||||
waterRequestParam(e.getStationCode(), e.getProductionTask());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stationCode 工位编码
|
||||
* @param number 任务单号
|
||||
*/
|
||||
public void waterRequestParam(String stationCode, String number) {
|
||||
//得到可以出库的箱子列表
|
||||
final List<ContainerInfo> containerInfos = containerService.queryGreaterThanEightHours();
|
||||
final List<ContainerInfo> collect = containerInfos.stream().filter(e -> e.getProductionTask().equals(number)).collect(Collectors.toList());
|
||||
Integer boxNumber = 4;
|
||||
//判断请求空箱数量是否大约仓库空箱数量
|
||||
if (collect.size() < 4) {
|
||||
boxNumber = collect.size();
|
||||
}
|
||||
List<ContainerInfo> sendContainer = new ArrayList<>();
|
||||
JSONObject data = new JSONObject(true);
|
||||
//搬运方式
|
||||
data.put("taskType", "carry");
|
||||
//任务组优先级
|
||||
data.put("groupPriority", 0);
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
for (int i = 0; i < boxNumber; i++) {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String taskCode = uuid.toString();
|
||||
ContainerInfo containerInfo = collect.get(i);
|
||||
JSONObject data1 = new JSONObject(true);
|
||||
//任务单号
|
||||
data1.put("taskCode", taskCode);
|
||||
//任务优先级
|
||||
data1.put("taskPriority", 2);
|
||||
JSONObject data2 = new JSONObject(true);
|
||||
//容器编码
|
||||
data2.put("containerCode", containerInfo.getContainerNumber());
|
||||
//容器类型
|
||||
data2.put("containerType", "CT_KUBOT_STANDARD");
|
||||
//工作位标签
|
||||
final AreaConfig areaConfig = areaConfigRepository.findByAreaType(RequestEnum.SENDWAITCHECK.getCode());
|
||||
if (null != areaConfig) {
|
||||
data2.put("storageTag", areaConfig.getAreaCode());
|
||||
} else {
|
||||
data2.put("storageTag", "");
|
||||
}
|
||||
//起始工作位
|
||||
data2.put("fromLocationCode", "");
|
||||
//目标工作位
|
||||
data2.put("toLocationCode", "");
|
||||
//目标工作站
|
||||
data2.put("toStationCode", stationCode);
|
||||
data1.put("taskDescribe", data2);
|
||||
taskList.add(data1);
|
||||
sendContainer.add(containerInfo);
|
||||
}
|
||||
if (taskList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
data.put("tasks", taskList);
|
||||
log.info("料箱出库param:" + JSONObject.toJSONString(data));
|
||||
final String result = agvService.taskCreate(JSONObject.toJSONString(data), RequestEnum.OUTSTORE.getCode());
|
||||
log.info("料箱出库result:" + result);
|
||||
int code = JSONObject.parseObject(result).getInteger("code");
|
||||
//请求发送成功
|
||||
if (code == 0) {
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(number);
|
||||
sendContainer.forEach(e -> {
|
||||
//修改为出库中状态
|
||||
e.setContainerStatus(35);
|
||||
containerInfoRepository.save(e);
|
||||
//修改库位状态,待空闲
|
||||
StoreInfo storeInfo = storeInfoRepository.findByStoreCode(e.getStoreCode());
|
||||
if (storeInfo != null) {
|
||||
storeInfo.setStoreStatus(20);
|
||||
storeInfoRepository.save(storeInfo);
|
||||
}
|
||||
//修改单据出库数据
|
||||
if (orderInfo != null) {
|
||||
if (orderInfo.getOnoutingCheckQty() == null) {
|
||||
orderInfo.setOnoutingCheckQty(0);
|
||||
}
|
||||
orderInfo.setOnoutingCheckQty(orderInfo.getOnoutingCheckQty() + e.getQty());
|
||||
//orderInfo.setInQty(orderInfo.getInQty() - e.getQty());
|
||||
}
|
||||
});
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
} else {
|
||||
throw new ServiceException(RespondEnum.FAILURE, "任务发起失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 送检验工位定时任务
|
||||
*/
|
||||
public void sendCheck() {
|
||||
//查询检验工位状态
|
||||
final List<StationInfo> stationInfos = stationInfoRepository.findByStationTypeAndStationStatus(15, 10);
|
||||
stationInfos.forEach(e -> {
|
||||
//判断AGV任务列表是否存在该类型并正在进行中的任务
|
||||
AtomicReference<Boolean> flag = new AtomicReference<>(true);
|
||||
final List<AgvTask> agvTasks = agvTaskRepository.findByDictTypeAndStatus(RequestEnum.SENDCHECK.getCode(), AgvTaskEnum.ONGOING.getCode());
|
||||
if (null != agvTasks) {
|
||||
agvTasks.forEach(m -> {
|
||||
//取未完成任务目标工作位的值,如果和当前工作为一致,则不新建任务。
|
||||
final String toLocationCode = JSONObject.parseObject(m.getJson()).getString("toLocationCode");
|
||||
if (toLocationCode.equals(e.getStationCode())) {
|
||||
flag.set(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sendCheckParam(e.getStoreCode(), e.getProductionTask());
|
||||
}
|
||||
if (flag.get() && null != agvTasks) {
|
||||
sendCheckParam(e.getStoreCode(), e.getProductionTask());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 送检验参数
|
||||
*
|
||||
* @param storeCode 检验工位地码
|
||||
* @param number 任务单
|
||||
*/
|
||||
public void sendCheckParam(String storeCode, String number) {
|
||||
//查询任务单待检货架
|
||||
final List<ShelfInfo> shelfInfos = shelfInfoRepository.findByProductionTaskAndOrderStatus(number, 5);
|
||||
if (shelfInfos.size() == 0) {
|
||||
return;
|
||||
}
|
||||
final StoreInfo storeInfo = storeInfoRepository.findByStoreCode(storeCode);
|
||||
//判断站位是否空闲,如果不是空闲状态结束任务
|
||||
if (storeInfo.getStoreStatus() != 5) {
|
||||
return;
|
||||
}
|
||||
ShelfInfo shelfInfo = shelfInfos.get(0);
|
||||
JSONObject data = new JSONObject(true);
|
||||
//搬运方式
|
||||
data.put("taskType", "carry");
|
||||
//任务组优先级
|
||||
data.put("groupPriority", 0);
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String taskCode = uuid.toString();
|
||||
JSONObject data1 = new JSONObject(true);
|
||||
//任务单号
|
||||
data1.put("taskCode", taskCode);
|
||||
//任务优先级
|
||||
data1.put("taskPriority", 0);
|
||||
JSONObject data2 = new JSONObject(true);
|
||||
//容器编码
|
||||
data2.put("containerCode", shelfInfo.getShelfCode());
|
||||
//容器类型
|
||||
data2.put("containerType", "CT_KUBOT_STANDARD");
|
||||
//工作为标签
|
||||
data2.put("storageTag", "");
|
||||
//起始工作位
|
||||
data2.put("fromLocationCode", "");
|
||||
//目标工作位
|
||||
data2.put("toLocationCode", storeCode);
|
||||
//目标工作站
|
||||
data2.put("toStationCode", "");
|
||||
data1.put("taskDescribe", data2);
|
||||
taskList.add(data1);
|
||||
data.put("tasks", taskList);
|
||||
final String result = agvService.taskCreate(JSONObject.toJSONString(data), RequestEnum.OUTSTORE.getCode());
|
||||
int code = JSONObject.parseObject(result).getInteger("code");
|
||||
//请求发送成功
|
||||
if (code == 0) {
|
||||
OrderInfo orderInfo = orderInfoRepository.findByProductionTask(number);
|
||||
//修改为出库中状态
|
||||
shelfInfo.setOrderStatus(10);
|
||||
shelfInfoRepository.save(shelfInfo);
|
||||
//修改单据出库数据
|
||||
orderInfo.setWaitCheckQty(orderInfo.getWaitCheckQty() - shelfInfo.getQty());
|
||||
orderInfo.setCheckQty(orderInfo.getCheckQty() + shelfInfo.getQty());
|
||||
orderInfo.setUpdatedDt(DateUtil.getCurrentDate());
|
||||
orderInfoRepository.save(orderInfo);
|
||||
} else {
|
||||
throw new ServiceException(RespondEnum.FAILURE, "任务发起失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 待检区已检验货架送抽检定时任务
|
||||
*/
|
||||
public void sendPostCheck() {
|
||||
//查询已完成检验送回待检区的货架
|
||||
final List<ShelfInfo> shelfInfos = shelfInfoRepository.findByOrderStatus(15);
|
||||
//如果没有待检货架,结束任务
|
||||
if (shelfInfos.size() == 0) {
|
||||
return;
|
||||
}
|
||||
final List<StoreInfo> storeInfos = storeInfoRepository.findByStoreTypeAndStoreStatus(20, 5);
|
||||
//如果没有空闲站位,结束任务
|
||||
if (storeInfos.size() == 0) {
|
||||
return;
|
||||
}
|
||||
AgvRequestVo agvRequestVo = new AgvRequestVo();
|
||||
agvRequestVo.setType(0);
|
||||
agvRequestVo.setToLocationCode(storeInfos.get(0).getStoreCode());
|
||||
agvRequestVo.setContainerCode(shelfInfos.get(0).getShelfCode());
|
||||
agvRequestVo.setRequestType(RequestEnum.SENDSPOTCHECK.getCode());
|
||||
agvService.taskParamCreate(agvRequestVo);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.wms.service;
|
||||
|
||||
import com.ruoyi.wms.repository.ShelfInfoRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/28
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ShelfService {
|
||||
@Autowired
|
||||
private ShelfInfoRepository shelfInfoRepository;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.wms.service;
|
||||
|
||||
import com.ruoyi.wms.repository.StationInfoRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/28
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class StationService {
|
||||
@Autowired
|
||||
private StationInfoRepository stationInfoRepository;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.wms.service;
|
||||
|
||||
import com.ruoyi.wms.repository.StoreInfoRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/28
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class StoreService {
|
||||
@Autowired
|
||||
private StoreInfoRepository storeInfoRepository;
|
||||
}
|
@ -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] = 04;
|
||||
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,153 @@
|
||||
package com.ruoyi.wms.util;
|
||||
|
||||
/**
|
||||
* 作者:御坂美琴
|
||||
* date: 9/15/2021
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* java发送http的get和post请求
|
||||
* */
|
||||
public class HttpRequest {
|
||||
/**
|
||||
* ?
|
||||
* @param urlPath ?
|
||||
* @param jsonStr ?
|
||||
* @return ?
|
||||
*/
|
||||
public static String doPost(String urlPath, String jsonStr) {
|
||||
String result = "";
|
||||
BufferedReader reader = null;
|
||||
|
||||
try {
|
||||
URL url = new URL(urlPath);
|
||||
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
|
||||
//设置请求方式为POST
|
||||
conn.setRequestMethod("POST");
|
||||
// 设置超时为10秒
|
||||
conn.setConnectTimeout(60 * 1000);
|
||||
conn.setReadTimeout(60 * 1000);
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
//不使用缓存
|
||||
conn.setUseCaches(false);
|
||||
//使用Keep-Alive连接方式
|
||||
conn.setRequestProperty("Connection", "Keep-Alive");
|
||||
//设置字符格式为UTF-8
|
||||
conn.setRequestProperty("Charset","UTF-8");
|
||||
//设置正文格式为json且字符格式为UTF-8
|
||||
conn.setRequestProperty("Content-Type","application/json;charset=UTF-8");
|
||||
// 设置接收类型否则返回415错误
|
||||
//conn.setRequestProperty("accept","*/*")此处为暴力方法设置接受所有类型,以此来防范返回415;
|
||||
//设置接收格式为accept
|
||||
conn.setRequestProperty("accept","application/json");
|
||||
|
||||
// 往服务器里面发送数据
|
||||
byte[] writebytes = jsonStr.getBytes();
|
||||
conn.setRequestProperty("Content-Length",String.valueOf(writebytes.length));
|
||||
OutputStream outwritestream = conn.getOutputStream();
|
||||
outwritestream.write(jsonStr.getBytes());
|
||||
outwritestream.flush();
|
||||
outwritestream.close();
|
||||
System.out.println("conn" + ":" + conn.toString());
|
||||
System.out.println("conn.getResponseCode()" + ":" + conn.getResponseCode());
|
||||
if (conn.getResponseCode() == 200) {
|
||||
reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
result = reader.readLine();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送 POST 请求出现异常!");
|
||||
//e.printStackTrace();
|
||||
} finally {
|
||||
//使用finally块来关闭输出流、输入流
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("发送 IOException 出现异常!" + "IOException" + ":" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* ?
|
||||
* @param urlPath ?
|
||||
* @param jsonStr ?
|
||||
* @return ?
|
||||
*/
|
||||
public static String doGet(String urlPath, String jsonStr) {
|
||||
String result = "";
|
||||
BufferedReader reader = null;
|
||||
|
||||
try {
|
||||
URL url = new URL(urlPath);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
//设置请求方式为GET
|
||||
conn.setRequestMethod("GET");
|
||||
// 设置超时为10秒
|
||||
conn.setConnectTimeout(10 * 1000);
|
||||
conn.setReadTimeout(10 * 1000);
|
||||
// 发送POST请求必须设置如下两行
|
||||
//conn.setDoOutput(true);
|
||||
//conn.setDoInput(true);
|
||||
//不使用缓存
|
||||
conn.setUseCaches(false);
|
||||
//使用Keep-Alive连接方式
|
||||
conn.setRequestProperty("Connection", "Keep-Alive");
|
||||
//设置字符格式为UTF-8
|
||||
conn.setRequestProperty("Charset","UTF-8");
|
||||
//设置正文格式为json且字符格式为UTF-8
|
||||
conn.setRequestProperty("Content-Type","application/json;charset=UTF-8");
|
||||
// 设置接收类型否则返回415错误
|
||||
//conn.setRequestProperty("accept","*/*")此处为暴力方法设置接受所有类型,以此来防范返回415;
|
||||
//设置接收格式为accept
|
||||
conn.setRequestProperty("accept","application/json");
|
||||
|
||||
// 往服务器里面发送数据
|
||||
//if ((jsonStr != null && !TextUtils.isEmpty(jsonStr)) || true == true) {
|
||||
byte[] writebytes = jsonStr.getBytes();
|
||||
conn.setRequestProperty("Content-Length",String.valueOf(writebytes.length));
|
||||
//OutputStream outwritestream =conn.getOutputStream();
|
||||
//outwritestream.write(jsonStr.getBytes());
|
||||
//outwritestream.flush();
|
||||
//outwritestream.close();
|
||||
//}
|
||||
System.out.println("conn" + ":" + conn.toString());
|
||||
System.out.println("conn.getResponseCode()" + ":" + conn.getResponseCode());
|
||||
if (conn.getResponseCode() == 200) {
|
||||
reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
result = reader.readLine();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送 POST 请求出现异常!");
|
||||
//e.printStackTrace();
|
||||
} finally {
|
||||
//使用finally块来关闭输出流、输入流
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("发送 IOException 出现异常!" + "IOException" + ":" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,145 @@
|
||||
package com.ruoyi.wms.util;
|
||||
|
||||
import com.ruoyi.wms.service.AGVService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.Socket;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/7/5
|
||||
**/
|
||||
@Slf4j
|
||||
public class TcpUtil extends Thread {
|
||||
|
||||
private AGVService agvService;
|
||||
public static TcpUtil tcpUtil;
|
||||
private Socket clientSocket;
|
||||
private PrintWriter out;
|
||||
private InputStream in;
|
||||
OutputStream outputStream = null;
|
||||
DataOutputStream dataOutputStream = null;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
tcpUtil = this;
|
||||
}
|
||||
|
||||
public TcpUtil(Socket socket, AGVService agvService) {
|
||||
this.clientSocket = socket;
|
||||
this.agvService = agvService;
|
||||
}
|
||||
|
||||
//public TcpUtil() {
|
||||
// configureTasks();
|
||||
//}
|
||||
|
||||
//private void configureTasks() {
|
||||
// try {
|
||||
// if (clientSocket == null)
|
||||
// return;
|
||||
// outputStream = clientSocket.getOutputStream();
|
||||
// dataOutputStream = new DataOutputStream(outputStream);
|
||||
// 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());
|
||||
// dataOutputStream.write(bytes);
|
||||
// } catch (IOException e) {
|
||||
// clientSocket = null;
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
out = new PrintWriter(clientSocket.getOutputStream(), true);
|
||||
in = clientSocket.getInputStream();
|
||||
while (true) {
|
||||
log.info("接收");
|
||||
log.info(clientSocket.toString());
|
||||
String inputLine = "";
|
||||
byte[] temp = new byte[10];
|
||||
int length = 0;
|
||||
//clientSocket.shutdownOutput();
|
||||
try {
|
||||
length = in.read(temp);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (length == -1) {
|
||||
return;
|
||||
}
|
||||
inputLine += new String(temp, 0, length, "UTF-8");
|
||||
//log.info("inputLine:" + inputLine);
|
||||
if (".".equals(inputLine)) {
|
||||
out.println("bye");
|
||||
break;
|
||||
}
|
||||
final String s = BinaryToHexString(temp);
|
||||
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")) {
|
||||
//成品出库
|
||||
agvService.outProdStore("04");
|
||||
} else if (status.equals("03") || status.equals("01")) {
|
||||
//成品出库
|
||||
agvService.outProdStore("01");
|
||||
} else if (status.equals("00") || status.equals("02")) {
|
||||
//成品出库
|
||||
agvService.outProdStore("04");
|
||||
try {
|
||||
sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
agvService.outProdStore("01");
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
clientSocket.close();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字节数组转换成十六进制的字符串
|
||||
*
|
||||
* @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,10 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
/**
|
||||
* @Verasion:1.0
|
||||
* @Author:DZY
|
||||
* @Date:2023/6/27
|
||||
* AGV回调参数
|
||||
**/
|
||||
public class AgvCallBackVo {
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
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;
|
||||
//上次任务号
|
||||
public String lastRequestCode;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/7/6
|
||||
*/
|
||||
@Data
|
||||
public class AgvTaskExportVo {
|
||||
@ApiParam(value = "请求单号")
|
||||
private String requestCode;
|
||||
@ApiParam(value = "类型 1:请求空箱 2:入水测 3:出水测 4:送待检 5:送检验 6:回待检 7:送抽检 8:送成品库 9:出成品库")
|
||||
private Integer dictType;
|
||||
private String dictTypeShow;
|
||||
@ApiParam(value = "json")
|
||||
private String json;
|
||||
@ApiParam(value = "任务状态 1:未发起 2:进行中 3:已完成 4:失败 5:取消 6:挂起")
|
||||
private Integer status;
|
||||
private String statusShow;
|
||||
@ApiParam(value = "处理结果")
|
||||
private String message;
|
||||
@ApiParam(value = "创建人")
|
||||
private String createdBy;
|
||||
@ApiParam(value = "创建时间")
|
||||
private String createdDt;
|
||||
}
|
@ -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,41 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/7/6
|
||||
*/
|
||||
@Data
|
||||
public class ContainerInfoExportVo {
|
||||
@ApiParam(value = "周装箱号(入库时不存在,自动增加)")
|
||||
private String containerNumber;
|
||||
@ApiParam(value = "周装箱状态:5-空闲(库外),从出库工位完成出库后标记为该状态10-空闲(库内),空箱完成入库上架后的状态15-入库中(手动),PDA扫描确认数量的20-入库中(自动),滚筒线扫描枪扫描后确认数量的25-入库中(空箱),夜班模式空箱入库30-在库,非空空箱在库35-出库中,发送出库调度任务后")
|
||||
private Integer containerStatus;
|
||||
@ApiParam(value = "周装箱状态:5-空闲(库外),从出库工位完成出库后标记为该状态10-空闲(库内),空箱完成入库上架后的状态15-入库中(手动),PDA扫描确认数量的20-入库中(自动),滚筒线扫描枪扫描后确认数量的25-入库中(空箱),夜班模式空箱入库30-在库,非空空箱在库35-出库中,发送出库调度任务后")
|
||||
private String containerStatusShow;
|
||||
@ApiParam(value = "周装箱装表数量")
|
||||
private Integer qty;
|
||||
@ApiParam(value = "库位编码(iCMX-A01-05-03)")
|
||||
private String storeCode;
|
||||
@ApiParam(value = "开始入库时间(人工扫描或自动扫描时间)")
|
||||
private String onInstoreTime;
|
||||
@ApiParam(value = "入库时间(机器人放到库位上时间)")
|
||||
private String instoreTime;
|
||||
@ApiParam(value = "开始出库时间(机器人开始出库作业时间)")
|
||||
private String onOutstoreTime;
|
||||
@ApiParam(value = "出库时间(机器人取货到出库工位完成时间)")
|
||||
private String outstoreTime;
|
||||
@ApiParam(value = "生产任务单")
|
||||
private String productionTask;
|
||||
@ApiParam(value = "创建人")
|
||||
private String createdBy;
|
||||
@ApiParam(value = "创建时间")
|
||||
private String createdDt;
|
||||
@ApiParam(value = "更新人")
|
||||
private String updatedBy;
|
||||
@ApiParam(value = "更新时间")
|
||||
private String updatedDt;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/7/22
|
||||
*/
|
||||
@Data
|
||||
public class DataVo {
|
||||
private boolean allow;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import com.ruoyi.wms.po.OrderInfo;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/30
|
||||
*/
|
||||
@Data
|
||||
public class FindOrderByStationVo extends OrderInfo {
|
||||
@ApiParam(value = "工位状态(5-空闲(默认)、10-作业中、15-停止作业、20-作业完成)")
|
||||
private Integer stationStatus;
|
||||
|
||||
@ApiParam(value = "工位名称")
|
||||
private String stationName;
|
||||
|
||||
@ApiParam(value = "工位类型:5-入库工位10-出库工位15-校验工位20-抽检工位25-发货库位")
|
||||
private Integer stationType;
|
||||
|
||||
@ApiParam(value = "工位编码")
|
||||
private String stationCode;
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/7/6
|
||||
*/
|
||||
@Data
|
||||
public class OrderInfoExportVo {
|
||||
@ApiParam(value = "生产任务单")
|
||||
private String productionTask;
|
||||
@ApiParam(value = "单据状态(5-已录入、10-部分入库、15-全部入库)")
|
||||
private Integer orderStatus;
|
||||
private String orderStatusShow;
|
||||
@ApiParam(value = "销售订单")
|
||||
private String saleOrder;
|
||||
@ApiParam(value = "物料编码")
|
||||
private String materialCode;
|
||||
@ApiParam(value = "物料名称")
|
||||
private String materialName;
|
||||
@ApiParam(value = "物料规格")
|
||||
private String materialSpec;
|
||||
@ApiParam(value = "计划完工日期")
|
||||
private String plannedCompletionDate;
|
||||
@ApiParam(value = "计划数量")
|
||||
private Integer planQty;
|
||||
@ApiParam(value = "已入库数")
|
||||
private Integer inQty;
|
||||
@ApiParam(value = "入库中数量")
|
||||
private Integer ongoingQty;
|
||||
@ApiParam(value = "出库数量")
|
||||
private Integer outQty;
|
||||
@ApiParam(value = "出库中数量")
|
||||
private Integer onoutingCheckQty;
|
||||
@ApiParam(value = "待校验数")
|
||||
private Integer waitCheckQty;
|
||||
@ApiParam(value = "已校验数")
|
||||
private Integer finishCheckQty;
|
||||
@ApiParam(value = "校验中数")
|
||||
private Integer checkQty;
|
||||
@ApiParam(value = "成品区已入库数")
|
||||
private Integer productInQty;
|
||||
@ApiParam(value = "成品区入库中数量")
|
||||
private Integer productOngoingQty;
|
||||
@ApiParam(value = "成品区出库数量")
|
||||
private Integer productOutQty;
|
||||
@ApiParam(value = "成品区出库中数量")
|
||||
private Integer productOnoutingQty;
|
||||
@ApiParam(value = "创建人")
|
||||
private String createdBy;
|
||||
@ApiParam(value = "创建时间")
|
||||
private String createdDt;
|
||||
@ApiParam(value = "更新人")
|
||||
private String updatedBy;
|
||||
@ApiParam(value = "更新时间")
|
||||
private String updatedDt;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/6/27
|
||||
*/
|
||||
@Data
|
||||
public class OrderQueryVo {
|
||||
@ApiParam(value = "销售订单")
|
||||
private String billCode;
|
||||
|
||||
@ApiParam(value = "1:生产任务单")
|
||||
private String mode;
|
||||
|
||||
@ApiParam(value = "左右")
|
||||
private String direction ;
|
||||
|
||||
@ApiParam(value = "token码")
|
||||
private String token;
|
||||
}
|
@ -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,33 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/7/6
|
||||
*/
|
||||
@Data
|
||||
public class ShelfInfoExportVo {
|
||||
@ApiParam(value = "货架编码")
|
||||
private String shelfCode;
|
||||
@ApiParam(value = "货架状态空闲占用禁用(预留功能)")
|
||||
private Integer shelfStatus;
|
||||
private String shelfStatusShow;
|
||||
@ApiParam(value = "生产任务单")
|
||||
private String productionTask;
|
||||
@ApiParam(value = "存放表数量")
|
||||
private Integer qty;
|
||||
@ApiParam(value = "当前货架存放任务单状态:5-待校验10-校验中15-校验完成20-待抽检25-待出库(缓存区)30-待出库(出库位)35-出库完成40-空箱")
|
||||
private Integer orderStatus;
|
||||
private String orderStatusShow;
|
||||
@ApiParam(value = "创建人")
|
||||
private String createdBy;
|
||||
@ApiParam(value = "创建时间")
|
||||
private String createdDt;
|
||||
@ApiParam(value = "更新人")
|
||||
private String updatedBy;
|
||||
@ApiParam(value = "更新时间")
|
||||
private String updatedDt;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import com.ruoyi.wms.po.OrderInfo;
|
||||
import com.ruoyi.wms.po.ShelfInfo;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/9/10
|
||||
*/
|
||||
@Data
|
||||
public class ShelfVo extends ShelfInfo {
|
||||
private OrderInfo orderInfo;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import com.ruoyi.wms.po.ShelfInfo;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/8/31
|
||||
*/
|
||||
@Data
|
||||
public class SpotCheckVo extends ShelfInfo {
|
||||
private String requestCode;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/7/7
|
||||
*/
|
||||
@Data
|
||||
public class StationInfoExportVo {
|
||||
@ApiParam(value = "工位编码")
|
||||
private String stationCode;
|
||||
@ApiParam(value = "对应地码")
|
||||
private String storeCode;
|
||||
@ApiParam(value = "工位名称")
|
||||
private String stationName;
|
||||
@ApiParam(value = "工位类型:5-入库工位10-出库工位15-校验工位20-抽检工位25-发货库位")
|
||||
private Integer stationType;
|
||||
private String stationTypeShow;
|
||||
@ApiParam(value = "工位状态(5-空闲(默认)、10-作业中、15-停止作业、20-作业完成)")
|
||||
private Integer stationStatus;
|
||||
private String stationStatusShow;
|
||||
@ApiParam(value = "工位子编码")
|
||||
private String stationSubnumber;
|
||||
@ApiParam(value = "生产任务单")
|
||||
private String productionTask;
|
||||
@ApiParam(value = "创建人")
|
||||
private String createdBy;
|
||||
@ApiParam(value = "创建时间")
|
||||
private String createdDt;
|
||||
@ApiParam(value = "更新人")
|
||||
private String updatedBy;
|
||||
@ApiParam(value = "更新时间")
|
||||
private String updatedDt;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.ruoyi.wms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 李俊辉
|
||||
* @version 1.0
|
||||
* date: 2023/7/7
|
||||
*/
|
||||
@Data
|
||||
public class StoreInfoExportVo {
|
||||
@ApiParam(value = "库位编码")
|
||||
private String storeCode;
|
||||
@ApiParam(value = "库位类型:5-干湿库位 10-缓存库位 15-检验库位 20-抽检库位 25-成品缓存库位 30-成品出库库位 35-空车回库库位 ")
|
||||
private Integer storeType;
|
||||
private String storeTypeShow;
|
||||
@ApiParam(value = "库位状态 5-空闲:机器人任务回调后10-待占用:机器人任务发起后15-占用:机器人任务回调后20-待空闲:机器人任务发起后")
|
||||
private Integer storeStatus;
|
||||
private String storeStatusShow;
|
||||
@ApiParam(value = "库位属于的工位编码")
|
||||
private String stationCode;
|
||||
@ApiParam(value = "货架编码")
|
||||
private String shelfCode;
|
||||
@ApiParam(value = "创建人")
|
||||
private String createdBy;
|
||||
@ApiParam(value = "创建时间")
|
||||
private String createdDt;
|
||||
@ApiParam(value = "更新人")
|
||||
private String updatedBy;
|
||||
@ApiParam(value = "更新时间")
|
||||
private String updatedDt;
|
||||
}
|
Reference in New Issue
Block a user