소스 검색

新增返回换炉消息接口

lingpeng.li 3 주 전
부모
커밋
f4914cd717

+ 12 - 4
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/controller/BilletHotsendBaseController.java

@@ -72,6 +72,7 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
 
     @Autowired
     public RedisTemplate redisTemplate;
+
     /**
      * 分页列表查询
      *
@@ -142,7 +143,7 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
         if (storageBill == null) {
             return Result.error("未查询到该装运单信息,操作失败!");
         }
-        if (storageBill.getTypeConfigId().equals("1024") || oConvertUtils.isEmpty(storageBill.getTypeConfigId())){
+        if (storageBill.getTypeConfigId().equals("1024") || oConvertUtils.isEmpty(storageBill.getTypeConfigId())) {
             return Result.error("未选择目的地,热装操作失败!");
         }
         billetHotsendDetailsVo.setStorageBill(storageBill);
@@ -155,7 +156,7 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
         billetHotsendDetailsVo.setBilletHotsendTypeConfigId(billetHotsendTypeConfig.getId());
 
         String classShiftGroup = String.format("class:shift:group:%s", hotChargeVo.getCcmNo()); // 班组
-        String classShift = String.format("class:shift:%s",hotChargeVo.getCcmNo()); // 班别
+        String classShift = String.format("class:shift:%s", hotChargeVo.getCcmNo()); // 班别
         String shift = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)) : "";
         String shiftGroup = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)) : "";
 
@@ -178,7 +179,7 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
                 .isNotNull(BilletBasicInfo::getAssemblyNumber)
                 .orderByAsc(BilletBasicInfo::getCreateTime);
         List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper2);
-        if (oConvertUtils.listIsEmpty(billetBasicInfoList)){
+        if (oConvertUtils.listIsEmpty(billetBasicInfoList)) {
             log.info("{}{}", "钢坯实绩不存在,热装操作失败!", JSON.toJSON(hotChargeVo));
             return Result.error("钢坯实绩不存在,热装操作失败!");
         }
@@ -219,7 +220,7 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
 
         billetHotsendDetailsVo.setRollClubCommonList(rollClubCommonList);
 
-        log.info(">>>>>>>>>>>>B端操作工-热装参数集:"+ JSON.toJSON(billetHotsendDetailsVo));
+        log.info(">>>>>>>>>>>>B端操作工-热装参数集:" + JSON.toJSON(billetHotsendDetailsVo));
 
         JSONObject jsonObject = billetHotsendBaseService.saveBilletHotsendDetails(billetHotsendDetailsVo);
         if (jsonObject.containsKey("fail")) {
@@ -503,4 +504,11 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
 
     }
 
+    @ApiOperation(value = "返回换炉消息", notes = "返回换炉消息")
+    @PostMapping(value = "/returnFurnaceChange")
+    public Result<?> returnFurnaceChange(@RequestBody FurnaceChangeData data) {
+        FurnaceChangeData furnaceChangeData = billetHotsendBaseService.buildFurnaceChangeData(data);
+        return Result.OK("返回换炉消息成功!",furnaceChangeData);
+    }
+
 }

+ 16 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/entity/FurnaceChangeData.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.billet.billetHotsend.entity;
+
+import lombok.Data;
+
+@Data
+public class FurnaceChangeData {
+
+    private String ccmNo;        // 铸机号
+    private String heatNo;       // 炉号
+    private String netWeight;    // 钢水毛重
+    private String ladleNo;      // 钢包号
+    private String grade;        // 钢种
+    private String startPourTime;// 开浇时间
+    private String spec;         // 规格
+    private String sendTime;     // 发送时间
+}

+ 3 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/service/IBilletHotsendBaseService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletBasicInfoDetails;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsend;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsendDetailsVo;
+import org.jeecg.modules.billet.billetHotsend.entity.FurnaceChangeData;
 import org.jeecg.modules.billet.billetHotsendConfig.entity.BilletHotsendTypeConfig;
 import org.jeecg.modules.billet.storageBill.entity.StorageBill;
 
@@ -32,4 +33,6 @@ public interface IBilletHotsendBaseService extends IService<BilletHotsend> {
     StorageBill getStorageBillById(String storageId);
 
     BilletHotsendTypeConfig getBilletHotsendTypeConfigByCcmNoAndTypeConfigId(String typeConfigId);
+
+    FurnaceChangeData buildFurnaceChangeData(FurnaceChangeData data);
 }

+ 52 - 4
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/service/impl/BilletHotsendBaseServiceImpl.java

@@ -7,14 +7,14 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.exception.JeecgBootException;
 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;
-import org.jeecg.modules.billet.billetHotsend.entity.BilletBasicInfoDetails;
-import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsend;
-import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsendDetailsVo;
-import org.jeecg.modules.billet.billetHotsend.entity.RollClubCommon;
+import org.jeecg.modules.actualControl.heatsActuals.entity.HeatsActuals;
+import org.jeecg.modules.actualControl.heatsActuals.service.IHeatsActualsService;
+import org.jeecg.modules.billet.billetHotsend.entity.*;
 import org.jeecg.modules.billet.billetHotsend.mapper.BilletHotsendBaseMapper;
 import org.jeecg.modules.billet.billetHotsend.service.IBilletHotsendBaseService;
 import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
@@ -62,6 +62,8 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.math.BigDecimal;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
@@ -75,6 +77,9 @@ import java.util.stream.Collectors;
 @Service
 @Slf4j
 public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseMapper, BilletHotsend> implements IBilletHotsendBaseService {
+
+	private static final DateTimeFormatter DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
 	@Autowired
 	private IOperateLogService operateLogService;
 	@Autowired
@@ -117,6 +122,8 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 	private IStackingDownLogService stackingDownLogService;
 	@Autowired
 	private IBilletLiftingBillService billetLiftingBillService;
+	@Autowired
+	private IHeatsActualsService heatsActualsService;
 
 	@Override
 	@Transactional
@@ -703,6 +710,39 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		return billetHotsendTypeConfigService.getById(typeConfigId);
 	}
 
+	@Override
+	public FurnaceChangeData buildFurnaceChangeData(FurnaceChangeData data) {
+		String heatNo = data.getHeatNo(); // 炉号
+		if (oConvertUtils.isEmpty(heatNo)) {
+			throw new JeecgBootException("换炉查询失败:炉号不能为空!");
+		}
+		LambdaQueryWrapper<HeatsActuals> queryWrapper = new LambdaQueryWrapper<>();
+		queryWrapper.eq(HeatsActuals::getHeatsCode, heatNo);
+		HeatsActuals one = heatsActualsService.getOne(queryWrapper, false);
+
+		FurnaceChangeData finalData = new FurnaceChangeData();
+
+		finalData.setHeatNo(heatNo);
+
+		if (one != null) {
+			finalData.setNetWeight(one.getMoltenSteelWeight() != null ? one.getMoltenSteelWeight().toString() : null);
+			finalData.setLadleNo(one.getLadleCode());
+			finalData.setGrade(one.getGrade());
+			finalData.setStartPourTime(formatDate(one.getStartPourTime()));
+			finalData.setSpec(one.getSpec());
+			finalData.setCcmNo(one.getCasterCode());
+		} else {
+			finalData.setNetWeight(data.getNetWeight());
+			finalData.setLadleNo(data.getLadleNo());
+			finalData.setGrade(data.getGrade());
+			finalData.setStartPourTime(data.getStartPourTime());
+			finalData.setSpec(data.getSpec());
+			finalData.setCcmNo(data.getCcmNo());
+		}
+
+		return finalData;
+	}
+
 	/**
 	 * 通过CcmNo查询结束根
 	 * @param ccmNo
@@ -753,6 +793,14 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 	}
 
 
+	private String formatDate(Date date) {
+		return date != null ? date.toInstant()
+				.atZone(ZoneId.systemDefault())
+				.toLocalDateTime()
+				.format(DATETIME_FORMATTER) : null;
+	}
+
+
 	/**
 	 * 根据铸机号、班次、班别查询当天交班记录,并根据提供的日志列表更新相应的热送总支数
 	 *