| | |
| | | package com.example.springboot.service; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | import com.example.springboot.entity.Queue; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.StorageTask; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | @Slf4j |
| | | @Service |
| | | public class StorageCageService { |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private SpianService spianService; |
| | | |
| | | @Autowired |
| | | private JdbcConnections jdbcConnections; |
| | | |
| | | public void EndTask(int types) { |
| | | String A01glassid1 = spianService.queGlassid("DB103.128", 14).toString(); |
| | | String A01glassid2 = spianService.queGlassid("DB103.142", 14).toString(); |
| | | String A02glassid1 = spianService.queGlassid("DB103.156", 14).toString(); |
| | | String B01glassid = spianService.queGlassid("DB103.184", 14).toString(); |
| | | String B02glassid = spianService.queGlassid("DB103.212", 14).toString(); |
| | | String D02glassid = spianService.queGlassid("DB103.58", 14).toString(); |
| | | List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10); |
| | | if (types == 0) {// 终止进片任务 |
| | | List<StorageTask> cageList = homeMapper.SelectTaskByState(types); |
| | |
| | | } |
| | | if (storageTask.getGlassId().equals(B02glassid) && DeviceList.get(3) == 0) { |
| | | ClearGlassId("DB101.10.3"); |
| | | outSliceServive.StopTask(storageTask.getGlassId(), types); |
| | | } |
| | | log.info("stopfeedid:"+storageTask.getGlassId()+"D02id:"+D02glassid+"devicestate:"+DeviceList.get(1)); |
| | | if (storageTask.getGlassId().equals(D02glassid) && DeviceList.get(1) == 0) { |
| | | ClearGlassId("DB101.9.3"); |
| | | outSliceServive.StopTask(storageTask.getGlassId(), types); |
| | | } |
| | | } |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | public Result InsertQueueGlassId(Short id, Queue queue) { |
| | | public Result InsertQueueGlassId(Short id, Queue queue) throws SQLException { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | Short zhi = 200; |
| | | short result = homeMapper.SelectStorageByGlassId(queue.getglassId()); |
| | | if (result > 0) { |
| | | map.put("message", "300"); |
| | | map.put("message", "500"); |
| | | } else { |
| | | if (id == 1) { |
| | | // 调用伍存储过程 |
| | | zhi = spianService.selectAll(queue.getglassId()); |
| | | north_glass_buffer1 north_glass_buffer1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(queue.getglassId(), "", ""); |
| | | zhi = spianService.selectAll(north_glass_buffer1); |
| | | if (zhi == 200) { |
| | | homeMapper.InsertQueueGlassId(queue, id); |
| | | } |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | public Short InsertQueueGlassIds(Short id, Queue queue) throws SQLException { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | Short zhi = 0; |
| | | short result = homeMapper.SelectStorageByGlassId(queue.getglassId()); |
| | | if (result > 0) { |
| | | zhi=500; |
| | | map.put("message", "500"); |
| | | } else { |
| | | if (id == 1) { |
| | | // 调用伍存储过程 |
| | | north_glass_buffer1 north_glass_buffer1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(queue.getglassId(), "", ""); |
| | | zhi = spianService.selectAll(north_glass_buffer1); |
| | | if (zhi == 200) { |
| | | homeMapper.InsertQueueGlassId(queue, id); |
| | | } |
| | | } |
| | | map.put("message", zhi); |
| | | } |
| | | if (zhi != 200) { |
| | | Plchome.FeedState = true; |
| | | } |
| | | return zhi; |
| | | } |
| | | |
| | | } |