| | |
| | | @ApiModelProperty(value= "") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value= "输送PLCId") |
| | | @TableField("devp_id") |
| | | private Integer devpId; |
| | | |
| | | public BasArm() {} |
| | | |
| | | public BasArm(Integer armNo,Integer staNo,Integer sortingLine,Integer status) { |
| | |
| | | */ |
| | | @ApiModelProperty(value= "绑定标记") |
| | | @TableField("binding_tags") |
| | | private Integer bindingTags; |
| | | private Long bindingTags; |
| | | |
| | | /** |
| | | * 优先级 |
| | |
| | | @TableField("arm_msg") |
| | | private String armMsg; |
| | | |
| | | /** |
| | | * 异常信息 |
| | | */ |
| | | @ApiModelProperty(value= "异常信息") |
| | | @TableField("barcode") |
| | | private String barcode; |
| | | |
| | | public BasArmMast() {} |
| | | |
| | | public BasArmMast(Integer armNo,Integer armDirection,Integer staNo,Integer sortingLine,Integer bindingTags,Long priority,Integer status,String matnr,String sku,String po,String upc,String supplier,String orderNo,Integer ctns,Long createTime,Long armError,String armMsg) { |
| | | public BasArmMast(Integer armNo,Integer armDirection,Integer staNo,Integer sortingLine,Long bindingTags,Long priority,Integer status,String matnr,String sku,String po,String upc,String supplier,String orderNo,Integer ctns,Long createTime,Long armError,String armMsg) { |
| | | this.armNo = armNo; |
| | | this.armDirection = armDirection; |
| | | this.staNo = staNo; |
| | |
| | | public CombParam(List<BasArmMast> basArmMastList) { |
| | | this.orderNo = basArmMastList.get(0).getOrderNo(); |
| | | this.combMats = new ArrayList<>(); |
| | | this.barcode = basArmMastList.get(0).getBarcode(); |
| | | List<BasArmMast> basArmMasts = new ArrayList<>(); |
| | | for (BasArmMast basArmMast : basArmMastList) { |
| | | if (basArmMasts.isEmpty()){ |
| | |
| | | private BasArmService basArmService; |
| | | @Autowired |
| | | private BasArmMastService basArmMastService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | |
| | | @Value("${inventory.number}") |
| | | private Integer inventoryNumber; |
| | | |
| | | public Integer wrkNo = 10000; |
| | | public Integer wrkNo = 10001; |
| | | public static final List<Integer> LEFT_POSITION = Arrays.asList(1018,2018); |
| | | /** |
| | | * 组托 |
| | |
| | | && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() |
| | | && staProtocol.isPakMk() |
| | | && staProtocol.getWorkNo() == 0 |
| | | ) { |
| | | if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | // News.error(JSON.toJSONString(staProtocol)); |
| | |
| | | News.error("" + mark + " - 1" + " - 2" + " - 入库 ===>>Rgv站点在数据库不存在, 站点编号={}", rgvStn.getStaNo()); |
| | | continue; |
| | | } |
| | | if((staProtocol.getWorkNo()>9999 && staProtocol2.getWorkNo()>9999) || (staProtocol.getWorkNo()<10000 && staProtocol2.getWorkNo()<10000)){ |
| | | //当连续取货站点为相同类型时才能连续取 |
| | | wrkMastSta3 = wrkMastStaMapper.selectByWrkNo(staProtocol2.getWorkNo()); |
| | | } |
| | | |
| | | wrkMastSta3 = wrkMastStaMapper.selectByWrkNo(staProtocol2.getWorkNo()); |
| | | } |
| | | // if(rgvProtocol.getTaskNo2() > 9999){ |
| | | // continue; |
| | | // } |
| | | if(rgvProtocol.getTaskNo2() > 9999 && staProtocol.getWorkNo() < 10000){ |
| | | continue; |
| | | } |
| | | |
| | | if (staProtocol == null) { |
| | | News.infoNoLog("" + mark + " - 1" + " - 1" + " - Rgv入库站信息(staProtocol!=null继续执行):staProtocol=" + staProtocol); |
| | |
| | | case 2: route = RouteUtils.getRouteTwo();break; |
| | | } |
| | | basRgvMap.setNowRoute(rgvProtocol.getRgvPosI2()); //更新小车当前位置站点号 |
| | | WrkMastSta wrkMastSta = wrkMastStaMapper.selectNoInterfere(route, route, Long.valueOf(staProtocol.getWorkNo()));//根据站点工作号和小车工作范围检索任务档 |
| | | basRgvMapService.updateById(basRgvMap); |
| | | WrkMastSta wrkMastSta = wrkMastStaMapper.selectNoInterfere(route, route, Long.valueOf(staProtocol.getWorkNo()));//根据站点工作号和小车工作范围检索任务档 |
| | | if( null == wrkMastSta ) { |
| | | News.infoNoLog("" + mark + " - 1" + " - 4" + " - 查询无待入库数据--wrk_sts0, 工作号={}", staProtocol.getWorkNo()); |
| | | continue; |
| | |
| | | /* |
| | | * arm任务完成自动组托 |
| | | * */ |
| | | public synchronized void armMissionAccomplished() { |
| | | public synchronized void armMissionAccomplished() { |
| | | try{ |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历拣料入库口 |
| | |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | String barcode = staProtocol.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | log.error("机械臂抓取任务完成:"+JSON.toJSON(barcode)+"===》托盘条码异常"); |
| | | continue; |
| | | } |
| | | } else { |
| | | log.error("机械臂抓取任务完成:===》托盘条码为空"); |
| | | continue; |
| | | } |
| | | |
| | | // String barcode = staProtocol.getBarcode(); |
| | | // if(!Cools.isEmpty(barcode)) { |
| | | // if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | // armTaskAssignmentCallApiLogSave(staProtocol, "托盘条码为空", staProtocol.getSiteId()+"码垛位置,===》托盘条码为空", false); |
| | | // continue; |
| | | // } |
| | | // } else { |
| | | // armTaskAssignmentCallApiLogSave(staProtocol, "托盘条码为空", staProtocol.getSiteId()+"码垛位置,===》托盘条码为空", false); |
| | | // continue; |
| | | // } |
| | | List<BasArm> basArmList = basArmService.selectList(new EntityWrapper<BasArm>() |
| | | .eq("arm_no", armSta.getArmNo()) |
| | | .eq("sta_no_sou", armSta.getStaNo()) |
| | |
| | | continue; |
| | | } |
| | | CombParam combParam = new CombParam(basArmMastList); |
| | | combParam.setBarcode(barcode); |
| | | //arm任务完成自动组托 |
| | | ReturnT<String> result = new PostMesDataUtils().postMesData("arm任务完成自动组托",wmsUrl, wmsComb, combParam); |
| | | if (result.getCode()==200){ |
| | | basArmMastService.updateArmMastStatus(basArm.getArmNo(),basArm.getSortingLineSou(),3,4); |
| | | } else { |
| | | log.error("机械臂抓取任务完成:"+JSON.toJSON(basArmMastList)+"===》自动组托失败,等待重试"); |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "自动组托失败", staProtocol.getSiteId()+"码垛位置,===》自动组托失败,等待重试", false); |
| | | // log.error("机械臂抓取任务完成:"+JSON.toJSON(basArmMastList)+"===》自动组托失败,等待重试"); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error("arm编号:"+basArm.getArmNo()+"====》机械臂抓取任务完成"+e.getMessage()); |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "机械臂抓取任务完成异常", staProtocol.getSiteId()+"码垛位置,===》自动组托失败,等待重试", false); |
| | | // log.error("arm编号:"+basArm.getArmNo()+"====》机械臂抓取任务完成"+e.getMessage()); |
| | | } |
| | | break; |
| | | } |
| | |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | |
| | | // if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()) { |
| | | // int workNo = commonService.getWorkNo(6);//待完善 |
| | | // // 更新站点信息 且 下发plc命令 |
| | |
| | | continue; |
| | | } |
| | | try{ |
| | | // 获取站点信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, basArm.getDevpId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(basArm.getStaNoSou()); |
| | | if (staProtocol == null || !staProtocol.isLoading()) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | |
| | | String barcode = staProtocol.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "托盘条码为空", staProtocol.getSiteId()+"码垛位置,===》托盘条码为空", false); |
| | | // log.error(staProtocol.getSiteId()+"码垛位置,===》托盘条码为空"); |
| | | continue; |
| | | } |
| | | } else { |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "托盘条码为空", staProtocol.getSiteId()+"码垛位置,===》托盘条码为空", false); |
| | | |
| | | // log.error(staProtocol.getSiteId()+"码垛位置,===》托盘条码为空"); |
| | | continue; |
| | | } |
| | | |
| | | if(barcode.length()!=6){ |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "条码长度不是6位", staProtocol.getSiteId()+"码垛位置,条码长度不是6位===>>" + barcode, false); |
| | | // log.error(staProtocol.getSiteId()+"码垛位置,条码长度不是6位===>>" + barcode); |
| | | continue; |
| | | // throw new CoolException(staProtocol.getSiteId()+"码垛位置,条码长度不是6位===>>" + barcode); |
| | | } |
| | | |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",barcode)); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",barcode)); |
| | | int countwait = waitPakinMapper.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",barcode)); |
| | | if (countLoc > 0 || countWrk > 0 || countwait > 0) { |
| | | // throw new CoolException("组托档/工作档/库存条码数据已存在===>>" + barcode); |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "条码数据已存在", staProtocol.getSiteId()+"码垛位置,组托档/工作档/库存条码数据已存在===>>" + barcode, false); |
| | | |
| | | // log.error(staProtocol.getSiteId()+"码垛位置,组托档/工作档/库存条码数据已存在===>>" + barcode); |
| | | continue; |
| | | } |
| | | |
| | | List<BasArmMast> basArmMastListRuningBarCode = basArmMastService.selectList( |
| | | new EntityWrapper<BasArmMast>() |
| | | .eq("barcode", barcode) |
| | | .eq("status", 3) |
| | | ); |
| | | if (!basArmMastListRuningBarCode.isEmpty()){ |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "条码数据已存在,正在自动组托!!!", staProtocol.getSiteId()+"码垛位置,条码数据正在自动组托===>>" + barcode, false); |
| | | continue; |
| | | } |
| | | List<BasArmMast> basArmMastListError = basArmMastService.selectList( |
| | | new EntityWrapper<BasArmMast>() |
| | | .eq("arm_no", basArm.getArmNo()) |
| | |
| | | .eq("status", 9) |
| | | ); |
| | | if (!basArmMastListError.isEmpty()){ |
| | | log.error(basArm.getArmNo()+"号机械臂存在异常数据需要维护!!!"); |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "存在异常机械臂任务", basArm.getArmNo()+"号机械臂存在异常数据需要维护!!!", false); |
| | | |
| | | // log.error(basArm.getArmNo()+"号机械臂存在异常数据需要维护!!!"); |
| | | continue; |
| | | } |
| | | List<BasArmMast> basArmMastListRuning = basArmMastService.selectList( |
| | |
| | | continue; |
| | | } |
| | | if (basArmMastList.size()>1){ |
| | | log.error("arm编号:"+basArm.getArmNo()+"====》拆码垛任务异常禁止下发!!!任务待执行数量大于1!!!"); |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "任务待执行数量大于1", "arm编号:"+basArm.getArmNo()+"====》拆码垛任务异常禁止下发!!!任务待执行数量大于1!!!", false); |
| | | |
| | | // log.error("arm编号:"+basArm.getArmNo()+"====》拆码垛任务异常禁止下发!!!任务待执行数量大于1!!!"); |
| | | continue; |
| | | } |
| | | BasArmMast basArmMast = basArmMastList.get(0); |
| | |
| | | // 订单下发(SKU+订单) |
| | | ReturnT<String> result = new PostMesDataUtils().postMesData("机械臂抓取订单(SKU)下发:",ArmConstant.getArmUrl(basArmMast.getArmNo()), ArmConstant.ARM_ADAPTOR, armOrderAssignmentParam); |
| | | if (result.getCode()==200){ |
| | | basArmMast.setStatus(1); |
| | | basArmMastService.updateById(basArmMast); |
| | | // basArmMast.setStatus(1); |
| | | // basArmMast.setBarcode(barcode); |
| | | // basArmMastService.updateById(basArmMast); |
| | | } else { |
| | | log.error("机械臂抓取订单(SKU)下发:"+JSON.toJSON(basArmMast)+"===》订单信息下发失败"); |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "机械臂抓取订单(SKU)下发", "arm编号:"+basArm.getArmNo()+"订单下发订单信息下发失败!!!", false); |
| | | |
| | | // log.error("arm编号:"+basArm.getArmNo()+"机械臂抓取订单(SKU)下发:"+JSON.toJSON(basArmMast)+"===》订单信息下发失败"); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error("机械臂抓取订单(SKU)下发:"+JSON.toJSON(basArmMast)+"===》订单下发订单信息下发失败"); |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "机械臂抓取订单(SKU)下发", "arm编号:"+basArm.getArmNo()+"订单下发订单信息下发失败!!!", false); |
| | | // log.error("arm编号:"+basArm.getArmNo()+"机械臂抓取订单(SKU)下发:"+JSON.toJSON(basArmMast)+"===》订单下发订单信息下发失败"); |
| | | continue; |
| | | } |
| | | } |
| | |
| | | ReturnT<String> result = new PostMesDataUtils().postMesData("机械臂抓取任务下发:通知工作空间已就绪",ArmConstant.getArmUrl(basArmMast.getArmNo()), ArmConstant.ARM_WORKSPACE, armTaskAssignmentParam); |
| | | if (result.getCode()==200){ |
| | | basArmMast.setStatus(1); |
| | | basArmMast.setBarcode(barcode); |
| | | basArmMastService.updateById(basArmMast); |
| | | } else { |
| | | log.error("机械臂抓取任务:"+JSON.toJSON(basArmMast)+"===》任务信息下发失败"); |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "机械臂抓取任务信息下发失败", "arm编号:"+basArm.getArmNo()+"任务信息下发失败!!!", false); |
| | | // log.error("机械臂抓取任务:"+JSON.toJSON(basArmMast)+"===》任务信息下发失败"); |
| | | } |
| | | } |
| | | } catch (Exception e){ |
| | |
| | | } |
| | | } |
| | | |
| | | public void armTaskAssignmentCallApiLogSave(StaProtocol staProtocol ,String tableName, String response, Boolean bool) { |
| | | ApiLog apiLog = apiLogService.selectOne(new EntityWrapper<ApiLog>() |
| | | .eq("namespace", "机械臂任务相关") |
| | | .eq("request", "站点号:" + staProtocol.getSiteId()) |
| | | .eq("response", response) |
| | | .eq("url", tableName) |
| | | .eq("client_ip", staProtocol.getBarcode()) |
| | | .eq("result", 0) |
| | | .orderBy("create_time", false) |
| | | ); |
| | | |
| | | if (!Cools.isEmpty(apiLog)){ |
| | | long parseLong = Long.parseLong(apiLog.getTimestamp()); |
| | | if (new Date().getTime()-parseLong<5*1000*60){ |
| | | return; |
| | | } |
| | | } |
| | | apiLogService.save("机械臂任务相关", tableName, "null", staProtocol.getBarcode(), |
| | | "站点号:" + staProtocol.getSiteId() , |
| | | response, bool); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.ApiLog; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.utils.core.AbstractHandler; |
| | | import com.zy.asrs.utils.core.ReturnT; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | ApiLogService apiLogService = SpringUtils.getBean(ApiLogService.class); |
| | | apiLogService.save( |
| | | name, |
| | | URL +"/"+ mesPath, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(combParam), |
| | | response, |
| | | success |
| | | ); |
| | | if (success){ |
| | | // 保存接口日志 |
| | | ApiLogService apiLogService = SpringUtils.getBean(ApiLogService.class); |
| | | apiLogService.save( |
| | | name, |
| | | URL +"/"+ mesPath, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(combParam), |
| | | response, |
| | | success |
| | | ); |
| | | } else { |
| | | postMesDataCallApiLogSave(response,success,name, URL, mesPath, combParam); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("", e); } |
| | | } |
| | |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public void postMesDataCallApiLogSave(String response,boolean success,String name, String URL, String mesPath, Object combParam) { |
| | | ApiLogService apiLogService = SpringUtils.getBean(ApiLogService.class); |
| | | |
| | | ApiLog apiLog = apiLogService.selectOne(new EntityWrapper<ApiLog>() |
| | | .eq("namespace", name) |
| | | .eq("response", response) |
| | | .eq("url", URL +"/"+ mesPath) |
| | | .eq("result", success? 1:0) |
| | | .orderBy("create_time", false) |
| | | ); |
| | | |
| | | if (!Cools.isEmpty(apiLog)){ |
| | | long parseLong = Long.parseLong(apiLog.getTimestamp()); |
| | | if (new Date().getTime()-parseLong<5*1000*60){ |
| | | return; |
| | | } |
| | | } |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | name, |
| | | URL +"/"+ mesPath, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(combParam), |
| | | response, |
| | | success |
| | | ); |
| | | } |
| | | } |
| | |
| | | |
| | | // mainService.outOfDevp(11); |
| | | |
| | | if (i>2){ |
| | | if (i>10){ |
| | | //空托盘自动出库 |
| | | // mainService.autoEmptyOut(); |
| | | //空托盘自动入库 |
| | |
| | | posMap.put(1024, 219684); |
| | | posMap.put(1028, 246724); |
| | | posMap.put(1031, 288194); |
| | | posMap.put(1035, 315204); |
| | | posMap.put(2003, 314954); |
| | | posMap.put(2006, 288094); |
| | | posMap.put(2009, 246574); |
| | | posMap.put(2012, 219584); |
| | | posMap.put(2015, 177934); |
| | | posMap.put(2018, 138126); |
| | | posMap.put(2021, 102124); |
| | | posMap.put(2024, 75174); |
| | | posMap.put(2027, 33748); |
| | | posMap.put(2030, 6449); |
| | | |
| | | |
| | | int tolerance = 200; // 允许误差范围 |
| | | |
| | | for (Map.Entry<Integer, Integer> entry : posMap.entrySet()) { |
| | |
| | | } |
| | | } |
| | | private static final Set<Integer> specialSites = new HashSet<>( |
| | | Arrays.asList(1004,1014,1018,1028,1035)); |
| | | Arrays.asList(1004,1014,1018,1028,1035,2006,2012,2018,2024,2030)); |
| | | public static final Map<Integer, Integer> StaPosition = new HashMap<Integer, Integer>() {{ |
| | | put(1004, 1001);put(1014, 1011);put(1018, 1015);put(1028, 1025);put(1035, 1032); |
| | | put(2006, 2004);put(2012, 2010);put(2018, 2016);put(2024, 2022);put(2030, 2028); |
| | | |
| | | }}; |
| | | public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{ |
| | |
| | | */ |
| | | private void readStatus(){ |
| | | try { |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 38); |
| | | if (result.IsSuccess) { |
| | |
| | | add(2016);add(2018); |
| | | add(2019);add(2021); |
| | | add(2022);add(2024); |
| | | add(2028);add(2030); |
| | | add(2025);add(2027); |
| | | add(2031);add(2033); |
| | | add(2034);add(2035);add(2037); |
| | | add(2041);add(2042);add(2043);add(2044); |
| | | add(2045);add(2046);add(2047);add(2048); |
| | | add(2101);add(2102);add(2103);add(2104);add(2105);add(2106);add(2107);add(2108);add(2109);add(2110); |
| | | add(2111);add(2112);add(2113);add(2114);add(2115);add(2116);add(2117);add(2118);add(2119);add(2120); |
| | | add(4001);add(4003);add(4004);add(4006); |
| | | // add(2041);add(2042);add(2043);add(2044); |
| | | // add(2045);add(2046);add(2047);add(2048); |
| | | // add(2101);add(2102);add(2103);add(2104);add(2105);add(2106);add(2107);add(2108);add(2109);add(2110); |
| | | // add(2111);add(2112);add(2113);add(2114);add(2115);add(2116);add(2117);add(2118);add(2119);add(2120); |
| | | // add(4001);add(4003);add(4004);add(4006); |
| | | }}; |
| | | |
| | | // 站点偏移量映射表 |
| | |
| | | }}; |
| | | |
| | | public static final Map<Integer, Integer> siteErrOffsetMap = new HashMap<Integer, Integer>() {{ |
| | | put(1036, 512);put(1103, 476);put(1047, 452); |
| | | put(1036, 512);put(1103, 476);put(1047, 452);put(2037, 270); |
| | | |
| | | }}; |
| | | |
| | | // 特殊站点集合 |
| | | private static final Set<Integer> specialSites = new HashSet<>( |
| | | Arrays.asList(1001,1005,1008,1011,1015,1019,1022,1025,1029, 1032,1039,2004,2001,2007,2010,2016,2013,2019,2022,2025,2030,4001,4004)); |
| | | Arrays.asList(1001,1005,1008,1011,1015,1019,1022,1025,1029, 1032,1039,2004,2001,2007,2010,2016,2013,2019,2022,2025,4001,4004)); |
| | | |
| | | // 特殊站点集合 |
| | | private static final Set<Integer> specialSites2 = new HashSet<>( |
| | |
| | | public static final ArrayList<Integer> BarcodeList = new ArrayList<Integer>() {{ |
| | | add(0); add(1); add(2); |
| | | }}; |
| | | public static final ArrayList<Integer> BarcodeListMat = new ArrayList<Integer>() {{ |
| | | add(3); add(4); |
| | | public static final ArrayList<Integer> BarcodeList2 = new ArrayList<Integer>() {{ |
| | | add(3); add(4); add(5); |
| | | }}; |
| | | public static final ArrayList<Integer> staNosErrList = new ArrayList<Integer>() {{ |
| | | add(1103);add(1036);add(1047); |
| | |
| | | return staNos1; |
| | | case 2: |
| | | return staNos2; |
| | | default: |
| | | throw new CoolException("服务器异常"); |
| | | } |
| | | } |
| | | |
| | | private ArrayList<Integer> getBarcodeList() { |
| | | switch (slave.getId()) { |
| | | case 1: |
| | | return BarcodeList; |
| | | case 2: |
| | | return BarcodeList2; |
| | | default: |
| | | throw new CoolException("服务器异常"); |
| | | } |
| | |
| | | OperateResultExOne<byte[]> result3 = null;//1042-1053 |
| | | OperateResultExOne<byte[]> result4 = null;//1054-1079 |
| | | OperateResultExOne<byte[]> result5 = null;//1080-1110 |
| | | OperateResultExOne<byte[]> resultErr = null;//1080-1110 |
| | | OperateResultExOne<byte[]> resultErr = null; |
| | | if(staNoSize == 99){ |
| | | result1 = siemensS7Net.Read("DB100.0", (short) (2768));//1001-1028 |
| | | result2 = siemensS7Net.Read("DB101.0", (short) (1268));//1029-1037 |
| | | result3 = siemensS7Net.Read("DB104.0", (short) (1268));//1042-1053 |
| | | result4 = siemensS7Net.Read("DB103.0", (short) (2824));//1054-1079 |
| | | result5 = siemensS7Net.Read("DB102.0", (short) (3428));//1080-1110 |
| | | resultErr = siemensS7Net.Read("DB3.0", (short) (536));//1080-1110 |
| | | resultErr = siemensS7Net.Read("DB3.0", (short) (536)); |
| | | }else{ |
| | | result1 = siemensS7Net.Read("DB200.0", (short) (3000));//2001-2030 |
| | | result2 = siemensS7Net.Read("DB201.0", (short) (720));//2031-2037 |
| | | result3 = siemensS7Net.Read("DB400.0", (short) (600));//4001-4006 |
| | | resultErr = siemensS7Net.Read("DB3.0", (short) (354)); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setSiteId(siteId); |
| | | if (staNoSize == 99) { |
| | | if (siteId < 1029) { |
| | | result = result1; |
| | |
| | | } |
| | | } |
| | | //条码扫描器 |
| | | ArrayList<Integer> barcodeList = BarcodeList; |
| | | |
| | | ArrayList<Integer> barcodeList = getBarcodeList(); |
| | | OperateResultExOne<byte[]> reasultBarcode1 = siemensS7Net.Read("DB101.780", (short) 8);//1036 |
| | | OperateResultExOne<byte[]> reasultBarcode2 = siemensS7Net.Read("DB104.548", (short) 8);//1047 |
| | | OperateResultExOne<byte[]> reasultBarcode3 = siemensS7Net.Read("DB102.2780", (short) 8);//1103 |
| | | // OperateResultExOne<byte[]> reasultBarcode4 = siemensS7Net.Read("DB104.180", (short) 184); |
| | | if(reasultBarcode1.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(0); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode1.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | // News.error(JSON.toJSONString(barcode+"线程"+barcodeId)); |
| | | OperateResultExOne<byte[]> reasultBarcode4 = siemensS7Net.Read("DB201.344", (short) 8); |
| | | if(barcodeList.get(0) == 0){ |
| | | if(reasultBarcode1.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(0); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode1.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | |
| | | } |
| | | if(reasultBarcode2.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(1); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode2.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | // News.error(JSON.toJSONString(barcode+"线程"+barcodeId)); |
| | | if(reasultBarcode2.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(1); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode2.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | |
| | | } |
| | | if(reasultBarcode3.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(2); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode3.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | // News.error(JSON.toJSONString(barcode+"线程"+barcodeId)); |
| | | if(reasultBarcode3.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(2); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode3.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | |
| | | } |
| | | }else{ |
| | | if(reasultBarcode4.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(0); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode3.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + +1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | # RGV穿梭车2 |
| | | rgv[1]: |
| | | id: 2 |
| | | ip: 10.10.10.63 |
| | | ip: 10.10.10.193 |
| | | port: 502 |
| | | rack: 0 |
| | | slot: 0 |
| | |
| | | # 输送线1 |
| | | devp[1]: |
| | | id: 2 |
| | | ip: 10.10.10.61 |
| | | ip: 10.10.10.71 |
| | | port: 102 |
| | | rack: 0 |
| | | slot: 0 |
| | | # 入库口1 |
| | | inSta[0]: |
| | | staNo: 2035 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | barcodeMat: ${wcs-slave.barcode[3].id} |
| | | barcode: ${wcs-slave.barcode[3].id} |
| | | backSta: 2034 |
| | | led: ${wcs-slave.led[1].id} |
| | | led: ${wcs-slave.led[5].id} |
| | | # # 空板入库口1 |
| | | # emptyInSta[0]: |
| | | # staNo: 106 |
| | |
| | | # 入库口1 |
| | | inSta[1]: |
| | | staNo: 4001 |
| | | barcode: ${wcs-slave.barcode[1].id} |
| | | barcodeMat: ${wcs-slave.barcode[4].id} |
| | | barcode: ${wcs-slave.barcode[4].id} |
| | | backSta: 4003 |
| | | led: ${wcs-slave.led[2].id} |
| | | led: ${wcs-slave.led[6].id} |
| | | # # 空板入库口1 |
| | | # emptyInSta[1]: |
| | | # staNo: 107 |
| | |
| | | # 出库口1 |
| | | outSta[0]: |
| | | staNo: 2033 |
| | | led: ${wcs-slave.led[0].id} |
| | | # led: ${wcs-slave.led[0].id} |
| | | outSta[1]: |
| | | staNo: 4006 |
| | | led: ${wcs-slave.led[3].id} |
| | | led: ${wcs-slave.led[7].id} |
| | | # outSta[2]: |
| | | # staNo: 156 |
| | | # led: ${wcs-slave.led[4].id} |
| | |
| | | # 条码扫描仪1mat |
| | | barcode[3]: |
| | | id: 4 |
| | | ip: 10.10.10.121 |
| | | ip: 10.10.10.124 |
| | | port: 51236 |
| | | # 条码扫描仪2mat |
| | | barcode[4]: |
| | | id: 5 |
| | | ip: 10.10.10.122 |
| | | ip: 10.10.10.125 |
| | | port: 51236 |
| | | # 条码扫描仪3mat |
| | | barcode[5]: |
| | | id: 6 |
| | | ip: 10.10.10.123 |
| | | ip: 10.10.10.126 |
| | | port: 51236 |
| | | # LED1 |
| | | led[0]: |
| | | id: 1 |
| | | ip: 10.10.10.101 |
| | | ip: 10.10.10.212 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 100 |
| | | staArr: 1036 |
| | | # LED2 |
| | | led[1]: |
| | | id: 2 |
| | | ip: 10.10.10.102 |
| | | ip: 10.10.10.213 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 106 |
| | | staArr: 1041 |
| | | # LED3 |
| | | led[2]: |
| | | id: 3 |
| | | ip: 10.10.10.103 |
| | | ip: 10.10.10.214 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 107 |
| | | staArr: 1103 |
| | | # LED4 |
| | | led[3]: |
| | | id: 4 |
| | | ip: 10.10.10.104 |
| | | ip: 10.10.10.215 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 152 |
| | | # LED5 |
| | | led[4]: |
| | | id: 5 |
| | | ip: 10.10.10.105 |
| | | ip: 10.10.10.216 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 156 |
| | | # LED6 |
| | | led[5]: |
| | | id: 6 |
| | | ip: 10.10.10.106 |
| | | ip: 10.10.10.217 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 160,159 |
| | | # LED6 |
| | | led[6]: |
| | | id: 7 |
| | | ip: 10.10.10.218 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 160,159 |
| | | # LED6 |
| | | led[7]: |
| | | id: 8 |
| | | ip: 10.10.10.219 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 160,159 |
| | |
| | | <result column="sta_no_sou" property="staNoSou" /> |
| | | <result column="sorting_line_sou" property="sortingLineSou" /> |
| | | <result column="status" property="status" /> |
| | | <result column="devp_id" property="devpId" /> |
| | | |
| | | </resultMap> |
| | | |
| | |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="arm_error" property="armError" /> |
| | | <result column="arm_msg" property="armMsg" /> |
| | | <result column="barcode" property="barcode" /> |
| | | |
| | | </resultMap> |
| | | |