qiangxuan пре 2 месеци
родитељ
комит
64193f2426

+ 135 - 39
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/controller/BilletHotsendChangeShiftController.java

@@ -18,12 +18,13 @@ import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.actualControl.heatsActuals.service.IHeatsActualsService;
 import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
 import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
-import org.jeecg.modules.billet.billetHotsendChangeShift.util.ScheduleUtils;
+import org.jeecg.modules.billet.billetHotsendChangeShift.util.ScheduleRecord;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
 import org.jeecg.modules.billet.storageBill.entity.ShiftEnum;
 import org.jeecg.modules.billet.storageBill.entity.ShiftGroupEnum;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
@@ -33,8 +34,10 @@ import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.YearMonth;
 import java.time.format.DateTimeFormatter;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
 
 /**
  * @Description: 钢坯交班记录
@@ -242,35 +245,51 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 
 
 	// 每天 08:00:00 执行的定时任务
-//	@Scheduled(cron = "0 0 8 * * ?")
+	@Scheduled(cron = "0 0 8 * * ?")
 	public void executeDayShiftTask() {
 		log.info("自动化定时交班——白班:08:00:00开始执行!");
 		performShiftChange("白班");
 	}
 
 	// 每天 16:00:00 执行的定时任务
-//	@Scheduled(cron = "0 0 16 * * ?")
+	@Scheduled(cron = "0 0 16 * * ?")
 	public void executeMiddleShiftTask() {
 		log.info("自动定时交班——中班:16:00:00开始执行!");
 		performShiftChange("中班");
 	}
 
 	// 每天 00:00:00 执行的定时任务
-//	@Scheduled(cron = "0 0 0 * * ?")
+	@Scheduled(cron = "0 0 0 * * ?")
 	public void executeNeightShiftTask() {
-		log.info("自动化定时交班——白班:08:00:00开始执行!");
+		log.info("自动化定时交班——白班:00:00:00开始执行!");
 		performShiftChange("夜班");
 	}
 
 	@ApiOperation(value="自动化交班测试", notes="自动化交班测试")
 	@GetMapping(value = "/autoByCcmNo")
-	public Result<List<BilletHotsendChangeShift>> autoByCcmNo() {
-		performShiftChange("白班");
-		List<BilletHotsendChangeShift> list = billetHotsendChangeShiftService.list().stream()
-				.sorted(Comparator.comparing(BilletHotsendChangeShift::getCreateTime).reversed())
-				.limit(2)
-				.collect(Collectors.toList());
-		return Result.OK(list);
+	public Result<String> autoByCcmNo(@RequestParam(name="ccmNo", required = false) String ccmNo,
+															  @RequestParam(name="nextId", required = false) Integer nextId,
+															  @RequestParam(name="shift", required = false) String shift,
+															  @RequestParam(name="shiftGroup", required = false) String shiftGroup) {
+		// 设置5.6号机的缓存班组班别信息
+		if ("5".equals(ccmNo) || "6".equals(ccmNo)){
+			String keyShiftGroupsix = String.format("class:shift:group:%s", "6");
+			String keyShiftsix = String.format("class:shift:%s", "6");
+			redisTemplate.opsForValue().set(keyShiftGroupsix, shiftGroup);
+			redisTemplate.opsForValue().set(keyShiftsix, shift);
+
+			String keyShiftGroupsix1 = String.format("class:shift:group:%s", "5");
+			String keyShiftsix1 = String.format("class:shift:%s", "5");
+			redisTemplate.opsForValue().set(keyShiftGroupsix1, shiftGroup);
+			redisTemplate.opsForValue().set(keyShiftsix1, shift);
+			return Result.OK("5.6号机缓存设置成功!");
+		} else if (oConvertUtils.isNotEmpty(nextId)) {
+			String nextshiftIdKey = String.format("class:nextshift:Id:%s", "5-6");
+			redisTemplate.opsForValue().set(nextshiftIdKey, nextId);
+			return Result.OK("设置交班索引i为:" + nextId);
+		}
+//		performShiftChange(null);
+		return Result.OK(null);
 	}
 	/**
 	 * 自动化交班
@@ -279,12 +298,6 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 	 */
 	private void performShiftChange(String shiftName) {
 
-		String keyShiftGroupfive = String.format("class:shift:group:%s", "5");
-		String keyShiftfive = String.format("class:shift:%s", "5");
-
-		String fiveShiftGroup = oConvertUtils.getString(redisTemplate.opsForValue().get(keyShiftGroupfive));
-		String fiveShift = oConvertUtils.getString(redisTemplate.opsForValue().get(keyShiftfive));
-
 		String keyShiftGroupsix = String.format("class:shift:group:%s", "6");
 		String keyShiftsix = String.format("class:shift:%s", "6");
 
@@ -292,46 +305,129 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 		String sixShift = oConvertUtils.getString(redisTemplate.opsForValue().get(keyShiftsix));
 
 
-		// 5.6号机的班组和班别是否相等
-		if (!Objects.equals(sixShiftGroup, fiveShiftGroup) || !Objects.equals(sixShift, fiveShift)) {
-			log.info("缓存中5.6号机的当班班组信息不一致,执行交班定时任务失败! {}", new Date());
-			log.info("5号机班组值:{},6号机班组值:{}", fiveShiftGroup, sixShiftGroup);
-			log.info("5号机班别值:{},6号机班别值:{}", fiveShift, sixShift);
-			return;
-		}
-
 		String currentShiftGroupName = ShiftGroupEnum.fromCode(sixShiftGroup).name();
 		String currentShiftName = ShiftEnum.fromCode(sixShift).name().replace("班", "");
 
-		String[] result = ScheduleUtils.getNextShiftInfo(currentShiftGroupName, currentShiftName);
-		if (result.length < 4 || result[2] == null || result[3] == null) {
-			log.info("根据排班表未匹配出下一个班次信息,自动化交班失败! {}", new Date());
-			return;
+		String nextshiftIdKey = String.format("class:nextshift:Id:%s", "5-6");
+		String nextCacheId = oConvertUtils.getString(redisTemplate.opsForValue().get(nextshiftIdKey));
+
+
+		String nextShiftGroupName = "";
+		String nextShiftName = "";
+		int nextShiftGroupVal = 0;
+		int nextShiftVal = 0;
+
+
+		List<ScheduleRecord> scheduleRecordListAll = new ArrayList<>();
+		// 将数据添加到列表中
+		scheduleRecordListAll.add(new ScheduleRecord(1, "丙", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(2, "甲", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(3, "乙", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(4, "丙", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(5, "甲", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(6, "乙", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(7, "丙", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(8, "甲", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(9, "乙", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(10, "丙", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(11, "甲", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(12, "乙", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(13, "丁", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(14, "丙", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(15, "甲", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(16, "丁", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(17, "丙", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(18, "甲", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(19, "丁", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(20, "丙", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(21, "甲", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(22, "丁", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(23, "丙", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(24, "甲", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(25, "乙", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(26, "丁", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(27, "丙", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(28, "乙", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(29, "丁", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(30, "丙", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(31, "乙", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(32, "丁", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(33, "丙", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(34, "乙", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(35, "丁", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(36, "丙", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(37, "甲", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(38, "乙", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(39, "丁", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(40, "甲", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(41, "乙", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(42, "丁", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(43, "甲", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(44, "乙", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(45, "丁", "中"));
+		scheduleRecordListAll.add(new ScheduleRecord(46, "甲", "夜"));
+		scheduleRecordListAll.add(new ScheduleRecord(47, "乙", "白"));
+		scheduleRecordListAll.add(new ScheduleRecord(48, "丁", "中"));
+
+		if (oConvertUtils.isEmpty(nextCacheId)) {
+			for (ScheduleRecord scheduleRecord : scheduleRecordListAll) {
+				if (currentShiftGroupName.equals(scheduleRecord.getShiftGroup()) && currentShiftName.equals(scheduleRecord.getShift())) {
+					nextShiftGroupName = scheduleRecord.getShiftGroup();
+					nextShiftName = scheduleRecord.getShift();
+					nextShiftGroupVal = scheduleRecord.getShiftGroupValue();
+					nextShiftVal = scheduleRecord.getShiftValue();
+					redisTemplate.opsForValue().set(nextshiftIdKey, scheduleRecord.getId() + 1);
+					break;
+				}
+			}
+		}else {
+			for (ScheduleRecord scheduleRecord : scheduleRecordListAll) {
+				if (scheduleRecord.getId() == Integer.parseInt(nextCacheId)) {
+
+					nextShiftName = scheduleRecord.getShift();
+					nextShiftGroupName = scheduleRecord.getShiftGroup();
+
+					nextShiftGroupVal = scheduleRecord.getShiftGroupValue();
+					nextShiftVal = scheduleRecord.getShiftValue();
+
+					if (Integer.parseInt(nextCacheId) == 48){
+						redisTemplate.opsForValue().set(nextshiftIdKey, 1);
+					}else {
+						redisTemplate.opsForValue().set(nextshiftIdKey, scheduleRecord.getId() + 1);
+					}
+				}
+			}
 		}
-		log.info("下一个班次信息:{}——{}", result[0], result[1]);
-		log.info("下一个班次信息:{}——{}", result[3], result[2]);
+		log.info(new Date() + "下一个班次名::" + nextCacheId + ","+nextShiftGroupName+ ","+ nextShiftName);
+		log.info("下一个班次值::" + nextShiftGroupVal+ ","+ nextShiftVal);
 
+		String finalNextShiftGroupVal = String.valueOf(nextShiftGroupVal);
+		String finalNextShiftVal = String.valueOf(nextShiftVal);
 		// 查询当天的交班记录
 		LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapperCS = new LambdaQueryWrapper<>();
 		queryWrapperCS.between(BilletHotsendChangeShift::getCreateTime, DateUtils.getStartOfDay(), DateUtils.getEndOfDay());
 		List<BilletHotsendChangeShift> billetHotsendChangeShiftList = billetHotsendChangeShiftService.list(queryWrapperCS);
 
-		String nextShift = String.join(",", result[3], result[2]);
+		String nextShift = String.join(",", finalNextShiftVal, finalNextShiftGroupVal);
 
 		if (oConvertUtils.listIsNotEmpty(billetHotsendChangeShiftList)) {
 			boolean exists = billetHotsendChangeShiftList.stream()
 					.map(x -> String.join(",", x.getShift(), x.getShiftGroup()))
 					.anyMatch(s -> s.equals(nextShift));
 			if (exists) {
-				log.info("自动化当天不能重复交班! {}", new Date());
+				log.info("自动交班,当天不能重复交班! {}", new Date());
+				// 自动交班失败,交班ID索引值回滚,保证交班顺序
+				String nextCacheIdRollBack = oConvertUtils.getString(redisTemplate.opsForValue().get(nextshiftIdKey));
+				int nextCacheIdRollBacks = Integer.parseInt(nextCacheIdRollBack);
+				redisTemplate.opsForValue().set(nextshiftIdKey, nextCacheIdRollBacks - 1);
 				return;
 			}
 		}
 
 		BilletHotsendChangeShift billetHotsendChangeShiftVo = new BilletHotsendChangeShift();
-		billetHotsendChangeShiftVo.setShiftGroup(result[2]);
-		billetHotsendChangeShiftVo.setShift(result[3]);
+		billetHotsendChangeShiftVo.setShiftGroup(finalNextShiftGroupVal);
+		billetHotsendChangeShiftVo.setShift(finalNextShiftVal);
 		JSONObject jsonObject = billetHotsendChangeShiftService.autoChangeShiftHandle(billetHotsendChangeShiftVo);
-		log.info("自动化{}交班成功! {} 结果值:{}", shiftName, new Date(), jsonObject);
+		log.info("自动化{}交班成功!{} 结果值:{}", shiftName, new Date(), jsonObject);
 	}
 }

+ 15 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/service/impl/BilletHotsendChangeShiftServiceImpl.java

@@ -73,6 +73,8 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
                         .orderByDesc(BilletHotsendChangeShift::getCreateTime).last("limit 1"));
                 if (oConvertUtils.isEmpty(billetHotsendChangeShift)) {
                     result.put("fail", "当班信息查询为空,交班操作失败!");
+                    redisTemplate.opsForValue().set(keyShiftGroup, oldShiftGroup);
+                    redisTemplate.opsForValue().set(keyShift, oldShift);
                     return result;
                 }
                 // 更新当前班次的交班时间,相当于上一个班交班的结束时间
@@ -138,7 +140,8 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
     @Transactional(rollbackFor = Exception.class)
     public JSONObject autoChangeShiftHandle(BilletHotsendChangeShift billetHotsendChangeShiftVo) {
         JSONObject result = new JSONObject();
-
+        // 缓存交班索引ID
+        String nextshiftIdKey = String.format("class:nextshift:Id:%s", "5-6");
         List<String> ccmNoList = Arrays.asList("5", "6");
         for (String ccmNo : ccmNoList){
             String keyShiftGroup = String.format("class:shift:group:%s", ccmNo);
@@ -162,6 +165,13 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
                         .last("limit 1"));
                 if (oConvertUtils.isEmpty(billetHotsendChangeShift)) {
                     result.put("fail", "当班信息查询为空,自动化交班操作失败!");
+                    // 自动交班失败,交班ID索引值回滚,保证交班顺序
+                    String nextCacheIdRollBack = oConvertUtils.getString(redisTemplate.opsForValue().get(nextshiftIdKey));
+                    int nextCacheIdRollBacks = Integer.parseInt(nextCacheIdRollBack);
+                    redisTemplate.opsForValue().set(nextshiftIdKey, nextCacheIdRollBacks - 1);
+                    // 班组班别回滚
+                    redisTemplate.opsForValue().set(keyShiftGroup, oldShiftGroup);
+                    redisTemplate.opsForValue().set(keyShift, oldShift);
                     return result;
                 }
                 // 更新当前班次的交班时间,相当于上一个班交班的结束时间
@@ -217,6 +227,10 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
                     redisTemplate.opsForValue().set(keyShiftGroup, oldShiftGroup);
                     redisTemplate.opsForValue().set(keyShift, oldShift);
                 }
+                // 自动交班失败,交班ID索引值回滚,保证交班顺序
+                String nextCacheIdRollBack = oConvertUtils.getString(redisTemplate.opsForValue().get(nextshiftIdKey));
+                int nextCacheIdRollBacks = Integer.parseInt(nextCacheIdRollBack);
+                redisTemplate.opsForValue().set(nextshiftIdKey, nextCacheIdRollBacks - 1);
                 result.put("fail", "自动化交班操作失败,出现异常!");
             }
         }

+ 10 - 7
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/util/ScheduleRecord.java

@@ -5,15 +5,14 @@ import lombok.Data;
 @Data
 public class ScheduleRecord {
 
+    private int id;
     private String shiftGroup; // 人员,如甲、乙、丙、丁
-
     private String shift;      // 班次,如白、中、夜
-
     private String startTime;  // 班次开始时间
+    private String endTime;    // 班次结束时间
 
-    private String endTime;    //
-
-    public ScheduleRecord(String shiftGroup, String shift) {
+    public ScheduleRecord(int id, String shiftGroup, String shift) {
+        this.id = id;
         this.shiftGroup = shiftGroup;
         this.shift = shift;
         // 根据班次设置开始和结束时间
@@ -36,6 +35,10 @@ public class ScheduleRecord {
         }
     }
 
+    public int getId() {
+        return id;
+    }
+
     // 获取人员对应的值
     public int getShiftGroupValue() {
         switch (shiftGroup) {
@@ -68,6 +71,6 @@ public class ScheduleRecord {
 
     @Override
     public String toString() {
-        return "人员: " + shiftGroup + "(" + getShiftGroupValue() + "), 班次: " + shift + "(" + getShiftValue() + "), 时段: " + startTime + " - " + endTime;
+        return "id: " + id + ", 人员: " + shiftGroup + "(" + getShiftGroupValue() + "), 班次: " + shift + "(" + getShiftValue() + "), 时段: " + startTime + " - " + endTime;
     }
-}
+}

+ 0 - 102
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/util/ScheduleUtils.java

@@ -1,102 +0,0 @@
-package org.jeecg.modules.billet.billetHotsendChangeShift.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ScheduleUtils {
-
-    public static String[] getNextShiftInfo(String currentShiftGroup, String currentShift) {
-
-        List<ScheduleRecord> scheduleRecords = new ArrayList<>();
-        scheduleRecords.add(new ScheduleRecord("甲", "白"));
-        scheduleRecords.add(new ScheduleRecord("乙", "中"));
-        scheduleRecords.add(new ScheduleRecord("丙", "夜"));
-        scheduleRecords.add(new ScheduleRecord("甲", "白"));
-        scheduleRecords.add(new ScheduleRecord("乙", "中"));
-        scheduleRecords.add(new ScheduleRecord("丙", "夜"));
-        scheduleRecords.add(new ScheduleRecord("甲", "白"));
-        scheduleRecords.add(new ScheduleRecord("乙", "中"));
-        scheduleRecords.add(new ScheduleRecord("丙", "夜"));
-        scheduleRecords.add(new ScheduleRecord("甲", "白"));
-        scheduleRecords.add(new ScheduleRecord("乙", "中"));
-        scheduleRecords.add(new ScheduleRecord("丁", "夜"));
-        scheduleRecords.add(new ScheduleRecord("丙", "白"));
-        scheduleRecords.add(new ScheduleRecord("甲", "中"));
-        scheduleRecords.add(new ScheduleRecord("丁", "夜"));
-        scheduleRecords.add(new ScheduleRecord("丙", "白"));
-        scheduleRecords.add(new ScheduleRecord("甲", "中"));
-        scheduleRecords.add(new ScheduleRecord("丁", "夜"));
-        scheduleRecords.add(new ScheduleRecord("丙", "白"));
-        scheduleRecords.add(new ScheduleRecord("甲", "中"));
-        scheduleRecords.add(new ScheduleRecord("丁", "夜"));
-        scheduleRecords.add(new ScheduleRecord("丙", "白"));
-        scheduleRecords.add(new ScheduleRecord("甲", "中"));
-        scheduleRecords.add(new ScheduleRecord("乙", "夜"));
-        scheduleRecords.add(new ScheduleRecord("丁", "白"));
-        scheduleRecords.add(new ScheduleRecord("丙", "中"));
-        scheduleRecords.add(new ScheduleRecord("乙", "夜"));
-        scheduleRecords.add(new ScheduleRecord("丁", "白"));
-        scheduleRecords.add(new ScheduleRecord("丙", "中"));
-        scheduleRecords.add(new ScheduleRecord("乙", "夜"));
-        scheduleRecords.add(new ScheduleRecord("丁", "白"));
-        scheduleRecords.add(new ScheduleRecord("丙", "中"));
-        scheduleRecords.add(new ScheduleRecord("乙", "夜"));
-        scheduleRecords.add(new ScheduleRecord("丁", "白"));
-        scheduleRecords.add(new ScheduleRecord("丙", "中"));
-        scheduleRecords.add(new ScheduleRecord("甲", "夜"));
-        scheduleRecords.add(new ScheduleRecord("乙", "白"));
-        scheduleRecords.add(new ScheduleRecord("丁", "中"));
-        scheduleRecords.add(new ScheduleRecord("甲", "夜"));
-        scheduleRecords.add(new ScheduleRecord("乙", "白"));
-        scheduleRecords.add(new ScheduleRecord("丁", "中"));
-        scheduleRecords.add(new ScheduleRecord("甲", "夜"));
-        scheduleRecords.add(new ScheduleRecord("乙", "白"));
-        scheduleRecords.add(new ScheduleRecord("丁", "中"));
-        scheduleRecords.add(new ScheduleRecord("甲", "夜"));
-        scheduleRecords.add(new ScheduleRecord("乙", "白"));
-        scheduleRecords.add(new ScheduleRecord("丁", "中"));
-
-        // 假设存储下一个班次的名称和值信息
-        String nextShiftGroupName = "";
-        String nextShiftName = "";
-        String nextShiftGroupValue = "";
-        String nextShiftValue = "";
-        // 找到当前班次在排班表中的位置
-        int currentIndex = -1;
-        for (int i = 0; i < scheduleRecords.size(); i++) {
-            ScheduleRecord record = scheduleRecords.get(i);
-            if (record.getShift().equals(currentShift) && record.getShiftGroup().equals(currentShiftGroup)) {
-                currentIndex = i;
-                break;
-            }
-        }
-
-        if (currentIndex != -1) {
-            // 输出接下来的一个班次信息
-            int nextIndex = (currentIndex + 1) % scheduleRecords.size();
-            ScheduleRecord nextRecord = scheduleRecords.get(nextIndex);
-            nextShiftGroupName = nextRecord.getShiftGroup();
-            nextShiftName = nextRecord.getShift();
-            nextShiftGroupValue = String.valueOf(nextRecord.getShiftGroupValue());
-            nextShiftValue = String.valueOf(nextRecord.getShiftValue());
-        } else {
-            nextShiftGroupValue = null;
-            nextShiftValue = null;
-        }
-        return new String[]{nextShiftGroupName, nextShiftName, nextShiftGroupValue, nextShiftValue};
-    }
-
-
-//    public static void main(String[] args) {
-//        String[] result = getNextShiftInfo("甲", "白");
-//        //判断班组值和班别值是否为空
-//        if (result[2] == null || result[3] == null) {
-//            System.out.println("找不到下一个班次信息,自动化交班失败!");
-//            return;
-//        }
-//        System.out.println("下一个班组:" + result[0]);
-//        System.out.println("下一个班别:" + result[1]);
-//        System.out.println("下一个班组值:" + result[2]);
-//        System.out.println("下一个班别值:" + result[3]);
-//    }
-}