Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
| | |
| | | |
| | | import com.mes.entity.userInfo.SysMenuItem; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface SysMenuItemMapper { |
| | | |
| | | @Select("select * from `sys_menu_item` as a where a.state=1 order by a.menuId,a.listSort;") |
| | | |
| | | |
| | | List<SysMenuItem> findAll() ; |
| | | } |
| | |
| | | |
| | | User findOne(Integer id); |
| | | |
| | | @Select("select user_name FROM `user` where login_name=#{LoginName} ") |
| | | User findOneLoginName(String LoginName); |
| | | |
| | | @Select("select count(id) FROM `user` where login_name=#{userName} and password=#{password} ") |
| | | int checkUser(@Param("userName") String userName,@Param("password") String password); |
| | | |
| | |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | package com.mes.bigstorage.controller; |
| | | |
| | | |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/bigStorageCage") |
| | | public class BigStorageCageController { |
| | | |
| | | //todo: 实例代码 待删除 |
| | | private BigStorageCageService bigStorageCageService; |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | |
| | | //todo: 实例代码 待删除 |
| | | @ApiOperation("测试") |
| | | @GetMapping("/index") |
| | | public String index() { |
| | | return "hello world"; |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("理片笼信息") |
| | | @GetMapping("/BigStorageCage") |
| | | public List<BigStorageCage> BigStorageCage() { |
| | | return bigStorageCageService.list(); |
| | | } |
| | | |
| | | @ApiOperation("理片笼详情") |
| | | @GetMapping("/BigStorageCageDetails") |
| | | public List<BigStorageCageDetails> BigStorageCageDetails() { |
| | | return bigStorageCageDetailsService.list(); |
| | | } |
| | | |
| | | @ApiOperation("小车实时位置") |
| | | @GetMapping("/CarPosition") |
| | | public List<Integer> CarPosition() { |
| | | return bigStorageCageDetailsService.getCarposition(); |
| | | } |
| | | |
| | | @ApiOperation("手动完成任务") |
| | | @GetMapping("/FinishTask") |
| | | public void FinishTask(int type, int id) { |
| | | // bigStorageCageDetailsService.FinishTask(); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import feign.Param; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | public interface BigStorageCageDetailsMapper extends BaseMapper<BigStorageCageDetails> { |
| | | |
| | | BigStorageCageDetails SelectTemperingFeedSlot(@Param("bigStorageCageDetails") BigStorageCageDetails bigStorageCageDetails); |
| | | |
| | | BigStorageCageDetails SelectEmptyFeedSlot(); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.uppattenusage.entity.GlassInfo; |
| | | import org.apache.ibatis.annotations.Update; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface BigStorageCageMapper extends BaseMapper<BigStorageCage> { |
| | | |
| | | |
| | | BigStorageCageDetails SelectEmptyFeedSlot(); |
| | | |
| | | @Update("update big_storage_cage set remain_width = #{width} where slot=#{slot}") |
| | | public void UpdateRemainWidth(int slot,int width); |
| | | |
| | | BigStorageCageDetails SelectTemperingFeedSlot(GlassInfo glassInfo); |
| | | |
| | | BigStorageCageDetails SelectOtherFeedSlot(); |
| | | |
| | | List<String> selectTemperingId(); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface BigStorageCageDetailsService extends IService<BigStorageCageDetails> { |
| | | |
| | | public boolean getTemperingGlass(); |
| | | |
| | | List<Integer> getCarposition(); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | | import com.mes.uppattenusage.entity.GlassInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageService extends IService<BigStorageCage> { |
| | | |
| | | public void updateRemainWidth(int Slot); |
| | | public BigStorageCageDetails FeedGlass(GlassInfo glassInfo, BigStorageCageDetails bigStorageCageDetails); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class BigStorageCageDetailsServiceImpl extends ServiceImpl<BigStorageCageDetailsMapper, BigStorageCageDetails> implements BigStorageCageDetailsService { |
| | | @Autowired |
| | | private BigStorageCageMapper bigStorageCageMapper; |
| | | @Override |
| | | public boolean getTemperingGlass(){ |
| | | //获取笼子内所有版图号 |
| | | List<String> temperingIdList=bigStorageCageMapper.selectTemperingId(); |
| | | for (String temperingId:temperingIdList |
| | | ) { |
| | | |
| | | } |
| | | return true; |
| | | } |
| | | @Override |
| | | public List<Integer> getCarposition(){ |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.uppattenusage.entity.GlassInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class BigStorageCageServiceImpl extends ServiceImpl<BigStorageCageMapper, BigStorageCage> implements BigStorageCageService { |
| | | @Autowired |
| | | private BigStorageCageMapper bigStorageCageMapper; |
| | | @Autowired |
| | | private BigStorageCageDetailsMapper bigStorageCageDetailsMapper; |
| | | @Override |
| | | public BigStorageCageDetails FeedGlass(GlassInfo glassInfo, BigStorageCageDetails bigStorageCageDetails) { |
| | | |
| | | |
| | | //获取同钢化版图id可进片的格子 |
| | | BigStorageCageDetails layoutSlotInfo =bigStorageCageMapper.SelectTemperingFeedSlot(glassInfo); |
| | | //有符合条件的格子时 |
| | | if (layoutSlotInfo!=null) { |
| | | //将玻璃信息填入理片笼详情表 |
| | | bigStorageCageDetails.setSlot(layoutSlotInfo.getSlot()); |
| | | }else{ |
| | | //获取不到时: |
| | | |
| | | //获取可进片格子信息 |
| | | BigStorageCageDetails EmptySlotInfo=bigStorageCageMapper.SelectEmptyFeedSlot(); |
| | | if (EmptySlotInfo!=null){ |
| | | bigStorageCageDetails.setSlot(EmptySlotInfo.getSlot()); |
| | | }else{ |
| | | //获取其他笼格子- |
| | | BigStorageCageDetails OtherSlotInfo=bigStorageCageMapper.SelectOtherFeedSlot(); |
| | | bigStorageCageDetails.setSlot(OtherSlotInfo.getSlot()); |
| | | } |
| | | //将玻璃信息放入该格子 |
| | | |
| | | } |
| | | |
| | | updateRemainWidth(bigStorageCageDetails.getSlot()); |
| | | return bigStorageCageDetails; |
| | | } |
| | | |
| | | //修改格子剩余宽度 |
| | | @Override |
| | | public void updateRemainWidth(int Slot){ |
| | | //获取该格子内玻璃信息 |
| | | int width=5000; |
| | | List<BigStorageCageDetails> bigStorageCageDetailsList= Collections.singletonList(bigStorageCageDetailsMapper.selectById(Slot)); |
| | | for (BigStorageCageDetails bigStorageCageDetails:bigStorageCageDetailsList |
| | | ) { |
| | | width-=Integer.parseInt(bigStorageCageDetails.getWidth().toString())+bigStorageCageDetails.getGap(); |
| | | } |
| | | //修改格子剩余宽度 |
| | | bigStorageCageMapper.UpdateRemainWidth(Slot,width); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.component; |
| | | |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.uppattenusage.entity.GlassInfo; |
| | | import com.mes.uppattenusage.service.GlassInfoService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class PlcStorageCage extends Thread { |
| | | |
| | | @Autowired |
| | | private BigStorageCageService bigStorageCageService; |
| | | @Autowired |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | @Autowired |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | |
| | | Thread.sleep(500); |
| | | String plcFeedReq ="0"; |
| | | String plcFeedGlassid ="111"; |
| | | //Plc进片请求时 |
| | | if("1".equals(plcFeedReq)){ |
| | | BigStorageCageDetails bigStorageCageDetails=new BigStorageCageDetails(); |
| | | //传入玻璃id |
| | | GlassInfo glassInfo=glassInfoService.getById(plcFeedGlassid); |
| | | |
| | | BigStorageCageDetails SlotInfo=bigStorageCageService.FeedGlass(glassInfo,bigStorageCageDetails); |
| | | if(SlotInfo!=null){ |
| | | //plc任务发送字 |
| | | } |
| | | } |
| | | |
| | | //出片请求 |
| | | String plcOutReq ="0"; |
| | | boolean result=false; |
| | | if("1".equals(plcOutReq)){ |
| | | //获取钢化小片表未出笼信息 |
| | | List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.SelectTemperingGlassInfo(); |
| | | //没有可出的玻璃时 |
| | | if(temperingGlassInfoList!=null){ |
| | | //查询是否有小片全部到齐的钢化版图 |
| | | result = bigStorageCageDetailsService.getTemperingGlass(); |
| | | }else{ |
| | | //继续当前钢化版图的任务 |
| | | |
| | | temperingGlassInfoService.addOutTask(temperingGlassInfoList); |
| | | result=true; |
| | | } |
| | | if(result==true){ |
| | | //plc任务发送字 |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface TemperingGlassInfoService extends IService<TemperingGlassInfo> { |
| | | |
| | | public void addOutTask(List<TemperingGlassInfo> temperingGlassInfoList); |
| | | public List<TemperingGlassInfo> SelectTemperingGlassInfo(); |
| | | } |
| | |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | |
| | | @Service |
| | | public class TemperingGlassInfoServiceImpl extends ServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingGlassInfoService { |
| | | |
| | | @Override |
| | | public void addOutTask(List<TemperingGlassInfo> temperingGlassInfoList) { |
| | | double carwidth=5000; |
| | | double gay=50; |
| | | //写入任务到任务表 |
| | | for (TemperingGlassInfo temperingGlassInfo:temperingGlassInfoList |
| | | ) { |
| | | if((carwidth-gay-temperingGlassInfo.getWidth())>0){ |
| | | //添加任务到任务表 |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<TemperingGlassInfo> SelectTemperingGlassInfo() { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>loadGlass</artifactId> |
| | | <artifactId>cacheGlass</artifactId> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.mes</groupId> |
| | | <artifactId>servicebase</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
New file |
| | |
| | | package com.mes.upworkstation.controller; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.mes.upworkstation.entity.UpWorkstation; |
| | | import com.mes.upworkstation.service.LoadGlassService; |
| | | import com.mes.utils.Result; |
| | | |
| | | @RestController |
| | | @RequestMapping("/LoadGlass") |
| | | |
| | | // TidyUpGlassModule 钢化模块 |
| | | public class LoadGlassController { |
| | | |
| | | @Autowired |
| | | private LoadGlassService loadGlassService; |
| | | |
| | | @PostMapping("/SelectAll") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result SelectGlassInfo() { |
| | | List<UpWorkstation> glass = loadGlassService.selectAll(); |
| | | System.out.println(glass); |
| | | return Result.build(200,"", glass); |
| | | } |
| | | |
| | | @PostMapping("/insertGlass") //修改一条工位信息,接收实例类字段为宽高厚膜系数量工位id |
| | | @ResponseBody |
| | | public void insertGlassinfo(@RequestBody UpWorkstation upwork) { |
| | | loadGlassService.insertGlass(upwork); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/deleteGlass") //修改一条工位的玻璃信息,传输工位id将玻璃信息相关字段更改为null |
| | | @ResponseBody |
| | | public void SelectCutTerritory(int upworkid) { |
| | | loadGlassService.deleteGlass(upworkid); |
| | | } |
| | | |
| | | @PostMapping("/selectPriority") //开始上片任务 |
| | | @ResponseBody |
| | | public void selectPriority() { |
| | | boolean result = loadGlassService.isCanLoadGlass(); |
| | | if(result==true){ |
| | | loadGlassService.selectPriority(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.upworkstation.mapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.*; |
| | | import com.mes.upworkstation.entity.UpWorkstation; |
| | | @Mapper |
| | | public interface LoadGlassMapper extends BaseMapper<UpWorkstation> { |
| | | //显示目前工位玻璃信息 |
| | | @Select("SELECT * FROM up_workstation") |
| | | List<UpWorkstation> selectALL(); |
| | | //删除工位的玻璃信息 |
| | | @Update("UPDATE `hangzhoumes`.`up_workstation` SET `pattern_width` =NULL, `pattern_heigth` = NULL, `pattern_thickness` = NULL, `films_id` = NULL, `number` = NULL WHERE `workstation_id`=#{id}") |
| | | void deleteGlass(int id ); |
| | | //增加上片信息 |
| | | @Update ("UPDATE `hangzhoumes`.`up_workstation` SET `pattern_width` = #{upwork.patternwidth}, `pattern_heigth` = #{upwork.patternheigth}, `pattern_thickness` =#{upwork.patternthickness}, `films_id` =#{upwork.filmsid}, `number` = #{upwork.number} WHERE `id` = #{upwork.workstationid}; ") |
| | | void insertGlass(UpWorkstation upwork); |
| | | //是否发起吸片 |
| | | @Select("SELECT * FROM up_workstation where workstation_id=#{id}") |
| | | UpWorkstation selectAdd(int id); |
| | | //判断优先工位吸片 |
| | | @Select("select b.layout_sequence from up_workstation a left join up_patten_usage b on a.pattern_width=b.width and a.pattern_heigth=b.width and a.pattern_thickness=b.thickness where a.workstation_id=#{id}") |
| | | int selectPriority(int id); |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.upworkstation.service; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | import com.mes.common.PLCAutoMes; |
| | | import com.mes.common.PlcParameterObject; |
| | | import com.mes.upworkstation.entity.UpWorkstation; |
| | | import com.mes.upworkstation.mapper.LoadGlassMapper; |
| | | |
| | | @Service |
| | | public class LoadGlassService { |
| | | |
| | | |
| | | private LoadGlassMapper LoadGlassMapper; |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | //显示工位上的玻璃信息 |
| | | public List<UpWorkstation> selectAll() { |
| | | List<UpWorkstation> glassInfo= LoadGlassMapper.selectALL(); |
| | | return glassInfo; |
| | | } |
| | | //增加人工输入的工位玻璃信息 |
| | | public void insertGlass(UpWorkstation upwork) { |
| | | LoadGlassMapper.insertGlass(upwork); |
| | | } |
| | | //删除人工搬走的玻璃信息 |
| | | public void deleteGlass(int id) { |
| | | LoadGlassMapper.deleteGlass(id); |
| | | } |
| | | //判断是否可以吸片进行任务 |
| | | public boolean isCanLoadGlass() { |
| | | String loadstate=plcmes.getPlcParameter("吸片信号").getValue(); |
| | | if(loadstate.equals("1")) { |
| | | return true; |
| | | }else{ |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | //判断优先吸片位置后发送出片任务 |
| | | public void selectPriority() { |
| | | int loadid1=LoadGlassMapper.selectPriority(1); |
| | | int loadid2=LoadGlassMapper.selectPriority(2); |
| | | //判断一二号工位哪边的顺序更先 |
| | | if(loadid1>loadid2) { |
| | | //s7control.WriteWord("DB100.10", (short)2); |
| | | }else if(loadid1==loadid2){ |
| | | //当两个工位上的玻璃数相同时,判断哪个工位上的玻璃数更少,优先清空一个架子 |
| | | int glassnum1=Integer.parseInt(plcmes.getPlcParameter("玻璃数").getValue()); |
| | | int glassnum2=Integer.parseInt(plcmes.getPlcParameter("玻璃数").getValue()); |
| | | if(glassnum1>glassnum2){ |
| | | // s7control.WriteWord("DB100.10", (short)2); |
| | | }else{ |
| | | //s7control.WriteWord("DB100.10", (short)1); |
| | | } |
| | | }else{ |
| | | //s7control.WriteWord("DB100.10", (short)1); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>temperingGlass</artifactId> |
| | | <artifactId>cacheGlass</artifactId> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.mes</groupId> |
| | | <artifactId>servicebase</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
New file |
| | |
| | | package com.mes.temperingglass.controller; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingOverService; |
| | | import com.mes.temperingglass.service.TemperingService; |
| | | import com.mes.utils.Result; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping("/Tempering") |
| | | |
| | | // TidyUpGlassModule 钢化模块 |
| | | public class TemperingController { |
| | | |
| | | @Autowired |
| | | private TemperingService temperingService; |
| | | |
| | | @Autowired |
| | | private TemperingOverService temperingOverService; |
| | | |
| | | @GetMapping("/SelectWaitingGlass") // 查询钢化等片中的版图信息,状态为1的为已到,状态为0的为等待中 |
| | | @ResponseBody |
| | | public Result SelectWaitingGlass(@RequestParam(name = "ProcessId", required = false) String ProcessId) { |
| | | List<TemperingGlassInfo> glass = temperingService.SelectWaitingGlass(); |
| | | System.out.println(glass); |
| | | return Result.build(200,"", glass); |
| | | } |
| | | |
| | | @GetMapping("/SelectIntoGlass") // 查询进炉中的钢化等片中的版图信息,状态全为1的为已到。 |
| | | @ResponseBody |
| | | public Result SelectIntoGlass(String ProcessId) { |
| | | List<TemperingGlassInfo> glass = temperingService.SelectIntoGlass(); |
| | | System.out.println(glass); |
| | | return Result.build(200,"", glass); |
| | | } |
| | | |
| | | @GetMapping("/SelectOutGlass") //钢化后显示出炉的版图信息 |
| | | @ResponseBody |
| | | public Result SelectOutGlass(String ProcessId) { |
| | | List<TemperingGlassInfo> glass = temperingOverService.SelectOutGlass(); |
| | | System.out.println(glass); |
| | | return Result.build(200,"", glass); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.temperingglass.entity.GlassInfo; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.*; |
| | | |
| | | @Mapper |
| | | public interface TemperingMapper extends BaseMapper<TemperingGlassInfo> { |
| | | |
| | | |
| | | //查询该玻璃的尺寸和坐标 |
| | | @Select("select *from glass_info where id=#{glassid};") |
| | | GlassInfo SelectGlass(String glassid); |
| | | //是否可以发送进炉信号 |
| | | @Select("select count(*) from glass_info where id=#{glassid};") |
| | | int SelectTempering(String glassid); |
| | | //查询等待中的钢化版图玻璃信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,count(state)state from tempering_glass_info GROUP BY flowcard_id,state)b on a.flowcard_id=b.flowcard_id where b.state=2") |
| | | List<TemperingGlassInfo> SelectWaitingGlass(); |
| | | //查询进炉中的钢化版图玻璃信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,min(state)state1 from tempering_glass_info GROUP BY flowcard_id having state1=1)b on a.flowcard_id=b.flowcard_id where b.state1=1") |
| | | List<TemperingGlassInfo> SelectInGlass(); |
| | | //查询钢化后的钢化版图信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,min(state)state1 from tempering_glass_info GROUP BY flowcard_id having state1=2)b on a.flowcard_id=b.flowcard_id where b.state1=2") |
| | | List <TemperingGlassInfo> SelectOutGlass(); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingMapper; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class TemperingOverService { |
| | | private final TemperingMapper temperingMapper; |
| | | //PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | public TemperingOverService(TemperingMapper temperingMapper) { |
| | | this.temperingMapper = temperingMapper; |
| | | } |
| | | //接收出炉信号和炉号 |
| | | public String SelectOutSignal () { |
| | | |
| | | //S7control.getinstance().WriteWord("出炉信号", (short)1); |
| | | return "GlassInfo"; |
| | | } |
| | | //发送确认收到信号 |
| | | public void OverSignal () { |
| | | //S7control.getinstance().WriteWord("确认字", (short)1); |
| | | } |
| | | //显示钢化出炉后的版图信息 |
| | | public List <TemperingGlassInfo> SelectOutGlass () { |
| | | return temperingMapper.SelectOutGlass(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service; |
| | | import com.mes.temperingglass.entity.GlassInfo; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.tools.S7control; |
| | | import com.mes.temperingglass.mapper.TemperingMapper; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | 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.SelectGlass(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); |
| | | } |
| | | //显示等待中的版图 |
| | | public List <TemperingGlassInfo> SelectWaitingGlass () { |
| | | List<TemperingGlassInfo> WaitingGlass = temperingMapper.SelectWaitingGlass(); |
| | | return WaitingGlass; |
| | | } |
| | | //显示正在进炉的版图 |
| | | public List<TemperingGlassInfo> SelectIntoGlass () { |
| | | List<TemperingGlassInfo> IntoGlass = temperingMapper.SelectInGlass(); |
| | | return IntoGlass; |
| | | } |
| | | } |