| | |
| | | |
| | | // 单例实例 |
| | | private static PLCAutoMes instance; |
| | | private static String PlcMes = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath(); |
| | | private static String PlcRead = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath(); |
| | | private static String Plcframe = PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath(); |
| | | private static String PlcParameter = PLCAutomaticParameterSettingReview2.class |
| | | .getResource("/JsonFile/PlcParameter.json").getPath(); |
| | | private static String PlcSign = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json") |
| | | .getPath(); |
| | | private static String PlcState = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json") |
| | | .getPath(); |
| | | private static String PlcAlarm = PLCAutoMes.class.getResource("/JsonFile/PlcAlarm.json").getPath(); |
| | | private static String PlcTest = PLCAutoMes.class.getResource("/JsonFile/PlcTest.json").getPath(); |
| | | // private static String PlcMes = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath(); |
| | | private static String PlcAlbania = PLCAutoMes.class.getResource("/JsonFile/PlcAlbania.json").getPath(); |
| | | // private static String PlcRead = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath(); |
| | | // private static String Plcframe = PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath(); |
| | | // private static String PlcParameter = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcParameter.json").getPath(); |
| | | |
| | | // private static String PlcSign = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json").getPath(); |
| | | |
| | | // private static String PlcState = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json").getPath(); |
| | | |
| | | // private static String PlcAlarm = PLCAutoMes.class.getResource("/JsonFile/PlcAlarm.json").getPath(); |
| | | // private static String PlcTest = PLCAutoMes.class.getResource("/JsonFile/PlcTest.json").getPath(); |
| | | |
| | | // 调用initword方法 |
| | | |
| | | public static PlcParameterObject plcParameterObject = initUtil.initword(PlcParameter); |
| | | public static PlcBitObject plcPlcTest = initUtil.initbit(PlcTest); |
| | | public static PlcBitObject plcBitObject = initUtil.initbit(PlcSign); |
| | | public static PlcParameterObject plcStateObject= initUtil.initword(PlcState); |
| | | public static PlcBitObject plcPlcAlarm = initUtil.initbit(PlcAlarm); |
| | | public static PlcParameterObject PlcMesObject = initUtil.initword(PlcMes); |
| | | public static PlcParameterObject PlcReadObject = initUtil.initword(PlcRead); |
| | | public static PlcParameterObject PlcframeObject = initUtil.initword(Plcframe); |
| | | |
| | | // public static PlcParameterObject plcParameterObject = initUtil.initword(PlcParameter); |
| | | // public static PlcBitObject plcPlcTest = initUtil.initbit(PlcTest); |
| | | // public static PlcBitObject plcBitObject = initUtil.initbit(PlcSign); |
| | | // public static PlcParameterObject plcStateObject= initUtil.initword(PlcState); |
| | | // public static PlcBitObject plcPlcAlarm = initUtil.initbit(PlcAlarm); |
| | | public static PlcParameterObject PlcMesObject = initUtil.initword(PlcAlbania); |
| | | // public static PlcParameterObject PlcReadObject = initUtil.initword(PlcRead); |
| | | // public static PlcParameterObject PlcframeObject = initUtil.initword(Plcframe); |
| | | |
| | | // 私有构造函数 |
| | | public PLCAutoMes() throws IOException { |
| | | config = new Configuration("config.properties"); |
| | |
| | | |
| | | // System.out.println(jsonFilePath); |
| | | |
| | | readAndUpdateWordValues(PlcReadObject); |
| | | //readAndUpdateWordValues(PlcReadObject); |
| | | readAndUpdateWordValues(PlcMesObject); |
| | | readAndUpdateWordValues(PlcframeObject); |
| | | //readAndUpdateWordValues(PlcframeObject); |
| | | // readAndUpdateWordValues(PlcframeObject); |
| | | |
| | | // readAndUpdateWordValues(plcStateObject); |
| | |
| | | addresses2.add("FeedID"); |
| | | addresses2.add("FeedCarStatus"); |
| | | |
| | | System.out.println(PlcReadObject.getPlcParameterValues(addresses2)); |
| | | //System.out.println(PlcReadObject.getPlcParameterValues(addresses2)); |
| | | |
| | | } |
| | | } |
| | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.example.springboot.service.JdbcConnections; |
| | | import com.example.springboot.service.SpianService; |
| | | import com.example.springboot.service.SpianServiceNew; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.entity.device.PlcParameterObject; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | |
| | | @Autowired |
| | | private JdbcConnections jdbcConnections; |
| | | private AlbaniaMapper albaniaMapper; |
| | | private SpianService spianService; |
| | | private SpianServiceNew spianService; |
| | | int aaa; |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | // if (S7control.getinstance().CheckConnected() == false) { |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class); |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianServiceNew.class); |
| | | albaniaMapper = WebSocketServer.applicationContext.getBean(AlbaniaMapper.class); |
| | | |
| | | //读取DB105区文件 |
| | |
| | | String OutActivate=plcmes.getPlcParameter("OutActivate").getValue();//出片请求二线 |
| | | String AddRequest=plcmes.getPlcParameter("AddRequest").getValue();//进片请求 |
| | | String CarRequest=plcmes.getPlcParameter("CatReque").getValue();//运送车请求 |
| | | |
| | | // 出片任务 |
| | | String Tastoverid=plcmes.getPlcParameter("Tastoverid").getValue();//任务完成 |
| | | String glassid=plcmes.getPlcParameter("glassid").getValue();//玻璃id |
| | | |
| | | //调用出片任务 |
| | | if (OutActivate.equals("1") == false&&CarRequest.equals("0")==true) { |
| | | S7control.getinstance().WriteWord("DB105.18", (short)1);// 将大车的状态改为运输中 |
| | | |
| | | //将运输车状态改为忙碌 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 1); |
| | | spianService.selectout(glassid); |
| | | } |
| | | |
| | | //调用进片任务 |
| | | if(AddRequest.equals("1")==true&&CarRequest.equals("0")==true){ |
| | | //将运输车状态改为忙碌 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 1); |
| | | |
| | | spianService.selectAll(albaniaMapper.SelectGlass()); |
| | | } |
| | | |
| | | |
| | | ///////////// 进片任务 |
| | | |
| | | String B01backs = plcread.getPlcParameter("B01CompleteTheReport").getValue();// b01汇报 |
| | | String B02backs = plcread.getPlcParameter("B02CompleteTheReport").getValue();// b02汇报 |
| | | // String B01backs = plcread.getPlcParameter("B01CompleteTheReport").getValue();// b01汇报 |
| | | // String B02backs = plcread.getPlcParameter("B02CompleteTheReport").getValue();// b02汇报 |
| | | |
| | | String B01glassid = plcstate.getPlcParameter("B01ID1").getValue();// BO1的玻璃id |
| | | String B02glassid = plcstate.getPlcParameter("B02ID1").getValue();// B02的玻璃id |
| | | // String B01glassid = plcstate.getPlcParameter("B01ID1").getValue();// BO1的玻璃id |
| | | // String B02glassid = plcstate.getPlcParameter("B02ID1").getValue();// B02的玻璃id |
| | | |
| | | // 当进片小车完成任务时 |
| | | if (B01backs.equals("1") == true) { |
| | | // 判断是否汇报正确的id |
| | | int HB = spianMapper.SelectHB(B01glassid.toString()); |
| | | if (HB > 0) { |
| | | // 恢复B01小车应答改为1 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 1); |
| | | String yingda =plcmes.getPlcParameter("B01report").getValue();// b01汇报 |
| | | if (yingda.equals("1")) { |
| | | spianService.overtask(B01glassid.toString());// 完成任务 |
| | | } |
| | | } |
| | | // // 当进片小车完成任务时 |
| | | // if (B01backs.equals("1") == true) { |
| | | // // 判断是否汇报正确的id |
| | | // int HB = spianMapper.SelectHB(B01glassid.toString()); |
| | | // if (HB > 0) { |
| | | // // 恢复B01小车应答改为1 |
| | | // S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 1); |
| | | // String yingda =plcmes.getPlcParameter("B01report").getValue();// b01汇报 |
| | | // if (yingda.equals("1")) { |
| | | // spianService.overtask(B01glassid.toString());// 完成任务 |
| | | // } |
| | | // } |
| | | |
| | | }else{ |
| | | // 恢复B01小车应答改为0 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 0); |
| | | } |
| | | // }else{ |
| | | // // 恢复B01小车应答改为0 |
| | | // S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 0); |
| | | // } |
| | | |
| | | // 当出片小车完成任务时 |
| | | if (B02backs.equals("1") == true) { |
| | | // 判断是否汇报正确的id |
| | | int HB = spianMapper.SelectHB(B02glassid); |
| | | if (HB > 0) { |
| | | // 恢复B02小车应答改为1 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("B02report").getAddress(plcmes.getPlcParameter("B02report").getAddressIndex()), (short) 1); |
| | | String yingda =plcmes.getPlcParameter("B01report").getValue();// b02应答 |
| | | if (yingda.equals("1") == true) { |
| | | spianService.overtask(B02glassid);// 完成任务 |
| | | } |
| | | } |
| | | }else{ |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("B02report").getAddress(plcmes.getPlcParameter("B02report").getAddressIndex()), (short) 0); |
| | | } |
| | | // // 当出片小车完成任务时 |
| | | // if (B02backs.equals("1") == true) { |
| | | // // 判断是否汇报正确的id |
| | | // int HB = spianMapper.SelectHB(B02glassid); |
| | | // if (HB > 0) { |
| | | // // 恢复B02小车应答改为1 |
| | | // S7control.getinstance().WriteWord(plcmes.getPlcParameter("B02report").getAddress(plcmes.getPlcParameter("B02report").getAddressIndex()), (short) 1); |
| | | // String yingda =plcmes.getPlcParameter("B01report").getValue();// b02应答 |
| | | // if (yingda.equals("1") == true) { |
| | | // spianService.overtask(B02glassid);// 完成任务 |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // S7control.getinstance().WriteWord(plcmes.getPlcParameter("B02report").getAddress(plcmes.getPlcParameter("B02report").getAddressIndex()), (short) 0); |
| | | // } |
| | | |
| | | |
| | | // 获取DO1数据 |
| | | String Do1ID=plcread.getPlcParameter("FeedID").getValue();// 获取请求的id跟DO1同时清 |
| | | // 获取DO2数据 |
| | | String Do2ID=plcread.getPlcParameter("FeedID").getValue();// 获取请求的id跟DO1同时清 |
| | | // // 获取DO1数据 |
| | | // String Do1ID=plcread.getPlcParameter("FeedID").getValue();// 获取请求的id跟DO1同时清 |
| | | // // 获取DO2数据 |
| | | // String Do2ID=plcread.getPlcParameter("FeedID").getValue();// 获取请求的id跟DO1同时清 |
| | | |
| | | |
| | | int questate = spianMapper.Selectquecount(Do1ID.toString());// 判断扫码位是否有玻璃已确认 |
| | | // queueid1.toString().isEmpty() |
| | | north_glass_buffer1 glass1 = spianMapper.selectGlass(Do1ID);// D01的玻璃信息 |
| | | north_glass_buffer1 glass2 = spianMapper.selectGlass(Do2ID);// D02玻璃信息 |
| | | // 当扫码位玻璃id为空时 宽度为0 |
| | | if (Do1ID != null && questate == 0) { |
| | | // 写入D01的数据到上片队列表 |
| | | if (glass1 == null) { // 当没有值时传空 |
| | | spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 1); |
| | | } else { |
| | | spianMapper.Updatequeue(Do1ID.toString(), glass1.getordernumber(), glass1.getlistnumber(), |
| | | glass1.getboxnumber(), 0, glass1.getglasslengthmm().toString(), glass1.getglassheightmm().toString(), |
| | | glass1.getglasslength().toString(), glass1.getglassheight().toString(), 1); |
| | | } |
| | | // int questate = spianMapper.Selectquecount(Do1ID.toString());// 判断扫码位是否有玻璃已确认 |
| | | // // queueid1.toString().isEmpty() |
| | | // north_glass_buffer1 glass1 = spianMapper.selectGlass(Do1ID);// D01的玻璃信息 |
| | | // north_glass_buffer1 glass2 = spianMapper.selectGlass(Do2ID);// D02玻璃信息 |
| | | // // 当扫码位玻璃id为空时 宽度为0 |
| | | // if (Do1ID != null && questate == 0) { |
| | | // // 写入D01的数据到上片队列表 |
| | | // if (glass1 == null) { // 当没有值时传空 |
| | | // spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 1); |
| | | // } else { |
| | | // spianMapper.Updatequeue(Do1ID.toString(), glass1.getordernumber(), glass1.getlistnumber(), |
| | | // glass1.getboxnumber(), 0, glass1.getglasslengthmm().toString(), glass1.getglassheightmm().toString(), |
| | | // glass1.getglasslength().toString(), glass1.getglassheight().toString(), 1); |
| | | // } |
| | | |
| | | } |
| | | // } |
| | | |
| | | if (Do2ID != null) { |
| | | // 写入D02的数据到上片队列表 |
| | | if (glass2 == null) { |
| | | spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 2); |
| | | } else { |
| | | spianMapper.Updatequeue(Do2ID.toString(), glass2.getordernumber(), glass2.getlistnumber(), |
| | | glass2.getboxnumber(), 0, glass2.getglasslengthmm().toString(), glass2.getglassheightmm().toString(), |
| | | glass2.getglasslength().toString(), glass2.getglassheight().toString(), 2); |
| | | spianMapper.overqueue2(Do2ID.toString(), 0, 1);// 更改扫码位任务表的状态为0 |
| | | S7control.getinstance().WriteWord("DB105.16", (short) 0);// 关闭任务启动 |
| | | } |
| | | // if (Do2ID != null) { |
| | | // // 写入D02的数据到上片队列表 |
| | | // if (glass2 == null) { |
| | | // spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 2); |
| | | // } else { |
| | | // spianMapper.Updatequeue(Do2ID.toString(), glass2.getordernumber(), glass2.getlistnumber(), |
| | | // glass2.getboxnumber(), 0, glass2.getglasslengthmm().toString(), glass2.getglassheightmm().toString(), |
| | | // glass2.getglasslength().toString(), glass2.getglassheight().toString(), 2); |
| | | // spianMapper.overqueue2(Do2ID.toString(), 0, 1);// 更改扫码位任务表的状态为0 |
| | | // S7control.getinstance().WriteWord("DB105.16", (short) 0);// 关闭任务启动 |
| | | // } |
| | | |
| | | } |
| | | // } |
| | | |
| | | // 查询数据库 |
| | | // 推送到前端 |
| | |
| | | System.out.println("启动完成"); |
| | | |
| | | // new PlcHold().start(); |
| | | new PlcHoldNew().start(); |
| | | // new PLCAutoMes().start(); |
| | | |
| | | new Plchome().start(); |
| | | //new Plchome().start(); |
| | | // new PlcLayout().start(); |
| | | // new Plcalarm().start(); |
| | | |
| | |
| | | |
| | | @Data |
| | | @TableName("`flowcard`") |
| | | public class flowcard { |
| | | public class FlowCard { |
| | | private Integer id;// 自增id |
| | | private String flowcard;// 流程卡id |
| | | private Integer number;// 玻璃数量 |
| | |
| | | |
| | | @Data |
| | | @TableName("`glassinfo`") |
| | | public class glassinfo { |
| | | public class GlassInfo { |
| | | private Integer id;// 自增id |
| | | private String flowcard;// 流程卡id |
| | | private Integer glasstype;// 玻璃类型 |
| | | private Integer mateid;// 配片id |
| | | private Integer glassid;// 玻璃id |
| | | private String glassid;// 玻璃id |
| | | private Integer tier;// 层 |
| | | private String films;// 膜系 |
| | | private Double width;// 宽 |
| | | private Double height;// 高 |
| | | private String thickness;// 厚 |
| | | private Double thickness;// 厚 |
| | | private Integer number;// 数量 |
| | | private Integer finishnumber;// 完成数量 |
| | | |
| | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | private String listId; |
| | | private String thickness; |
| | | /** |
| | | * 箱子号 |
| | | */ |
| | | private String boxId; |
| | | private String films; |
| | | /** |
| | | * 状态(0:无玻璃,1:有玻璃,2:进片中,3:出片中,4:调度中) |
| | | */ |
| | |
| | | package com.example.springboot.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 流程卡表 |
| | | */ |
| | | @Data |
| | | @TableName("flowcard") |
| | | @TableName("`flowcard`") |
| | | public class FlowCard { |
| | | |
| | | /** |
| | | * 主键,自动生成 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowcard; |
| | | /** |
| | | * 总层数 |
| | | */ |
| | | private Integer totaltier; |
| | | /** |
| | | * 玻璃数量 |
| | | */ |
| | | private Integer number; |
| | | /** |
| | | * 任务线路 |
| | | */ |
| | | private Integer line; |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | private Integer id;// 自增id |
| | | private String flowcard;// 流程卡id |
| | | private Integer number;// 玻璃数量 |
| | | private Integer line;// 任务路线 |
| | | private Integer state;// 状态 |
| | | |
| | | |
| | | } |
| | |
| | | package com.example.springboot.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 玻璃表 |
| | | */ |
| | | @Data |
| | | @TableName("glassinfo") |
| | | @TableName("`glassinfo`") |
| | | public class GlassInfo { |
| | | |
| | | /** |
| | | * 主键,自动生成 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 流程卡id |
| | | */ |
| | | private Integer flowcard; |
| | | /** |
| | | * 玻璃类型 |
| | | */ |
| | | private Integer glasstype; |
| | | /** |
| | | * 配片id |
| | | */ |
| | | private Integer mateid; |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | private String glassid; |
| | | /** |
| | | * 层 |
| | | */ |
| | | private Integer tier; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String films; |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | /** |
| | | * 数量 |
| | | */ |
| | | private Integer number; |
| | | /** |
| | | * 完成数量 |
| | | */ |
| | | private Integer finishnumber; |
| | | private Integer id;// 自增id |
| | | private String flowcard;// 流程卡id |
| | | private Integer glasstype;// 玻璃类型 |
| | | private Integer mateid;// 配片id |
| | | private String glassid;// 玻璃id |
| | | private Integer tier;// 层 |
| | | private String films;// 膜系 |
| | | private Double width;// 宽 |
| | | private Double height;// 高 |
| | | private Double thickness;// 厚 |
| | | private Integer number;// 数量 |
| | | private Integer finishnumber;// 完成数量 |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | package com.example.springboot.mapper; |
| | | import org.apache.ibatis.annotations.Insert; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.entity.GlassInfo; |
| | | |
| | | @Mapper |
| | | @Repository |
| | |
| | | //减少玻璃数 |
| | | @Update("update storage_cage set number=number-1,width=width+glasswidth where id=#{id}") |
| | | void UpdateCageNumberOut(int id); |
| | | |
| | | //增加任务记录 |
| | | @Insert("INSERT INTO `canadames`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id,count,finsh_time) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid},#{count},#{qidong});") |
| | | void Inserttask(int tasktype, int taskstate, int shelfrack, int loadrack, String glassid, int count,int qidong); |
| | | //新增一条笼子数据 |
| | | @Update("UPDATE `albania`.`storage_cage` SET `glass_id` =#{glassid}, `width` =width-#{glasswidth}, `glasswidth` =#{glasswidth}, `glassheight` =#{glassheight}, `glasswidthmm` =#{glasswidthmm}, `glassheightmm` = #{glassheightmm}, `state` = #{state}, `glasstype` = #{glasstype}, `number` = #{number} WHERE `id` =#{id};") |
| | | void AddCage(int id,String glassid,Double glasswidth,Double glassheight,Double glasswidthmm,Double glassheightmm,int state,int glasstype,int number); |
| | | //获取进片数据 |
| | | @Select("select glassid,flowcard,glasswidth as width,glassheight as height,glasswidthmm,glassheightmm,glasstype from queue where glasstype=1") |
| | | GlassInfo SelectGlass(); |
| | | |
| | | |
| | | } |
| | |
| | | import com.example.springboot.component.PLCAutoMes; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.GlassInfo; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.glassinfo; |
| | | import com.example.springboot.entity.device.PlcParameterObject; |
| | | import com.example.springboot.mapper.AlbaniaMapper; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | import com.google.common.primitives.Bytes; |
| | | |
| | | |
| | |
| | | public Short selectAll(GlassInfo glassInfo) { |
| | | //定义初始字段 |
| | | int cageid; |
| | | String glassid=glassInfo.getGlassid(); |
| | | Double width=glassInfo.getWidth(); |
| | | Double height=glassInfo.getHeight(); |
| | | int glasstype=glassInfo.getGlasstype(); |
| | | |
| | | |
| | | |
| | | //判断是否有同类型的 |
| | | cageid=albaniaMapper.SelectCage(glassInfo.getGlasstype(), glassInfo.getWidth(), 50); |
| | | //如果有同类型时直接增加 |
| | | if(cageid!=Integer.MIN_VALUE){ |
| | | //发送plc任务 |
| | | |
| | | //任务完成后增加数量 |
| | | albaniaMapper.UpdateCageNumberAdd(cageid); |
| | | }else{ |
| | | //判断玻璃是否进入大片笼 |
| | |
| | | cageid=albaniaMapper.SelectNewCell(3,5); |
| | | }else{ |
| | | cageid=albaniaMapper.SelectNewCell(3,5); |
| | | //发送plc任务 |
| | | } |
| | | //当返回的格子号为空时,返回400笼子已满 |
| | | if(cageid==Integer.MIN_VALUE){ |
| | | return(400); |
| | | }else{ |
| | | //判断完成任务后增加数量 |
| | | albaniaMapper.AddCage(cageid, glassid, width, height, width, height, 0, glasstype, 1); |
| | | } |
| | | } |
| | | //增加任务记录 |
| | | albaniaMapper.Inserttask(0, 0, 0, cageid, glassInfo.getGlassid(), 0, 0); |
| | | return(200); |
| | | |
| | | } |
| | | |
| | | public Short selectout2(String glassid) { |
| | | |
| | | public Short selectout(String glasstype) { |
| | | //判断笼子最先出哪片 |
| | | |
| | | |
| | | return(200);// 结束 |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB14.0", |
| | | "plcAddressLenght":"210", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "PLCToMES", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus1", |
| | | "addressIndex":"2", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus2", |
| | | "addressIndex":"4", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus3", |
| | | "addressIndex":"6", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus4", |
| | | "addressIndex":"8", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus5", |
| | | "addressIndex":"10", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "IDStatus6", |
| | | "addressIndex":"12", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "StautsID1", |
| | | "addressIndex":"14", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID2", |
| | | "addressIndex":"16", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID3", |
| | | "addressIndex":"18", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID4", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID5", |
| | | "addressIndex":"22", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "StautsID6", |
| | | "addressIndex":"24", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "GaToMES", |
| | | "addressIndex":"26", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "Height", |
| | | "addressIndex":"28", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "width", |
| | | "addressIndex":"30", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "ExportTOMES1", |
| | | "addressIndex":"32", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "ExportToMES2", |
| | | "addressIndex":"34", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESToPLC", |
| | | "addressIndex":"36", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESID1", |
| | | "addressIndex":"38", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESID2", |
| | | "addressIndex":"54", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID3", |
| | | "addressIndex":"70", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID4", |
| | | "addressIndex":"86", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID5", |
| | | "addressIndex":"102", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID6", |
| | | "addressIndex":"118", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESToPLCStart1", |
| | | "addressIndex":"134", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStart2", |
| | | "addressIndex":"136", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStart3", |
| | | "addressIndex":"138", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart4", |
| | | "addressIndex":"140", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart5", |
| | | "addressIndex":"142", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart6", |
| | | "addressIndex":"144", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget1", |
| | | "addressIndex":"146", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget2", |
| | | "addressIndex":"148", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget3", |
| | | "addressIndex":"150", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget4", |
| | | "addressIndex":"152", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget5", |
| | | "addressIndex":"154", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget6", |
| | | "addressIndex":"156", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus1", |
| | | "addressIndex":"158", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus2", |
| | | "addressIndex":"160", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus3", |
| | | "addressIndex":"162", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus4", |
| | | "addressIndex":"164", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus5", |
| | | "addressIndex":"166", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus6", |
| | | "addressIndex":"168", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToGaStatus", |
| | | "addressIndex":"170", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A01Err", |
| | | "addressIndex":"172", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A02Err", |
| | | "addressIndex":"174", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01Err", |
| | | "addressIndex":"176", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01Err", |
| | | "addressIndex":"178", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02Err", |
| | | "addressIndex":"180", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace1", |
| | | "addressIndex":"182", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace2", |
| | | "addressIndex":"184", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace3", |
| | | "addressIndex":"186", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01Position", |
| | | "addressIndex":"188", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01Position", |
| | | "addressIndex":"190", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02Position", |
| | | "addressIndex":"192", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "DeviceState", |
| | | "addressIndex":"194", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "AllFVRun", |
| | | "addressIndex":"196", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A01State", |
| | | "addressIndex":"198", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A02State", |
| | | "addressIndex":"200", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01State", |
| | | "addressIndex":"202", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01State", |
| | | "addressIndex":"204", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02State", |
| | | "addressIndex":"206", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MainControl", |
| | | "addressIndex":"208", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | ] |
| | | } |