| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.dto.NotifyCustomDataDto; |
| | | import com.zy.asrs.domain.enums.NotifyMsgType; |
| | | import com.zy.asrs.domain.enums.RedisKeyType; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.domain.enums.WorkNoType; |
| | | import com.zy.asrs.entity.*; |
| | |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.*; |
| | | import com.zy.core.enums.DevpType.DevpRequestType; |
| | | import com.zy.core.enums.DevpType.DevpStateType; |
| | | import com.zy.core.enums.DevpType.DevpTrayType; |
| | | import com.zy.core.enums.DevpType.DevpWorkType; |
| | | import com.zy.core.model.CrnSlave; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.Task; |
| | |
| | | @Autowired |
| | | private TaskWrkService taskWrkService; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private StaDescMapper staDescMapper; |
| | | @Autowired |
| | | private CommandInfoService commandInfoService; |
| | | @Autowired |
| | | private OpenServiceImpl openServiceImpl; |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | @Autowired |
| | |
| | | private CrnOperaUtils crnOperaUtils; |
| | | @Autowired |
| | | private NotifyUtils notifyUtils; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Value("${wms.count}") |
| | | private Integer maxCount; |
| | | @Value("${wms.url}") |
| | |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | Short workNo = staProtocol.getWorkNo().shortValue(); |
| | | Short stano = staProtocol.getStaNo(); |
| | | |
| | | // 尺寸检测异常 |
| | | boolean back = false; |
| | |
| | | String response = ""; |
| | | Boolean success = false; |
| | | try { |
| | | Object object = redisUtil.get(RedisKeyType.IN_TASK_LOCK.key); |
| | | if(object != null) { |
| | | continue; |
| | | } |
| | | |
| | | response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath(inboundTaskApplyPath) |
| | |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | redisUtil.set(RedisKeyType.IN_TASK_LOCK.key, "lock", 5); |
| | | if (jsonObject.getInteger("code") != 200) { |
| | | log.info("条码:" + barcode + "申请WMS失败,response=" + JSON.toJSONString(jsonObject)); |
| | | continue; |
| | | } |
| | | |
| | | if (back) { |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | continue; |
| | | } |
| | | |
| | |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | // 遍历堆垛机出库站 |
| | | for (CrnSlave.CrnStn crnStn : crnSlave.getCrnOutStn()) { |
| | | List<StaDesc> staDescs = staDescMapper.selectList(new EntityWrapper<StaDesc>().eq("crn_no", crnSlave.getId()).eq("crn_stn", crnStn.getStaNo())); |
| | | List<StaDesc> staDescs = staDescMapper.selectList(new EntityWrapper<StaDesc>().eq("type_no", 2).eq("crn_no", crnSlave.getId()).eq("crn_stn", crnStn.getStaNo())); |
| | | for (StaDesc staDesc : staDescs) { |
| | | try { |
| | | // 获取堆垛机出库站信息 |
| | |
| | | continue; |
| | | } |
| | | |
| | | LocMast locMast=locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | //判断其库位是否为深库位,如果为深库位找其浅库位是都有货 |
| | | if(locMast.getRow1()==1||locMast.getRow1()==5){ |
| | | LocMast locMast1=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", (locMast.getRow1()+1)) |
| | | .eq("bay1",locMast.getBay1()) |
| | | .eq("lev1",locMast.getLev1()).eq("loc_sts","F")); |
| | | if (!Cools.isEmpty(locMast1)){ |
| | | log.info(locMast.getLocNo()+"出深库位,浅库位有货"); |
| | | continue; |
| | | } |
| | | }else if(locMast.getRow1()==4||locMast.getRow1()==8){ |
| | | LocMast locMast1=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", (locMast.getRow1()-1)) |
| | | .eq("bay1",locMast.getBay1()) |
| | | .eq("lev1",locMast.getLev1()).eq("loc_sts","F")); |
| | | if (!Cools.isEmpty(locMast1)){ |
| | | log.info(locMast.getLocNo()+"出深库位,浅库位有货"); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | // 获取堆垛机出库站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()); |
| | |
| | | } |
| | | |
| | | // 判断堆垛机出库站状态 |
| | | if (staProtocol.isAutoing() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y") |
| | | if (staProtocol.isAutoing() && staProtocol.isOutEnable() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y") |
| | | ) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | |
| | | if (taskWrk.getIoType() == 1 && taskWrk.getWrkSts() == 3) { |
| | | taskWrk.setWrkSts(4);//入库完成 |
| | | taskWrk.setStatus(5);//完结 |
| | | |
| | | //更新库位状态 |
| | | LocMast locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | locMast.setLocSts("F");//F.在库 |
| | | locMast.setBarcode(taskWrk.getBarcode());//托盘码 |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiUser(9999L); |
| | | locMastService.updateById(locMast); |
| | | } else if (taskWrk.getIoType() == 2 && taskWrk.getWrkSts() == 12) { |
| | | taskWrk.setWrkSts(13);//出库完成 |
| | | taskWrk.setStatus(5);//完结 |
| | | |
| | | //更新库位状态 |
| | | LocMast locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | locMast.setLocSts("O");//O.空库位 |
| | | locMast.setBarcode("");//托盘码 |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiUser(9999L); |
| | | locMastService.updateById(locMast); |
| | | } else if (taskWrk.getIoType() == 3 && taskWrk.getWrkSts() == 12) { |
| | | taskWrk.setWrkSts(4);//入库完成 |
| | | taskWrk.setStatus(5);//完结 |
| | | //更新库位状态 |
| | | LocMast locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | locMast.setLocSts("F");//F.在库 |
| | | locMast.setBarcode(taskWrk.getBarcode());//托盘码 |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiUser(9999L); |
| | | locMastService.updateById(locMast); |
| | | |
| | | LocMast locMast1 = locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | locMast1.setLocSts("O");//O.空库位 |
| | | locMast1.setBarcode("");//托盘码 |
| | | locMast1.setModiTime(new Date()); |
| | | locMast1.setModiUser(9999L); |
| | | locMastService.updateById(locMast1); |
| | | } |
| | | taskWrkService.updateById(taskWrk); |
| | | } |