New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`big_storage_cage`") |
| | | public class BigStorageCage { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//大理片笼表id |
| | | private Integer device_id;//设备id |
| | | private Integer slot;//栅格号 |
| | | private String enable_state;//启用状态 |
| | | private Integer remain_width;//剩余宽度 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`big_storage_cage_details`") |
| | | public class BigStorageCageDetails { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//大理片笼详情表id |
| | | private Integer deviceid;//设备id |
| | | private Integer slot;//栅格号 |
| | | private Integer glassid;//玻璃id |
| | | private Integer sequence;//小片在格内的顺序 |
| | | private String flowcardid;//流程卡号 |
| | | private Integer glasstype;//玻璃类型 |
| | | private Double width;//宽 |
| | | private Double height;//高 |
| | | private Double thickness;//厚度 |
| | | private Integer temperinglayoutid;//钢化版图id |
| | | private Integer temperingfeedsequence;//钢化版图片序 |
| | | private Integer state;//状态 |
| | | private Integer gap;//玻璃间隙 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`down_glass_info`") |
| | | public class DownGlassInfo { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//下片玻璃信息表id |
| | | private String flowcardid;//流程卡号 |
| | | private Integer sequence;//顺序 |
| | | private Integer width;//宽 |
| | | private Integer height;//高 |
| | | private Integer thickness;//厚度 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`down_storage_cage`") |
| | | public class DownStorageCage { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//下片前理片笼表id |
| | | private Integer deviceid;//设备id |
| | | private Integer slot;//栅格号 |
| | | private String enablestate;//启用状态 |
| | | private Integer remainwidth;//剩余 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`down_storage_cage_details`") |
| | | public class DownStorageCagedetails { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//下片前理片笼明细表id |
| | | private Integer deviceid;//设备id |
| | | private Integer slot;//栅格号 |
| | | private Integer glassid;//玻璃id |
| | | private Integer sequence;//小片在格内的顺序 |
| | | private String flow_card_id;//流程卡号 |
| | | private Integer glass_type;//玻璃类型 |
| | | private Double width;//宽 |
| | | private Double height;//高 |
| | | private Double thickness;//厚度 |
| | | private Integer temperinglayoutid;//钢化版图id |
| | | private Integer tempering_feed_sequence;//钢化版图片序 |
| | | private Integer state;//状态 |
| | | private Integer gap;//玻璃间隙 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`down_workstation`") |
| | | public class DownWorkstation { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//下片工位表id |
| | | private Integer flowcard_id;//工位id |
| | | private String glass_type;//流程卡号 |
| | | private Integer width;//设备id |
| | | private Integer height;//启用状态 |
| | | private Integer thickness;//工作状态 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`edg_storage_cage`") |
| | | public class EdgStorageCage { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//磨边前理片笼表id |
| | | private Integer flowcard_id;//设备id |
| | | private Integer glass_type;//栅格号 |
| | | private String height;//启用状态 |
| | | private Integer thickness;//剩余 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`edg_storage_cage_details`") |
| | | public class EdgStorageCageDetails { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//磨边前理片笼详情表id |
| | | private Integer deviceid;//设备id |
| | | private Integer slot;//栅格号 |
| | | private Integer glassid;//玻璃id |
| | | private Integer sequence;//小片在格内的顺序 |
| | | private String flowcardid;//流程卡号 |
| | | private Integer glasstype;//玻璃类型 |
| | | private Double width;//宽 |
| | | private Double height;//高 |
| | | private Double thickness;//厚度 |
| | | private Double edgwidth;//磨前宽 |
| | | private Double edgheight;//磨前高 |
| | | private Integer temperinglayoutid;//钢化版图id |
| | | private Integer temperingfeedsequence;//钢化版图片序 |
| | | private Integer patternsequence;//原片顺序 |
| | | private Integer state;//状态 |
| | | private Integer gap;//玻璃间隙 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import java.math.BigInteger; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`engineering`") |
| | | public class Engineering { |
| | | @TableId(type = IdType.AUTO) |
| | | private BigInteger id;//工程表id |
| | | private Integer engineerid;//工程号 |
| | | private String engineername;//工程名称 |
| | | private Double avgavailability;//平均利用率 |
| | | private Double validavailability;//有效利用率 |
| | | private Double lastavailability;//尾片利用率 |
| | | private Integer state;//状态 |
| | | private Integer glasstotal;//小片总数 |
| | | private Double glasstotalarea;//小片总面积 |
| | | private Integer planpatterntotal;//计划原片总数 |
| | | private Double planpatterntotalarea;//计划原片总面积 |
| | | private Integer realitypatterntotal;//实际原片总数 |
| | | private Double realitypatterntotalarea;//实际原片总面积 |
| | | private Integer filmsid;//膜系id |
| | | private String notes;//备注 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`glass_films`") |
| | | public class GlassFilms { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//膜系表id |
| | | private Integer films_id;//膜系id |
| | | private String films_name;//膜系 |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import java.math.BigInteger; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`glass_info`") |
| | | public class GlassInfo { |
| | | @TableId(type = IdType.AUTO) |
| | | private BigInteger id;//玻璃信息表id |
| | | private String flowcardid;//流程卡 |
| | | private Integer glasstype;//流程卡玻璃类型 |
| | | private Double width;//宽 |
| | | private Double height;//高 |
| | | private Double thickness;//厚度 |
| | | private Integer filmsid;//膜系 |
| | | private Double edgwidth;//磨前宽 |
| | | private Double edgheight;//磨前高 |
| | | private Integer ismultiple;//是否配片 |
| | | private Double maxwidth;//配片最大宽 |
| | | private Double maxheight;//配片最大高 |
| | | private Integer ishorizontal;//钢化是否接受横放 |
| | | private Integer patternsequence;//原片顺序 |
| | | private Integer temperinglayoutid;//钢化版图id |
| | | private Integer temperingfeedsequence;//钢化版图片序 |
| | | private Integer xcoordinate;//x坐标 |
| | | private Integer ycoordinate;//y坐标 |
| | | private Integer angle;//旋转角度(逆时针) |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`tempering_glass_info`") |
| | | public class Tempering { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//钢化小片信息表id |
| | | private String flowcard_id;//流程卡 |
| | | private Integer glass_type;//流程卡玻璃类型 |
| | | private Double width;//宽 |
| | | private Double height;//高 |
| | | private Double thickness;//厚度 |
| | | private Integer filmsid;//膜系 |
| | | private Integer ishorizontal;//钢化是否接受横放 |
| | | private Integer tempering_layout_id;//钢化版图id |
| | | private Integer tempering_feed_sequence;//钢化版图片序 |
| | | private Integer x_coordinate;//x坐标 |
| | | private Integer y_coordinate;//y坐标 |
| | | private Integer angle;//旋转角度(逆时针) |
| | | private Integer state;//状态 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`up_patten_usage`") |
| | | public class UpPattenUsage { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//原片使用情况表id |
| | | private Integer engineeringid;//工程号 |
| | | private Integer filmsid;//膜系id |
| | | private Double width;//宽 |
| | | private Double height;//高 |
| | | private Double thickness;//厚度 |
| | | private Integer layoutsequence;//原片版图片序 |
| | | private Integer state;//状态 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`up_workstation`") |
| | | public class UpWorkstation { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//上片工位表id |
| | | private Integer workstationid;//工位号 |
| | | private Integer deviceid;//设备id |
| | | private Integer enablestate;//启用状态 |
| | | private Integer workstate;//工作状态 |
| | | private Double patternwidth;//原片宽 |
| | | private Double patternheigth;//原片高 |
| | | private Double patternthickness;//原片厚度 |
| | | private Integer filmsid;//膜系 |
| | | private Integer number;//数量 |
| | | |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.*; |
| | | |
| | | @Mapper |
| | | public interface OrderTestMapper extends BaseMapper<OrderTest> { |
| | | |
| | | |
| | | public interface LoadGlassMapper extends BaseMapper<UpWorkstation> { |
| | | //显示目前工位玻璃信息 |
| | | @Select("SELECT * FROM up_workstation") |
| | | UpWorkstation SelectALL(); |
| | | //删除工位的玻璃信息 |
| | | @Delete("DELETE FROM up_workstation where workstation_id=#{id}") |
| | | void DeleteALL(int id ); |
| | | //增加上片信息 |
| | | @Insert ("INSERT INTO up_workstation (pattern_width,pattern_heigth,pattern_thickness)value(#{patternwidth},#{patternheigth},#{patternthickness}where workstation_id=#{workstationid) ") |
| | | void InsertALL(Double patternwidth,Double patternheigth,Double patternthickness,int workstationid); |
| | | } |
| | |
| | | package com.example.springboot.service; |
| | | |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.example.springboot.component.PLCAutoMes; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.entity.device.PlcParameterObject; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | import com.google.common.primitives.Bytes; |
| | | |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.UpWorkstation; |
| | | import com.mes.mapper.LoadGlassMapper; |
| | | import com.mes.mapper.TemperingMapper; |
| | | |
| | | @Service |
| | | public class LoadGlassService { |
| | | @Autowired |
| | | |
| | | |
| | | public Short selectAll(String glassid) { |
| | | |
| | | |
| | | |
| | | private com.mes.common.PlcTools.S7control s7control; |
| | | private LoadGlassMapper LoadGlassMapper; |
| | | //显示工位上的玻璃信息 |
| | | public GlassInfo selectAll() { |
| | | GlassInfo glassInfo = LoadGlassMapper.SelectALL(); |
| | | return glassInfo; |
| | | } |
| | | //增加人工输入的工位玻璃信息 |
| | | public void insertGlass(UpWorkstation upwork) { |
| | | LoadGlassMapper.insertGlass(upwork.Getpatternwidth(),upwork.getPatternheigth(),upwork.getPatternthickness(),1); |
| | | } |
| | | //删除人工搬走的玻璃信息 |
| | | public void deleteGlass(String id) { |
| | | LoadGlassMapper.deleteGlass(id); |
| | | } |
| | | //判断是否可以吸片进行任务 |
| | | public boolean isCanLoadGlass() { |
| | | boolean result=s7control.WriteWord("100.10", 1); |
| | | return result; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | |
| | | server: |
| | | port: 8080 |
| | | servlet: |
| | | context-path: /mesModuleTools |
| | | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: user_info #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | user_info: |
| | | url: jdbc:mysql://10.153.19.150:3306/erp_user_info?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | sd: |
| | | url: jdbc:mysql://10.153.19.150:3306/sd?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | mm: |
| | | url: jdbc:mysql://10.153.19.150:3306/mm?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//大理片笼表id |
| | | private Integer device_id;//设备id |
| | | private String slot;//栅格号 |
| | | private Integer slot;//栅格号 |
| | | private String enable_state;//启用状态 |
| | | private Integer remain_width;//剩余宽度 |
| | | |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//下片前理片笼表id |
| | | private Integer deviceid;//设备id |
| | | private String slot;//栅格号 |
| | | private Integer slot;//栅格号 |
| | | private String enablestate;//启用状态 |
| | | private Integer remainwidth;//剩余 |
| | | |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//磨边前理片笼表id |
| | | private Integer flowcard_id;//设备id |
| | | private String glass_type;//栅格号 |
| | | private Integer glass_type;//栅格号 |
| | | private String height;//启用状态 |
| | | private Integer thickness;//剩余 |
| | | |
| | |
| | | package com.mes.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.entity.OrderTest; |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.Tempering; |
| | | |
| | | import org.apache.ibatis.annotations.*; |
| | | |
| | | @Mapper |
| | | public interface OrderTestMapper extends BaseMapper<OrderTest> { |
| | | public interface TemperingMapper extends BaseMapper<Tempering> { |
| | | |
| | | |
| | | //查询该玻璃的尺寸和坐标 |
| | | @Select("select*from where id=#{glassId}") |
| | | Tempering SelectTempering(String glassId); |
| | | @Select("select *from glass_info where id=#{glassid};") |
| | | GlassInfo SelectOutGlass(String glassid); |
| | | |
| | | @Select("select *from glass_info where id=#{glassid};") |
| | | int SelectTempering(String glassid); |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.service; |
| | | |
| | | import com.rabbitmq.client.Channel; |
| | | import com.rabbitmq.client.Connection; |
| | | import com.rabbitmq.client.ConnectionFactory; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class ModuleA { |
| | | private static String QUEUE_NAME = "hangzhou2"; |
| | | |
| | | public ModuleA(String QUEUENAME){ |
| | | QUEUE_NAME=QUEUENAME; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] argv) throws Exception { |
| | | // 创建连接工厂 |
| | | ConnectionFactory factory = new ConnectionFactory(); |
| | | factory.setHost("10.153.19.150"); |
| | | //factory.setHost("localhost"); |
| | | |
| | | try (Connection connection = factory.newConnection(); |
| | | //channel 是通过 connection 创建的一个 AMQP 信道对象 |
| | | Channel channel = connection.createChannel()) { |
| | | // `channel.queueDeclare(QUEUE_NAME, false, false, false, null);` 是用来声明一个队列的方法 |
| | | //该方法有五个参数: |
| | | //1. `QUEUE_NAME`:指定队列的名称,这里使用了之前声明的常量`"module_queue"`作为队列名称。 |
| | | //2. `false`:指定队列是否为持久化的。在这里设置为`false`,表示不将队列持久化到磁盘,一旦RabbitMQ服务停止或崩溃,队列将会丢失。 |
| | | //3. `false`:指定是否只允许当前连接声明此队列。在这里设置为`false`,表示可允许其他连接也声明同名的队列。 |
| | | //4. `false`:指定是否在不再使用时自动删除队列。在这里设置为`false`,表示当没有消费者或者所有消费者断开连接后,队列不会自动删除。 |
| | | //5. `null`:指定其他队列属性的参数。在这里设置为`null`,表示没有其他属性需要设置。 |
| | | //执行`channel.queueDeclare()`方法后,如果队列不存在,将会创建一个新的队列,如果队列已经存在,则不做任何操作。 |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("x-max-length-bytes",20000); |
| | | // args.put("x-max-length",5000); |
| | | channel.queueDeclare(QUEUE_NAME, false, false, false, args); |
| | | |
| | | String message = "你"; |
| | | |
| | | for ( int i=1;i< 5000;i++) |
| | | { |
| | | message+="你"; |
| | | |
| | | } |
| | | |
| | | message+="b"; |
| | | |
| | | |
| | | |
| | | // 将消息发布到指定的队列中。空字符串""表示默认的交换机,QUEUE_NAME指定了目标队列名称,null表示没有指定其他属性,message.getBytes()将消息内容转换为字节数组进行传输。 |
| | | channel.basicPublish("", QUEUE_NAME, null, message.getBytes()); |
| | | System.out.println(" [x] Sent '" + message + "'"); |
| | | } |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.service; |
| | | |
| | | import com.rabbitmq.client.Channel; |
| | | import com.rabbitmq.client.Connection; |
| | | import com.rabbitmq.client.ConnectionFactory; |
| | | import com.rabbitmq.client.DeliverCallback; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class ModuleB { |
| | | private final static String QUEUE_NAME = "hangzhou2"; |
| | | |
| | | public static void main(String[] argv) throws Exception { |
| | | // 创建连接工厂 |
| | | ConnectionFactory factory = new ConnectionFactory(); |
| | | factory.setHost("10.153.19.150"); |
| | | //factory.setHost("localhost"); |
| | | try (Connection connection = factory.newConnection(); |
| | | Channel channel = connection.createChannel()) { |
| | | // 声明队列 |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("x-max-length-bytes",20000); |
| | | // args.put("x-max-length",5000); |
| | | channel.queueDeclare(QUEUE_NAME, false, false, false, args); |
| | | |
| | | // 创建消费者 |
| | | DeliverCallback deliverCallback = (consumerTag, delivery) -> { |
| | | String receivedMessage = new String(delivery.getBody(), "UTF-8"); |
| | | System.out.println(" [x] Received '" + receivedMessage + "'"); |
| | | }; |
| | | // 开始消费消息 |
| | | channel.basicConsume(QUEUE_NAME, true, deliverCallback, consumerTag -> { |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.service; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.userInfo.SysError; |
| | | import com.mes.mapper.TemperingMapper; |
| | | import com.mes.mapper.userInfo.SysErrorMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @DS("glass_info") |
| | | public class TemperingOverService { |
| | | private final TemperingMapper temperingMapper; |
| | | |
| | | public TemperingOverService(TemperingMapper temperingMapper) { |
| | | this.temperingMapper = temperingMapper; |
| | | } |
| | | //接收出炉信号和炉号 |
| | | public GlassInfo SelectOutGlass (String glassid) { |
| | | GlassInfo GlassInfo = temperingMapper.SelectOutGlass(glassid); |
| | | return GlassInfo; |
| | | } |
| | | //发送确认收到 |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.service; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.mes.common.PlcTools.S7control; |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.userInfo.SysError; |
| | | import com.mes.mapper.TemperingMapper; |
| | | import com.mes.mapper.userInfo.SysErrorMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @DS("glass_info") |
| | | public class TemperingService { |
| | | |
| | | private final TemperingMapper temperingMapper; |
| | | private S7control s7control; |
| | | |
| | | public TemperingService(TemperingMapper temperingMapper) { |
| | | this.temperingMapper = temperingMapper; |
| | | } |
| | | //接收id返回坐标和数据 |
| | | public GlassInfo SelectOutGlass (String glassid) { |
| | | GlassInfo GlassInfo = temperingMapper.SelectOutGlass(glassid); |
| | | return GlassInfo; |
| | | } |
| | | //发送坐标信息 |
| | | public void SendCoordinate (short glassX,short glassY) { |
| | | s7control.WriteWord("DB100.10", glassX); |
| | | s7control.WriteWord("DB100.10", glassY); |
| | | } |
| | | //判断是否可以发送进炉信号 |
| | | public int SelectTempering (String glassid) { |
| | | int tempering = temperingMapper.SelectTempering(glassid); |
| | | if (tempering == 1) { |
| | | return 1; |
| | | } |
| | | else { |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | //发送进炉信号 |
| | | public void SendIntoGlass (short start) { |
| | | s7control.WriteWord("DB100.10", start); |
| | | } |
| | | //接受完成字回复确认字 |
| | | |
| | | public void SendIntoGlass () { |
| | | s7control.WriteWord("DB100.10", (short)1); |
| | | } |
| | | } |
New file |
| | |
| | | |
| | | server: |
| | | port: 8080 |
| | | servlet: |
| | | context-path: /mesModuleTools |
| | | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: user_info #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | user_info: |
| | | url: jdbc:mysql://10.153.19.150:3306/erp_user_info?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | sd: |
| | | url: jdbc:mysql://10.153.19.150:3306/sd?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | mm: |
| | | url: jdbc:mysql://10.153.19.150:3306/mm?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |