| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.domain.enums.WorkNoType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.TaskCreateParam; |
| | | 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.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.service.CommonService; |
| | |
| | | @Service |
| | | public class OpenServiceImpl implements OpenService { |
| | | |
| | | @Autowired |
| | | private TaskWrkService taskWrkService; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | public ArrayList<String> wharfCode1 = new ArrayList<String>() {{ |
| | | add("J-1101"); |
| | | add("J-1103"); |
| | |
| | | add("H-1101"); |
| | | add("G-1101"); |
| | | }}; |
| | | |
| | | @Autowired |
| | | private TaskWrkService taskWrkService; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | |
| | | @Override |
| | | public HashMap<String, Object> taskCreate(TaskCreateParam param) { |
| | | HashMap<String,Object> map=new HashMap<>(); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); |
| | | if (taskWrk != null) { |
| | | map.put("Code","0"); |
| | | map.put("Msg",param.getTaskNo()+"任务已经生成!"); |
| | | map.put("Code", "0"); |
| | | map.put("Msg", param.getTaskNo() + "任务已经生成!"); |
| | | return map; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if (!taskWrkService.insert(taskWrk)) { |
| | | map.put("Code","0"); |
| | | map.put("Msg",param.getTaskNo()+"创建任务失败!"); |
| | | map.put("Code", "0"); |
| | | map.put("Msg", param.getTaskNo() + "创建任务失败!"); |
| | | return map; |
| | | } |
| | | map.put("Code","1"); |
| | | map.put("Msg","ok"); |
| | | map.put("Code", "1"); |
| | | map.put("Msg", "ok"); |
| | | return map; |
| | | } |
| | | |
| | |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() |
| | | .eq("stn_desc", param.getWharfCode())); |
| | | .eq("stn_desc", param.getStartPoint())); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | throw new RuntimeException("未查询到站点信息"); |
| | | } |
| | |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | Short workNo = staProtocol.getWorkNo(); |
| | | if (wharfCode1.contains(param.getWharfCode())) { |
| | | if (wharfCode1.contains(param.getStartPoint())) { |
| | | if (!staProtocol.isLoading() && !staProtocol.isCar() && staProtocol.getWorkNo() > 0) { |
| | | //AGV出库完成以后 |
| | | staProtocol.setWorkNo((short) 0); |
| | |
| | | |
| | | @Override |
| | | public R getAgvPickAndPlaceV1(TaskOverParam param) { |
| | | BasDevp basDevp = basDevpService.selectById(param.getStaNo()); |
| | | BasDevp basDevp = basDevpService.selectById(param.getStartPoint()); |
| | | if (Cools.isEmpty(basDevp)) { |
| | | return R.error("站点号有误" + param.getStaNo()); |
| | | return R.error("站点号有误" + param.getStartPoint()); |
| | | } |
| | | if (Cools.isEmpty(param.getHeight())) { |
| | | return R.error("高度不能为空" + param.getStartPoint()); |
| | | } |
| | | if (param.getType() == 0 && basDevp.getAgvStartPick() == 1) { |
| | | basDevp.setInreq2(param.getHeight().toString()); |
| | | return R.ok(); |
| | | } else if (param.getType() == 1 && basDevp.getAgvStartPlace() == 1) { |
| | | return R.ok(); |
| | |
| | | |
| | | @Override |
| | | public R getAgvPickAndPlaceV2(TaskOverParam param) { |
| | | BasDevp basDevp = basDevpService.selectById(param.getStaNo()); |
| | | BasDevp basDevp = basDevpService.selectById(param.getStartPoint()); |
| | | if (Cools.isEmpty(basDevp)) { |
| | | return R.error("站点号有误" + param.getStaNo()); |
| | | return R.error("站点号有误" + param.getStartPoint()); |
| | | } |
| | | if (param.getType() == 0) { |
| | | basDevp.setAgvTargetPick(1); |