| | |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date appeTime; |
| | | |
| | | /** |
| | | * 库位号 |
| | | */ |
| | | @ApiModelProperty(value= "库位号") |
| | | @TableField("jar_loc_digit") |
| | | private Integer jarLocDigit; |
| | | |
| | | public BasJarMast() {} |
| | | |
| | | public BasJarMast(Long wrkNo,Integer enterStaNo,Integer outStaNo,Integer jarEnterStaNo,Integer jarOutStaNo,Integer jarId,Integer jarRegin,Integer status,Integer enterSteNo,Integer outSteId,Integer enterRgvId,Integer outRgvId,Date ioTime,Date modiTime,Date appeTime) { |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableField; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
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 java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.service.BasJarMastStatusService; |
| | | import com.zy.asrs.entity.BasJarMastStatus; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @TableName("jar_wrk_mast_execute") |
| | | public class WrkMastExecute implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 工作号 |
| | | */ |
| | | @ApiModelProperty(value= "工作号") |
| | | @TableField("wrk_no") |
| | | private Long wrkNo; |
| | | |
| | | /** |
| | | * 入库源站点 |
| | | */ |
| | | @ApiModelProperty(value= "入库源站点") |
| | | @TableField("enter_sta_no") |
| | | private Integer enterStaNo; |
| | | |
| | | /** |
| | | * 入库目标站点 |
| | | */ |
| | | @ApiModelProperty(value= "入库目标站点") |
| | | @TableField("out_sta_no") |
| | | private Integer outStaNo; |
| | | |
| | | /** |
| | | * 入硫化罐站点 |
| | | */ |
| | | @ApiModelProperty(value= "入硫化罐站点") |
| | | @TableField("jar_enter_sta_no") |
| | | private Integer jarEnterStaNo; |
| | | |
| | | /** |
| | | * 出硫化罐站点 |
| | | */ |
| | | @ApiModelProperty(value= "出硫化罐站点") |
| | | @TableField("jar_out_sta_no") |
| | | private Integer jarOutStaNo; |
| | | |
| | | /** |
| | | * 设备ID |
| | | */ |
| | | @ApiModelProperty(value= "设备ID") |
| | | @TableField("jar_id") |
| | | private Integer jarId; |
| | | |
| | | /** |
| | | * 区域 |
| | | */ |
| | | @ApiModelProperty(value= "区域") |
| | | @TableField("jar_regin") |
| | | private Integer jarRegin; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | @ApiModelProperty(value= "状态") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 穿梭板 |
| | | */ |
| | | @ApiModelProperty(value= "穿梭板") |
| | | @TableField("ste_id") |
| | | private Integer steId; |
| | | |
| | | /** |
| | | * RGV |
| | | */ |
| | | @ApiModelProperty(value= "RGV") |
| | | @TableField("rgv_id") |
| | | private Integer rgvId; |
| | | |
| | | /** |
| | | * 作业时间 |
| | | */ |
| | | @ApiModelProperty(value= "作业时间") |
| | | @TableField("io_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date ioTime; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty(value= "创建时间") |
| | | @TableField("modi_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date modiTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @ApiModelProperty(value= "更新时间") |
| | | @TableField("appe_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date appeTime; |
| | | |
| | | /** |
| | | * 任务状态 0: 初始 1: 作业中 2: 完成 |
| | | */ |
| | | @ApiModelProperty(value= "任务状态 0: 初始 1: 作业中 2: 完成 ") |
| | | @TableField("wrk_type") |
| | | private Integer wrkType; |
| | | |
| | | /** |
| | | * 工作状态 |
| | | */ |
| | | @ApiModelProperty(value= "工作状态") |
| | | @TableField("wrk_sts") |
| | | private Integer wrkSts; |
| | | |
| | | /** |
| | | * 任务类型 0: 未知 1: 开门 2: 关门 3: 入硫化罐 4: 入冷却槽 5: 穿梭车进冷却槽 6: 穿梭车离开冷却槽 7: 出冷却槽 |
| | | */ |
| | | @ApiModelProperty(value= "任务类型 0: 未知 1: 开门 2: 关门 3: 入硫化罐 4: 入冷却槽 5: 穿梭车进冷却槽 6: 穿梭车离开冷却槽 7: 出冷却槽 ") |
| | | @TableField("io_type") |
| | | private Integer ioType; |
| | | |
| | | /** |
| | | * 设备 0: 未知 1: 硫化罐 2: 冷却槽 |
| | | */ |
| | | @ApiModelProperty(value= "设备 0: 未知 1: 硫化罐 2: 冷却槽 ") |
| | | private Integer type; |
| | | |
| | | public WrkMastExecute() {} |
| | | |
| | | public WrkMastExecute(Long wrkNo,Integer enterStaNo,Integer outStaNo,Integer jarEnterStaNo,Integer jarOutStaNo,Integer jarId,Integer jarRegin,Integer status,Integer steId,Integer rgvId,Date ioTime,Date modiTime,Date appeTime,Integer wrkType,Integer wrkSts,Integer ioType,Integer type) { |
| | | this.wrkNo = wrkNo; |
| | | this.enterStaNo = enterStaNo; |
| | | this.outStaNo = outStaNo; |
| | | this.jarEnterStaNo = jarEnterStaNo; |
| | | this.jarOutStaNo = jarOutStaNo; |
| | | this.jarId = jarId; |
| | | this.jarRegin = jarRegin; |
| | | this.status = status; |
| | | this.steId = steId; |
| | | this.rgvId = rgvId; |
| | | this.ioTime = ioTime; |
| | | this.modiTime = modiTime; |
| | | this.appeTime = appeTime; |
| | | this.wrkType = wrkType; |
| | | this.wrkSts = wrkSts; |
| | | this.ioType = ioType; |
| | | this.type = type; |
| | | } |
| | | |
| | | // WrkMastExecute wrkMastExecute = new WrkMastExecute( |
| | | // null, // 工作号[非空] |
| | | // null, // 入库源站点[非空] |
| | | // null, // 入库目标站点[非空] |
| | | // null, // 入硫化罐站点[非空] |
| | | // null, // 出硫化罐站点[非空] |
| | | // null, // 设备ID[非空] |
| | | // null, // 区域[非空] |
| | | // null, // 状态[非空] |
| | | // null, // 穿梭板[非空] |
| | | // null, // RGV[非空] |
| | | // null, // 作业时间 |
| | | // null, // 创建时间 |
| | | // null, // 更新时间 |
| | | // null, // 任务状态[非空] |
| | | // null, // 工作状态[非空] |
| | | // null, // 任务类型[非空] |
| | | // null // 设备[非空] |
| | | // ); |
| | | |
| | | public String getIoTime$(){ |
| | | if (Cools.isEmpty(this.ioTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ioTime); |
| | | } |
| | | |
| | | public String getModiTime$(){ |
| | | if (Cools.isEmpty(this.modiTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); |
| | | } |
| | | |
| | | public String getAppeTime$(){ |
| | | if (Cools.isEmpty(this.appeTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime); |
| | | } |
| | | |
| | | public String getWrkType$(){ |
| | | if (null == this.wrkType){ return null; } |
| | | switch (this.wrkType){ |
| | | case 0: |
| | | return "初始"; |
| | | case 1: |
| | | return "作业中"; |
| | | case 2: |
| | | return "完成"; |
| | | default: |
| | | return String.valueOf(this.wrkType); |
| | | } |
| | | } |
| | | |
| | | public String getWrkSts$(){ |
| | | BasJarMastStatusService service = SpringUtils.getBean(BasJarMastStatusService.class); |
| | | BasJarMastStatus basJarMastStatus = service.selectById(this.wrkSts); |
| | | if (!Cools.isEmpty(basJarMastStatus)){ |
| | | return String.valueOf(basJarMastStatus.getId()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getIoType$(){ |
| | | if (null == this.ioType){ return null; } |
| | | switch (this.ioType){ |
| | | case 0: |
| | | return this.ioType+":未知"; |
| | | case 1: |
| | | return this.ioType+":开门"; |
| | | case 2: |
| | | return this.ioType+":关门"; |
| | | case 3: |
| | | return this.ioType+":入硫化罐"; |
| | | case 4: |
| | | return this.ioType+":入冷却槽"; |
| | | case 5: |
| | | return this.ioType+":穿梭车进冷却槽"; |
| | | case 6: |
| | | return this.ioType+":穿梭车离开冷却槽"; |
| | | case 7: |
| | | return this.ioType+":出冷却槽"; |
| | | default: |
| | | return String.valueOf(this.ioType); |
| | | } |
| | | } |
| | | |
| | | public String getType$(){ |
| | | if (null == this.type){ return null; } |
| | | switch (this.type){ |
| | | case 0: |
| | | return "未知"; |
| | | case 1: |
| | | return "硫化罐"; |
| | | case 2: |
| | | return "冷却槽"; |
| | | default: |
| | | return String.valueOf(this.type); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.entity.BasJarMast; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface BasJarMastMapper extends BaseMapper<BasJarMast> { |
| | | |
| | | List<BasJarMast> getJarMastByJarId(@Param("jarId") Long jarId); |
| | | |
| | | BasJarMast getJarMastByJarIdMax(@Param("jarId") Long jarId); |
| | | |
| | | BasJarMast getJarMastByJarIdMin(@Param("jarId") Long jarId); |
| | | |
| | | Integer getJarMastByJarIdCount(@Param("jarId") Long jarId); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.zy.asrs.entity.WrkMastExecute; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface WrkMastExecuteMapper extends BaseMapper<WrkMastExecute> { |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.entity.BasJarMast; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BasJarMastService extends IService<BasJarMast> { |
| | | |
| | | List<BasJarMast> getJarMastByJarId(Long jarId); |
| | | |
| | | BasJarMast getJarMastByJarIdMax(Long jarId); |
| | | |
| | | BasJarMast getJarMastByJarIdMin(Long jarId); |
| | | |
| | | Integer getJarMastByJarIdCount(Long jarId); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.zy.asrs.entity.WrkMastExecute; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface WrkMastExecuteService extends IService<WrkMastExecute> { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service("basJarMastService") |
| | | public class BasJarMastServiceImpl extends ServiceImpl<BasJarMastMapper, BasJarMast> implements BasJarMastService { |
| | | |
| | | @Override |
| | | public List<BasJarMast> getJarMastByJarId(Long jarId) { |
| | | return this.baseMapper.getJarMastByJarId(jarId); |
| | | } |
| | | |
| | | /* |
| | | * 获取jarLocDigit最大的BasJarMast |
| | | * */ |
| | | @Override |
| | | public BasJarMast getJarMastByJarIdMax(Long jarId) { |
| | | return this.baseMapper.getJarMastByJarIdMax(jarId); |
| | | } |
| | | |
| | | /* |
| | | * 获取jarLocDigit最小的BasJarMast |
| | | * */ |
| | | @Override |
| | | public BasJarMast getJarMastByJarIdMin(Long jarId) { |
| | | return this.baseMapper.getJarMastByJarIdMin(jarId); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getJarMastByJarIdCount(Long jarId) { |
| | | return this.baseMapper.getJarMastByJarIdCount(jarId); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.zy.core.model.command.RgvCommand; |
| | | import com.zy.core.model.cpmmandParam.CrnCommandParam; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.model.protocol.JarProtocol; |
| | | import com.zy.core.model.protocol.RgvProtocol; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.LedThread; |
| | | import com.zy.core.thread.RgvThread; |
| | | import com.zy.core.thread.SiemensDevpThread; |
| | | import com.zy.core.thread.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | private WrkMastCrnMapper wrkMastCrnMapper; |
| | | @Autowired |
| | | private WrkMastSplitTwinMapper wrkMastSplitTwinMapper; |
| | | @Autowired |
| | | private WrkMastSplitTwinService wrkMastSplitTwinService; |
| | | @Autowired |
| | | private BasJarMastService basJarMastService; |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | @Autowired |
| | | private WrkMastSplitTwinService wrkMastSplitTwinService; |
| | | |
| | | |
| | | /** |
| | | * 组托 |
| | |
| | | * Jar任务创建 |
| | | */ |
| | | public synchronized void jarGenerateWrkMastSta() { |
| | | for (JarSlave jarSlave : slaveProperties.getJar()) { |
| | | try{ |
| | | Integer count = basJarMastService.getJarMastByJarIdCount(jarSlave.getId().longValue()); |
| | | if (count>=7){ |
| | | continue; |
| | | } |
| | | BasJarMast jarMastByJarIdMax = basJarMastService.getJarMastByJarIdMax(jarSlave.getId().longValue()); |
| | | if (jarMastByJarIdMax.getJarLocDigit()==7){ |
| | | continue; |
| | | } |
| | | jarGenerateWrkMastStaExecute(jarSlave); |
| | | }catch (Exception e){ |
| | | log.error(jarSlave.getId()+"号小车复位线程报错!"+e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Jar任务创建 执行 |
| | | */ |
| | | public synchronized boolean jarGenerateWrkMastStaExecute(JarSlave jarSlave) { |
| | | try{ |
| | | // 获取堆垛机信息 |
| | | JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getId()); |
| | | JarProtocol jarProtocol = jarThread.getJarProtocol(); |
| | | if (jarProtocol == null) { |
| | | return false; |
| | | } |
| | | if (jarProtocol.modeType != JarModeType.AUTO){ |
| | | return false; |
| | | } |
| | | // 状态:等待确认 并且 任务完成位 = 1 |
| | | |
| | | }catch (Exception e){ |
| | | log.error("小车复位线程报错!"+e); |
| | | // log.error("堆垛机工位二完成等待确认异常,堆垛机号={},异常信息={},工位号={}",crn.getId(),e.getMessage(),2); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Jar任务执行 |
| | |
| | | return false; |
| | | } |
| | | /* |
| | | * 小车取空板至工位任务 满取 |
| | | * 穿梭板移动 |
| | | * */ |
| | | public synchronized boolean jarRgvTake8(Integer rgvId,BasJarMast basJarMast){ |
| | | return false; |
New file |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.zy.asrs.mapper.WrkMastExecuteMapper; |
| | | import com.zy.asrs.entity.WrkMastExecute; |
| | | import com.zy.asrs.service.WrkMastExecuteService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("wrkMastExecuteService") |
| | | public class WrkMastExecuteServiceImpl extends ServiceImpl<WrkMastExecuteMapper, WrkMastExecute> implements WrkMastExecuteService { |
| | | |
| | | } |
| | |
| | | generator.url="192.168.4.15:1433;databasename=ahyxasrs"; |
| | | generator.username="sa"; |
| | | generator.password="sa@123"; |
| | | generator.table="asr_bas_jar_mast"; |
| | | generator.table="jar_wrk_mast_execute"; |
| | | generator.packagePath="com.zy.asrs"; |
| | | |
| | | generator.controller = false; |
New file |
| | |
| | | package com.zy.core.enums; |
| | | |
| | | public enum JarModeType { |
| | | |
| | | NONE(-1, "离线"), |
| | | STOP(0, "维修"), |
| | | HAND(1, "手动"), |
| | | HALF_AUTO(2, "半自动"), |
| | | AUTO(3, "自动"), |
| | | AUTO2(100, "其它"), |
| | | ; |
| | | |
| | | public Integer id; |
| | | public String desc; |
| | | JarModeType(Integer id, String desc) { |
| | | this.id = id; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public static JarModeType get(Integer id) { |
| | | if (null == id) { |
| | | return null; |
| | | } |
| | | for (JarModeType type : JarModeType.values()) { |
| | | if (type.id.equals(id)) { |
| | | return type; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static JarModeType get(JarModeType type) { |
| | | if (null == type) { |
| | | return null; |
| | | } |
| | | for (JarModeType jarModeType : JarModeType.values()) { |
| | | if (jarModeType == type) { |
| | | return jarModeType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.zy.core.model.protocol; |
| | | |
| | | import com.zy.asrs.entity.BasJar; |
| | | import com.zy.core.enums.CrnModeType; |
| | | import com.zy.core.enums.JarModeType; |
| | | import com.zy.core.enums.JarStatusType; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | * 0 = 脱机模式 |
| | | */ |
| | | public Integer mode; |
| | | |
| | | public JarModeType modeType; |
| | | |
| | | |
| | | /** |
| | | IDLE(0, "空闲"), |
| | |
| | | this.status = JarStatusType.get(type).id.shortValue(); |
| | | } |
| | | |
| | | public void setMode(Integer mode) { |
| | | this.mode = mode; |
| | | this.modeType = JarModeType.get(mode); |
| | | } |
| | | |
| | | public void setMode(JarModeType type) { |
| | | this.modeType = type; |
| | | this.mode = JarModeType.get(type).id; |
| | | } |
| | | |
| | | public BasJar toSqlModel(BasJar basJar){ |
| | | if (jarErr!=null) { |
| | |
| | | import HslCommunication.Core.Types.OperateResultExOne; |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | 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.entity.BasSteOpt; |
| | | import com.zy.asrs.service.BasJarService; |
| | | import com.zy.asrs.service.BasSteOptService; |
| | | import com.zy.core.News; |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.MessageQueue; |
| | |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.JarSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.SteCommand; |
| | | import com.zy.core.model.protocol.JarProtocol; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | |
| | | // 读数据 |
| | | case 1: |
| | | readStatus(); |
| | | break; |
| | | // 写数据 ID+目标站 |
| | | case 2: |
| | | write(null); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | */ |
| | | private void readStatus(){ |
| | | try { |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) 10); |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("V300", (short) 26); |
| | | if (result.IsSuccess) { |
| | | if (null == jarProtocol) { |
| | | jarProtocol = new JarProtocol(); |
| | | jarProtocol.setJarNo(slave.getId()); |
| | | } |
| | | jarProtocol.setMode(siemensS7Net.getByteTransform().TransInt32(result.Content, 2)); |
| | | jarProtocol.setLeftDoor(siemensS7Net.getByteTransform().TransBool(result.Content, 4));//左门状态 |
| | | jarProtocol.setRightDoor(siemensS7Net.getByteTransform().TransBool(result.Content, 4));//右门状态 |
| | | jarProtocol.setLeftInEnable(siemensS7Net.getByteTransform().TransBool(result.Content, 4));//左门可开 |
| | | jarProtocol.setLeftOutEnable(siemensS7Net.getByteTransform().TransBool(result.Content, 4));//左门可关 |
| | | jarProtocol.setRightInEnable(siemensS7Net.getByteTransform().TransBool(result.Content, 4));//右门可开 |
| | | jarProtocol.setRightOutEnable(siemensS7Net.getByteTransform().TransBool(result.Content, 4));//右门可关 |
| | | jarProtocol.setAutoing(siemensS7Net.getByteTransform().TransBool(result.Content, 4));//自 |
| | | jarProtocol.setJarErr(siemensS7Net.getByteTransform().TransInt32(result.Content, 4));//异常码 |
| | | |
| | | |
| | | jarProtocol.setMode((int)siemensS7Net.getByteTransform().TransInt16(result.Content, 0)); |
| | | jarProtocol.setLeftDoor(siemensS7Net.getByteTransform().TransInt16(result.Content, 2) != 0);//左门状态 |
| | | jarProtocol.setRightDoor(siemensS7Net.getByteTransform().TransInt16(result.Content, 4) != 0);//右门状态 |
| | | jarProtocol.setLeftInEnable(siemensS7Net.getByteTransform().TransInt16(result.Content, 6) != 0);//左门可开 |
| | | jarProtocol.setLeftOutEnable(siemensS7Net.getByteTransform().TransInt16(result.Content, 8) != 0);//左门可关 |
| | | jarProtocol.setRightInEnable(siemensS7Net.getByteTransform().TransInt16(result.Content, 10) != 0);//右门可开 |
| | | jarProtocol.setRightOutEnable(siemensS7Net.getByteTransform().TransInt16(result.Content, 12) != 0);//右门可关 |
| | | jarProtocol.setJarErr((int)siemensS7Net.getByteTransform().TransInt16(result.Content, 14));//异常码 |
| | | jarProtocol.setAutoing(siemensS7Net.getByteTransform().TransInt16(result.Content, 16) != 0);//模式 |
| | | // 根据实时信息更新数据库 |
| | | BasJarService service = SpringUtils.getBean(BasJarService.class); |
| | | if (null != service) { |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 写入数据 |
| | | */ |
| | | private synchronized boolean write(SteCommand command){ |
| | | if (null == command) { |
| | | News.error("穿梭车写入命令为空"); |
| | | return false; |
| | | } |
| | | command.setSteNo(slave.getId()); |
| | | OperateResult result = null; |
| | | // 开始任务 |
| | | if (!command.getComplete()) { |
| | | //组织任务前,先清空写任务确认位,以及任务完成确认位 |
| | | OperateResult result01 = siemensS7Net.Write("V2000.0", false); |
| | | OperateResult result02 = siemensS7Net.Write("V2000.1", false); |
| | | // 1.任务号 |
| | | OperateResult result0 = siemensS7Net.Write("V998", command.getTaskNo().shortValue()); |
| | | try { |
| | | Thread.sleep(200); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // 作业 |
| | | if (command.getTaskMode() != 0) { |
| | | // 2.作业 |
| | | OperateResult result1 = siemensS7Net.Write("V1000", command.getTaskMode()); |
| | | // 3.确认开始任务 |
| | | if (result0.IsSuccess && result1.IsSuccess) { |
| | | result = siemensS7Net.Write("V2000.0", true); |
| | | } |
| | | } |
| | | |
| | | // 任务完成 |
| | | } else { |
| | | siemensS7Net.Write("V998", (short) 0); |
| | | siemensS7Net.Write("V1000", (short) 0); |
| | | siemensS7Net.Write("V2000.0", false); |
| | | result = siemensS7Net.Write("V2000.1", true); |
| | | } |
| | | |
| | | try { |
| | | // 日志记录 |
| | | if (!command.getComplete() && command.getTaskMode() != 0) { |
| | | BasSteOptService bean = SpringUtils.getBean(BasSteOptService.class); |
| | | if (null != bean) { |
| | | BasSteOpt basSteOpt = new BasSteOpt( |
| | | command.getTaskNo(), // 任务号 |
| | | command.getSteNo(), // 穿梭车 |
| | | new Date(), // 下发时间 |
| | | command.getTaskModeType().desc, // 作业 |
| | | null, // 源排 |
| | | null, // 源列 |
| | | null, // 源层 |
| | | null, // 源站 |
| | | null, // 目标排 |
| | | null, // 目标列 |
| | | null, // 目标层 |
| | | null, // 目标站 |
| | | null, // 响应结果 |
| | | null, // 修改时间 |
| | | null, // 修改人员 |
| | | null // 备注 |
| | | ); |
| | | bean.insert(basSteOpt); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception ignore) {} |
| | | |
| | | if (result != null && result.IsSuccess) { |
| | | |
| | | |
| | | News.info("穿梭车命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); |
| | | OutputQueue.STE.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); |
| | | |
| | | try { |
| | | Thread.sleep(500); |
| | | } catch (Exception e){ |
| | | |
| | | } |
| | | OperateResultExOne<byte[]> result1 = siemensS7Net.Read("V998", (short) 4); |
| | | if (result1.IsSuccess) { |
| | | short taskNo = siemensS7Net.getByteTransform().TransInt16(result1.Content, 0); |
| | | short taskType = siemensS7Net.getByteTransform().TransInt16(result1.Content, 2); |
| | | // readStatus(); |
| | | } |
| | | return true; |
| | | } 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()); |
| | | |
| | | //写入失败后,重新添加commanddao 任务队列中,并立即回读一次设备状态 |
| | | // MessageQueue.offer(SlaveType.Ste, slave.getId(), new Task(2, command)); |
| | | // readStatus(); |
| | | |
| | | initSte(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void close() { |
| | | // siemensS7Net.ConnectClose(); |
| | |
| | | <result column="io_time" property="ioTime" /> |
| | | <result column="modi_time" property="modiTime" /> |
| | | <result column="appe_time" property="appeTime" /> |
| | | <result column="jar_loc_digit" property="jarLocDigit" /> |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="getJarMastByJarId" resultMap="BaseResultMap"> |
| | | select * from asr_bas_jar_mast |
| | | where 1=1 |
| | | and jar_id = #{jarId} |
| | | order by jar_loc_digit |
| | | </select> |
| | | |
| | | <select id="getJarMastByJarIdMax" resultMap="BaseResultMap"> |
| | | select top 1 * from asr_bas_jar_mast |
| | | where 1=1 |
| | | and jar_id = #{jarId} |
| | | order by jar_loc_digit desc |
| | | </select> |
| | | |
| | | <select id="getJarMastByJarIdMin" resultMap="BaseResultMap"> |
| | | select top 1 * from asr_bas_jar_mast |
| | | where 1=1 |
| | | and jar_id = #{jarId} |
| | | order by jar_loc_digit asc |
| | | </select> |
| | | |
| | | <select id="getJarMastByJarIdCount" resultType="Integer"> |
| | | select count(1) from asr_bas_jar_mast |
| | | where 1=1 |
| | | and jar_id = #{jarId} |
| | | </select> |
| | | |
| | | </mapper> |
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.WrkMastExecuteMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.WrkMastExecute"> |
| | | <id column="id" property="id" /> |
| | | <result column="wrk_no" property="wrkNo" /> |
| | | <result column="enter_sta_no" property="enterStaNo" /> |
| | | <result column="out_sta_no" property="outStaNo" /> |
| | | <result column="jar_enter_sta_no" property="jarEnterStaNo" /> |
| | | <result column="jar_out_sta_no" property="jarOutStaNo" /> |
| | | <result column="jar_id" property="jarId" /> |
| | | <result column="jar_regin" property="jarRegin" /> |
| | | <result column="status" property="status" /> |
| | | <result column="ste_id" property="steId" /> |
| | | <result column="rgv_id" property="rgvId" /> |
| | | <result column="io_time" property="ioTime" /> |
| | | <result column="modi_time" property="modiTime" /> |
| | | <result column="appe_time" property="appeTime" /> |
| | | <result column="wrk_type" property="wrkType" /> |
| | | <result column="wrk_sts" property="wrkSts" /> |
| | | <result column="io_type" property="ioType" /> |
| | | <result column="type" property="type" /> |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |