wuyouming666
2024-05-20 1ac37f17a1e674337ea924e9f930725575cee15d
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -23,6 +23,7 @@
import com.example.springboot.entity.CarPosition;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
import com.example.springboot.entity.north_frame_buffer1_frames;
import com.example.springboot.entity.north_glass_buffer1;
import com.example.springboot.entity.Out_slice;
import com.example.springboot.entity.Queue;
@@ -106,14 +107,15 @@
  // 根据玻璃id手动上片
  @GetMapping("/Addglassid")
  public Result Addglassid(String glassid) {
  public Result Addglassid(String glassid) throws SQLException {
    Map<String, Object> map = new HashMap<>();
    short taskno = homeMapper.SelectInTask();
    if (taskno > 0) {
      map.put("message2", "500");
    } else {
      // 调用伍上片函数
      short results = spianService.selectAll(glassid);
      north_glass_buffer1 north_glass_buffer1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(glassid, "", "");
      short results = spianService.selectAll(north_glass_buffer1);
      if (results == 200) {
        map.put("message2", "200");
      } else if (results == 300) {
@@ -177,10 +179,10 @@
    Map<String, Object> map = new HashMap<>();
    Out_slice result = homeMapper.SelectQueueByglassid(glassid);
    if (result == null) {
      north_glass_buffer1 north_glass_buffer1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(glassid, "", "");
      north_glass_buffer1 north_glass_buffer1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIdout(glassid, "", "");
      String flip = jdbcConnections.SelectFlipByFrameBarcode(north_glass_buffer1.getFrameBarcode());
      if (flip != null) {
      if (flip != null&&flip != "") {
        String position = jdbcConnections.SelectPositionByFrameBarcode(north_glass_buffer1.getFrameBarcode());
        if (position != null) {
          String framelength = jdbcConnections.SelectFrameLengthByFrameBarcode(north_glass_buffer1.getFrameBarcode());
@@ -273,20 +275,9 @@
  // 手动添加扫码位玻璃
  @PostMapping("/InsertQueueGlassId")
  public Result InsertQueueGlassId(Short id, @RequestBody Queue queue) {
    Map<String, Object> map = new HashMap<>();
    short result = homeMapper.SelectStorageByGlassId(queue.getglassId());
    if (result > 0) {
      map.put("message", "300");
    } else {
      homeMapper.InsertQueueGlassId(queue, id);
      if (id == 1) {
        // 调用伍存储过程
        spianService.selectAll(queue.getglassId());
      }
      map.put("message", "200");
    }
    return Result.success(map);
  public Result InsertQueueGlassId(Short id, @RequestBody Queue queue) throws SQLException {
    return storageCageService.InsertQueueGlassId(id, queue);
  }
  // 确认扫码位玻璃信息
@@ -321,6 +312,7 @@
  public Result SelectAluminumFrameInfoById(String FrameBarcode) throws SQLException {
    String flip = jdbcConnections.SelectFlipByFrameBarcode(FrameBarcode);
    List<north_glass_buffer1> AluminumFrame = north_Glass_Buffer1Service.SelectAluminumFrameInfoById(FrameBarcode);
    Plchome.AluminumFrameInfo=jdbcConnections.SelectFrameBarcode(FrameBarcode);
    Map<String, Object> map = new HashMap<>();
    map.put("AluminumFrame", AluminumFrame);
    map.put("flip", flip);
@@ -330,11 +322,7 @@
  // 根据铝框id删除出片队列玻璃
  @PostMapping("/DeleteProductionQueueGlass")
  public Result DeleteProductionQueueGlass(String FrameNo) {
    homeMapper.CompleteQueueByFrameNo(FrameNo);
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
    return outSliceServive.CompleteQueueByFrameNo(FrameNo);
  }
  // 添加铝框id对应玻璃到出片队列
@@ -343,6 +331,8 @@
    // public Result AddOutSliceS(@RequestBody String[][] AluminumFrames) throws
    // SQLException {
    north_Glass_Buffer1Service.AddOutSliceS(FrameNo);
    Plchome.AluminumFrame = null;
    Plchome.AluminumFrameInfo = new north_frame_buffer1_frames();
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
@@ -377,7 +367,7 @@
    return Result.success(map);
  }
  // 修改出片队列状态与出片队列调序
  // 修是否需要确认
  @PostMapping("/isConfirmStates")
  public Result isConfirmStates(Boolean isConfirmStates) {
    Plchome.isConfirm = isConfirmStates;
@@ -400,8 +390,12 @@
  // 手动写入plc扫码位玻璃id
  @PostMapping("/WriteGlassID")
  public void WriteGlassID(String glassid) {
  public Result WriteGlassID(String glassid) {
    // 扫码位写入玻璃id
    spianService.outmesid(glassid, "DB103.286");
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
  }
  // 清除指定位置id
@@ -414,6 +408,7 @@
  @PostMapping("/CloseForm7")
  public Result CloseForm7() {
    Plchome.AluminumFrame = null;
    Plchome.AluminumFrameInfo = new north_frame_buffer1_frames();
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
@@ -431,20 +426,30 @@
  // 软急停
  @PostMapping("/SoftEmergencyStop")
  public Result SoftEmergencyStop(Short num) {
    String position="DB101.11.3";
    String position = "DB101.11.3";
    Map<String, Object> map = new HashMap<>();
        if (S7control.getinstance().CheckConnected() == true) {
            S7control.getinstance().WriteBit(position, false);
            try {
                TimeUnit.MILLISECONDS.sleep(300);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            S7control.getinstance().WriteBit(position, true);
            map.put("message", "200");
        } else {
            map.put("message", "300");
        }
        return Result.success(map);
    if (S7control.getinstance().CheckConnected() == true) {
      S7control.getinstance().WriteBit(position, false);
      try {
        TimeUnit.MILLISECONDS.sleep(300);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      S7control.getinstance().WriteBit(position, true);
      map.put("message", "200");
    } else {
      map.put("message", "300");
    }
    return Result.success(map);
  }
  // 切换PLC获取二维码方式
  @PostMapping("/SwitchScanMethod")
  public Result SwitchScanMethod(Boolean scansmethod) {
    S7control.getinstance().WriteBit("DB101.11.4", scansmethod);
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
  }
}