| | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | |
| | | @SpringBootApplication |
| | | @EnableSwagger2 |
| | | @EnableDiscoveryClient |
| | | @EnableScheduling |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class LoadGlassModuleApplication { |
| | | public static void main(String[] args) { |
| | |
| | | public Result <List<UpPattenUsage>> pauseTask(@RequestBody Engineering engineering) { |
| | | boolean work=engineeringService.changeTask(engineering.getEngineerId(),engineering.getState()); |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist(); |
| | | log.info("StartorStop:{},{}", work,engineering); |
| | | return Result.build(200, engineering.getEngineerId(),glass); |
| | | if(work){ |
| | | return Result.build(200,"成功",glass); |
| | | }else { |
| | | return Result.build(100,"失败",glass); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("暂停") |
| | | @PostMapping("/pause") //暂停上片任务 |
| | | @ResponseBody |
| | | public Result <List<UpPattenUsage>> pause(@RequestBody Engineering engineering) { |
| | | boolean work=engineeringService.changeTask(engineering.getEngineerId(),engineering.getState()); |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist(); |
| | | log.info("StartorStop:{},{}", work,engineering); |
| | | return Result.build(200, engineering.getEngineerId(),glass); |
| | | boolean work=engineeringService.pauseTask(engineering.getEngineerId(),engineering.getState()); |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist();String message; |
| | | if(work){ |
| | | return Result.build(200,"成功",glass); |
| | | }else { |
| | | return Result.build(100,"成功",glass); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("开始上片") |
| | |
| | | * @return Engineering |
| | | */ |
| | | List<Engineering> selectTask(); |
| | | |
| | | boolean pauseTask(String engineerId, Integer state); |
| | | } |
| | |
| | | LambdaUpdateChainWrapper<Engineering> pauseWrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | pauseWrapper.set(Engineering::getState,0); |
| | | pauseWrapper.eq(Engineering::getState,1); |
| | | pauseWrapper.update(); |
| | | boolean pause = pauseWrapper.update(); |
| | | //使用projectId作为条件开始工程 |
| | | LambdaUpdateChainWrapper<Engineering> wrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | wrapper.set(Engineering::getState,state); |
| | | wrapper.eq(Engineering::getEngineerId,projectId); |
| | | return wrapper.update(); |
| | | wrapper.update(); |
| | | return pause; |
| | | } |
| | | |
| | | @Override |
| | |
| | | return engineeringMapper.selectList(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public boolean pauseTask(String engineerId, Integer state) { |
| | | //暂停正在进行工程 |
| | | LambdaUpdateChainWrapper<Engineering> pauseWrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | pauseWrapper.set(Engineering::getState,0); |
| | | pauseWrapper.eq(Engineering::getState,1); |
| | | return pauseWrapper.update(); |
| | | } |
| | | |
| | | } |
| | |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | | */ |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | @Scheduled(fixedDelay = 3000000) |
| | | public void plcLoadGlassTask() throws InterruptedException { |
| | | try { |
| | | //获取联机状态 |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | @Scheduled(fixedDelay = 3000000) |
| | | public void plcLoadGlassReport(){ |
| | | //获取是否有汇报 |
| | | String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue(); |
| | |
| | | public void loadGlassStatus(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue(); |
| | | //String inkageStatus ="1"; |
| | | //String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue(); |
| | | String inkageStatus ="1"; |
| | | jsonObject.append("InkageStatus", inkageStatus); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass"); |
| | | if (sendwServer != null) { |
| | |
| | | private EngineeringService engineeringService; |
| | | @Autowired |
| | | private OptimizeProjectService optimizeProjectService; |
| | | @ApiOperation("显示正在出片的工程信息") |
| | | @ApiOperation("显示选择的工程信息") |
| | | @GetMapping("/prioritylist") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result<List<UpPattenUsage>> prioritylist() { |
| | |
| | | @PostMapping("/selectUpPattenUsage") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result<List<UpPattenUsage>> selectUpPattenUsage(@RequestBody Engineering engineering) { |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineering.getEngineerId()); |
| | | return Result.build(200, "", upPattenUsages); |
| | | List<UpPattenUsage> upPattenUsages=null; |
| | | UpPattenUsage upPattenUsage = upPattenUsageService.selectedEngineering(engineering.getEngineerId()); |
| | | if(upPattenUsage == null){ |
| | | upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineering.getEngineerId()); |
| | | }else { |
| | | upPattenUsages= upPattenUsageService.selectUpPattenUsage(upPattenUsage); |
| | | } |
| | | |
| | | if (!upPattenUsages.isEmpty()) { |
| | | return Result.build(200, "成功", upPattenUsages); |
| | | }else { |
| | | return Result.build(100, "失败", upPattenUsages); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ApiOperation("切换原片上片状态") |
| | | @PostMapping("/updateGlassState") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result<Boolean> updateGlassState(@RequestBody UpPattenUsage upPattenUsage) { |
| | | Boolean whether = upPattenUsageService.updateGlassState(upPattenUsage); |
| | | if (whether){ |
| | | return Result.build(200, "成功", whether); |
| | | }else { |
| | | return Result.build(100, "失败", whether); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | List<UpPattenUsage> prioritylist(); |
| | | /** |
| | | * 查询上片表的工程信息 |
| | | * @return List<UpPattenUsage> |
| | | */ |
| | | List<UpPattenUsage> selectUpPattenUsage(UpPattenUsage upPattenUsage); |
| | | /** |
| | | * 查询上片顺序信息 |
| | | * @return List<UpPattenUsage> |
| | | */ |
| | |
| | | */ |
| | | UpPattenUsage selectSequence(UpPattenUsage upPattenUsage); |
| | | |
| | | |
| | | Boolean updateGlassState(UpPattenUsage upPattenUsage); |
| | | } |
| | | |
| | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.engineering.entity.Engineering; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<UpPattenUsage> selectUpPattenUsage(UpPattenUsage upPattenUsage) { |
| | | LambdaQueryWrapper<UpPattenUsage> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(UpPattenUsage::getEngineeringId,upPattenUsage.getEngineeringId()); |
| | | return this.list(wrapper); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return this.getOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updateGlassState(UpPattenUsage upPattenUsage) { |
| | | UpdateWrapper<UpPattenUsage> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.eq("id",upPattenUsage.getId()) |
| | | .set("state",upPattenUsage.getState()); |
| | | return this.update(updateWrapper); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @PostMapping("/updateGlassMessage") |
| | | @ResponseBody |
| | | public Result<List<UpWorkstation>> updateGlassMessage(@RequestBody UpWorkstation upwork) { |
| | | upWorkstationService.updateGlassMessage(upwork); |
| | | Boolean info= upWorkstationService.updateGlassMessage(upwork); |
| | | List<UpWorkstation> glass = upWorkstationService.list(); |
| | | return Result.build(200, "", glass); |
| | | if(info){ |
| | | return Result.build(200, "成功", glass); |
| | | }else{ |
| | | return Result.build(100, "失败", glass); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | * 增加人工输入的工位玻璃信息 |
| | | * @param upwork |
| | | */ |
| | | void updateGlassMessage(UpWorkstation upwork); |
| | | Boolean updateGlassMessage(UpWorkstation upwork); |
| | | |
| | | |
| | | String updateMesInkageLoad(short inKageWord); |
| | |
| | | * 增加人工输入的工位玻璃信息/删除人工搬走的玻璃信息 |
| | | */ |
| | | @Override |
| | | public void updateGlassMessage(UpWorkstation upwork) { |
| | | public Boolean updateGlassMessage(UpWorkstation upwork) { |
| | | int update = 0; |
| | | UpdateWrapper<UpWorkstation> updateWrapper = new UpdateWrapper<>(); |
| | | if (upwork.getWorkstationId() == 1 || upwork.getWorkstationId() == 3) { |
| | | updateWrapper.eq("workstation_id", upwork.getWorkstationId()); |
| | | int update = this.baseMapper.update(upwork, updateWrapper); |
| | | update = this.baseMapper.update(upwork, updateWrapper); |
| | | } else { |
| | | if (upwork.getPatternHeight() > 2700 || upwork.getPatternHeight() == 0) { |
| | | updateWrapper.eq("workstation_id", upwork.getWorkstationId()); |
| | | int update = this.baseMapper.update(upwork, updateWrapper); |
| | | update = this.baseMapper.update(upwork, updateWrapper); |
| | | } |
| | | } |
| | | return update>0; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Test |
| | | public void textengineering(){ |
| | | Engineering engineering=new Engineering(); |
| | | List<Engineering> glass= engineeringService.selectEngineering("P24032204"); |
| | | engineeringService.saveEngineering(glass); |
| | | log.info("glassinfo:{}", Arrays.asList(glass)); |
| | |
| | | List<OptimizeProject> engineerings=optimizeProjectService.listByState(optimizeRequest); |
| | | log.info("上片表任务中的数据{}",engineerings); |
| | | } |
| | | @Test |
| | | public void textengineering6(){ |
| | | //上片表最后一片 |
| | | UpPattenUsage upPattenUsage=new UpPattenUsage(); |
| | | upPattenUsage.setState(100); |
| | | upPattenUsage.setId(2248L); |
| | | boolean isOver= upPattenUsageService.updateGlassState(upPattenUsage); |
| | | log.info("更改是否成功{}",isOver); |
| | | } |
| | | |
| | | } |
| | |
| | | List<TemperingGlassInfo> outGlass = temperingAgoService.selectOutGlass(); |
| | | jsonObject.append("outGlass", outGlass); |
| | | //过旋转台钢化后的玻璃 |
| | | TemperingGlassInfo overGlass = temperingAgoService.selectOverGlass(); |
| | | List<TemperingGlassInfo> overGlass = temperingAgoService.selectOverGlass(); |
| | | jsonObject.append("overGlass", overGlass); |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("temperingGlass"); |
| | |
| | | |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingAgoService; |
| | | import com.mes.temperingglass.service.TemperingOverService; |
| | | import com.mes.temperingglass.service.TemperingService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | // TidyUpGlassModule 钢化模块 |
| | | public class TemperingGlassInfoController { |
| | | |
| | | @Autowired |
| | | TemperingService temperingService; |
| | | @Autowired |
| | | private TemperingAgoService temperingAgoService; |
| | | |
| | |
| | | |
| | | List<TemperingGlassInfo> selectOutGlass(); |
| | | |
| | | TemperingGlassInfo selectOverGlass(); |
| | | List<TemperingGlassInfo> selectOverGlass(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public TemperingGlassInfo selectOverGlass() { |
| | | //获取过旋转台的玻璃 |
| | | public List<TemperingGlassInfo> selectOverGlass() { |
| | | //获取过旋转台最大的钢化版图id |
| | | QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>(); |
| | | wapper.select("top 1 *").eq("state", 4) |
| | | .orderByAsc("tempering_layout_id") |
| | | .orderByDesc("tempering_feed_sequence"); |
| | | return temperingMapper.selectOne(wapper); |
| | | .orderByDesc("tempering_layout_id"); |
| | | //根据最大的版图id显示钢化后的版图信息 |
| | | TemperingGlassInfo glassinfo= temperingMapper.selectOne(wapper); |
| | | QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("tempering_layout_id",glassinfo.getTemperingLayoutId()); |
| | | return temperingMapper.selectList(wrapper); |
| | | } |
| | | } |
| | |
| | | } |
| | | @Test |
| | | public void testFindPa4() { |
| | | TemperingGlassInfo glass = temperingAgoService.selectOverGlass(); |
| | | List<TemperingGlassInfo> glass = temperingAgoService.selectOverGlass(); |
| | | log.info("等待中的玻璃:{}", Arrays.asList(glass)); |
| | | } |
| | | } |