2025-06-05 | zhang | ![]() |
2025-06-05 | zhang | ![]() |
2025-06-05 | Administrator | ![]() |
2025-06-05 | zhang | ![]() |
2025-06-05 | Administrator | ![]() |
2025-06-05 | Administrator | ![]() |
2025-06-05 | zhang | ![]() |
src/main/java/com/zy/asrs/entity/TaskWrk.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/entity/TaskWrkLog.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/entity/param/TaskCreateParam.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/core/model/protocol/StaProtocol.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/core/thread/SiemensDevpThread.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/entity/TaskWrk.java
@@ -177,6 +177,10 @@ @TableField("mark_start") private Integer markStart; @TableField("type") private String type; public TaskWrk() { } src/main/java/com/zy/asrs/entity/TaskWrkLog.java
@@ -167,6 +167,10 @@ @TableField("transfer_mark") private Integer transferMark; @TableField("type") private String type; public TaskWrkLog() { } src/main/java/com/zy/asrs/entity/param/TaskCreateParam.java
@@ -8,6 +8,10 @@ //任务号 private String taskNo; // private String type; //任务类型 private Integer ioType; src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -164,7 +164,7 @@ } String BoxNo = barcodeThread.getBarcode(); if (Cools.isEmpty(BoxNo)) { log.error("{}号条码扫描失败,值:{}",inSta.getBarcode(),BoxNo); log.error("{}号条码扫描失败,值:{}", inSta.getBarcode(), BoxNo); continue; } TaskWrk taskWrk1 = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("barcode", BoxNo)); @@ -181,7 +181,7 @@ log.info("组托入库={}", storageEscalationParam); TaskWrk taskWrk = toWmsService.getLocNoFromWms(storageEscalationParam); if (taskWrk == null) { log.error("入库请求wms创建任务工作档为空:{}",storageEscalationParam); log.error("入库请求wms创建任务工作档为空:{}", storageEscalationParam); continue; } if (back) { @@ -193,13 +193,13 @@ StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() .eq("crn_no", taskWrk.getCrnNo()).eq("type_no", 1).eq("stn_no", staProtocol.getSiteId())); if (staDesc == null) { log.error("组托入库路径不存在,wrkNo={},crn={},stn_no={}",taskWrk.getWrkNo(),taskWrk.getCrnNo(),staProtocol.getSiteId()); log.error("组托入库路径不存在,wrkNo={},crn={},stn_no={}", taskWrk.getWrkNo(), taskWrk.getCrnNo(), staProtocol.getSiteId()); continue; } staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); staProtocol.setStaNo(staDesc.getCrnStn().shortValue()); MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); log.info("组托入库命令推送输送线队列成功:{}",staProtocol); log.info("组托入库命令推送输送线队列成功:{}", staProtocol); } } @@ -219,46 +219,49 @@ for (CrnSlave crnSlave : slaveProperties.getCrn()) { // 遍历堆垛机出库站 for (CrnSlave.CrnStn crnStn : crnSlave.getCrnOutStn()) { try { // 获取堆垛机出库站信息 DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId()); StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()); if (staProtocol == null) { continue; } else { staProtocol = staProtocol.clone(); } if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == 0)) { // 查询工作档 TaskWrk taskWrk = taskWrkMapper.selectCrnStaWorking(crnSlave.getId(), String.valueOf(crnStn.getStaNo()-1)); if (taskWrk == null) { continue; } log.info("下发输送线任务:taskWrk:" + JSON.toJSONString(taskWrk)); staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); staProtocol.setStaNo(Short.valueOf(taskWrk.getTargetPoint())); boolean offer = false; try { offer = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol)); } catch (Exception e) { log.error("下发输送线任务失败:异常:" + e); log.error("下发输送线任务失败:异常:offer:" + offer); } if (offer) { log.info("下发输送线任务成功:taskWrk:" + JSON.toJSONString(taskWrk)); taskWrk.setStatus(5); taskWrk.setWrkSts(14); taskWrk.setCompleteTime(new Date()); taskWrkService.updateById(taskWrk); } else { log.error("下发输送线任务失败:taskWrk:" + JSON.toJSONString(taskWrk)); } // } } } catch (Exception e) { log.error("出库到出库站异常:异常信息:" + e); try { // 获取堆垛机出库站信息 DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId()); StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()); if (staProtocol == null) { continue; } else { staProtocol = staProtocol.clone(); } if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == 0)) { // 查询工作档 TaskWrk taskWrk = taskWrkMapper.selectCrnStaWorking(crnSlave.getId(), String.valueOf(crnStn.getStaNo() - 1)); if (taskWrk == null) { continue; } log.info("下发输送线任务:taskWrk:" + JSON.toJSONString(taskWrk)); staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); staProtocol.setStaNo(Short.valueOf(taskWrk.getTargetPoint())); if (!Cools.isEmpty(taskWrk.getType())) { staProtocol.setHeight(taskWrk.getType()); } boolean offer = false; try { offer = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol)); } catch (Exception e) { log.error("下发输送线任务失败:异常:" + e); log.error("下发输送线任务失败:异常:offer:" + offer); } if (offer) { log.info("下发输送线任务成功:taskWrk:" + JSON.toJSONString(taskWrk)); taskWrk.setStatus(5); taskWrk.setWrkSts(14); taskWrk.setCompleteTime(new Date()); taskWrkService.updateById(taskWrk); } else { log.error("下发输送线任务失败:taskWrk:" + JSON.toJSONString(taskWrk)); } // } } } catch (Exception e) { log.error("出库到出库站异常:异常信息:" + e); } // } } @@ -349,8 +352,8 @@ } LocMast locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); if(!locMast.getLocSts().equals("O") && taskWrk.getWrkSts() == 2) { log.error("入库WMS分配库位{}有误,库位状态为{}",locMast.getLocNo(),locMast.getLocSts()); if (!locMast.getLocSts().equals("O") && taskWrk.getWrkSts() == 2) { log.error("入库WMS分配库位{}有误,库位状态为{}", locMast.getLocNo(), locMast.getLocSts()); taskWrk.setWrkSts(5); taskWrk.setMemo("WMS分配库位有误"); taskWrkService.updateById(taskWrk); @@ -449,7 +452,7 @@ log.info(locMast.getLocNo() + "出深库位,浅库位有货"); continue; } } else if (flag == 2){ } else if (flag == 2) { LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>() .eq("row1", (locMast.getRow1() - 1)) .eq("bay1", locMast.getBay1()) src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -80,6 +80,7 @@ taskWrk.setIoPri(param.getTaskPriority());//优先级 taskWrk.setBarcode(param.getBarcode());//条码 taskWrk.setCrnNo(locMast.getCrnNo()); taskWrk.setType(param.getType()); if (param.getIoType() == 1) { taskWrk.setWrkSts(1); if (!Cools.isEmpty(param.getTargetPoint())) { src/main/java/com/zy/core/model/protocol/StaProtocol.java
@@ -67,6 +67,9 @@ // 物料号列表 private List<String> matIdList; // 高度 private String height; // 外形检测 ------------------------------------------------------------------------ // 前超限 src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -38,23 +38,61 @@ public class SiemensDevpThread implements Runnable, DevpThread { public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{ add(101);add(102);add(103);add(104);add(105);add(106);add(107);add(108);add(109);add(110); add(111);add(112);add(113);add(114);add(115);add(116); // 侧面从 index 16开始 长度12 add(201);add(202);add(203);add(204);add(205);add(206);add(207);add(208);add(209);add(210);add(211);add(212); add(101); add(102); add(103); add(104); add(105); add(106); add(107); add(108); add(109); add(110); add(111); add(112); add(113); add(114); add(115); add(116); // 侧面从 index 16开始 长度12 add(201); add(202); add(203); add(204); add(205); add(206); add(207); add(208); add(209); add(210); add(211); add(212); }}; public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{ add(301);add(302);add(303);add(304);add(305);add(306);add(307);add(308); add(301); add(302); add(303); add(304); add(305); add(306); add(307); add(308); }}; // 正面5个条码扫描站 public static final ArrayList<Integer> barcodeSite2 = new ArrayList<Integer>() {{ add(102);add(105);add(108);add(111);add(114); add(102); add(105); add(108); add(111); add(114); }}; // 侧面三个条码扫描站 public static final ArrayList<Integer> barcodeSite = new ArrayList<Integer>() {{ add(202);add(206);add(211); add(202); add(206); add(211); }}; /** @@ -256,21 +294,21 @@ if (result3.IsSuccess) { for (int i = 0; i < 5; i++) { String barcode = siemensS7Net.getByteTransform().TransString(result3.Content, i * 40, 40, "UTF-8"); if(!Cools.isEmpty()){ if (!Cools.isEmpty()) { barcode = barcode.trim(); } List<String> barcodeList = Arrays.stream(barcode.split(";")).collect(Collectors.toList()); Iterator<String> iterator = barcodeList.iterator(); while (iterator.hasNext()){ while (iterator.hasNext()) { String next = iterator.next(); if(next.length() == 6) { if (next.length() == 6) { barcode = next; iterator.remove(); break; } } BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i+1); BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1); if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { barcodeThread.setBarcode(barcode); } @@ -481,15 +519,18 @@ String workNoAddress; // 目标站地址 String staNoAddress; // 高度类型地址 String heightAddress; // 目标站地址 String heightAddress = null; if (index < 16) { workNoAddress = "DB100." + index * 4; staNoAddress = "DB100." + (index * 4 + 2); heightAddress = "DB104." + (index * 4 + 2); } else { workNoAddress = "DB100." + (400 + (index-16) * 4); staNoAddress = "DB100." + (400 + (index-16) * 4 + 2); workNoAddress = "DB100." + (400 + (index - 16) * 4); staNoAddress = "DB100." + (400 + (index - 16) * 4 + 2); } int i = barcodeSite2.indexOf(staProtocol.getSiteId()); if (i != -1) { heightAddress = "DB104." + (i * 4); } OperateResult writeResult; @@ -500,6 +541,17 @@ while (writeCount < 5) { OperateResult writeResult1 = siemensS7Net.Write(workNoAddress, staProtocol.getWorkNo()); // 工作号 OperateResult writeResult2 = siemensS7Net.Write(staNoAddress, staProtocol.getStaNo()); // 目标站 if (!Cools.isEmpty(staProtocol.getHeight()) && heightAddress != null) { OperateResult writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); // 目标站 log.info("写入高度地址:{},{}", heightAddress, writeResult3); if (!writeResult3.IsSuccess) { //fangzhi xierukushibai,jiu duoxiejici,meixunhuan writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); if (!writeResult3.IsSuccess) { writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); // 目标站 } } } if (writeResult1.IsSuccess && writeResult2.IsSuccess) { Thread.sleep(200); OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index * 4, (short) 2); @@ -508,9 +560,9 @@ // short staNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 2); // if (staProtocol.getWorkNo().equals(workNo) && staProtocol.getStaNo().equals(staNo)) { // //任务命令写入成功 writeFlag = true; log.info("写入输送线命令后返回成功,并且回读成功。输送线plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); break; writeFlag = true; log.info("写入输送线命令后返回成功,并且回读成功。输送线plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); break; // } else {//返回结果是成功了,但是真实值不相同 // writeCount++; // OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令后返回成功,但是读取任务值不一致。输送线plc编号={1},站点数据={2},写入次数={3}", @@ -571,9 +623,10 @@ // array[1] = staProtocol.getStaNo(); // OperateResult write = siemensS7Net.Write("DB100." + index*4, array); // //// OperateResult write = siemensS7Net.Write("DB100." + index*2, staProtocol.getWorkNo()); // 工作号 //// Thread.sleep(500); //// OperateResult write1 = siemensS7Net.Write("DB101." + index*2, staProtocol.getStaNo()); // 目标站 /// / OperateResult write = siemensS7Net.Write("DB100." + index*2, staProtocol.getWorkNo()); // 工作号 /// / Thread.sleep(500); /// / OperateResult write1 = siemensS7Net.Write("DB101." + index*2, staProtocol.getStaNo()); // 目标站 // // if (!write.IsSuccess) { // staProtocol = station.get(staProtocol.getSiteId()); @@ -593,7 +646,6 @@ // } // } // } private void write2(StaProtocol staProtocol) throws InterruptedException { if (null == staProtocol) { return;