| | |
| | | package com.example.springboot.controller; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | import com.example.springboot.service.OutSliceServive; |
| | | import com.example.springboot.service.SpianService; |
| | | import com.example.springboot.service.StorageCageService; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.JsonArray; |
| | | import com.google.gson.JsonObject; |
| | | |
| | | import cn.hutool.core.lang.Console; |
| | | |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.component.Plchome; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.CarPosition; |
| | | import com.example.springboot.entity.GlassInfo; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.alarmmg; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | |
| | | |
| | | @Autowired |
| | | private JdbcConnections jdbcConnections; |
| | | |
| | | @GetMapping("/WriteWord") |
| | | public Result WriteWord(String address, float value, String type) { |
| | | |
| | | if ("0".equals(type)) { |
| | | System.err.println("写入word" + address + "+" + value); |
| | | S7control.getinstance().WriteWord(address, (short) value); |
| | | |
| | | } else if ("3".equals(type)) { |
| | | System.err.println("写入time" + address + "+" + value); |
| | | S7control.getinstance().writetime(address, (long) value); |
| | | } else { |
| | | System.err.println("写入float" + address + "+" + value); |
| | | S7control.getinstance().writeFloat32(address, value); |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 写入bit |
| | | @GetMapping("/WriteBit") |
| | | public Result WriteBit(String address, short value) { |
| | | |
| | | boolean values; |
| | | if (value == 0) { |
| | | values = false; |
| | | } else { |
| | | values = true; |
| | | } |
| | | S7control.getinstance().WriteBit(address, values); |
| | | System.err.println("写入bit" + address + "+" + values); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 获取当前登录用户权限 |
| | | @GetMapping("/SelectPermissionByUserName") |
| | |
| | | map.put("message2", "500"); |
| | | } else { |
| | | // 调用伍上片函数 |
| | | System.out.println("调用上片函数"); |
| | | short results = spianService.selectAll(glassid); |
| | | if (results == 200) { |
| | | map.put("message2", "200"); |
| | |
| | | @PostMapping("/InsertQueueGlassId") |
| | | public Result InsertQueueGlassId(Short id, @RequestBody Queue queue) { |
| | | return storageCageService.InsertQueueGlassId(id, queue); |
| | | |
| | | |
| | | } |
| | | |
| | | // 确认扫码位玻璃信息 |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 更改笼子数量 |
| | | @PostMapping("/UpdateStroageCageByCell") |
| | | public Result UpdateStroageCageByCell(Integer cell, Integer num) { |
| | | return storageCageService.UpdateStroageCageByCell(cell, num); |
| | | } |
| | | @PostMapping("/AddOutGlass") |
| | | public Result AddOutGlass(Integer cell, Integer glasstype) { |
| | | return storageCageService.AddOutGlass(cell,glasstype); |
| | | } |
| | | |
| | | |
| | | // 手动完成任务 |
| | | @PostMapping("/FinishTask") |
| | | public Result FinishTask(Integer id) { |
| | | return storageCageService.FinishTask(); |
| | | } |
| | | // 手动结束任务 |
| | | @PostMapping("/TerminateTask") |
| | | public Result TerminateTask(Integer id) { |
| | | return storageCageService.TerminateTask(id); |
| | | } |
| | | |
| | | // 查询玻璃信息 |
| | | @PostMapping("/SelectGlassInfo") |
| | | public Result SelectGlassInfo(String width, String height, String thickness, String films) { |
| | | return storageCageService.SelectGlassInfo(width, height, thickness, films); |
| | | } |
| | | |
| | | // 添加玻璃信息到笼子 |
| | | @PostMapping("/StorageCageAddGlass") |
| | | public Result StorageCageAddGlass(String cell, @RequestBody GlassInfo glassInfo) { |
| | | return storageCageService.StorageCageAddGlass(cell, glassInfo); |
| | | } |
| | | |
| | | // 领取/暂停任务 |
| | | @PostMapping("/ClaimTasks") |
| | | public Result ClaimTasks(String flowcard, Integer state, Integer line) { |
| | | return storageCageService.ClaimTasks(flowcard, state, line); |
| | | } |
| | | |
| | | // 修改出片方式 |
| | | @PostMapping("/ModeChange") |
| | | public Result ModeChange(String flowcard, Integer method) { |
| | | return storageCageService.ModeChange(flowcard, method); |
| | | } |
| | | |
| | | // 添加玻璃信息到测量信息 |
| | | @PostMapping("/UpdateQueue") |
| | | public Result UpdateQueue(@RequestBody GlassInfo glassInfo) { |
| | | return storageCageService.UpdateQueue(glassInfo); |
| | | } |
| | | |
| | | // 人工拿走 |
| | | @PostMapping("/ManualTake") |
| | | public Result ManualTake(@RequestBody String glassInfo) { |
| | | return storageCageService.ManualTake(glassInfo); |
| | | } |
| | | |
| | | // 开始工程 |
| | | @PostMapping("/StartChange") |
| | | public Result StartChange(String flowcard,Integer orderstate) { |
| | | return storageCageService.StartChange(flowcard,orderstate); |
| | | } |
| | | // 开始/暂停出片队列 |
| | | @PostMapping("/UpdateOutTask") |
| | | public Result UpdateOutTask(Integer id,Integer state) { |
| | | return storageCageService.UpdateOutTask(id,state); |
| | | } |
| | | |
| | | // 重新测量 |
| | | @PostMapping("/AnewMeasure") |
| | | public Result AnewMeasure(@RequestBody String glassInfo) { |
| | | return storageCageService.AnewMeasure(glassInfo); |
| | | } |
| | | |
| | | // 导入数据 :添加玻璃信息 |
| | | @PostMapping("/importData") |
| | | public Result importData(@RequestBody List<Map> IportDataStr) { |
| | | return storageCageService.AddGlassinfo(IportDataStr); |
| | | } |
| | | |
| | | // 删除订单 |
| | | @PostMapping("/deleteTasks") |
| | | public Result deleteTasks(@RequestBody Map num) { |
| | | System.out.println("控制器:" + num); |
| | | return storageCageService.deleteTasks(num); |
| | | } |
| | | //删除出片队列 |
| | | @PostMapping("/DeleteOutTask") |
| | | public Result DeleteOutTask(Integer id) { |
| | | System.out.println("控制器:" + id); |
| | | return storageCageService.DeleteOutTask(id); |
| | | } |
| | | |
| | | // 保存膜系设置 |
| | | @PostMapping("/SaveMeasure") |
| | | public Result SaveMeasure(String films, Integer thickness) { |
| | | System.out.println("控制器:" + films+thickness); |
| | | return storageCageService.SaveMeasure(films,thickness); |
| | | } |
| | | |
| | | @GetMapping("/writeValue") |
| | | public Result writeValue(String address, float value, String type) { |
| | | if ("0".equals(type)) { |
| | | System.err.println("写入word" + address + "+" + value); |
| | | // S7control.getinstance().WriteWord(address, (short) value); |
| | | } else if("1".equals(type)) { |
| | | |
| | | System.err.println("写入float" + address + "+" + value); |
| | | // S7control.getinstance().writeFloat32(address, value); |
| | | }else{ |
| | | System.err.println("写入bit" + address + "+" + value); |
| | | // S7control.getinstance().WriteBit(address, true); |
| | | try { |
| | | TimeUnit.MILLISECONDS.sleep(300); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // S7control.getinstance().WriteBit(address, false); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | } |