wu
2024-02-01 0810f5bb75f043dd7b8ffa024b415e9188677d35
springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java
@@ -6,11 +6,9 @@
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoProperties.Storage;
import org.springframework.stereotype.Service;
import com.example.springboot.common.Result;
import com.example.springboot.component.S7control;
import com.example.springboot.entity.Out_slice;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.mapper.HomeMapper;
@@ -25,9 +23,8 @@
  private SpianMapper spianMapper;
  @Autowired
  SpianService spianService;
  @Autowired
  private JdbcConnections jdbcConnections;
  StorageCageService storageCageService;
  public void AddOutSliceS(String[][] AluminumFrames) throws SQLException {
    // int sequence = homeMapper.SelectMaxSquence();
@@ -55,41 +52,77 @@
  // 完成出片任务
  public Result CompleteQueue(String id, String frameid, String glassid) {
    homeMapper.CompleteQueue(id);
    Short num = homeMapper.SelectCountByFrameNo(frameid);
    if (num == 0) {
      homeMapper.CompleteQueueByFrameNo(frameid);
    }
    StorageCage storageCage = homeMapper.SelectGlassInfo(glassid);
    if (storageCage != null&&storageCage.getState().equals("3")) {
      spianMapper.UpdataOutCage1(storageCage.getGlassWidth(), storageCage.getCage(), storageCage.getCell());
      homeMapper.DeleteByGlassID(glassid);
    }
    homeMapper.CompleteQueueByGlassId(glassid);
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
  }
  //终止进片/出片
  public void StopTask(String glassid, int i) {
    if (i == 0) {// 进片终止
      spianService.overtask(glassid);
      DeleteByGlassIDs(glassid);
      homeMapper.UpdateOutSliceGlass(glassid);
    } else {// 出片终止
      spianMapper.UpdatetaskOut(glassid);//完成出片任务
      spianMapper.UpdataGlassCage(glassid, 0);// 清除出片格子玻璃信息
      spianMapper.UpdateCageOver(glassid, 0);// 更改笼子表出片状态
      homeMapper.UpdateOutSliceGlass(glassid);//修改出片队列此玻璃状态为缺失
  // 确认后完成修改出片队列状态
  public void CompleteQueueByGlassId(String glassid) {
    homeMapper.CompleteQueueByGlassId(glassid);
    Out_slice outslice = homeMapper.SelectQueueByglassid(glassid);
    Short num = homeMapper.SelectCountByFrameNo(outslice.getBarCode());
    if (num == 0) {
      homeMapper.CompleteQueueByFrameNo(outslice.getBarCode());
    }
  }
  //删除笼内玻璃还原宽度
  public void DeleteByGlassIDs(String glassid) {
    StorageCage glassinfor = homeMapper.SelectGlassInfo(glassid);
    spianMapper.UpdataOutCage1(glassinfor.getGlassWidth(), glassinfor.getCage(), glassinfor.getCell());
    homeMapper.DeleteByGlassID(glassid);
  // 终止进片/出片
  public void StopTask(String glassid, int i) {
    if (i == 0) {// 进片终止
      homeMapper.UpdateTask(0,glassid);// 完成进片任务
      DeleteByGlassIDs(glassid);//删除进片任务
      homeMapper.UpdateOutSliceGlass(glassid);
    } else if(i==1) {// 出片终止
      homeMapper.UpdateTask(1,glassid);// 完成出片任务
      spianMapper.UpdataGlassCage(glassid, 0);// 清除出片格子玻璃信息
      homeMapper.UpdateOutSliceGlass(glassid);// 修改出片队列此玻璃状态为缺失
    }else{
      //清除进片
      homeMapper.UpdateTask(2,glassid);
      homeMapper.UpdateOutSliceGlass(glassid);
      //清除进出片玻璃id
      DeleteByGlassIDs(glassid);
    }
  }
  // 删除笼内玻璃还原宽度
  public void DeleteByGlassIDs(String glassid) {
    List<StorageCage> glassinfor = homeMapper.SelectStorageInfoByGlassId(glassid);
    for (StorageCage storageCage : glassinfor) {
      if (storageCage.getState().equals("2")) {
        homeMapper.UpdataCageWidth(storageCage.getGlassWidth(), storageCage.getCage(), storageCage.getCell());
      }
    }
    homeMapper.DeleteByGlassID(glassid);
  }
  //修改铝框确认状态
  public Result FrameStateUpdate(String frameno) {
    homeMapper.FrameStateUpdate(frameno);
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
  }
  //查询当前铝框
  public Out_slice SelectCurrentFrame() {
    return homeMapper.SelectCurrentFrame();
  }
public Result CompleteQueueByFrameNo(String frameNo) {
  Map<String, Object> map = new HashMap<>();
  Short num= homeMapper.SelectOutingQueueCount(frameNo);
  if(num==0){
    homeMapper.CompleteQueueByFrameNo(frameNo);
    map.put("message", "200");
  }else{
    map.put("message", "300");
  }
  return Result.success(map);
}
}