| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | 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.WMSAndAGVInterfaceParam; |
| | |
| | | import com.zy.core.model.CrnSlave; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.CommandPackage; |
| | | import com.zy.core.model.command.CrnCommand; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 立体仓库WCS系统主流程业务 |
| | |
| | | private StaDescMapper staDescMapper; |
| | | @Autowired |
| | | private CommandInfoService commandInfoService; |
| | | |
| | | @Autowired |
| | | private OpenServiceImpl openServiceImpl; |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | |
| | | // ToWmsDTO toWmsDTO = new ToWmsDTO(); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("x-api-key","7a15b5db-29b6-552c-8cff-0cfec3756da2"); |
| | | // List<Integer> list = openServiceImpl.getInEnableRoadway(); |
| | | // |
| | | // //TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); |
| | | // toWmsDTO.setWarehouseId("1688469798893297665"); |
| | | // toWmsDTO.setContainerCode(param.getContainerCode()); |
| | | // toWmsDTO.setApplyType("TUNNEL"); |
| | | // toWmsDTO.setWharfSource(null); |
| | | // toWmsDTO.setCanInboundTunnels(list); |
| | | // String response = null; |
| | | // try { |
| | | // response = new HttpHandler.Builder() |
| | | // .setHeaders(map) |
| | | // .setUri(wmsUrl) |
| | | // .setPath("wcsManager/wcsInterface/inboundTaskApply") |
| | | // .setJson(JSON.toJSONString(toWmsDTO)) |
| | | // .build() |
| | | // .doPost(); |
| | | // }catch (Exception e){ |
| | | // |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | if (commandInfos.isEmpty()) { |
| | | continue;//命令空 |
| | | } |
| | | |
| | | // CommandPackage commandPackage = JSON.parseObject(commandInfo.getCommand(), CommandPackage.class);//取出命令报文 |
| | | // CrnCommand crnCommand = JSON.parseObject(commandPackage.getCommand().toString(), CrnCommand.class); |
| | | Integer commandStep = taskWrk.getCommandStep(); |
| | | CommandInfo commandInfo = commandInfos.get(commandStep); |
| | | StaProtocol staProtocol1 = JSON.parseObject(commandInfo.getCommand(), StaProtocol.class); |
| | | CommandPackage commandPackage = JSON.parseObject(commandInfo.getCommand(), CommandPackage.class);//取出命令报文 |
| | | //StaProtocol staProtocol1 = JSON.parseObject(commandInfo.getCommand(), StaProtocol.class); |
| | | StaProtocol staProtocol1 = JSON.parseObject(commandPackage.getCommand().toString(), StaProtocol.class); |
| | | if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol1))) { |
| | | log.error("输送线命令下方失败!!! [工作号:{}]", taskWrk.getWrkNo()); |
| | | continue;//命令下发失败 |
| | |
| | | /** |
| | | * 入出库 ===>> 堆垛机入出库作业下发 |
| | | */ |
| | | public synchronized void crnIoExecute(){ |
| | | public synchronized void crnIoExecute() throws IOException { |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | // 获取堆垛机信息 |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); |
| | |
| | | /** |
| | | * 入库 ===>> 堆垛机站到库位 |
| | | */ |
| | | public void crnStnToLoc(CrnSlave slave, CrnProtocol crnProtocol){ |
| | | public void crnStnToLoc(CrnSlave slave, CrnProtocol crnProtocol) throws IOException { |
| | | for (CrnSlave.CrnStn crnStn : slave.getCrnInStn()) { |
| | | List<StaDesc> staDescs = staDescMapper.selectList(new EntityWrapper<StaDesc>().eq("crn_no", slave.getId()).eq("crn_stn", crnStn.getStaNo())); |
| | | for (StaDesc staDesc : staDescs) { |
| | |
| | | continue;//命令空 |
| | | } |
| | | CommandInfo commandInfo = commandInfos.get(commandStep); |
| | | CrnCommand crnCommand = JSON.parseObject(commandInfo.getCommand(), CrnCommand.class);//取出命令报文 |
| | | CommandPackage commandPackage = JSON.parseObject(commandInfo.getCommand(), CommandPackage.class);//取出命令报文 |
| | | CrnCommand crnCommand = JSON.parseObject(commandPackage.getCommand().toString(), CrnCommand.class); |
| | | |
| | | if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); |
| | |
| | | continue;//命令空 |
| | | } |
| | | CommandInfo commandInfo = commandInfos.get(commandStep); |
| | | CrnCommand crnCommand = JSON.parseObject(commandInfo.getCommand(), CrnCommand.class);//取出命令报文 |
| | | CommandPackage commandPackage = JSON.parseObject(commandInfo.getCommand(), CommandPackage.class);//取出命令报文 |
| | | CrnCommand crnCommand = JSON.parseObject(commandPackage.getCommand().toString(), CrnCommand.class); |
| | | |
| | | if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); |