| | |
| | | if(Cools.isEmpty(staDesc)){ |
| | | return R.error("入库路劲不存在"); |
| | | } |
| | | r = openService.taskCreate(new TaskCreateParam(param,staDesc.getCrnNo())); |
| | | r = openService.taskCreate(new TaskCreateParam(param,staDesc.getCrnNo(),staDesc.getCrnStn())); |
| | | |
| | | }else if(param.getIoType() == 2){ |
| | | //出库任务创建 |
| | |
| | | if(Cools.isEmpty(staDesc)){ |
| | | return R.error("出库路劲不存在"); |
| | | } |
| | | r = openService.taskCreate(new TaskCreateParam(param,staDesc.getCrnNo())); |
| | | r = openService.taskCreate(new TaskCreateParam(param,staDesc.getCrnNo(),staDesc.getCrnStn())); |
| | | }else if (param.getIoType() == 3){ |
| | | LocMast locMast2 = locMastService.selectByLocNo(param.getTargetPoint()); |
| | | if(Cools.isEmpty(locMast2)){ |
| | |
| | | basDevp.setOutEnable(outEnable ? "Y" : "N"); |
| | | } |
| | | basDevpService.updateById(basDevp); |
| | | boolean result = CommandUtils.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (result) { |
| | | return R.ok(); |
| | | } else { |
| | |
| | | @TableField("ORIGIN_START_POINT") |
| | | private String originStartPoint; |
| | | |
| | | @ApiModelProperty(value = "原始起点") |
| | | @ApiModelProperty(value = "原始终点") |
| | | @TableField("ORIGIN_TARGET_POINT") |
| | | private String originTargetPoint; |
| | | |
| | |
| | | |
| | | |
| | | public Integer getTargetPointConvert(){ |
| | | switch (targetPoint){ |
| | | switch (originTargetPoint){ |
| | | case "11": |
| | | return 11; |
| | | default: |
| | |
| | | |
| | | //起点 |
| | | private String startPoint; |
| | | private Integer startPointSta; |
| | | |
| | | //优先级 |
| | | private Integer taskPriority; |
| | | |
| | | //终点 |
| | | private String targetPoint; |
| | | private Integer targetPointSta; |
| | | |
| | | //是否空托盘 Y:是 N:否 |
| | | private String emptyContainer; |
| | |
| | | this.crn = crn; |
| | | }; |
| | | |
| | | public TaskCreateParam(CarryParam param, Integer crn,Integer crnSta){ |
| | | this.taskNo = param.getTaskNo(); |
| | | this.ioType = param.getIoType(); |
| | | this.barcode = param.getBarcode(); |
| | | this.taskPriority = param.getTaskPriority(); |
| | | this.startPoint = param.getStartPoint(); |
| | | this.targetPoint = param.getTargetPoint(); |
| | | this.emptyContainer = "N"; |
| | | this.crn = crn; |
| | | this.startPointSta = crnSta; |
| | | this.targetPointSta = crnSta; |
| | | }; |
| | | |
| | | |
| | | public static Integer convertParamIoType(String paramIoType){ |
| | | switch (paramIoType){ |
| | |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.mapper.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.CommandUtils; |
| | | import com.zy.asrs.utils.RouteUtils; |
| | | import com.zy.asrs.utils.TrackRangeUtils; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.asrs.utils.*; |
| | | import com.zy.common.model.MatDto; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.CollectionUtils; |
| | |
| | | |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() && (workNo == 0 || (workNo>9000 && workNo<10000)) |
| | | // && staProtocol.isInEnable() |
| | | && (workNo == 0 || (workNo>9000 && workNo<10000)) |
| | | && staProtocol.isPakMkWalk() |
| | | ) { |
| | | if (inSta.isBarcodeSign()){ |
| | |
| | | return; |
| | | } else { |
| | | staProtocol.setWorkNo(taskWrk1.getWrkNo()); |
| | | staProtocol.setStaNo(staDesc.getCrnStn()); |
| | | staProtocol.setStaNo(BarcodeUtils.getStaNo(staProtocol.getSiteId())); |
| | | devpThread.setPakMkWalk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | |
| | | Date now = new Date(); |
| | | // taskWrk1.setStatus(TaskStatusType.DISTRIBUTE.id);//派发状态 |
| | | // taskWrk.setAssignTime(now);//派发时间 |
| | | taskWrk1.setExecuteTime(now); |
| | | taskWrk1.setWrkSts(2);//工作状态 3.吊车入库 |
| | | taskWrk1.setCrnNo(staDesc.getCrnNo());//堆垛机号 |
| | | taskWrk1.setModiTime(now); |
| | | taskWrk1.setModiUser(9988L); |
| | | taskWrkService.updateById(taskWrk1); |
| | | |
| | | |
| | | } |
| | | } |
| | | return; |
| | |
| | | log.info("下发输送线任务:taskWrk:" + JSON.toJSONString(taskWrk)); |
| | | // R r = siteController.siteDetlUpdate(Integer.valueOf(taskWrk.getTargetPoint()), taskWrk.getWrkNo().shortValue(), (short) 0, "Y", false, false); |
| | | staProtocol.setWorkNo(taskWrk.getWrkNo()); |
| | | staProtocol.setStaNo(staDesc.getCrnStn()); |
| | | staProtocol.setStaNo(BarcodeUtils.getStaNo(staProtocol.getSiteId())); |
| | | boolean offer = false; |
| | | try { |
| | | offer = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol)); |
| | |
| | | if (rgvProtocol == null || rgvTaskProtocol == null) { |
| | | return false; |
| | | } |
| | | if (!rgvProtocol.getModeType().equals(RgvModeType.AUTO) || rgvProtocol.getRgvPos().equals(0L) || rgvTaskProtocol.getAvoid() == -1 || rgvProtocol.getRgvPosDestination() == 0L |
| | | if (!rgvProtocol.getModeType().equals(RgvModeType.AUTO) || rgvProtocol.getRgvPos().equals(0L) || rgvTaskProtocol.getAvoid() == -1 |
| | | || (!rgvProtocol.getStatusType().equals(RgvStatusType.IDLE) && !rgvProtocol.getStatusType().equals(RgvStatusType.ROAM))) { |
| | | return false; |
| | | } |
| | |
| | | // 判断是否满足取货条件 |
| | | if (staProtocol.isAutoing() |
| | | // && staProtocol.isLoading() |
| | | && staProtocol.isStaOk() |
| | | && staProtocol.getWorkNo() != 0) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(staProtocol.getWorkNo().toString()); |
| | | TaskWrk taskWrk = taskWrkService.selectByWrkNo(staProtocol.getWorkNo()); |
| | | if (taskWrk != null) { |
| | | return taskWrk; |
| | | } |
| | |
| | | if (taskWrk == null) { |
| | | return false; |
| | | } |
| | | Integer targetPointConvert = taskWrk.getTargetPointConvert(); |
| | | // Integer targetPointConvert = taskWrk.getTargetPointConvert(); |
| | | Integer targetPointConvert = BarcodeUtils.getOutStaNo(taskWrk.getOriginTargetPoint()); |
| | | if (targetPointConvert == null) { |
| | | return false; |
| | | } |
| | |
| | | BasDevpPosition basDevpPositionEnd = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", targetPointConvert)); |
| | | //执行 |
| | | issuedTake.setTaskNo(Long.valueOf(taskWrk.getTaskNo())); |
| | | issuedTake.setTaskStatus(1); |
| | | issuedTake.setTaskStatus(2); |
| | | issuedTake.setTaskNoDirection(issuedTake.gettaskNoDirection$(issuedTake.getTaskNo(), issuedTake.getTaskStatus())); |
| | | issuedTake.setTargetPosition(basDevpPositionSou.getPlcPosition()); |
| | | issuedTake.setIsRunning(1); |
| | |
| | | |
| | | |
| | | issuedPut.setTaskNo(Long.valueOf(taskWrk.getTaskNo())); |
| | | issuedPut.setTaskStatus(2); |
| | | issuedPut.setTaskStatus(3); |
| | | issuedPut.setTaskNoDirection(issuedPut.gettaskNoDirection$(issuedPut.getTaskNo(), issuedPut.getTaskStatus())); |
| | | issuedPut.setTargetPosition(basDevpPositionEnd.getPlcPosition()); |
| | | issuedPut.setIsRunning(1); |
| | |
| | | // taskWrk.setTargetPoint(Utils.getWcsLocNo(param.getTargetPoint()));//终点 转换下 |
| | | taskWrk.setTargetPoint(param.getTargetPoint());//终点 |
| | | taskWrk.setStartPoint(param.getStartPoint()); |
| | | taskWrk.setOriginStartPoint(param.getStartPoint()); |
| | | taskWrk.setOriginStartPoint(param.getStartPointSta().toString()); |
| | | taskWrk.setOriginTargetPoint(param.getTargetPointSta().toString()); |
| | | } |
| | | |
| | | } else if (param.getIoType() == 2) { |
| | |
| | | taskWrk.setTargetPoint(param.getTargetPoint()); |
| | | } |
| | | taskWrk.setTargetPoint(param.getTargetPoint()); |
| | | taskWrk.setOriginStartPoint(param.getStartPointSta().toString()); |
| | | taskWrk.setOriginTargetPoint(param.getTargetPointSta().toString()); |
| | | }else if (param.getIoType() == 3){ |
| | | taskWrk.setWrkSts(11); |
| | | if (!Cools.isEmpty(param.getStartPoint())) { |
| | | taskWrk.setStartPoint(param.getStartPoint());//起点 |
| | | taskWrk.setTargetPoint(param.getTargetPoint()); |
| | | taskWrk.setOriginStartPoint(param.getStartPointSta().toString()); |
| | | taskWrk.setOriginTargetPoint(param.getTargetPointSta().toString()); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | public class BarcodeUtils { |
| | | |
| | | public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{ |
| | | add(1001);add(1002);add(1003);add(1004);add(1005);add(1006);add(1007); |
| | | add(1008);add(1009);add(1010);add(1011);add(1012);add(1013);add(1014);add(1015); |
| | | add(1016);add(1017);add(1018);add(1019);add(1020);add(1021);add(1022);add(1023); |
| | | }}; |
| | | |
| | | public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{ |
| | | add(1001);add(1002);add(1003);add(1004);add(1005);add(1006);add(1007); |
| | | add(1008);add(1009);add(1010);add(1011);add(1012);add(1013);add(1014);add(1015); |
| | | add(1016);add(1017);add(1018);add(1019);add(1020);add(1021);add(1022);add(1023); |
| | | }}; |
| | | |
| | | public static Integer getStaNo(Integer staNo) { |
| | | switch (staNo){ |
| | | case 1021: |
| | | return 1020; |
| | | case 1012: |
| | | return 1014; |
| | | case 1005: |
| | | return 1004; |
| | | default: |
| | | return staNo; |
| | | } |
| | | } |
| | | public static Integer getStartStaNo(String staNo) { |
| | | switch (staNo){ |
| | | case "1021": |
| | | return 1020; |
| | | case "1012": |
| | | return 1014; |
| | | case "1005": |
| | | return 1004; |
| | | default: |
| | | return Integer.getInteger(staNo); |
| | | } |
| | | } |
| | | public static Integer getOutStaNo(String staNo) { |
| | | switch (staNo){ |
| | | case "1021": |
| | | return 1020; |
| | | case "1012": |
| | | return 1009; |
| | | case "1005": |
| | | return 1004; |
| | | default: |
| | | return Integer.parseInt(staNo); |
| | | } |
| | | } |
| | | } |
| | |
| | | for (BasDevpPosition basDevpPosition : basDevpPositions) { |
| | | if (basDevpPosition.getPlcPosition().equals(position)) { |
| | | basDevpPositionSort.add(basDevpPosition); |
| | | basDevpPositions.remove(basDevpPosition); |
| | | break; |
| | | } |
| | | } |
| | |
| | | try { |
| | | List<TaskProtocol> allTakeTaskProtocol = new ArrayList<>(); |
| | | for (TaskProtocol task : cache.values()) { |
| | | if (task.getTaskStatus()==1) { |
| | | if (task.getTaskStatus()==2) { |
| | | allTakeTaskProtocol.add(task); |
| | | } |
| | | } |
| | |
| | | try { |
| | | List<TaskProtocol> allPutTaskProtocol = new ArrayList<>(); |
| | | for (TaskProtocol task : cache.values()) { |
| | | if (task.getTaskStatus()==2) { |
| | | if (task.getTaskStatus()==3) { |
| | | allPutTaskProtocol.add(task); |
| | | } |
| | | } |
| | |
| | | try { |
| | | List<TaskProtocol> allWalkTaskProtocol = new ArrayList<>(); |
| | | for (TaskProtocol task : cache.values()) { |
| | | if (task.getTaskStatus()==0) { |
| | | if (task.getTaskStatus()==1) { |
| | | allWalkTaskProtocol.add(task); |
| | | } |
| | | } |
| | |
| | | public enum RgvModeType { |
| | | |
| | | NONE(-1, "离线"), |
| | | STOP(1, "维修"), |
| | | STOP(2, "维修"), |
| | | HAND(0, "手动"), |
| | | HALF_AUTO(3, "半自动"), |
| | | AUTO(2, "自动"), |
| | | AUTO(1, "自动"), |
| | | OTHER(100, "其它"), |
| | | ; |
| | | |
| | |
| | | |
| | | // 低 |
| | | private boolean low; |
| | | private boolean staOk; |
| | | |
| | | // 锁定标记 |
| | | private boolean pakMk = true; |
| | |
| | | |
| | | private volatile int taskStatus = 0; //作业模式 1:行走 2:取 3:放 0:无 |
| | | |
| | | private volatile boolean direction; // 执行方向(面朝轨道 定位值左小右大) true:左 false:右 |
| | | private volatile boolean direction; // 执行方向(面朝轨道 定位值左小右大) true:左 false:右 执行方向(面朝轨道 1:自己 2 轨道 true:自己 false:轨道 |
| | | |
| | | public TaskProtocol(){} |
| | | |
| | |
| | | switch (taskStatus){ |
| | | case 1: |
| | | taskStatusStr = "Tack"; |
| | | break; |
| | | case 2: |
| | | taskStatusStr = "Put"; |
| | | break; |
| | | } |
| | | return taskNo+"_"+taskStatusStr; |
| | | } |
| | |
| | | new Thread(this::taskWalkIssued).start(); |
| | | |
| | | // 启动任务完成线程 |
| | | // new Thread(this::taskComplete).start(); |
| | | new Thread(this::taskComplete).start(); |
| | | } |
| | | } |
| | | |
| | |
| | | * 完成 |
| | | */ |
| | | private void taskComplete() { |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(100); |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB100.12", (short) 1); |
| | | boolean[] status = siemensNet.getByteTransform().TransBool(result.Content, 0, 1); |
| | | if (status[0]){ |
| | | OperateResult result4 = siemensNet.Write("DB100.12.0", true); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("RGV数据读取线程异常!!!" + e.getMessage()); |
| | | initRgv(); |
| | | // e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | if (rgvTaskProtocol.getAvoid() != 0) { |
| | | continue; |
| | | } |
| | | if (!rgvProtocol.getStatusType().equals(RgvStatusType.IDLE)){ |
| | | continue; |
| | | } |
| | | |
| | | List<TaskProtocol> allTakeTaskProtocol = taskProtocolCache.getTakeOrPutTaskProtocol(rgvProtocol.getLoaded()); |
| | | for (TaskProtocol taskProtocol : allTakeTaskProtocol) { |
| | |
| | | Thread.sleep(100); |
| | | TaskProtocol issued = new TaskProtocol(taskProtocol); |
| | | write(issued); |
| | | taskProtocol.setIsRunning(taskProtocol.getIsRunning() + 1); |
| | | taskProtocol.setIsRunning(4); |
| | | taskProtocolCache.updateTaskProtocol(taskProtocol); |
| | | break; |
| | | } |
| | |
| | | rgvTaskProtocol = new RgvTaskProtocol(); |
| | | rgvTaskProtocol.setRgvNo(slave.getId()); |
| | | } |
| | | rgvTaskProtocol.setAvoid(-1); |
| | | rgvTaskProtocol.setAvoid(0); |
| | | rgvTaskProtocol.setAvoidingTheDestination(0L); |
| | | |
| | | RgvStatusCache.updateRgvStatus(rgvProtocol); |
| | |
| | | */ |
| | | private void readStatus() { |
| | | try { |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 18); |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 19); |
| | | if (result.IsSuccess) { |
| | | // 构建设备状态对象 |
| | | RgvProtocol rgvProtocol = RgvStatusCache.getRgvStatus(slave.getId()); |
| | |
| | | |
| | | rgvProtocol.setRgvPos((long)siemensNet.getByteTransform().TransInt32(result.Content, 0)); |
| | | rgvProtocol.setRgvPosDestination((long)siemensNet.getByteTransform().TransInt32(result.Content, 4)); |
| | | if (rgvProtocol.getRgvPosDestination()==0L){ |
| | | rgvProtocol.setRgvPosDestination(rgvProtocol.getRgvPos()); |
| | | } |
| | | rgvProtocol.setStatus(siemensNet.getByteTransform().TransInt16(result.Content, 8)); |
| | | rgvProtocol.setTaskNo((long)siemensNet.getByteTransform().TransInt32(result.Content, 10)); |
| | | |
| | |
| | | // rgvProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 28)); |
| | | // rgvProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 40)); |
| | | // rgvProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 48)); |
| | | |
| | | // OperateResultExOne<byte[]> result11 = siemensNet.Read("DB100.12", (short) 1); |
| | | boolean[] status = siemensNet.getByteTransform().TransBool(result.Content, 18, 1); |
| | | rgvProtocol.setLoaded(status[0]? (short)1:(short)0); |
| | | |
| | | OutputQueue.RGV.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId())); |
| | | // // 工位1复位信号 |
| | |
| | | // array[2] = taskProtocol.getTaskMode(); |
| | | // array[4] = command.getDestinationStaNo(); |
| | | // array[10] = taskProtocol.getCommand(); |
| | | OperateResult result = siemensNet.Write("DB100.0", taskProtocol.getTaskNo()); |
| | | OperateResult result1 = siemensNet.Write("DB100.1", taskProtocol.isDirection()); // 执行方向(面朝轨道 定位值左小右大) true:左 false:右 |
| | | int taskStatus = taskProtocol.getTaskStatus(); |
| | | |
| | | OperateResult result = siemensNet.Write("DB100.0", taskProtocol.getTargetPosition().intValue()); |
| | | OperateResult result1 = siemensNet.Write("DB100.4", (short) taskStatus); |
| | | OperateResult result2 = siemensNet.Write("DB100.6", taskProtocol.getTaskNo().intValue()); |
| | | OperateResult result3 = siemensNet.Write("DB100.10", taskProtocol.isDirection()? (short) 1 : (short) 2); // 执行方向(面朝轨道 定位值左小右大) true:左 false:右 |
| | | |
| | | OperateResult result4 = siemensNet.Write("DB100.12.0", true); |
| | | // if (taskProtocol.getAckFinish1() == 0) { |
| | | // short commandFinish = 3; //工位1、2任务同时写入 |
| | | // Thread.sleep(100L); |
| | |
| | | */ |
| | | private void readStatus(){ |
| | | try { |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 56); |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 58); |
| | | if (result.IsSuccess) { |
| | | if (null == crnProtocol) { |
| | | crnProtocol = new CrnProtocol(); |
| | |
| | | crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 44)); |
| | | crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 48)); |
| | | crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 52)); |
| | | crnProtocol.setLaneNo((int)siemensNet.getByteTransform().TransInt16(result.Content, 54));//巷道号 |
| | | crnProtocol.setLaneNo((int)siemensNet.getByteTransform().TransInt16(result.Content, 56));//巷道号 |
| | | |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | |
| | | /** |
| | | * 条码数量 |
| | | */ |
| | | private int barcodeSize = 2; |
| | | private int barcodeSize = 3; |
| | | |
| | | /** |
| | | * 入出库模式 |
| | |
| | | staProtocol.setInEnable(status[2]); // 可入 |
| | | // staProtocol.setInEnable(true); // 可入 |
| | | staProtocol.setOutEnable(status[3]);// 可出 |
| | | // staProtocol.setOutEnable(true);// 可出 |
| | | staProtocol.setOutEnable(true);// 可出 |
| | | staProtocol.setEmptyMk(status[4]); // 空板信号 |
| | | staProtocol.setFullPlt(status[5]); // 满托盘 |
| | | staProtocol.setHigh(status[6]); // 高库位 |
| | | staProtocol.setLow(status[7]); // 低库位 |
| | | staProtocol.setStaOk(status[8]); // 就绪 |
| | | |
| | | |
| | | |
| | |
| | | |
| | | //条码 |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.100.0",(short) (barcodeSize*8)); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.840.0",(short) (barcodeSize*8)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeSize; i++) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8"); |
| | |
| | | |
| | | int index = staNos.indexOf(staProtocol.getSiteId()); |
| | | |
| | | //更新命令日志 |
| | | CommandInfoLogService commandInfoLogService = SpringUtils.getBean(CommandInfoLogService.class); |
| | | CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class); |
| | | CommandInfo commandInfo = commandInfoService.selectById(staProtocol.getCommandId()); |
| | | CommandInfoLog commandInfoLog = new CommandInfoLog(); |
| | | if (commandInfo != null) { |
| | | commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class); |
| | | commandInfoLog.setId(null); |
| | | }else { |
| | | Date now = new Date(); |
| | | commandInfoLog.setCommand(JSON.toJSONString(staProtocol)); |
| | | commandInfoLog.setCommandStatus(3); |
| | | commandInfoLog.setStartTime(now); |
| | | commandInfoLog.setExecuteTime(now); |
| | | commandInfoLog.setCompleteTime(now); |
| | | commandInfoLog.setDevice(SlaveType.Devp.toString()); |
| | | commandInfoLog.setWrkNo(9999); |
| | | commandInfoLog.setTaskNo("9999"); |
| | | commandInfoLog.setCommandDesc("手动命令"); |
| | | } |
| | | // //更新命令日志 |
| | | // CommandInfoLogService commandInfoLogService = SpringUtils.getBean(CommandInfoLogService.class); |
| | | // CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class); |
| | | // CommandInfo commandInfo = commandInfoService.selectById(staProtocol.getCommandId()); |
| | | // CommandInfoLog commandInfoLog = new CommandInfoLog(); |
| | | // if (commandInfo != null) { |
| | | // commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class); |
| | | // commandInfoLog.setId(null); |
| | | // }else { |
| | | // Date now = new Date(); |
| | | // commandInfoLog.setCommand(JSON.toJSONString(staProtocol)); |
| | | // commandInfoLog.setCommandStatus(3); |
| | | // commandInfoLog.setStartTime(now); |
| | | // commandInfoLog.setExecuteTime(now); |
| | | // commandInfoLog.setCompleteTime(now); |
| | | // commandInfoLog.setDevice(SlaveType.Devp.toString()); |
| | | // commandInfoLog.setWrkNo(9999); |
| | | // commandInfoLog.setTaskNo("9999"); |
| | | // commandInfoLog.setCommandDesc("手动命令"); |
| | | // } |
| | | |
| | | OperateResult writeResult; |
| | | //任务下发次数 |
| | |
| | | //任务下发成功标识 |
| | | boolean writeFlag = false; |
| | | while(writeCount < 5){ |
| | | OperateResult writeResult1 = siemensS7Net.Write("DB100." + index*6, staProtocol.getWorkNo()); // 工作号 |
| | | OperateResult writeResult2 = siemensS7Net.Write("DB100." + (index*6+4), staProtocol.getStaNo()); // 目标站 |
| | | OperateResult writeResult1 = siemensS7Net.Write("DB101." + index*8, staProtocol.getWorkNo()); // 工作号 |
| | | OperateResult writeResult2 = siemensS7Net.Write("DB101." + (index*8+4), staProtocol.getStaNo().shortValue()); // 目标站 |
| | | if(writeResult1.IsSuccess && writeResult2.IsSuccess){ |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB101.0" + index*8, (short)4); |
| | | |
| | | //更新指令日志 |
| | | commandInfoLog.setDeviceLog("指令下发成功"); |
| | | commandInfoLogService.insert(commandInfoLog); |
| | | // commandInfoLog.setDeviceLog("指令下发成功"); |
| | | // commandInfoLogService.insert(commandInfoLog); |
| | | |
| | | if(readResult.IsSuccess){ |
| | | Integer workNo = siemensS7Net.getByteTransform().TransInt32(readResult.Content, 0); |
| | |
| | | log.error("写入输送线命令失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | |
| | | //更新指令日志 |
| | | commandInfoLog.setDeviceLog("指令下发失败"); |
| | | commandInfoLogService.insert(commandInfoLog); |
| | | // commandInfoLog.setDeviceLog("指令下发失败"); |
| | | // commandInfoLogService.insert(commandInfoLog); |
| | | } |
| | | Thread.sleep(200); |
| | | } |
| | |
| | | # 入库口2 |
| | | inSta[1]: |
| | | staNo: 1020 |
| | | barcode: ${wcs-slave.barcode[1].id} |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | backSta: 1021 |
| | | # led: ${wcs-slave.led[0].id} |
| | | # 空板入库口1 |
| | |
| | | # 入库口2 |
| | | emptyInSta[1]: |
| | | staNo: 1020 |
| | | barcode: ${wcs-slave.barcode[1].id} |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | backSta: 1021 |
| | | # led: ${wcs-slave.led[0].id} |
| | | # 拣料入库口1 |
| | |
| | | # 拣料入库口2 |
| | | pickSta[1]: |
| | | staNo: 1020 |
| | | barcode: ${wcs-slave.barcode[1].id} |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | backSta: 1021 |
| | | # 入库下发口1 |
| | | inWalkSta[0]: |
| | | staNo: 1021 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | backSta: 1021 |
| | | barcodeSign: false |
| | | # 入库下发口1 |
| | | inWalkSta[1]: |
| | | staNo: 1004 |
| | | staNo: 1005 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | backSta: 1004 |
| | | backSta: 1005 |
| | | barcodeSign: false |
| | | # 入库下发口1 |
| | | inWalkSta[2]: |
| | | staNo: 1012 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | barcode: ${wcs-slave.barcode[1].id} |
| | | backSta: 1012 |
| | | barcodeSign: false |
| | | |
| | |
| | | # RGV穿梭车1 |
| | | rgv[0]: |
| | | id: 1 |
| | | ip: 10.10.10.49 |
| | | ip: 10.10.10.70 |
| | | port: 502 |
| | | rack: 0 |
| | | slot: 0 |
| | | otherId: 2 |
| | | carBodyJiaoMing: 100 |
| | | carBodyKunPeng: 100 |
| | | carBodyJiaoMing: 4100 |
| | | carBodyKunPeng: 4100 |
| | | #RGV源站点 |
| | | rgvInSta[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 100 |
| | | staNo: 1004 |
| | | direction: true |
| | | rgvInSta[1]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 101 |
| | | staNo: 1001 |
| | | #执行方向(面朝轨道 定位值左小右大) true:左 false:右 |
| | | direction: false |
| | | rgvInSta[2]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 1014 |
| | | #执行方向(面朝轨道 定位值左小右大) true:左 false:右 |
| | | direction: true |
| | | rgvInSta[3]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 1007 |
| | | #执行方向(面朝轨道 定位值左小右大) true:左 false:右 |
| | | direction: false |
| | | #RGV目标站点 |
| | |
| | | # RGV穿梭车2 |
| | | rgv[1]: |
| | | id: 2 |
| | | ip: 10.10.10.65 |
| | | ip: 10.10.10.71 |
| | | port: 502 |
| | | rack: 0 |
| | | slot: 0 |
| | | otherId: 1 |
| | | carBodyJiaoMing: 100 |
| | | carBodyKunPeng: 100 |
| | | carBodyJiaoMing: 4100 |
| | | carBodyKunPeng: 4100 |
| | | #RGV源站点 |
| | | rgvInSta[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | |
| | | #执行方向(面朝轨道 定位值左小右大) true:左 false:右 |
| | | direction: false |
| | | |
| | | barcode[0]: #条码扫描仪1 |
| | | barcode[0]: #条码扫描仪1004 |
| | | port: 51236 |
| | | ip: 10.10.10.52 |
| | | ip: 10.10.101.52 |
| | | id: 1 |
| | | barcode[1]: #条码扫描仪1 |
| | | barcode[1]: #条码扫描仪1无 |
| | | port: 51236 |
| | | ip: 10.10.10.52 |
| | | ip: 10.10.101.52 |
| | | id: 2 |
| | | barcode[2]: #条码扫描仪1020 |
| | | port: 51236 |
| | | ip: 10.10.101.52 |
| | | id: 3 |
| | | # 磅秤 |
| | | scale[0]: |
| | | id: 1 |
| | |
| | | |
| | | constant-parameters: |
| | | # 轨道总长 |
| | | trackEntireLength: 1737000 |
| | | trackEntireLength: 190000 |
| | | # 轨道基准点 |
| | | trackBenchmark: 1 |
| | | # 轨道转换为米比例 |
| | | trackProportion: 10000 |
| | | # 避让距离 |
| | | avoidDistance: 100 |
| | | avoidDistance: 4100 |
| | | |
| | | wms: |
| | | # 是否开启上报 |
| | |
| | | <select id="selectPakIn" resultMap="BaseResultMap"> |
| | | select top 1 * from "SOURCE"."wcs_task_wrk" |
| | | where "STATUS"=1 |
| | | and "WRK_STS"=2 |
| | | and "CRN_NO"=#{crnNo} |
| | | and "WRK_NO"=#{workNo} |
| | | and "START_POINT"=#{startPoint} |
| | |
| | | "id": "site-1004", |
| | | "text": "1004", |
| | | "top": 344, |
| | | "left": 240, |
| | | "left": 287, |
| | | "width": 45, |
| | | "height": 23 |
| | | }, { |
| | |
| | | "id": "site-1005", |
| | | "text": "1005", |
| | | "top": 344, |
| | | "left": 287, |
| | | "left": 240, |
| | | "width": 45, |
| | | "height": 23 |
| | | }, { |
| | |
| | | "type": "stn", |
| | | "id": "site-1023", |
| | | "text": "1023", |
| | | "top": 59, |
| | | "top": 0, |
| | | "left": 240, |
| | | "width": 92, |
| | | "height": 23 |
| | |
| | | "type": "stn", |
| | | "id": "site-1021", |
| | | "text": "1021", |
| | | "top": 0, |
| | | "top": 59, |
| | | "left": 240, |
| | | "width": 45, |
| | | "height": 23 |
| | |
| | | "type": "stn", |
| | | "id": "site-1020", |
| | | "text": "1020", |
| | | "top": 0, |
| | | "top": 59, |
| | | "left": 287, |
| | | "width": 45, |
| | | "height": 23 |