| | |
| | | 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.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 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; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 立体仓库WCS系统主流程业务 |
| | |
| | | private String movePath; |
| | | |
| | | |
| | | public void generateStoreWrkFile() { |
| | | public void generateStoreWrkFile() throws IOException, InterruptedException { |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历入库口 |
| | |
| | | Short workNo = staProtocol.getWorkNo(); |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | && !staProtocol.isInEnable() |
| | | && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && (workNo >= 0) |
| | | && staProtocol.isPakMk()) { |
| | | |
| | |
| | | staProtocol.setWorkNo(workNo); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); |
| | | |
| | | TaskWrk taskWrk = taskWrkMapper.selectByWrkNo(Integer.valueOf(workNo)); |
| | | if (taskWrk != null) { |
| | |
| | | } |
| | | 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){ |
| | | // |
| | | // } |
| | | StaDescService staDescService = SpringUtils.getBean(StaDescService.class); |
| | | StaDesc staDesc1 = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("stn_no",inSta.getBackSta())); |
| | | 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.selectOne(new EntityWrapper<TaskWrk>().eq("barcode", barcode).eq("crn_no",staDesc1.getCrnNo())); |
| | | |
| | | if (Cools.isEmpty(taskWrk)){ |
| | | continue; |
| | | } |
| | | |
| | | if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null && taskWrk.getWrkNo() != null && taskWrk.getWrkNo().shortValue() != workNo){ |
| | | //获取堆垛机站点 |
| | | StaDesc staDesc = new StaDesc(); |
| | | if (devp.getId() <= 1){ |
| | | staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() |
| | | .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("crn_stn", 200)); |
| | | }else { |
| | | staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() |
| | | .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).ge("crn_stn", 200)); |
| | | } |
| | | staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(staDesc.getCrnStn().shortValue()); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); |
| | | Thread.sleep(200); |
| | | }else { |
| | | //TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); |
| | | toWmsDTO.setWarehouseId("1688469798893297665"); |
| | | toWmsDTO.setContainerCode(barcode); |
| | | toWmsDTO.setApplyType("TUNNEL_LOCATION"); |
| | | toWmsDTO.setTaskTunnel(taskWrk.getCrnNo()); |
| | | 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){ |
| | | log.error("wms通讯失败,"+e.getMessage()); |
| | | continue; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | GetWmsDto getWmsDto = JSON.parseObject(jsonObject.get("data").toString(), GetWmsDto.class); |
| | | taskWrk.setOriginTargetPoint(getWmsDto.getTargetLocationCode()); |
| | | taskWrk.setTargetPoint(Utils.getWcsLocNo(getWmsDto.getTargetLocationCode())); |
| | | taskWrk.setStartPoint(String.valueOf(inSta.getBackSta())); |
| | | if (!taskWrkService.updateById(taskWrk)){ |
| | | log.error("保存wms库位号失败"); |
| | | } |
| | | |
| | | }else { |
| | | log.error("wms通讯失败,"+jsonObject.get("msg")); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | if (taskWrk.getIoType() == 1) { |
| | | //入库任务 |
| | | taskWrk.setWrkSts(4);//3.吊车入库中 => 4.入库完成 |
| | | taskWrk.setStatus(TaskStatusType.COMPLETE.id); |
| | | //taskWrk.setStatus(TaskStatusType.COMPLETE.id); |
| | | taskWrk.setModiTime(now); |
| | | taskWrkService.updateById(taskWrk); |
| | | |