Merge remote-tracking branch 'origin/xgmwcs' into xgmwcs
| | |
| | | import com.zy.asrs.domain.enums.SiteStatusType; |
| | | import com.zy.asrs.domain.param.SystemSwitchParam; |
| | | import com.zy.asrs.domain.vo.*; |
| | | import com.zy.asrs.entity.BasCrnError; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.mapper.BasCrnErrorMapper; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private LocMastMapper locMastMapper; |
| | | @Autowired |
| | | private BasCrnErrorMapper basCrnErrorMapper; |
| | | |
| | | @PostMapping("/system/running/status") |
| | | @ManagerAuth(memo = "系统运行状态") |
| | |
| | | /** |
| | | * 堆垛机状态判断 |
| | | */ |
| | | if (crn.getId() == 1 && crnProtocol.getAlarm() > 0) { |
| | | if (crnProtocol.getAlarm() > 0) { |
| | | vo.setCrnStatus(CrnStatusType.MACHINE_ERROR); |
| | | } else { |
| | | if (crnProtocol.getTaskNo()>0) { |
| | |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | vo.setCrnNo(crnNo); |
| | | vo.setWorkNo(crnProtocol.getTaskNo()); |
| | | vo.setCrnStatus(crnProtocol.getStatusType().desc); |
| | | |
| | | if (crnProtocol.getAlarm() > 0) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm()); |
| | | vo.setError(crnError == null ? "未知异常" : crnError.getErrName()); |
| | | } |
| | | |
| | | if (crnProtocol.getTaskNo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); |
| | | if (wrkMast != null) { |
| | |
| | | @ApiModelProperty(value= "条形码") |
| | | private String barcode; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @ApiModelProperty(value= "入库暂存数") |
| | | @TableField("in_qty") |
| | | private Integer inQty; |
| | | |
| | |
| | | |
| | | List<WrkMast> selectToBeHistoryData(); |
| | | |
| | | int getOutToStn182(Integer devpNo); |
| | | |
| | | } |
| | |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | // if(!Cools.isEmpty(barcode)) { |
| | | // log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | // if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | // continue; |
| | | // } |
| | | // } else { |
| | | // continue; |
| | | // } |
| | | if(!Cools.isEmpty(barcode)) { |
| | | log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | continue; |
| | | } |
| | | } else { |
| | | continue; |
| | | } |
| | | |
| | | // 获取入库站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | |
| | | && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999) |
| | | && staProtocol.isPakMk()){// && !Cools.isEmpty(barcode)) { |
| | | |
| | | if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | //条码为空或者不符合,退库到172站点 |
| | | staProtocol.setWorkNo((short)9999); |
| | | staProtocol.setStaNo((short)172); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | continue; |
| | | } |
| | | // if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | // log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | // //条码为空或者不符合,退库到172站点 |
| | | // staProtocol.setWorkNo((short)9999); |
| | | // staProtocol.setStaNo((short)172); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // if (!result) { |
| | | // throw new CoolException("更新plc站点信息失败"); |
| | | // } |
| | | // continue; |
| | | // } |
| | | |
| | | // 判断重复工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode); |
| | |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | // if(!Cools.isEmpty(barcode)) { |
| | | // log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); |
| | | // if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | // continue; |
| | | // } |
| | | // } else { |
| | | // continue; |
| | | // } |
| | | if(!Cools.isEmpty(barcode)) { |
| | | log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | continue; |
| | | } |
| | | } else { |
| | | continue; |
| | | } |
| | | |
| | | // 获取拣料入库站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | |
| | | |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()){ |
| | | |
| | | if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); |
| | | //条码为空或者不符合,退库到172站点 |
| | | staProtocol.setWorkNo((short)9999); |
| | | staProtocol.setStaNo((short)172); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | continue; |
| | | } |
| | | // if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | // log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); |
| | | // //条码为空或者不符合,退库到172站点 |
| | | // staProtocol.setWorkNo((short)9999); |
| | | // staProtocol.setStaNo((short)172); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // if (!result) { |
| | | // throw new CoolException("更新plc站点信息失败"); |
| | | // } |
| | | // continue; |
| | | // } |
| | | |
| | | WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode); |
| | | if (wrkMast == null) { |
| | |
| | | } |
| | | |
| | | // 已经存在吊车执行任务时,则过滤 |
| | | if (wrkMastMapper.selectLocMoving(slave.getId()) != null) { |
| | | if (wrkMastMapper.selectWorking(slave.getId()) != null) { |
| | | return; |
| | | } |
| | | |
| | |
| | | return this.baseMapper.selectToBeHistoryData(); |
| | | } |
| | | |
| | | @Override |
| | | public int getOutToStn182(Integer devpNo) { |
| | | return selectCount(new EntityWrapper<WrkMast>().eq("sta_no", devpNo).eq("wrk_sts",12)); |
| | | } |
| | | } |
| | |
| | | // 演示 |
| | | mainService.crnDemoOfLocMove1(); |
| | | // 入出库模式切换函数 |
| | | mainService.ioConvert(); |
| | | // mainService.ioConvert(); |
| | | // 入库 ===>> 入库站到堆垛机站,根据条码扫描生成入库工作档 |
| | | mainService.generateStoreWrkFile(); // 组托 |
| | | mainService.generateStoreWrkFile0(); // WMS入库 |
| | |
| | | // 锁定标记 |
| | | private boolean pakMk = true; |
| | | |
| | | // 入库暂存数 |
| | | private Short inQty; |
| | | |
| | | public BasDevp toSqlModel(){ |
| | | BasDevp basDevp = new BasDevp(); |
| | |
| | | basDevp.setLocType2((short) 0); // 宽窄类型{0:未知,1:窄库位,2:宽库位} |
| | | basDevp.setLocType3((short) 0); // 轻重类型{0:未知,1:轻库位,2:重库位} |
| | | basDevp.setLocType1(high != low && low ? (short) 1 : (short) 2); |
| | | basDevp.setInQty(inQty !=null ?(int)inQty : 0); |
| | | return basDevp; |
| | | } |
| | | |
| | |
| | | page.newLine("目标站:"+command.getStaNo()); |
| | | if (!command.isEmptyMk()) { |
| | | for (MatDto matDto : command.getMatDtos()) { |
| | | page.newLine(matDto.getMaknx() + "【数量" + matDto.getCount() +"】"); |
| | | //去掉小数点 |
| | | String strQty = matDto.getCount().toString(); |
| | | int idx = strQty.lastIndexOf("."); |
| | | if(idx >= 0){ |
| | | strQty.substring(0,idx); |
| | | } |
| | | page.newLine(matDto.getMaknx() + "[数量" + strQty +"]"); |
| | | // page.newLine(matDto.getMaknx() + "【数量" + matDto.getCount() +"】"); |
| | | } |
| | | } |
| | | page.newLine("\n"); |
| | | } |
| | | |
| | | // 设置字体 |
| | | page.setFont(new Font("宋体",Font.PLAIN,12)); |
| | | page.setFont(new Font("宋体",Font.PLAIN,10)); |
| | | // 设置文本颜色 |
| | | page.setForeground(Color.red); |
| | | // 设置显示特技为快速打出 |
| | |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | String strQty = "1234"; |
| | | int index = strQty.lastIndexOf("."); |
| | | if(index>=0) { |
| | | strQty=strQty.substring(0, index); |
| | | } |
| | | System.out.println("2==>>"+strQty); |
| | | |
| | | Bx5GEnv.initial(3000); |
| | | Bx5GScreenClient screen = new Bx5GScreenClient("my"); |
| | | DisplayStyleFactory.DisplayStyle[] styles = DisplayStyleFactory.getStyles().toArray(new DisplayStyleFactory.DisplayStyle[0]); |
| | |
| | | log.error("堆垛机写入命令为空"); |
| | | return false; |
| | | } |
| | | |
| | | // OperateResult result = null; |
| | | // try{ |
| | | // Integer exeCount=0; |
| | | // do{ |
| | | // command.setCrnNo(slave.getId()); |
| | | // short[] array = new short[10]; |
| | | // array[0] = command.getAckFinish(); |
| | | // array[1] = command.getTaskNo(); |
| | | // array[2] = command.getTaskMode(); |
| | | // array[3] = command.getSourcePosX(); |
| | | // array[4] = command.getSourcePosY(); |
| | | // array[5] = command.getSourcePosZ(); |
| | | // array[6] = command.getDestinationPosX(); |
| | | // array[7] = command.getDestinationPosY(); |
| | | // array[8] = command.getDestinationPosZ(); |
| | | // array[9] = command.getCommand(); |
| | | // result = melsecMcNet.Write("D0", array); |
| | | // if(result.IsSuccess) { |
| | | // if (command.getAckFinish() == 0) { |
| | | // short commandFinish = 1; |
| | | // result = melsecMcNet.Write("D9", commandFinish); |
| | | // if(result.IsSuccess){ |
| | | // //写任务确认返回成功后,查询确认一次 |
| | | // Thread.sleep(200); |
| | | // OperateResultExOne<byte[]> result1 = melsecMcNet.Read("D9", (short)2); |
| | | // if(result1.IsSuccess){ |
| | | // short commandVal = melsecMcNet.getByteTransform().TransInt16(result1.Content,2); |
| | | // if(commandVal==1){ |
| | | // break; |
| | | // } else { |
| | | // exeCount++; |
| | | // } |
| | | // } else{ |
| | | // exeCount++; |
| | | // } |
| | | // }else{ |
| | | // exeCount++; |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // exeCount++; |
| | | // } |
| | | // Thread.sleep(200); |
| | | // }while(exeCount>3); |
| | | // }catch (Exception e){ |
| | | // |
| | | // } |
| | | |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[10]; |
| | | array[0] = command.getAckFinish(); |
| | |
| | | bean.insert(basCrnOpt); |
| | | } catch (Exception ignore) {} |
| | | |
| | | if (result.IsSuccess) { |
| | | if (result != null && result.IsSuccess) { |
| | | log.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); |
| | | return true; |
| | |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | |
| | | add(150);add(151);add(152);add(153);add(154);add(155);add(156);add(157);add(158);add(159); |
| | | add(160);add(161);add(162);add(163);add(164);add(165);add(166);add(167);add(168);add(169); |
| | | add(170);add(171);add(172);add(173);add(174);add(175);add(176);add(177);add(178);add(179); |
| | | add(180);add(181);add(182);add(183);add(184);add(185);add(186);add(187);add(188);add(189); |
| | | add(180);add(181);add(182); |
| | | add(183);add(184);add(185);add(186);add(187);add(188);add(189); |
| | | add(190);add(191);add(192); |
| | | }}; |
| | | |
| | |
| | | // updateIoMode(); |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) 186); |
| | | if (result.IsSuccess) { |
| | | for (int i = 0; i < 83; i++) { |
| | | for (int i = 0; i < 93; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result0 = siemensS7Net.Read("DB101.0", (short) 186); |
| | | if (result0.IsSuccess) { |
| | | for (int i = 0; i < 83; i++) { |
| | | for (int i = 0; i < 93; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB102.0", (short) 186); |
| | | if (result1.IsSuccess) { |
| | | for (int i = 0; i < 83; i++) { |
| | | for (int i = 0; i < 93; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2, 1); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB300.0", (short) 10); |
| | | if (result3.IsSuccess) { |
| | | // Integer siteId = staNos.get(i); // 站点编号 |
| | | Integer siteId = 0; |
| | | for (int i = 0; i < 5; i++) { |
| | | switch (i){ |
| | | case 0: |
| | | siteId = 100; |
| | | break; |
| | | case 1: |
| | | siteId = 102; |
| | | break; |
| | | case 2: |
| | | siteId = 104; |
| | | break; |
| | | case 3: |
| | | siteId = 106; |
| | | break; |
| | | case 4: |
| | | siteId = 108; |
| | | break; |
| | | } |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | short value = siemensS7Net.getByteTransform().TransInt16(result3.Content, i*2); |
| | | staProtocol.setInQty(value); // 入库暂存数 |
| | | } |
| | | } |
| | | |
| | |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | basDevps.add(staProtocol.toSqlModel()); |
| | | } |
| | | |
| | | BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | if (!basDevpService.updateBatchById(basDevps)) { |
| | | if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { |
| | | throw new Exception("更新数据库数据失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】更新数据库数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | log.error("更新数据库数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | } |
| | | |
| | | //出库到182站堆垛机任务数据发送给PLC |
| | | try{ |
| | | WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class); |
| | | if(null != wrkMastService){ |
| | | int count = wrkMastService.getOutToStn182(182); |
| | | OperateResult write = siemensS7Net.Write("DB200.2",(short)count); |
| | | } |
| | | }catch (Exception e) { |
| | | log.error("更新数据库数据失败"); |
| | | } |
| | | |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】读取输送线plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | // log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | |
| | | # url: jdbc:sqlserver://47.97.1.152:51433;databasename=xgmasrs |
| | | # username: sa |
| | | # password: Zoneyung@zy56$ |
| | | # url: jdbc:sqlserver://10.10.10.238:1433;databasename=xgmasrs |
| | | url: jdbc:sqlserver://localhost:1433;databasename=xgmasrs |
| | | url: jdbc:sqlserver://10.10.10.238:1433;databasename=xgmasrs |
| | | # url: jdbc:sqlserver://localhost:1433;databasename=xgmasrs |
| | | username: sa |
| | | password: sa@123 |
| | | mvc: |
| | |
| | | inSta[0]: |
| | | staNo: 176 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | inSta[1]: |
| | | staNo: 180 |
| | | barcode: ${wcs-slave.barcode[1].id} |
| | | # inSta[1]: |
| | | # staNo: 180 |
| | | # barcode: ${wcs-slave.barcode[1].id} |
| | | # 空板入库口1 |
| | | emptyInSta[0]: |
| | | staNo: 176 |
| | |
| | | id: 1 |
| | | ip: 10.10.10.52 |
| | | port: 51236 |
| | | barcode[1]: |
| | | id: 2 |
| | | ip: 10.10.10.53 |
| | | port: 51236 |
| | | # barcode[1]: |
| | | # id: 2 |
| | | # ip: 10.10.10.53 |
| | | # port: 51236 |
| | | # LED1 |
| | | led[0]: |
| | | id: 1 |
| | |
| | | <th>走行速度(m/min)</th> |
| | | <th>升降速度(m/min)</th> |
| | | <th>叉牙速度(m/min)</th> |
| | | <th>走行距离(m)</th> |
| | | <th>升降距离(m)</th> |
| | | <th>走行时长(s)</th> |
| | | <th>升降时长(s)</th> |
| | | <th>走行距离(Km)</th> |
| | | <th>升降距离(Km)</th> |
| | | <th>走行时长(H)</th> |
| | | <th>升降时长(H)</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |