| | |
| | | if (!staProtocol.isLoading()) { |
| | | continue; |
| | | } |
| | | if (staProtocol.isAutoing() && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990) |
| | | && staProtocol.isPakMk() && staProtocol.getStamp() >= 2 && staProtocol.getStamp() != 3) {// && !Cools.isEmpty(barcode)) { |
| | | if (staProtocol.isAutoing() && staProtocol.isInEnable() && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990) && staProtocol.isPakMk() && staProtocol.getStamp() >= 2 && staProtocol.getStamp() != 3) {// && !Cools.isEmpty(barcode)) { |
| | | News.warn("" + mark + " - 0" + " - 开始执行"); |
| | | |
| | | if (!Cools.isEmpty(barcode)) { |
| | |
| | | } else if (inSta.getStaNo() == 201) { |
| | | param.setLocType2((short) 4); |
| | | } |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/loc/v1") |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | String response = new HttpHandler.Builder().setUri(wmsUrl).setPath("/rpc/pakin/loc/v1").setJson(JSON.toJSONString(param)).build().doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | |
| | | } |
| | | |
| | | } else { |
| | | News.errorNoLog("" + mark + " - 6" + " - 站点信息不符合入库条件!!!" + " 自动信号:" + staProtocol.isAutoing() + "、可入信号:" + staProtocol.isInEnable() |
| | | + "、空板信号:" + staProtocol.isEmptyMk() + "、工作号:" + staProtocol.getWorkNo() |
| | | + "、锁定标记" + staProtocol.isPakMk() + "、入库印记:" + staProtocol.getStamp()); |
| | | News.errorNoLog("" + mark + " - 6" + " - 站点信息不符合入库条件!!!" + " 自动信号:" + staProtocol.isAutoing() + "、可入信号:" + staProtocol.isInEnable() + "、空板信号:" + staProtocol.isEmptyMk() + "、工作号:" + staProtocol.getWorkNo() + "、锁定标记" + staProtocol.isPakMk() + "、入库印记:" + staProtocol.getStamp()); |
| | | } |
| | | |
| | | } |
| | |
| | | if (!staProtocol.isLoading()) { |
| | | continue; |
| | | } |
| | | if (staProtocol.isAutoing() && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999) |
| | | && staProtocol.isPakMk()) { |
| | | if (staProtocol.isAutoing() && staProtocol.isInEnable() && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999) && staProtocol.isPakMk()) { |
| | | News.warnNoLog("" + mark + " - 0" + " - 开始执行"); |
| | | // 判断重复工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep11(inSta.getStaNo()); |
| | |
| | | } |
| | | |
| | | } else { |
| | | News.errorNoLog("" + mark + " - 6" + " - 站点信息不符合入库条件!!!" + " 自动信号:" + staProtocol.isLoading() + "、可入信号:" + staProtocol.isInEnable() |
| | | + "、空板信号:" + staProtocol.isEmptyMk() + "、工作号:" + staProtocol.getWorkNo() |
| | | + "、锁定标记" + staProtocol.isPakMk() + "、入库印记:" + staProtocol.getStamp()); |
| | | News.errorNoLog("" + mark + " - 6" + " - 站点信息不符合入库条件!!!" + " 自动信号:" + staProtocol.isLoading() + "、可入信号:" + staProtocol.isInEnable() + "、空板信号:" + staProtocol.isEmptyMk() + "、工作号:" + staProtocol.getWorkNo() + "、锁定标记" + staProtocol.isPakMk() + "、入库印记:" + staProtocol.getStamp()); |
| | | } |
| | | } |
| | | } |
| | |
| | | // 无拣料数据 |
| | | continue; |
| | | } |
| | | if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) |
| | | || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo())) { |
| | | if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo())) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | // log.error("{}号任务数据异常!", wrkMast.getWrkNo()); |
| | | // } |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new QueryWrapper<StaDesc>() |
| | | .eq("type_no", wrkMast.getIoType() - 50) |
| | | .eq("stn_no", pickSta.getStaNo()) // 作业站点 = 拣料出库的目标站 |
| | | Wrapper<StaDesc> wrapper = new QueryWrapper<StaDesc>().eq("type_no", wrkMast.getIoType() - 50).eq("stn_no", pickSta.getStaNo()) // 作业站点 = 拣料出库的目标站 |
| | | .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号 |
| | | StaDesc staDesc = staDescService.getOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | |
| | | } |
| | | |
| | | } else { |
| | | News.errorNoLog("" + mark + " - 6" + " - 站点信息不符合入库条件!!!" + " 自动信号:" + staProtocol.isLoading() + "、可入信号:" + staProtocol.isInEnable() |
| | | + "、空板信号:" + staProtocol.isEmptyMk()); |
| | | News.errorNoLog("" + mark + " - 6" + " - 站点信息不符合入库条件!!!" + " 自动信号:" + staProtocol.isLoading() + "、可入信号:" + staProtocol.isInEnable() + "、空板信号:" + staProtocol.isEmptyMk()); |
| | | } |
| | | |
| | | } |
| | |
| | | wait = true; |
| | | } |
| | | // 判断堆垛机状态等待确认 |
| | | if (crnProtocol.modeType == CrnModeType.AUTO && crnProtocol.getTaskNo().equals(wrkMast.getWrkNo().shortValue()) |
| | | && wait |
| | | && crnProtocol.forkPosType == CrnForkPosType.HOME) { |
| | | if (crnProtocol.modeType == CrnModeType.AUTO && crnProtocol.getTaskNo().equals(wrkMast.getWrkNo().shortValue()) && wait && crnProtocol.forkPosType == CrnForkPosType.HOME) { |
| | | |
| | | News.warnNoLog("" + mark + " - 0" + " - 开始执行"); |
| | | |
| | |
| | | } |
| | | |
| | | } else { |
| | | News.errorNoLog("" + mark + " - 6" + " - 堆垛机信息不符合入库条件!!!" |
| | | + " 堆垛机状态:" + crnProtocol.modeType + "==自动AUTO:" + CrnModeType.AUTO |
| | | + "、堆垛机任务号:" + crnProtocol.getTaskNo() + "==工作档任务号:" + wrkMast.getWrkNo().shortValue() |
| | | + "、状态枚举:" + crnProtocol.statusType + "==WAITING:90 //任务完成等待WCS确认):" + CrnStatusType.WAITING_ONE |
| | | + "、货叉位置:" + crnProtocol.forkPosType + "==HOME:0 // 货叉原位:" + CrnForkPosType.HOME); |
| | | News.errorNoLog("" + mark + " - 6" + " - 堆垛机信息不符合入库条件!!!" + " 堆垛机状态:" + crnProtocol.modeType + "==自动AUTO:" + CrnModeType.AUTO + "、堆垛机任务号:" + crnProtocol.getTaskNo() + "==工作档任务号:" + wrkMast.getWrkNo().shortValue() + "、状态枚举:" + crnProtocol.statusType + "==WAITING:90 //任务完成等待WCS确认):" + CrnStatusType.WAITING_ONE + "、货叉位置:" + crnProtocol.forkPosType + "==HOME:0 // 货叉原位:" + CrnForkPosType.HOME); |
| | | } |
| | | |
| | | } |
| | |
| | | // continue; |
| | | // } |
| | | // 只有当堆垛机空闲 并且 无任务时才继续执行 |
| | | if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO |
| | | && crnProtocol.getLoaded() == 0 && crnProtocol.getForkPos() == 0) { |
| | | if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO && crnProtocol.getLoaded() == 0 && crnProtocol.getForkPos() == 0) { |
| | | News.warnNoLog("" + mark + " - 0" + " - 开始执行堆垛机入出库作业下发"); |
| | | // 如果最近一次是入库模式 |
| | | if (crnProtocol.getLastIo().equals("I")) { |
| | |
| | | News.error("" + mark + " - 1" + " - 2" + " - 入库 ===>> 堆垛机站点在数据库不存在, 站点编号={}", crnStn.getStaNo()); |
| | | continue; |
| | | } |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable() |
| | | && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) { |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable() && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) { |
| | | flag = true; |
| | | } |
| | | if (!flag) { |
| | | //TODO |
| | | News.error("" + mark + " - 1" + " - 3" + " - 堆垛机入库站信息(以下需要全true):" |
| | | + "自动信号" + staProtocol.isAutoing() + "有物信号" + staProtocol.isLoading() |
| | | + "工作号>0" + staProtocol.getWorkNo() + "可入信号" + staProtocol.isInEnable() |
| | | + "能入信号(wms设置).equals(\"Y\")" + staDetl.getCanining()); |
| | | News.error("" + mark + " - 1" + " - 3" + " - 堆垛机入库站信息(以下需要全true):" + "自动信号" + staProtocol.isAutoing() + "有物信号" + staProtocol.isLoading() + "工作号>0" + staProtocol.getWorkNo() + "可入信号" + staProtocol.isInEnable() + "能入信号(wms设置).equals(\"Y\")" + staDetl.getCanining()); |
| | | continue; |
| | | } |
| | | // 获取工作状态为2(设备上走)的入库工作档 |
| | |
| | | } |
| | | } |
| | | } |
| | | News.warnNoLog("" + mark + " - 1" + " - 15" + " - 命令下发 : 工作号={},源排={},源列={},源层={},目标排={},目标列={},目标层={}", wrkMast.getWrkNo().shortValue() |
| | | , crnStn.getRow().shortValue(), crnStn.getBay().shortValue(), crnStn.getLev().shortValue() |
| | | , locMast.getRow1().shortValue(), locMast.getBay1().shortValue(), locMast.getLev1().shortValue()); |
| | | News.warnNoLog("" + mark + " - 1" + " - 15" + " - 命令下发 : 工作号={},源排={},源列={},源层={},目标排={},目标列={},目标层={}", wrkMast.getWrkNo().shortValue(), crnStn.getRow().shortValue(), crnStn.getBay().shortValue(), crnStn.getLev().shortValue(), locMast.getRow1().shortValue(), locMast.getBay1().shortValue(), locMast.getLev1().shortValue()); |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | |
| | | // continue; |
| | | } |
| | | // 判断堆垛机出库站状态 |
| | | if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y") |
| | | && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) { |
| | | if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y") && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | | // 堆垛机控制过滤 |
| | |
| | | // return; |
| | | } |
| | | |
| | | News.warnNoLog("" + mark + " - 2" + " - 12" + " - 命令下发 : 工作号={},源排={},源列={},源层={},目标排={},目标列={},目标层={}", wrkMast.getWrkNo().shortValue() |
| | | , sourceSta.getRow1().shortValue(), sourceSta.getBay1().shortValue(), sourceSta.getLev1().shortValue() |
| | | , crnStn.getRow().shortValue(), crnStn.getBay().shortValue(), crnStn.getLev().shortValue()); |
| | | News.warnNoLog("" + mark + " - 2" + " - 12" + " - 命令下发 : 工作号={},源排={},源列={},源层={},目标排={},目标列={},目标层={}", wrkMast.getWrkNo().shortValue(), sourceSta.getRow1().shortValue(), sourceSta.getBay1().shortValue(), sourceSta.getLev1().shortValue(), crnStn.getRow().shortValue(), crnStn.getBay().shortValue(), crnStn.getLev().shortValue()); |
| | | |
| | | String locNo = sourceSta.getLocNo(); |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | News.warnNoLog("" + mark + " - 3" + " - 3" + " - 命令下发 : 工作号={},源排={},源列={},源层={},目标排={},目标列={},目标层={}", wrkMast.getWrkNo().shortValue() |
| | | , sourceSta.getRow1().shortValue(), sourceSta.getBay1().shortValue(), sourceSta.getLev1().shortValue() |
| | | , sta.getRow1().shortValue(), sta.getBay1().shortValue(), sta.getLev1().shortValue()); |
| | | News.warnNoLog("" + mark + " - 3" + " - 3" + " - 命令下发 : 工作号={},源排={},源列={},源层={},目标排={},目标列={},目标层={}", wrkMast.getWrkNo().shortValue(), sourceSta.getRow1().shortValue(), sourceSta.getBay1().shortValue(), sourceSta.getLev1().shortValue(), sta.getRow1().shortValue(), sta.getBay1().shortValue(), sta.getLev1().shortValue()); |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | |
| | | } |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm()); |
| | | String errName = crnError == null ? String.valueOf(crnProtocol.getAlarm()) : crnError.getErrName(); |
| | | BasErrLog basErrLog = new BasErrLog( |
| | | null, // 编号 |
| | | BasErrLog basErrLog = new BasErrLog(null, // 编号 |
| | | wrkMast.getWrkNo(), // 工作号 |
| | | now, // 发生时间 |
| | | null, // 结束时间 |
| | |
| | | if (latest == null || (latest.getErrCode() != crnProtocol.getAlarm().intValue())) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm()); |
| | | String errName = crnError == null ? String.valueOf(crnProtocol.getAlarm()) : crnError.getErrName(); |
| | | BasErrLog basErrLog = new BasErrLog( |
| | | null, // 编号 |
| | | BasErrLog basErrLog = new BasErrLog(null, // 编号 |
| | | null, // 工作号 |
| | | now, // 发生时间 |
| | | null, // 结束时间 |
| | |
| | | } |
| | | |
| | | // 站点条件判断 |
| | | if (staProtocol.isAutoing() |
| | | && staProtocol.isInEnable() |
| | | && staProtocol.isEmptyMk() |
| | | && (staProtocol.getWorkNo() >= 9990 && staProtocol.getWorkNo() <= 9999) |
| | | && staProtocol.isPakMk() && staProtocol.getStamp() >= 2) { |
| | | if (staProtocol.isAutoing() && staProtocol.isInEnable() && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() >= 9990 && staProtocol.getWorkNo() <= 9999) && staProtocol.isPakMk() && staProtocol.getStamp() >= 2) { |
| | | News.warnNoLog("" + mark + " - 0" + " - 开始执行:空栈板初始化入库,叉车入库站放货"); |
| | | |
| | | try { |
| | |
| | | } else if (emptyInSta.getStaNo() == 201) { |
| | | param.setLocType2((short) 4); |
| | | } |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/loc/v1") |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | String response = new HttpHandler.Builder().setUri(wmsUrl).setPath("/rpc/pakin/loc/v1").setJson(JSON.toJSONString(param)).build().doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | |
| | | } |
| | | |
| | | } else { |
| | | News.errorNoLog("" + mark + " - 4" + " - 站点信息不符合入库条件!!!" + " 自动信号:" + staProtocol.isAutoing() + "、可入信号:" + staProtocol.isInEnable() |
| | | + "、空板信号:" + staProtocol.isEmptyMk() + "、工作号:" + staProtocol.getWorkNo() |
| | | + "、锁定标记" + staProtocol.isPakMk()); |
| | | News.errorNoLog("" + mark + " - 4" + " - 站点信息不符合入库条件!!!" + " 自动信号:" + staProtocol.isAutoing() + "、可入信号:" + staProtocol.isInEnable() + "、空板信号:" + staProtocol.isEmptyMk() + "、工作号:" + staProtocol.getWorkNo() + "、锁定标记" + staProtocol.isPakMk()); |
| | | } |
| | | } |
| | | } |
| | |
| | | for (Integer row : rows) { |
| | | if (Utils.isDeepLoc(slaveProperties, row)) { |
| | | loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1(), shallowLoc.getLocType2()); |
| | | |
| | | if (loc != null) { |
| | | if (Utils.isDeepLoc(slaveProperties, loc.getLocNo())) { |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); |
| | |
| | | } |
| | | } |
| | | if (null != loc) { |
| | | break; |
| | | //调整的原因:双工位的情况,5列,只能2号工位取放,34列,只能工位1取放 |
| | | if (shallowLoc.getLocType1() == 1) { |
| | | if (shallowLoc.getBay1() == 5 && loc.getBay1() == 5) { |
| | | break; |
| | | } else if (shallowLoc.getBay1() == 3 || shallowLoc.getBay1() == 4) { |
| | | if (loc.getBay1() == 3 || loc.getBay1() == 4) { |
| | | break; |
| | | } |
| | | } |
| | | loc = null; |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | if (null != loc) { |
| | | break; |
| | | //调整的原因:双工位的情况,5列,只能2号工位取放,34列,只能工位1取放 |
| | | if (shallowLoc.getLocType1() == 1) { |
| | | if (shallowLoc.getBay1() == 5 && loc.getBay1() == 5) { |
| | | break; |
| | | } else if (shallowLoc.getBay1() == 3 || shallowLoc.getBay1() == 4) { |
| | | if (loc.getBay1() == 3 || loc.getBay1() == 4) { |
| | | break; |
| | | } |
| | | } |
| | | loc = null; |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | // 出库切换中 |
| | | devpThread.ioModeOf2F = IoModeType.PAKOUT_BOOTING; |
| | | WrkMast pakin = wrkMastMapper.selectWorkingPakin(inSta.getStaNo()); |
| | | if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() |
| | | && !devpThread.getStation().get(inSta.getStaNo() + 1).isLoading() |
| | | && devpThread.getStation().get(inSta.getStaNo() + 1).getWorkNo() == 0) { |
| | | if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() && !devpThread.getStation().get(inSta.getStaNo() + 1).isLoading() && devpThread.getStation().get(inSta.getStaNo() + 1).getWorkNo() == 0) { |
| | | // 出库模式 |
| | | devpThread.ioModeOf2F = IoModeType.PAKOUT_MODE; |
| | | } |
| | |
| | | // 出库切换中 |
| | | devpThread.ioModeOf4F = IoModeType.PAKOUT_BOOTING; |
| | | WrkMast pakin = wrkMastMapper.selectWorkingPakin(inSta.getStaNo()); |
| | | if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() |
| | | && !devpThread.getStation().get(inSta.getStaNo() + 1).isLoading() |
| | | && devpThread.getStation().get(inSta.getStaNo() + 1).getWorkNo() == 0) { |
| | | if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() && !devpThread.getStation().get(inSta.getStaNo() + 1).isLoading() && devpThread.getStation().get(inSta.getStaNo() + 1).getWorkNo() == 0) { |
| | | // 出库模式 |
| | | devpThread.ioModeOf4F = IoModeType.PAKOUT_MODE; |
| | | } |
| | |
| | | if (staProtocol.isAutoing() //自动 |
| | | && !staProtocol.isLoading() //无物 |
| | | && staProtocol.isOutEnable() //可出信号 |
| | | && staProtocol.getWorkNo() == 0 |
| | | ) { |
| | | && staProtocol.getWorkNo() == 0) { |
| | | WrkMast pakoutEmpty = wrkMastMapper.selectPakoutEmpty(autoOutSite); |
| | | if (null != pakoutEmpty) { |
| | | return; |
| | | } |
| | | try { |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/auto/emptyOut/v1") |
| | | .build() |
| | | .doPost(); |
| | | String response = new HttpHandler.Builder().setUri(wmsUrl).setPath("/rpc/auto/emptyOut/v1").build().doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | JSONObject data = (JSONObject) jsonObject.get("data"); |
| | |
| | | LocTypeDto locTypeDto = new LocTypeDto((short) 1, (short) 1, (short) 1); |
| | | |
| | | |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/auto/emptyIn/v1") |
| | | .setJson(JSON.toJSONString(locTypeDto)) |
| | | .build() |
| | | .doPost(); |
| | | String response = new HttpHandler.Builder().setUri(wmsUrl).setPath("/rpc/auto/emptyIn/v1").setJson(JSON.toJSONString(locTypeDto)).build().doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | News.info((String) jsonObject.get("msg")); |