Merge remote-tracking branch 'origin/master'
New file |
| | |
| | | { |
| | | "plcAddressBegin": "DB88.0", |
| | | "plcAddressLenght": "58", |
| | | "dataType": "word", |
| | | "parameteInfor": [ |
| | | { |
| | | "codeId": "confirmationWord", |
| | | "addressIndex": "0", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "temperingLayoutId", |
| | | "addressIndex": "2", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "filmsid", |
| | | "addressIndex": "4", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "temperingType", |
| | | "addressIndex": "6", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "thickness", |
| | | "addressIndex": "8", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "loadingRate", |
| | | "addressIndex": "10", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "areaDifference", |
| | | "addressIndex": "12", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "state", |
| | | "addressIndex": "22", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "deviceState", |
| | | "addressIndex": "24", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "resultState", |
| | | "addressIndex": "26", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "loadSpeed", |
| | | "addressIndex": "28", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "downSpeed", |
| | | "addressIndex": "30", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "load1", |
| | | "addressIndex": "32", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "heat1", |
| | | "addressIndex": "34", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "heat2", |
| | | "addressIndex": "36", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "cool1", |
| | | "addressIndex": "38", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "cool2", |
| | | "addressIndex": "40", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "downId", |
| | | "addressIndex": "42", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "productionTime", |
| | | "addressIndex": "44", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "heatEnergy", |
| | | "addressIndex": "46", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "coolEnergy", |
| | | "addressIndex": "48", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "temperatureUp1", |
| | | "addressIndex": "50", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "temperatureDown1", |
| | | "addressIndex": "52", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "temperatureUp2", |
| | | "addressIndex": "54", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "temperatureDown2", |
| | | "addressIndex": "56", |
| | | "addressLenght": "2" |
| | | } |
| | | ] |
| | | } |
| | |
| | | List<Object> list = edgStorageCageDetailsService.listObjs(queryWrapper); |
| | | //获取笼内玻璃版图差值是否大于阈值 |
| | | if (CollectionUtil.isNotEmpty(list)) { |
| | | int diff = (int) list.get(0); |
| | | Long diff = (Long) list.get(0); |
| | | return diff > threshold; |
| | | } else { |
| | | return Boolean.FALSE; |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7object extends Thread { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型 |
| | | private String ip = "192.168.20.202"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | |
| | | public PlcParameterObject PlcMesObject; |
| | | private static volatile S7object instance = null; |
| | | |
| | | private S7object() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcTemperingGlass.json"; |
| | | PlcMesObject = InitUtil.initword(PlcLoadGlass); |
| | | } |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7object getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7object.class) { |
| | | if (instance == null) { |
| | | instance = new S7object(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | if (getplcvlues != null) { |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import com.mes.tempering_record.service.TemperingRecordService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/7/17 12:47 |
| | | * @Description: |
| | | */ |
| | | public class TemperingTask { |
| | | |
| | | @Autowired |
| | | private TemperingRecordService temporalRecordService; |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void temperingGlassBefore() { |
| | | //todo:获取钢化版图中状态为2的(进炉完成的玻璃信息) 且不存在钢化记录表内的 |
| | | |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void temperingGlassAfter() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.tempering_record.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-07-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/temperingRecord") |
| | | public class TemperingRecordController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.tempering_record.entity; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-07-17 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class TemperingRecord implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 钢化版图 |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 玻璃材质(膜系0.白玻1.单银2.双银3三银 4.超白5.热反射) |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 钢化类型(1.全钢:2.半钢) |
| | | */ |
| | | private Integer temperingType; |
| | | |
| | | /** |
| | | * 厚度(厚度*10) |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 装载率 |
| | | */ |
| | | private Double loadingRate; |
| | | |
| | | /** |
| | | * 面积差 |
| | | */ |
| | | private Double areaDifference; |
| | | |
| | | /** |
| | | * 生产耗时 |
| | | */ |
| | | private String productionTime; |
| | | |
| | | /** |
| | | * 加热能耗 |
| | | */ |
| | | private String heatEnergy; |
| | | |
| | | /** |
| | | * 冷却能耗 |
| | | */ |
| | | private String coolEnergy; |
| | | |
| | | /** |
| | | * 是否完成(plc获取非1:参数不存在;2、匹配完成;3、匹配超时) |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.tempering_record.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.tempering_record.entity.TemperingRecord; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-07-17 |
| | | */ |
| | | public interface TemperingRecordMapper extends BaseMapper<TemperingRecord> { |
| | | |
| | | } |
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.mes.tempering_record.mapper.TemperingRecordMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.mes.tempering_record.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.tempering_record.entity.TemperingRecord; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-07-17 |
| | | */ |
| | | public interface TemperingRecordService extends IService<TemperingRecord> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.tempering_record.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.tempering_record.entity.TemperingRecord; |
| | | import com.mes.tempering_record.mapper.TemperingRecordMapper; |
| | | import com.mes.tempering_record.service.TemperingRecordService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-07-17 |
| | | */ |
| | | @Service |
| | | public class TemperingRecordServiceImpl extends ServiceImpl<TemperingRecordMapper, TemperingRecord> implements TemperingRecordService { |
| | | |
| | | } |
| | |
| | | DownGlassInfo downGlassInfo = new DownGlassInfo(); |
| | | BeanUtils.copyProperties(downStorageCageDetails, downGlassInfo); |
| | | //todo:落架片序 |
| | | downGlassInfo.setSequence(downGlassInfoService.queryMaxSequence(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer())); |
| | | downGlassInfoService.save(downGlassInfo); |
| | | //生成任务信息 |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | |
| | | order by count desc limit 1 |
| | | </select> |
| | | <select id="queryMaxSequence" resultType="java.lang.Integer"> |
| | | SELECT max(sequence) + 1 as sequence |
| | | SELECT COALESCE(max(sequence) + 1, 0) as sequence |
| | | FROM down_glass_info |
| | | WHERE flow_card_id = #{flowCardId} |
| | | AND layer = #{layer} |