|
@@ -3,6 +3,7 @@ package org.jeecg.modules.billet.billetHotsend.controller;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
|
|
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -21,14 +22,15 @@ 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.dto.BilletHotsendExportDTO;
|
|
|
-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.RealtimeStats;
|
|
|
+import org.jeecg.modules.billet.billetHotsend.entity.*;
|
|
|
import org.jeecg.modules.billet.billetHotsend.service.IBilletHotsendBaseService;
|
|
|
+import org.jeecg.modules.billet.billetHotsendConfig.entity.BilletHotsendTypeConfig;
|
|
|
import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
|
|
|
+import org.jeecg.modules.billet.storageBill.entity.StorageBill;
|
|
|
import org.jeecg.modules.carUnit.service.ISysDictService;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
@@ -41,9 +43,7 @@ import java.nio.charset.StandardCharsets;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -70,6 +70,8 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
|
|
|
@Autowired
|
|
|
private ISysDictService sysDictService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ public RedisTemplate redisTemplate;
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -125,6 +127,107 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
|
|
|
return Result.OK((String) jsonObject.get("success"));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "操作工钢坯热装-添加")
|
|
|
+ @ApiOperation(value = "操作工钢坯热装-添加", notes = "操作工钢坯热装-添加")
|
|
|
+ @PostMapping(value = "/addHotCharge")
|
|
|
+ public Result<?> addHotCharge(@RequestBody HotChargeVo hotChargeVo) {
|
|
|
+ BilletHotsendDetailsVo billetHotsendDetailsVo = new BilletHotsendDetailsVo();
|
|
|
+ // 根据hotChargeVo中的装运单ID,查询装运单信息
|
|
|
+ StorageBill storageBill = billetHotsendBaseService.getStorageBillById(hotChargeVo.getStorageId());
|
|
|
+ if (storageBill == null) {
|
|
|
+ return Result.error("未查询到该装运单信息,操作失败!");
|
|
|
+ }
|
|
|
+ if (storageBill.getTypeConfigId().equals("1024") || oConvertUtils.isEmpty(storageBill.getTypeConfigId())){
|
|
|
+ return Result.error("未选择目的地,热装操作失败!");
|
|
|
+ }
|
|
|
+ billetHotsendDetailsVo.setStorageBill(storageBill);
|
|
|
+
|
|
|
+ // 根据hotChargeVo中的铸机号、storageBill.getTypeConfigId()查询钢坯配置类型信息
|
|
|
+ BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendBaseService.getBilletHotsendTypeConfigByCcmNoAndTypeConfigId(storageBill.getTypeConfigId());
|
|
|
+
|
|
|
+ billetHotsendDetailsVo.setBelongTypeName(billetHotsendTypeConfig.getTypeName());
|
|
|
+ billetHotsendDetailsVo.setBelongTable(billetHotsendTypeConfig.getBelongTable());
|
|
|
+ billetHotsendDetailsVo.setBilletHotsendTypeConfigId(billetHotsendTypeConfig.getId());
|
|
|
+
|
|
|
+ String classShiftGroup = String.format("class:shift:group:%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)) : "";
|
|
|
+
|
|
|
+
|
|
|
+ BilletHotsend billetHotsend = new BilletHotsend();
|
|
|
+ billetHotsend.setCcmNo(hotChargeVo.getCcmNo());
|
|
|
+ billetHotsend.setHeatNo(hotChargeVo.getHeatNo());
|
|
|
+ billetHotsend.setShiftGroup(shiftGroup);
|
|
|
+ billetHotsend.setShift(shift);
|
|
|
+ billetHotsend.setIsUpd(false);
|
|
|
+ billetHotsendDetailsVo.setBilletHotsend(billetHotsend);
|
|
|
+
|
|
|
+
|
|
|
+ LambdaQueryWrapper<BilletBasicInfo> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper2.eq(BilletBasicInfo::getCcmNo, hotChargeVo.getCcmNo())
|
|
|
+ .eq(BilletBasicInfo::getHeatNo, hotChargeVo.getHeatNo())
|
|
|
+ .eq(BilletBasicInfo::getShift, shift)
|
|
|
+ .eq(BilletBasicInfo::getShiftGroup, shiftGroup)
|
|
|
+ .isNull(BilletBasicInfo::getBelongTable)
|
|
|
+ .isNotNull(BilletBasicInfo::getAssemblyNumber)
|
|
|
+ .orderByAsc(BilletBasicInfo::getCreateTime);
|
|
|
+ List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper2);
|
|
|
+ if (oConvertUtils.listIsEmpty(billetBasicInfoList)){
|
|
|
+ log.info("{}{}", "钢坯实绩不存在,热装操作失败!", JSON.toJSON(hotChargeVo));
|
|
|
+ return Result.error("钢坯实绩不存在,热装操作失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<RollClubCommon> rollClubCommonList = new ArrayList<>();
|
|
|
+
|
|
|
+ // 按assemblyNumber分组,并过滤出数量为4的组
|
|
|
+ Map<String, List<BilletBasicInfo>> groupByAssemblyNumber = billetBasicInfoList.stream()
|
|
|
+ .collect(Collectors.groupingBy(BilletBasicInfo::getAssemblyNumber))
|
|
|
+ .entrySet()
|
|
|
+ .stream()
|
|
|
+ .filter(entry -> entry.getValue().size() == 4)
|
|
|
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
|
+
|
|
|
+ // 获取第一个分组的第一条记录
|
|
|
+ Optional<BilletBasicInfo> firstBilletInfo = groupByAssemblyNumber.values().stream()
|
|
|
+ .filter(list -> !list.isEmpty())
|
|
|
+ .flatMap(List::stream)
|
|
|
+ .findFirst();
|
|
|
+
|
|
|
+ // 处理第一个分组的所有记录
|
|
|
+ firstBilletInfo.ifPresent(firstBillet -> {
|
|
|
+ String assemblyNumber = firstBillet.getAssemblyNumber();
|
|
|
+ // 从原始列表中筛选出相同assemblyNumber的所有记录
|
|
|
+ List<BilletBasicInfo> filteredBillets = billetBasicInfoList.stream()
|
|
|
+ .filter(billet -> assemblyNumber.equals(billet.getAssemblyNumber()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 将筛选出的记录转换为RollClubCommon
|
|
|
+ for (BilletBasicInfo billet : filteredBillets) {
|
|
|
+ RollClubCommon rollClubCommon = new RollClubCommon();
|
|
|
+ BeanUtils.copyProperties(billet, rollClubCommon);
|
|
|
+ rollClubCommon.setCcmNo(String.valueOf(billet.getCcmNo()));
|
|
|
+ rollClubCommon.setAssemblyNumber(assemblyNumber);
|
|
|
+ rollClubCommonList.add(rollClubCommon);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ billetHotsendDetailsVo.setRollClubCommonList(rollClubCommonList);
|
|
|
+
|
|
|
+ log.info(">>>>>>>>>>>>B端操作工-热装参数集:"+ JSON.toJSON(billetHotsendDetailsVo));
|
|
|
+
|
|
|
+ JSONObject jsonObject = billetHotsendBaseService.saveBilletHotsendDetails(billetHotsendDetailsVo);
|
|
|
+ if (jsonObject.containsKey("fail")) {
|
|
|
+ return Result.OK((String) jsonObject.get("fail"));
|
|
|
+ }
|
|
|
+ return Result.OK((String) jsonObject.get("success"));
|
|
|
+ }
|
|
|
+
|
|
|
@AutoLog(value = "新增钢坯热送基础信息")
|
|
|
@ApiOperation(value = "新增钢坯热送基础信息", notes = "新增钢坯热送基础信息")
|
|
|
@PostMapping(value = "/addBilletHotsendInfo")
|