New file |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @TableName("asr_bas_jar") |
| | | public class BasJar implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * JAR编号 |
| | | */ |
| | | @ApiModelProperty(value= "JAR编号") |
| | | @TableId(value = "jar_no", type = IdType.INPUT) |
| | | @TableField("jar_no") |
| | | private Integer jarNo; |
| | | |
| | | /** |
| | | * 区域 |
| | | */ |
| | | @ApiModelProperty(value= "区域") |
| | | private Integer region; |
| | | |
| | | /** |
| | | * 代号 |
| | | */ |
| | | @ApiModelProperty(value= "代号") |
| | | @TableField("jar_code") |
| | | private Integer jarCode; |
| | | |
| | | /** |
| | | * 对应出库站 |
| | | */ |
| | | @ApiModelProperty(value= "对应出库站") |
| | | @TableField("sta_no") |
| | | private Integer staNo; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | @ApiModelProperty(value= "状态") |
| | | @TableField("jar_status") |
| | | private Integer jarStatus; |
| | | |
| | | /** |
| | | * 库存数 |
| | | */ |
| | | @ApiModelProperty(value= "库存数") |
| | | @TableField("jar_count") |
| | | private Integer jarCount; |
| | | |
| | | /** |
| | | * 异常代码 |
| | | */ |
| | | @ApiModelProperty(value= "异常代码") |
| | | @TableField("jar_err") |
| | | private Integer jarErr; |
| | | |
| | | /** |
| | | * 左门(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "左门(checkBox)") |
| | | @TableField("left_door") |
| | | private String leftDoor; |
| | | |
| | | /** |
| | | * 右门(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "右门(checkBox)") |
| | | @TableField("right_door") |
| | | private String rightDoor; |
| | | |
| | | /** |
| | | * 左门可开(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "左门可开(checkBox)") |
| | | @TableField("left_in_enable") |
| | | private String leftInEnable; |
| | | |
| | | /** |
| | | * 左门可关(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "左门可关(checkBox)") |
| | | @TableField("left_out_enable") |
| | | private String leftOutEnable; |
| | | |
| | | /** |
| | | * 自动(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "自动(checkBox)") |
| | | private String autoing; |
| | | |
| | | /** |
| | | * 模式 |
| | | */ |
| | | @ApiModelProperty(value= "模式") |
| | | @TableField("jar_mode") |
| | | private Integer jarMode; |
| | | |
| | | /** |
| | | * 右门可开(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "右门可开(checkBox)") |
| | | @TableField("right_in_enable") |
| | | private String rightInEnable; |
| | | |
| | | /** |
| | | * 右门可关(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "右门可关(checkBox)") |
| | | @TableField("right_out_enable") |
| | | private String rightOutEnable; |
| | | |
| | | public BasJar() {} |
| | | |
| | | public BasJar(Integer jarNo,Integer region,Integer jarCode,Integer staNo,Integer jarStatus,Integer jarCount,Integer jarErr,String leftDoor,String rightDoor,String leftInEnable,String leftOutEnable,String autoing,Integer jarMode,String rightInEnable,String rightOutEnable) { |
| | | this.jarNo = jarNo; |
| | | this.region = region; |
| | | this.jarCode = jarCode; |
| | | this.staNo = staNo; |
| | | this.jarStatus = jarStatus; |
| | | this.jarCount = jarCount; |
| | | this.jarErr = jarErr; |
| | | this.leftDoor = leftDoor; |
| | | this.rightDoor = rightDoor; |
| | | this.leftInEnable = leftInEnable; |
| | | this.leftOutEnable = leftOutEnable; |
| | | this.autoing = autoing; |
| | | this.jarMode = jarMode; |
| | | this.rightInEnable = rightInEnable; |
| | | this.rightOutEnable = rightOutEnable; |
| | | } |
| | | |
| | | // BasJar basJar = new BasJar( |
| | | // null, // JAR编号[非空] |
| | | // null, // 区域 |
| | | // null, // 代号 |
| | | // null, // 对应出库站 |
| | | // null, // 状态 |
| | | // null, // 库存数 |
| | | // null, // 异常代码 |
| | | // null, // 左门(checkBox) |
| | | // null, // 右门(checkBox) |
| | | // null, // 左门可开(checkBox) |
| | | // null, // 左门可关(checkBox) |
| | | // null, // 自动(checkBox) |
| | | // null, // 模式 |
| | | // null, // 右门可开(checkBox) |
| | | // null // 右门可关(checkBox) |
| | | // ); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.zy.asrs.entity.BasJar; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface BasJarMapper extends BaseMapper<BasJar> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.zy.asrs.entity.BasJar; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface BasJarService extends IService<BasJar> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.zy.asrs.mapper.BasJarMapper; |
| | | import com.zy.asrs.entity.BasJar; |
| | | import com.zy.asrs.service.BasJarService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("basJarService") |
| | | public class BasJarServiceImpl extends ServiceImpl<BasJarMapper, BasJar> implements BasJarService { |
| | | |
| | | } |
| | |
| | | * */ |
| | | public synchronized boolean rgvMapUpdate(BasRgvMap basRgvMapCurrent,Integer staStart,Integer staEnd){ |
| | | if (true){ |
| | | basRgvMapMapper.updateById(basRgvMapCurrent); |
| | | return true; |
| | | } |
| | | |
| | |
| | | // generator.table="sys_host"; |
| | | // sqlserver |
| | | generator.sqlOsType = SqlOsType.SQL_SERVER; |
| | | generator.url="localhost:1433;databasename=xjhsasrs"; |
| | | generator.url="10.10.10.254:1433;databasename=ahyxasrs"; |
| | | generator.username="sa"; |
| | | generator.password="sa@123"; |
| | | generator.table="asr_bas_rgv_err_log"; |
| | | generator.table="asr_bas_jar"; |
| | | generator.packagePath="com.zy.asrs"; |
| | | |
| | | generator.controller = false; |
| | |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.CrnSlave; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.LedSlave; |
| | | import com.zy.core.model.RgvSlave; |
| | | import com.zy.core.model.*; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | for (Slave crn : slaveProperties.getCrn()) { |
| | | MessageQueue.init(SlaveType.Crn, crn); |
| | | } |
| | | // 初始化堆垛机mq |
| | | // 初始化RGVmq |
| | | for (Slave rgv : slaveProperties.getRgv()) { |
| | | MessageQueue.init(SlaveType.Rgv, rgv); |
| | | } |
| | |
| | | for (Slave scale : slaveProperties.getScale()) { |
| | | MessageQueue.init(SlaveType.Scale, scale); |
| | | } |
| | | // 初始化硫化罐mq |
| | | for (Slave jar : slaveProperties.getJar()) { |
| | | MessageQueue.init(SlaveType.Jar, jar); |
| | | } |
| | | // // 初始化台车mq |
| | | // for (Slave car : slaveProperties.getCar()) { |
| | | // MessageQueue.init(SlaveType.Car, car); |
| | | // } |
| | | // 初始化Stemq |
| | | for (Slave ste : slaveProperties.getSte()) { |
| | | MessageQueue.init(SlaveType.Ste, ste); |
| | | } |
| | | } |
| | | |
| | | private void initThread(){ |
| | |
| | | map.put(crnThread, thread); |
| | | SlaveConnection.put(SlaveType.Crn, crn.getId(), crnThread); |
| | | } |
| | | // // 初始化穿梭车线程 |
| | | // log.info("初始化RGV线程..................................................."); |
| | | // for (RgvSlave rgv : slaveProperties.getRgv()) { |
| | | // RgvThread rgvThread = new RgvThread(rgv); |
| | | // new Thread((Runnable) rgvThread).start(); |
| | | // SlaveConnection.put(SlaveType.Rgv, rgv.getId(), rgvThread); |
| | | // } |
| | | // 初始化穿梭车线程 |
| | | log.info("初始化RGV线程..................................................."); |
| | | for (RgvSlave rgv : slaveProperties.getRgv()) { |
| | | RgvThread rgvThread = new RgvThread(rgv); |
| | | new Thread((Runnable) rgvThread).start(); |
| | | SlaveConnection.put(SlaveType.Rgv, rgv.getId(), rgvThread); |
| | | } |
| | | // 初始化输送线线程 |
| | | log.info("初始化输送线线程..................................................."); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | |
| | | new Thread(ledThread).start(); |
| | | SlaveConnection.put(SlaveType.Led, led.getId(), ledThread); |
| | | } |
| | | // 初始化jar线程 |
| | | log.info("初始化jar线程..................................................."); |
| | | for (JarSlave jar : slaveProperties.getJar()) { |
| | | JarThread jarThread = new JarThread(jar); |
| | | new Thread(jarThread).start(); |
| | | SlaveConnection.put(SlaveType.Jar, jar.getId(), jarThread); |
| | | } |
| | | // 初始化Ste线程 |
| | | log.info("初始化ste线程..................................................."); |
| | | for (SteSlave ste : slaveProperties.getSte()) { |
| | | SteThread steThread = new SteThread(ste); |
| | | new Thread(steThread).start(); |
| | | SlaveConnection.put(SlaveType.Ste, ste.getId(), steThread); |
| | | } |
| | | // 初始化磅秤线程 |
| | | // log.info("初始化磅秤线程..................................................."); |
| | | // for (Slave scale : slaveProperties.getScale()) { |
New file |
| | |
| | | package com.zy.core.enums; |
| | | |
| | | public enum JarStatusType { |
| | | |
| | | IDLE(0, "空闲"), |
| | | MOVING(1, "作业中"), |
| | | SOS(2, "报警"), |
| | | WAITING(10, "等待确认"), |
| | | OFF_LINE(-1, "未知"), |
| | | OTHER(100, "其它"), |
| | | ; |
| | | |
| | | public Integer id; |
| | | public String desc; |
| | | JarStatusType(Integer id, String desc) { |
| | | this.id = id; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public static JarStatusType get(Short id) { |
| | | if (null == id) { |
| | | return null; |
| | | } |
| | | for (JarStatusType type : JarStatusType.values()) { |
| | | if (type.id.equals(id.intValue())) { |
| | | return type; |
| | | } |
| | | } |
| | | return OFF_LINE; |
| | | } |
| | | |
| | | public static JarStatusType get(JarStatusType type) { |
| | | if (null == type) { |
| | | return null; |
| | | } |
| | | for (JarStatusType jarStatusType : JarStatusType.values()) { |
| | | if (jarStatusType == type) { |
| | | return jarStatusType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | Scale, |
| | | Car, |
| | | Rgv, |
| | | Ste |
| | | Ste, |
| | | Jar |
| | | ; |
| | | |
| | | public static SlaveType findInstance(String s){ |
New file |
| | |
| | | package com.zy.core.model; |
| | | |
| | | import com.zy.core.Slave; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/8/10 |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class JarSlave extends Slave { |
| | | |
| | | private Integer rack; |
| | | |
| | | private Integer slot; |
| | | |
| | | private Boolean demo; |
| | | |
| | | // 穿梭车入库站点 |
| | | private List<CrnStn> steInStn = new ArrayList<>(); |
| | | |
| | | // 穿梭车出库站点 |
| | | private List<CrnStn> steOutStn = new ArrayList<>(); |
| | | |
| | | @Data |
| | | public static class CrnStn { |
| | | |
| | | // 输送线plc编号 |
| | | private Integer devpPlcId; |
| | | |
| | | // 穿梭车站点编号 |
| | | private Integer staNo; |
| | | |
| | | // 排 |
| | | private Integer row; |
| | | |
| | | // 列 |
| | | private Integer bay; |
| | | |
| | | // 层 |
| | | private Integer lev; |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.core.model.protocol; |
| | | |
| | | import com.zy.asrs.entity.BasJar; |
| | | import com.zy.core.enums.JarStatusType; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/8/7 |
| | | */ |
| | | @Slf4j |
| | | @Data |
| | | public class JarProtocol { |
| | | |
| | | /** |
| | | * 设备号 |
| | | */ |
| | | private Integer jarNo; |
| | | |
| | | /** |
| | | * 1 = 联机模式 |
| | | * 0 = 脱机模式 |
| | | */ |
| | | public Integer mode; |
| | | |
| | | /** |
| | | IDLE(0, "空闲"), |
| | | MOVING(1, "作业中"), |
| | | SOS(2, "报警"), |
| | | WAITING(3, "任务完成等待WCS确认"), |
| | | */ |
| | | public Short status; |
| | | |
| | | public JarStatusType statusType; |
| | | |
| | | /* |
| | | * 左门状态 |
| | | * */ |
| | | private boolean leftDoor; |
| | | |
| | | /* |
| | | * 右门状态 |
| | | * */ |
| | | private boolean rightDoor; |
| | | |
| | | /* |
| | | * 左门可开 |
| | | * */ |
| | | private boolean leftInEnable; |
| | | |
| | | /* |
| | | * 左门可关 |
| | | * */ |
| | | private boolean leftOutEnable; |
| | | |
| | | /* |
| | | * 右门可开 |
| | | * */ |
| | | private boolean rightInEnable; |
| | | |
| | | /* |
| | | * 右门可关 |
| | | * */ |
| | | private boolean rightOutEnable; |
| | | |
| | | /* |
| | | * 自动 |
| | | * */ |
| | | private boolean autoing; |
| | | |
| | | |
| | | /** |
| | | * 异常码 |
| | | */ |
| | | public Integer jarErr = 0; |
| | | |
| | | public void setStatus(Short status){ |
| | | this.status = status; |
| | | this.statusType = JarStatusType.get(status); |
| | | } |
| | | |
| | | public void setStatus(JarStatusType type){ |
| | | this.statusType = type; |
| | | this.status = JarStatusType.get(type).id.shortValue(); |
| | | } |
| | | |
| | | |
| | | public BasJar toSqlModel(BasJar basJar){ |
| | | if (jarErr!=null) { |
| | | basJar.setJarErr(jarErr); |
| | | } |
| | | basJar.setJarMode(mode); |
| | | // if (basSte.getPakMk().equals("N")) { |
| | | // if (!Cools.isEmpty(row)) { |
| | | // basSte.setRow(row.intValue()); |
| | | // } |
| | | // if (!Cools.isEmpty(bay)) { |
| | | // basSte.setBay(bay.intValue()); |
| | | // } |
| | | // if (!Cools.isEmpty(lev)) { |
| | | // basSte.setLev(lev.intValue()); |
| | | // } |
| | | // } |
| | | return basJar; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.core.properties; |
| | | |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.model.CrnSlave; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.LedSlave; |
| | | import com.zy.core.model.RgvSlave; |
| | | import com.zy.core.model.*; |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | |
| | | |
| | | private List<Slave> car = new ArrayList<>(); |
| | | |
| | | private List<JarSlave> jar = new ArrayList<>(); |
| | | |
| | | private List<SteSlave> Ste = new ArrayList<>(); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.core.thread; |
| | | |
| | | import HslCommunication.Core.Types.OperateResult; |
| | | import HslCommunication.Core.Types.OperateResultExOne; |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasJar; |
| | | import com.zy.asrs.service.BasJarService; |
| | | import com.zy.core.News; |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.enums.JarStatusType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.JarSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.protocol.JarProtocol; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * shuttle 硫化罐线程 |
| | | * Created by vincent on 2020/8/4 |
| | | * 不能有 槽号 和 机架号 |
| | | */ |
| | | @Data |
| | | @Slf4j |
| | | public class JarThread implements Runnable, ThreadHandler { |
| | | |
| | | private SiemensS7Net siemensS7Net; |
| | | private JarSlave slave; |
| | | private JarProtocol jarProtocol; |
| | | private short heartBeatVal = 1; |
| | | |
| | | public JarThread(JarSlave slave) { |
| | | this.slave = slave; |
| | | } |
| | | |
| | | @Override |
| | | @SuppressWarnings("InfiniteLoopStatement") |
| | | public void run() { |
| | | this.connect(); |
| | | while (true) { |
| | | try { |
| | | int step = 1; |
| | | Task task = MessageQueue.poll(SlaveType.Jar, slave.getId()); |
| | | if (task != null) { |
| | | step = task.getStep(); |
| | | } |
| | | switch (step) { |
| | | // 读数据 |
| | | case 1: |
| | | readStatus(); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | // 心跳 |
| | | // heartbeat(); |
| | | Thread.sleep(500); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化堆垛机状态 |
| | | */ |
| | | private void initSte() { |
| | | if (null == jarProtocol) { |
| | | jarProtocol = new JarProtocol(); |
| | | } |
| | | jarProtocol.setJarNo(slave.getId()); |
| | | jarProtocol.setMode( 0); |
| | | jarProtocol.setStatus(JarStatusType.OFF_LINE); |
| | | jarProtocol.setJarErr(0); |
| | | } |
| | | |
| | | @Override |
| | | public boolean connect() { |
| | | boolean result = false; |
| | | // 不能有 槽号 和 机架号 |
| | | siemensS7Net = new SiemensS7Net(SiemensPLCS.S200Smart, slave.getIp()); |
| | | // siemensS7Net.setRack(slave.getRack().byteValue()); |
| | | // siemensS7Net.setSlot(slave.getSlot().byteValue()); |
| | | OperateResult connect = siemensS7Net.ConnectServer(); |
| | | if(connect.IsSuccess){ |
| | | result = true; |
| | | OutputQueue.STE.offer(MessageFormat.format( "【{0}】硫化罐plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | News.info("硫化罐plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } else { |
| | | OutputQueue.STE.offer(MessageFormat.format("【{0}】硫化罐plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] ", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | News.error("硫化罐plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | initSte(); |
| | | } |
| | | // melsecMcNet.ConnectClose(); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 读取状态 |
| | | */ |
| | | private void readStatus(){ |
| | | try { |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) 10); |
| | | if (result.IsSuccess) { |
| | | if (null == jarProtocol) { |
| | | jarProtocol = new JarProtocol(); |
| | | jarProtocol.setJarNo(slave.getId()); |
| | | } |
| | | jarProtocol.setMode(siemensS7Net.getByteTransform().TransInt32(result.Content, 2)); |
| | | jarProtocol.setStatus(siemensS7Net.getByteTransform().TransInt16(result.Content, 4)); |
| | | |
| | | // 根据实时信息更新数据库 |
| | | BasJarService service = SpringUtils.getBean(BasJarService.class); |
| | | if (null != service) { |
| | | // 同步pakMk |
| | | BasJar one = service.selectById(slave.getId()); |
| | | |
| | | BasJar basJar = new BasJar(); |
| | | basJar.setJarNo(slave.getId()); |
| | | if (!service.updateById(jarProtocol.toSqlModel(basJar))){ |
| | | News.error("硫化罐plc数据库更新失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | OutputQueue.STE.offer(MessageFormat.format("【{0}】{1}硫化罐plc状态信息失败", DateUtils.convert(new Date()), slave.getId())); |
| | | throw new CoolException(MessageFormat.format( "硫化罐plc状态信息失败 ===>> [id:{0}] [ip:{1}] [port:{2}]", slave.getId(), slave.getIp(), slave.getPort())); |
| | | } |
| | | } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | OutputQueue.STE.offer(MessageFormat.format("【{0}】读取硫化罐plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | // News.error("读取穿梭车plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | initSte(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void close() { |
| | | // siemensS7Net.ConnectClose(); |
| | | } |
| | | |
| | | /** |
| | | * 心跳 |
| | | */ |
| | | private void heartbeat(){ |
| | | if (heartBeatVal == 1) { |
| | | heartBeatVal = 2; |
| | | } else { |
| | | heartBeatVal = 1; |
| | | } |
| | | OperateResult write = siemensS7Net.Write("D10", heartBeatVal); |
| | | if (!write.IsSuccess) { |
| | | News.error("硫化罐plc编号={} 心跳失败", slave.getId()); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.mapper.BasJarMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.BasJar"> |
| | | <result column="jar_no" property="jarNo" /> |
| | | <result column="region" property="region" /> |
| | | <result column="jar_code" property="jarCode" /> |
| | | <result column="sta_no" property="staNo" /> |
| | | <result column="jar_status" property="jarStatus" /> |
| | | <result column="jar_count" property="jarCount" /> |
| | | <result column="jar_err" property="jarErr" /> |
| | | <result column="left_door" property="leftDoor" /> |
| | | <result column="right_door" property="rightDoor" /> |
| | | <result column="left_in_enable" property="leftInEnable" /> |
| | | <result column="left_out_enable" property="leftOutEnable" /> |
| | | <result column="autoing" property="autoing" /> |
| | | <result column="jar_mode" property="jarMode" /> |
| | | <result column="right_in_enable" property="rightInEnable" /> |
| | | <result column="right_out_enable" property="rightOutEnable" /> |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |