qiangxuan 3 kuukautta sitten
vanhempi
sitoutus
c59edfee22

+ 11 - 0
zgztBus/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -850,4 +850,15 @@ public class DateUtils extends PropertyEditorSupport {
         return Date.from(localDate.atTime(LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant());
     }
 
+    public static Date getDateWithOnlyYearMonthDay(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        // 设置时间为当天的0时0分0秒
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        return calendar.getTime();
+    }
+
 }

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

@@ -427,7 +427,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 		BilletHotsendChangeShift billetHotsendChangeShiftVo = new BilletHotsendChangeShift();
 		billetHotsendChangeShiftVo.setShiftGroup(finalNextShiftGroupVal);
 		billetHotsendChangeShiftVo.setShift(finalNextShiftVal);
-		JSONObject jsonObject = billetHotsendChangeShiftService.autoChangeShiftHandle(billetHotsendChangeShiftVo);
+		JSONObject jsonObject = billetHotsendChangeShiftService.autoChangeShiftHandle(billetHotsendChangeShiftVo, sixShiftGroup, sixShift);
 		log.info("自动化{}交班成功!{} 结果值:{}", shiftName, DateUtils.date2Str(new Date(), DateUtils.datetimeFormat.get()), jsonObject);
 	}
 

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

@@ -14,5 +14,5 @@ public interface IBilletHotsendChangeShiftService extends IService<BilletHotsend
 
     JSONObject billetHotsendChangeShiftHandle(BilletHotsendChangeShift billetHotsendChangeShiftVo);
 
-    JSONObject autoChangeShiftHandle(BilletHotsendChangeShift billetHotsendChangeShiftVo);
+    JSONObject autoChangeShiftHandle(BilletHotsendChangeShift billetHotsendChangeShiftVo, String sixShiftGroup, String sixShift);
 }

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

@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
 import org.jeecg.modules.actualControl.billetActual.billetActual.service.IBilletBasicInfoService;
@@ -13,6 +15,8 @@ import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendCha
 import org.jeecg.modules.billet.billetHotsendChangeShift.mapper.BilletHotsendChangeShiftMapper;
 import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
+import org.jeecg.modules.billet.shiftConfiguration.entity.ShiftConfiguration;
+import org.jeecg.modules.billet.shiftConfiguration.service.IShiftConfigurationService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
@@ -40,6 +44,8 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
     @Autowired
     private IOperateLogService operateLogService;
 
+    @Autowired
+    private IShiftConfigurationService shiftConfigurationService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -153,7 +159,7 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public JSONObject autoChangeShiftHandle(BilletHotsendChangeShift billetHotsendChangeShiftVo) {
+    public JSONObject autoChangeShiftHandle(BilletHotsendChangeShift billetHotsendChangeShiftVo, String currentSixShiftGroup, String currentSixShift) {
         JSONObject result = new JSONObject();
         // 缓存交班索引ID
         String nextshiftIdKey = String.format("class:nextshift:Id:%s", "6");
@@ -246,6 +252,33 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
                 billetHotsendChangeShift1.setCounts(0);
                 billetHotsendChangeShift1.setBlankOutputs(0d);
                 baseMapper.insert(billetHotsendChangeShift1);
+                /**
+                 * 6号机根据 铸机号、当班班组、当班班别 查询储运配置信息,倒序取最新的一条,把查询到的牌号、定尺、目的地、新/旧站台
+                 * 带到下一个班组中,生成一个新的储运配置信息,并保存到数据库中。
+                 */
+                LambdaQueryWrapper<ShiftConfiguration> queryWrapper = new LambdaQueryWrapper<ShiftConfiguration>();
+                queryWrapper.eq(ShiftConfiguration::getCcmNo, "6")
+                        .eq(ShiftConfiguration::getShiftGroup, currentSixShiftGroup)
+                        .eq(ShiftConfiguration::getShift, currentSixShift)
+                        .orderByDesc(ShiftConfiguration::getCreateTime)
+                        .last("limit 1");
+                ShiftConfiguration shiftConfiguration = shiftConfigurationService.getOne(queryWrapper);
+                if (shiftConfiguration != null){
+                    // 生出储运配置信息
+                    ShiftConfiguration newShiftConfiguration = new ShiftConfiguration();
+                    newShiftConfiguration.setId(String.valueOf(IdWorker.getId()));
+                    newShiftConfiguration.setCcmNo(ccmNo);
+                    newShiftConfiguration.setShiftGroup(billetHotsendChangeShiftVo.getShiftGroup());
+                    newShiftConfiguration.setShift(billetHotsendChangeShiftVo.getShift());
+                    newShiftConfiguration.setSteelGrade(shiftConfiguration.getSteelGrade());
+                    newShiftConfiguration.setSpec(shiftConfiguration.getSpec());
+                    newShiftConfiguration.setDestination(shiftConfiguration.getDestination());
+                    newShiftConfiguration.setNewOldPlatform(shiftConfiguration.getNewOldPlatform());
+                    newShiftConfiguration.setCreateTime(new Date());
+                    newShiftConfiguration.setDate(DateUtils.getDateWithOnlyYearMonthDay(new Date()));
+                    shiftConfigurationService.save(newShiftConfiguration);
+                    log.info("{}{}", "6号机生成储运配置:", JSON.toJSON(newShiftConfiguration));
+                }
                 result.put("success", "自动化交班操作成功!");
             } catch (Exception e) {
                 log.error("自动化交班操作出现异常", e);
@@ -263,7 +296,6 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
         }
         return result;
     }
-
     /**
      * 计算余数并提取相应元素
      * @param billetBasicInfoList

+ 4 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/entity/StorageBill.java

@@ -180,4 +180,8 @@ public class StorageBill implements Serializable {
     @Excel(name = "牌号", width = 15)
     @ApiModelProperty(value = "牌号")
     private String brandNum;
+
+    @Excel(name = "新站台or旧站台", width = 15)
+    @ApiModelProperty(value = "新站台or旧站台(0 新站台 1 旧站台)")
+    private Integer newOldPlatform;
 }