pom.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/controller/OpenController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/entity/ToWmsDTO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/entity/param/TaskCreateParam.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/OpenService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
pom.xml
@@ -200,7 +200,7 @@ </dependencies> <build> <finalName>wxwcs</finalName> <finalName>ryzhwcs</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> src/main/java/com/zy/asrs/controller/OpenController.java
@@ -1,7 +1,6 @@ package com.zy.asrs.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.annotations.AppAuth; import com.core.common.BaseRes; @@ -11,9 +10,8 @@ import com.zy.asrs.entity.*; import com.zy.asrs.entity.param.TaskOverParam; import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam; import com.zy.asrs.entity.param.taskCreateParam; import com.zy.asrs.entity.param.TaskCreateParam; import com.zy.asrs.service.*; import com.zy.common.utils.HttpHandler; import com.zy.common.web.BaseController; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -23,7 +21,6 @@ import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.sql.ResultSetMetaData; import java.util.*; @Slf4j @@ -47,6 +44,8 @@ private BasCrnpService basCrnpService; @Autowired private StaDescService staDescService; @Autowired private LocMastService locMastService; @Value("${wms.url}") private String wmsUrl; @@ -79,7 +78,7 @@ //创建任务 @PostMapping("/taskCreate") public R taskCreate(@RequestHeader String appkey, @RequestBody taskCreateParam param, @RequestBody TaskCreateParam param, HttpServletRequest request) { auth(appkey, param, request); if (Cools.isEmpty(param)) { @@ -241,63 +240,86 @@ List<WMSAndAGVInterfaceParam> params1 =new ArrayList<>(); for (WMSAndAGVInterfaceParam param:params){ if (Cools.isEmpty(param)){ return R.error("参数为空!"); } else if (Cools.isEmpty(param.getTaskNo())){ return R.error("任务号为空!"); } else if (Cools.isEmpty(param.getTaskType())){ return R.error("任务类型为空!"); } else if (Cools.isEmpty(param.getWarehouseId())){ return R.error("仓库标识为空!"); } if (Cools.isEmpty(param.getTaskPriority())){ param.setTaskPriority(1); } if (Cools.isEmpty(param.getContainerCode())){ return R.error("容器编码(托盘码)为空!"); } if (Cools.isEmpty(param.getEmptyContainer())){ return R.error("是否空托盘信号为空!"); } if (!param.getTaskType().equals("YK")){ if (Cools.isEmpty(param.getTargetWharf())){ return R.error("目标码头区域为空!");//G开头=7车间,H开头=8层,J开头=9车间 } } if (Cools.isEmpty(param)){ return R.error("参数为空!"); } else if (Cools.isEmpty(param.getTaskNo())){ return R.error("任务号为空!"); } else if (Cools.isEmpty(param.getTaskType())){ return R.error("任务类型为空!"); } else if (Cools.isEmpty(param.getWarehouseId())){ return R.error("仓库标识为空!"); } if (Cools.isEmpty(param.getTaskPriority())){ param.setTaskPriority(1); } if (Cools.isEmpty(param.getSourceLocationCode()) || Cools.isEmpty(param.getTargetLocationCode())){ return R.error("初始目标或者目标位为空"); } // if (Cools.isEmpty(param.getContainerCode())){ // return R.error("容器编码(托盘码)为空!"); // } // if (Cools.isEmpty(param.getEmptyContainer())){ // return R.error("是否空托盘信号为空!"); // } // if (!param.getTaskType().equals("YK")){ // if (Cools.isEmpty(param.getTargetWharf())){ // return R.error("目标码头区域为空!");//G开头=7车间,H开头=8层,J开头=9车间 // } // } StaDesc staDesc = new StaDesc(); if (param.getTaskType().equals("CK") && param.getTargetWharf().contains("J")){ staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() .eq("crn_no",param.getTaskTunnel()) .eq("type_no",2) .lt("stn_no",200)); }else if (param.getTaskType().equals("CK") && param.getTargetWharf().contains("H")){ staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() .eq("crn_no",param.getTaskTunnel()) .eq("type_no",2) .lt("stn_no",400) .gt("stn_no",200)); }else { staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() .eq("crn_no",param.getTaskTunnel()) .eq("type_no",2) .lt("stn_no",500) .ge("stn_no",400)); LocMast locMast = locMastService.selectByLocNo(param.getSourceLocationCode()); if(Cools.isEmpty(locMast)){ return R.error("初始库位无法找到"); } Integer ioType = TaskCreateParam.convertParamIoType(param.getTaskType()); if(ioType == 2){ //出库任务创建 StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() .eq("type_no",2) .eq("crn_no",locMast.getCrnNo()) .eq("stn_no",param.getTargetLocationCode())); if(Cools.isEmpty(staDesc)){ return R.error("出库路劲不存在"); } param.setTargetLocationCode(staDesc.getStnNo().toString()); R r = openService.taskCreate(new TaskCreateParam(param)); }else if (ioType == 3){ //移库任务创建 } // if (param.getTaskType().equals("CK") && param.getTargetWharf().contains("J")){ // staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() // .eq("crn_no",param.getTaskTunnel()) // .eq("type_no",2) // .lt("stn_no",200)); // }else if (param.getTaskType().equals("CK") && param.getTargetWharf().contains("H")){ // staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() // .eq("crn_no",param.getTaskTunnel()) // .eq("type_no",2) // .lt("stn_no",400) // .gt("stn_no",200)); // }else { // staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() // .eq("crn_no",param.getTaskTunnel()) // .eq("type_no",2) // .lt("stn_no",500) // .ge("stn_no",400)); // } //param.setTargetLocationCode(staDesc.getStnNo().toString()); R r = openService.taskCreate(new taskCreateParam(param)); R r = openService.taskCreate(new TaskCreateParam(param)); apiLogService.save("Wms任务下发接口" ,request.getRemoteAddr()+request.getRequestURI() ,appkey ,request.getRemoteAddr() ,JSON.toJSONString(param) ,r.toString() ,true ); apiLogService.save("Wms任务下发接口" ,request.getRemoteAddr()+request.getRequestURI() ,appkey ,request.getRemoteAddr() ,JSON.toJSONString(param) ,r.toString() ,true ); } src/main/java/com/zy/asrs/entity/ToWmsDTO.java
@@ -8,7 +8,7 @@ @Data public class ToWmsDTO { private String warehouseId; //private String containerCode; private String containerCode; private String applyType; private String wharfSource; @@ -16,16 +16,16 @@ private List<Integer> canInboundTunnels; // 容器编码 private String containerCode; private String barcode; //容器类型 private String containerTypeCode; private String ioType; //入库站编号 private Integer stationCode; //库位类型 private String locationTypes; private String locType; public ToWmsDTO(String containerCode, Integer stationCode){ this.containerCode = containerCode; public ToWmsDTO(String barcode, Integer stationCode){ this.barcode = barcode; this.stationCode = stationCode; } src/main/java/com/zy/asrs/entity/param/TaskCreateParam.java
File was renamed from src/main/java/com/zy/asrs/entity/param/taskCreateParam.java @@ -3,7 +3,7 @@ import lombok.Data; @Data public class taskCreateParam { public class TaskCreateParam { //任务号 private String taskNo; @@ -31,9 +31,9 @@ //堆垛机 private Integer crn; public taskCreateParam(){}; public TaskCreateParam(){}; public taskCreateParam(WMSAndAGVInterfaceParam param){ public TaskCreateParam(WMSAndAGVInterfaceParam param){ this.taskNo = param.getTaskNo(); this.ioType = convertParamIoType(param.getTaskType()); this.barcode = param.getContainerCode(); src/main/java/com/zy/asrs/service/OpenService.java
@@ -3,15 +3,14 @@ import com.core.common.R; import com.zy.asrs.entity.param.TaskOverParam; import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam; import com.zy.asrs.entity.param.taskCreateParam; import com.zy.asrs.entity.param.TaskCreateParam; import javax.servlet.http.HttpServletRequest; import java.io.IOException; public interface OpenService { //创建任务 R taskCreate(taskCreateParam param); R taskCreate(TaskCreateParam param); R AgvToWCSToWms(WMSAndAGVInterfaceParam param) throws IOException; src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -4,21 +4,14 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.common.Cools; import com.core.common.R; import com.core.common.SpringUtils; import com.core.exception.CoolException; import com.fasterxml.jackson.databind.ObjectMapper; import com.zy.asrs.domain.enums.TaskStatusType; import com.zy.asrs.entity.*; import com.zy.asrs.entity.param.TaskOverToWms; import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam; import com.zy.asrs.entity.param.taskCreateParam; import com.zy.asrs.mapper.*; import com.zy.asrs.service.*; import com.zy.asrs.utils.CommandUtils; import com.zy.asrs.utils.PostMesDataUtils; import com.zy.asrs.utils.Utils; import com.zy.common.service.CommonService; import com.zy.common.utils.HttpHandler; import com.zy.core.CrnThread; import com.zy.core.DevpThread; @@ -34,7 +27,6 @@ import com.zy.core.model.protocol.StaProtocol; import com.zy.core.properties.SlaveProperties; import com.zy.core.thread.BarcodeThread; import com.zy.core.thread.LedThread; import com.zy.core.thread.SiemensDevpThread; import com.zy.system.entity.Config; import com.zy.system.service.ConfigService; @@ -43,6 +35,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.io.IOException; import java.util.*; @@ -100,6 +93,9 @@ public void generateStoreWrkFile() throws IOException, InterruptedException { try { // 根据输送线plc遍历 for (DevpSlave devp : slaveProperties.getDevp()) { // 遍历入库口 @@ -186,20 +182,23 @@ // 请求wms接口,获取工作号和目标库位 ToWmsDTO toWmsDTO = new ToWmsDTO(barcode,staProtocol.getSiteId()); String response; try { response = new HttpHandler.Builder() .setHeaders(null) .setUri(wmsUrl) .setPath(inboundTaskApplyPath) .setJson(JSON.toJSONString(toWmsDTO)) .build() .doPost(); }catch (Exception e){ log.error("wms通讯失败,"+e.getMessage()); continue; } response = new HttpHandler.Builder() .setHeaders(null) .setUri(wmsUrl) .setPath(inboundTaskApplyPath) .setJson(JSON.toJSONString(toWmsDTO)) .build() .doPost(); JSONObject jsonObject = JSON.parseObject(response); apiLogService.save("wms请求入库货位接口" ,wmsUrl+inboundTaskApplyPath ,null ,"127.0.0.1" ,JSON.toJSONString(toWmsDTO) ,response ,true ); if (jsonObject.getInteger("code").equals(200) && !Cools.isEmpty(jsonObject.get("data").toString())) { GetWmsDto getWmsDto = JSON.parseObject(jsonObject.get("data").toString(), GetWmsDto.class); // 创新一个入库工作档 @@ -301,6 +300,10 @@ } } } catch (Exception e) { log.error("generateStoreWrkFile e", e); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } } src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -12,7 +12,7 @@ import com.zy.asrs.entity.ToWmsDTO; import com.zy.asrs.entity.param.TaskOverParam; import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam; import com.zy.asrs.entity.param.taskCreateParam; import com.zy.asrs.entity.param.TaskCreateParam; import com.zy.asrs.service.ApiLogService; import com.zy.asrs.service.OpenService; import com.zy.asrs.service.StaDescService; @@ -31,7 +31,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.util.*; @@ -60,7 +59,7 @@ @Override public R taskCreate(taskCreateParam param) { public R taskCreate(TaskCreateParam param) { TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); if (taskWrk != null) { throw new CoolException(param.getTaskNo() + "任务已存在,请勿重复提交"); @@ -162,7 +161,7 @@ WMSAndAGVInterfaceParam data = JSONObject.parseObject(jsonObject.get("data").toString(), WMSAndAGVInterfaceParam.class); String msg = null; try { taskCreate(new taskCreateParam(data)); taskCreate(new TaskCreateParam(data)); }catch (Exception e){ msg = e.getMessage(); }