|
@@ -1,6 +1,7 @@
|
|
|
package org.jeecg.modules.billet.stackingAndLoadingVehicles.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
@@ -10,9 +11,8 @@ 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.actualControl.heatsActuals.entity.HeatsActuals;
|
|
|
-import org.jeecg.modules.actualControl.heatsActuals.service.IHeatsActualsService;
|
|
|
import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsend;
|
|
|
+import org.jeecg.modules.billet.billetHotsend.entity.RollClubCommon;
|
|
|
import org.jeecg.modules.billet.billetHotsend.entity.RulerDefaultConfig;
|
|
|
import org.jeecg.modules.billet.billetHotsend.service.IBilletHotsendBaseService;
|
|
|
import org.jeecg.modules.billet.billetHotsend.service.IRulerDefaultConfigService;
|
|
@@ -46,8 +46,10 @@ import org.jeecg.modules.billet.storageCarLog.entity.StorageCarLog;
|
|
|
import org.jeecg.modules.billet.storageCarLog.service.IStorageCarLogService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
@@ -87,8 +89,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
@Autowired
|
|
|
private StackingAndLoadingVehiclesMapper stackingAndLoadingVehiclesMapper;
|
|
|
@Autowired
|
|
|
- private IHeatsActualsService heatsActualsService;
|
|
|
- @Autowired
|
|
|
private IRollOutShippDetailsService rollOutShippDetailsService;
|
|
|
@Autowired
|
|
|
private IRollClubThreeDetailsService rollClubThreeDetailsService;
|
|
@@ -98,6 +98,9 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
private IBilletHotsendChangeShiftService billetHotsendChangeShiftService;
|
|
|
@Autowired
|
|
|
private IBilletHotsendAbandonsService billetHotsendAbandonsService;
|
|
|
+ @Autowired
|
|
|
+ public RedisTemplate redisTemplate;
|
|
|
+
|
|
|
@Override
|
|
|
public List<List<StackingAndLoadingVehicles>> getListBySatck(String typeConfigId) {
|
|
|
LambdaQueryWrapper<StackingAndLoadingVehicles> wrapper = new LambdaQueryWrapper<>();
|
|
@@ -475,120 +478,14 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void loadingHandle(LoadingParams loadingParams) {
|
|
|
+ public JSONObject loadingHandle(LoadingParams loadingParams) {
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
// 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
+
|
|
|
+ BilletHotsend billetHotsend = loadingParams.getBilletHotsend();
|
|
|
+
|
|
|
List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = loadingParams.getStackingAndLoadingVehiclesList();
|
|
|
- BilletHotsend billetHotsend = new BilletHotsend();
|
|
|
- BeanUtils.copyProperties(loadingParams.getBilletHotsend(), billetHotsend);
|
|
|
- String cacheShint = loadingParams.getBilletHotsend().getShift();
|
|
|
- String cacheShintGroup = loadingParams.getBilletHotsend().getShiftGroup();
|
|
|
- //1 新保存 钢坯热送基础信息
|
|
|
- HeatsActuals heatsActuals = heatsActualsService.getOne(new LambdaQueryWrapper<HeatsActuals>().eq(HeatsActuals::getCasterCode, billetHotsend.getCcmNo()).eq(HeatsActuals::getHeatsCode, billetHotsend.getHeatNo()));
|
|
|
- if (heatsActuals != null) {
|
|
|
- cacheShint = heatsActuals.getShift();
|
|
|
- cacheShintGroup = heatsActuals.getShiftGroup();
|
|
|
- }
|
|
|
- if (oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
|
|
|
- return;
|
|
|
- }
|
|
|
- // 根据铸机号、位置、层数、类型配置ID更新 初始化容器中的垛位信息
|
|
|
- stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
- LambdaUpdateWrapper<StackingAndLoadingVehicles> updateWrapper = new LambdaUpdateWrapper();
|
|
|
- updateWrapper.eq(StackingAndLoadingVehicles::getId, x.getId())
|
|
|
- .set(StackingAndLoadingVehicles::getBilletNos, null)
|
|
|
- .set(StackingAndLoadingVehicles::getSpec, null)
|
|
|
- .set(StackingAndLoadingVehicles::getSteel, null)
|
|
|
- .set(StackingAndLoadingVehicles::getSize, null)
|
|
|
- .set(StackingAndLoadingVehicles::getShift, null)
|
|
|
- .set(StackingAndLoadingVehicles::getHeatNo, null)
|
|
|
- .set(StackingAndLoadingVehicles::getCreateDate, null)
|
|
|
- .set(StackingAndLoadingVehicles::getShiftGroup, null);
|
|
|
- StackingAndLoadingVehicles stackingAndLoadingVehicles = new StackingAndLoadingVehicles();
|
|
|
- BeanUtils.copyProperties(x, stackingAndLoadingVehicles);
|
|
|
- stackingAndLoadingVehiclesMapper.update(stackingAndLoadingVehicles, updateWrapper);
|
|
|
- // 先根据垛位容器中的铸机号和炉号 查询钢坯热送基础信息
|
|
|
- LambdaQueryWrapper<BilletHotsend> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper1.eq(BilletHotsend::getCcmNo, x.getCcmNo())
|
|
|
- .eq(BilletHotsend::getHeatNo, x.getHeatNo());
|
|
|
- BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper1);
|
|
|
- idExistBh.setStackNum(idExistBh.getStackNum() - 4);
|
|
|
- if ("roll_club_two".equals(loadingParams.getDestinationTable())){
|
|
|
- idExistBh.setRollclubtwoNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubtwoNum()) ? idExistBh.getRollclubtwoNum() + 4 : 4);
|
|
|
- }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
|
- idExistBh.setRollclubthreeNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubthreeNum()) ? idExistBh.getRollclubthreeNum() + 4 : 4);
|
|
|
- }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
|
|
|
- idExistBh.setRolloutshippNum(oConvertUtils.isNotEmpty(idExistBh.getRolloutshippNum()) ? idExistBh.getRolloutshippNum() + 4 : 4);
|
|
|
- }
|
|
|
- billetHotsendBaseService.updateById(idExistBh);
|
|
|
- });
|
|
|
- String finalCacheShint1 = cacheShint;
|
|
|
- String finalCacheShintGroup1 = cacheShintGroup;
|
|
|
- // 3 保存 下垛日志 stacking_up_log
|
|
|
- List<StackingDownLog> stackingDownLogList = new ArrayList<>();
|
|
|
- List<RollClubTwoDetails> addRollClubTwoDetailsList = new ArrayList<>();
|
|
|
- List<RollClubThreeDetails> addRollClubThreeDetailsList = new ArrayList<>();
|
|
|
- List<RollOutShippDetails> addRollOutShippDetailsList = new ArrayList<>();
|
|
|
- stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
- StackingDownLog stackingDownLog = new StackingDownLog();
|
|
|
- BeanUtils.copyProperties(x, stackingDownLog);
|
|
|
- stackingDownLog.setId(String.valueOf(IdWorker.getId()));
|
|
|
- stackingDownLog.setBilletNo(x.getBilletNos());
|
|
|
- stackingDownLog.setStorageBillId(loadingParams.getStorageBill().getId());
|
|
|
- stackingDownLog.setStackStorey(x.getLayer());// 堆垛层号(1-20)
|
|
|
- stackingDownLog.setStackNum(x.getAddress());// 堆垛编号(1-9)
|
|
|
- stackingDownLog.setStackAddr(billetHotsendTypeConfig.getTypeName());
|
|
|
- stackingDownLog.setShift(finalCacheShint1);
|
|
|
- stackingDownLog.setShiftGroup(finalCacheShintGroup1);
|
|
|
-// stackingUpLog.setFromStackingId(stackingAndLoadingVehicles.getId());
|
|
|
- stackingDownLogList.add(stackingDownLog);
|
|
|
- if ("roll_club_two".equals(loadingParams.getDestinationTable())){
|
|
|
- RollClubTwoDetails rollClubTwoDetails = new RollClubTwoDetails();
|
|
|
- BeanUtils.copyProperties(x, rollClubTwoDetails);
|
|
|
- rollClubTwoDetails.setBilletNo(x.getBilletNos());
|
|
|
- rollClubTwoDetails.setStorageBillId(loadingParams.getStorageBill().getId());
|
|
|
- rollClubTwoDetails.setStackStorey(x.getLayer());
|
|
|
- rollClubTwoDetails.setStackNum(x.getAddress());
|
|
|
- rollClubTwoDetails.setLicensePlate(loadingParams.getStorageBill().getLicensePlate());
|
|
|
- rollClubTwoDetails.setCreateTime(new Date());
|
|
|
- rollClubTwoDetails.setUpdateTime(new Date());
|
|
|
- rollClubTwoDetails.setId(String.valueOf(IdWorker.getId()));
|
|
|
- addRollClubTwoDetailsList.add(rollClubTwoDetails);
|
|
|
- }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
|
- RollClubThreeDetails rollClubThreeDetails = new RollClubThreeDetails();
|
|
|
- BeanUtils.copyProperties(x, rollClubThreeDetails);
|
|
|
- rollClubThreeDetails.setBilletNo(x.getBilletNos());
|
|
|
- rollClubThreeDetails.setStorageBillId(loadingParams.getStorageBill().getId());
|
|
|
- rollClubThreeDetails.setStackStorey(x.getLayer());
|
|
|
- rollClubThreeDetails.setStackNum(x.getAddress());
|
|
|
- rollClubThreeDetails.setLicensePlate(loadingParams.getStorageBill().getLicensePlate());
|
|
|
- rollClubThreeDetails.setCreateTime(new Date());
|
|
|
- rollClubThreeDetails.setUpdateTime(new Date());
|
|
|
- rollClubThreeDetails.setId(String.valueOf(IdWorker.getId()));
|
|
|
- addRollClubThreeDetailsList.add(rollClubThreeDetails);
|
|
|
- }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
|
|
|
- RollOutShippDetails rollOutShippDetails = new RollOutShippDetails();
|
|
|
- BeanUtils.copyProperties(x, rollOutShippDetails);
|
|
|
- rollOutShippDetails.setBilletNo(x.getBilletNos());
|
|
|
- rollOutShippDetails.setStorageBillId(loadingParams.getStorageBill().getId());
|
|
|
- rollOutShippDetails.setStackStorey(x.getLayer());
|
|
|
- rollOutShippDetails.setStackNum(x.getAddress());
|
|
|
- rollOutShippDetails.setLicensePlate(loadingParams.getStorageBill().getLicensePlate());
|
|
|
- rollOutShippDetails.setId(String.valueOf(IdWorker.getId()));
|
|
|
- rollOutShippDetails.setCreateTime(new Date());
|
|
|
- rollOutShippDetails.setUpdateTime(new Date());
|
|
|
- addRollOutShippDetailsList.add(rollOutShippDetails);
|
|
|
- }
|
|
|
- });
|
|
|
- stackingDownLogService.saveBatch(stackingDownLogList);
|
|
|
- // 根据所去的目的地 保存到对应的明细表
|
|
|
- if ("roll_club_two".equals(loadingParams.getDestinationTable())){
|
|
|
- rollClubTwoDetailsService.saveBatch(addRollClubTwoDetailsList);
|
|
|
- }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
|
- rollClubThreeDetailsService.saveBatch(addRollClubThreeDetailsList);
|
|
|
- }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
|
|
|
- rollOutShippDetailsService.saveBatch(addRollOutShippDetailsList);
|
|
|
- }
|
|
|
// 获取所有的坯号集合
|
|
|
List<String> billetNosList = stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getBilletNos)
|
|
|
.flatMap(billetNos -> {
|
|
@@ -598,45 +495,84 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
return java.util.stream.Stream.empty();
|
|
|
}
|
|
|
}).collect(Collectors.toList());
|
|
|
-
|
|
|
- //5 查询并批量更新钢坯基础信息 belongTable
|
|
|
LambdaQueryWrapper<BilletBasicInfo> queryWrapperBB = new LambdaQueryWrapper<BilletBasicInfo>()
|
|
|
.eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
|
|
|
.in(BilletBasicInfo::getBilletNo, billetNosList);
|
|
|
List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperBB);
|
|
|
+ List<RollClubCommon> rollClubCommonList= new ArrayList<>();
|
|
|
+ billetBasicInfoList.forEach(x ->{
|
|
|
+ RollClubCommon rollClubCommon = new RollClubCommon();
|
|
|
+ BeanUtils.copyProperties(x, rollClubCommon);
|
|
|
+ rollClubCommon.setCcmNo(x.getCcmNo().toString());
|
|
|
+ rollClubCommonList.add(rollClubCommon);
|
|
|
+ });
|
|
|
+
|
|
|
+ StorageBill storageBill =loadingParams.getStorageBill();
|
|
|
+
|
|
|
+ handleStackDepartCommon(billetHotsend, stackingAndLoadingVehiclesList, loadingParams, billetHotsendTypeConfig, storageBill);
|
|
|
+
|
|
|
+ // 先根据垛位容器中的铸机号和炉号 查询钢坯热送基础信息
|
|
|
+ Map<String, List<RollClubCommon>> rollClubCommonListttt = groupByShiftAttributes(rollClubCommonList);
|
|
|
+ for (Map.Entry<String, List<RollClubCommon>> entry : rollClubCommonListttt.entrySet()) {
|
|
|
+ String[] parts = entry.getKey().split(",");
|
|
|
+ billetHotsend.setHeatNo(parts[0]);// 炉号
|
|
|
+ billetHotsend.setShiftGroup(parts[1]);// 班组
|
|
|
+ billetHotsend.setShift(parts[2]);// 班别
|
|
|
+ List<RollClubCommon> groupRollClubCommonList = entry.getValue();
|
|
|
+ LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
+ .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
|
+ .eq(BilletHotsend::getShift, billetHotsend.getShift())
|
|
|
+ .eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());
|
|
|
+ BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper);
|
|
|
+ if (oConvertUtils.isEmpty(idExistBh)){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ result.put("fail", "钢坯热送单为空,垛位装车保存失败");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ billetHotsend.setId(idExistBh.getId());
|
|
|
+ billetHotsend.setStackNum(idExistBh.getStackNum() - groupRollClubCommonList.size());
|
|
|
+ // 钢坯热送基础信息存在,但是钢坯信息不存在 直接返回
|
|
|
+ if ("roll_club_two".equals(loadingParams.getDestinationTable())){
|
|
|
+ billetHotsend.setRollclubtwoNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubtwoNum()) ? idExistBh.getRollclubtwoNum() + groupRollClubCommonList.size() : groupRollClubCommonList.size());
|
|
|
+ }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
|
+ billetHotsend.setRollclubthreeNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubthreeNum()) ? idExistBh.getRollclubthreeNum() + groupRollClubCommonList.size() : groupRollClubCommonList.size());
|
|
|
+ }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
|
|
|
+ billetHotsend.setRolloutshippNum(oConvertUtils.isNotEmpty(idExistBh.getRolloutshippNum()) ? idExistBh.getRolloutshippNum() + groupRollClubCommonList.size() : groupRollClubCommonList.size());
|
|
|
+ }
|
|
|
+ billetHotsend.setUpdateTime(new Date());
|
|
|
+ billetHotsendBaseService.updateById(billetHotsend);
|
|
|
+ }
|
|
|
+
|
|
|
+ //5 查询并批量更新钢坯基础信息 belongTable
|
|
|
billetBasicInfoList.forEach(x ->{
|
|
|
x.setBelongTable(loadingParams.getDestinationTable());
|
|
|
x.setBhtcId(loadingParams.getDestinationId());
|
|
|
x.setUpdateTime(new Date());
|
|
|
});
|
|
|
billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
|
|
|
- StorageBill storageBill = loadingParams.getStorageBill();
|
|
|
- storageBill.setAmountTotal(stackingAndLoadingVehiclesList.size() * 4);
|
|
|
+ storageBill.setAmountTotal((oConvertUtils.isNotEmpty(storageBill.getAmountTotal()) ? storageBill.getAmountTotal() : 0) + stackingAndLoadingVehiclesList.size() * 4);
|
|
|
storageBill.setDestination(loadingParams.getDestination());
|
|
|
storageBill.setTypeConfigId(loadingParams.getDestinationId());
|
|
|
storageBillService.updateById(storageBill);
|
|
|
+ result.put("success", "堆垛保存操作成功");
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public void stackDepartHandle(LoadingParams loadingParams) {
|
|
|
- // 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
- BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
- List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = loadingParams.getStackingAndLoadingVehiclesList();
|
|
|
- BilletHotsend billetHotsend = new BilletHotsend();
|
|
|
- BeanUtils.copyProperties(loadingParams.getBilletHotsend(), billetHotsend);
|
|
|
- String cacheShint = loadingParams.getBilletHotsend().getShift();
|
|
|
- String cacheShintGroup = loadingParams.getBilletHotsend().getShiftGroup();
|
|
|
- //1 新保存 钢坯热送基础信息
|
|
|
- HeatsActuals heatsActuals = heatsActualsService.getOne(new LambdaQueryWrapper<HeatsActuals>().eq(HeatsActuals::getCasterCode, billetHotsend.getCcmNo()).eq(HeatsActuals::getHeatsCode, billetHotsend.getHeatNo()));
|
|
|
- if (heatsActuals != null) {
|
|
|
- cacheShint = heatsActuals.getShift();
|
|
|
- cacheShintGroup = heatsActuals.getShiftGroup();
|
|
|
- }
|
|
|
- if (oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
|
|
|
- return;
|
|
|
- }
|
|
|
- // 2 发车后,动态更新容器中的垛位信息 初始化
|
|
|
+ /**
|
|
|
+ * 堆垛保存、堆垛发车公共处理
|
|
|
+ * @param billetHotsend
|
|
|
+ * @param stackingAndLoadingVehiclesList
|
|
|
+ * @param loadingParams
|
|
|
+ * @param billetHotsendTypeConfig
|
|
|
+ * @param storageBill
|
|
|
+ */
|
|
|
+ private void handleStackDepartCommon(BilletHotsend billetHotsend, List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList, LoadingParams loadingParams, BilletHotsendTypeConfig billetHotsendTypeConfig, StorageBill storageBill){
|
|
|
+ String keyShiftGroup = String.format("class:shift:group:%s", billetHotsend.getCcmNo());
|
|
|
+ String keyShift = String.format("class:shift:%s", billetHotsend.getCcmNo());
|
|
|
+ String finalCacheShintGroup = redisTemplate.opsForValue().get(keyShiftGroup).toString();
|
|
|
+ String finalCacheShint = redisTemplate.opsForValue().get(keyShift).toString();
|
|
|
+ // 根据铸机号、位置、层数、类型配置ID更新 初始化容器中的垛位信息
|
|
|
stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
LambdaUpdateWrapper<StackingAndLoadingVehicles> updateWrapper = new LambdaUpdateWrapper();
|
|
|
updateWrapper.eq(StackingAndLoadingVehicles::getId, x.getId())
|
|
@@ -651,25 +587,8 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
StackingAndLoadingVehicles stackingAndLoadingVehicles = new StackingAndLoadingVehicles();
|
|
|
BeanUtils.copyProperties(x, stackingAndLoadingVehicles);
|
|
|
stackingAndLoadingVehiclesMapper.update(stackingAndLoadingVehicles, updateWrapper);
|
|
|
- // 先根据垛位容器中的铸机号和炉号 查询钢坯热送基础信息
|
|
|
- LambdaQueryWrapper<BilletHotsend> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper1.eq(BilletHotsend::getCcmNo, x.getCcmNo())
|
|
|
- .eq(BilletHotsend::getHeatNo, x.getHeatNo());
|
|
|
- BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper1);
|
|
|
- idExistBh.setStackNum(idExistBh.getStackNum() - 4);
|
|
|
- if ("roll_club_two".equals(loadingParams.getDestinationTable())){
|
|
|
- idExistBh.setRollclubtwoNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubtwoNum()) ? idExistBh.getRollclubtwoNum() + 4 : 4);
|
|
|
- }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
|
- idExistBh.setRollclubthreeNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubthreeNum()) ? idExistBh.getRollclubthreeNum() + 4 : 4);
|
|
|
- }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
|
|
|
- idExistBh.setRolloutshippNum(oConvertUtils.isNotEmpty(idExistBh.getRolloutshippNum()) ? idExistBh.getRolloutshippNum() + 4 : 4);
|
|
|
- }
|
|
|
- billetHotsendBaseService.updateById(idExistBh);
|
|
|
});
|
|
|
- StorageBill storageBill = loadingParams.getStorageBill();
|
|
|
- // 4 保存 下垛日志 stacking_down_log
|
|
|
- String finalCacheShint1 = cacheShint;
|
|
|
- String finalCacheShintGroup1 = cacheShintGroup;
|
|
|
+ // 3 保存 下垛日志 stacking_up_log
|
|
|
List<StackingDownLog> stackingDownLogList = new ArrayList<>();
|
|
|
List<RollClubTwoDetails> addRollClubTwoDetailsList = new ArrayList<>();
|
|
|
List<RollClubThreeDetails> addRollClubThreeDetailsList = new ArrayList<>();
|
|
@@ -678,30 +597,46 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
StackingDownLog stackingDownLog = new StackingDownLog();
|
|
|
BeanUtils.copyProperties(x, stackingDownLog);
|
|
|
stackingDownLog.setId(String.valueOf(IdWorker.getId()));
|
|
|
+ // 根据坯号查询 对应的钢坯基础信息,获取到炉号
|
|
|
+ String[] parts = x.getBilletNos().split(",");
|
|
|
+ //4 获取所有的坯号集合
|
|
|
+ LambdaQueryWrapper<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(BilletBasicInfo::getBilletNo, Arrays.asList(parts));
|
|
|
+ List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper);
|
|
|
+ BilletBasicInfo billetBasicInfo = billetBasicInfoList.stream().findFirst().orElse(null);
|
|
|
+ List<String> heatNos = billetBasicInfoList.stream().map(BilletBasicInfo::getHeatNo).distinct().collect(Collectors.toList());
|
|
|
+ stackingDownLog.setHeatNo(String.join(",", heatNos));
|
|
|
stackingDownLog.setBilletNo(x.getBilletNos());
|
|
|
- stackingDownLog.setStorageBillId(loadingParams.getStorageBill().getId());// 装运单ID
|
|
|
- stackingDownLog.setStackStorey(x.getLayer());
|
|
|
- stackingDownLog.setStackNum(x.getAddress());
|
|
|
- stackingDownLog.setShift(finalCacheShint1);
|
|
|
- stackingDownLog.setShiftGroup(finalCacheShintGroup1);
|
|
|
- stackingDownLog.setCreateTime(new Date());
|
|
|
+ stackingDownLog.setStorageBillId(storageBill.getId());
|
|
|
+ stackingDownLog.setStackStorey(x.getLayer());// 堆垛层号(1-20)
|
|
|
+ stackingDownLog.setStackNum(x.getAddress());// 堆垛编号(1-9)
|
|
|
+ stackingDownLog.setStackAddr(billetHotsendTypeConfig.getTypeName());
|
|
|
+ stackingDownLog.setShift(finalCacheShint);
|
|
|
+ stackingDownLog.setShiftGroup(finalCacheShintGroup);
|
|
|
+// stackingUpLog.setFromStackingId(stackingAndLoadingVehicles.getId());
|
|
|
stackingDownLogList.add(stackingDownLog);
|
|
|
if ("roll_club_two".equals(loadingParams.getDestinationTable())){
|
|
|
RollClubTwoDetails rollClubTwoDetails = new RollClubTwoDetails();
|
|
|
BeanUtils.copyProperties(x, rollClubTwoDetails);
|
|
|
+ rollClubTwoDetails.setHeatNo(String.join(",", heatNos));
|
|
|
rollClubTwoDetails.setBilletNo(x.getBilletNos());
|
|
|
rollClubTwoDetails.setStorageBillId(storageBill.getId());
|
|
|
rollClubTwoDetails.setStackStorey(x.getLayer());
|
|
|
rollClubTwoDetails.setStackNum(x.getAddress());
|
|
|
+ rollClubTwoDetails.setShiftGroup(billetBasicInfo.getShiftGroup());
|
|
|
+ rollClubTwoDetails.setShift(billetBasicInfo.getShift());
|
|
|
rollClubTwoDetails.setLicensePlate(storageBill.getLicensePlate());
|
|
|
- rollClubTwoDetails.setId(String.valueOf(IdWorker.getId()));
|
|
|
rollClubTwoDetails.setCreateTime(new Date());
|
|
|
rollClubTwoDetails.setUpdateTime(new Date());
|
|
|
+ rollClubTwoDetails.setId(String.valueOf(IdWorker.getId()));
|
|
|
addRollClubTwoDetailsList.add(rollClubTwoDetails);
|
|
|
}else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
|
RollClubThreeDetails rollClubThreeDetails = new RollClubThreeDetails();
|
|
|
BeanUtils.copyProperties(x, rollClubThreeDetails);
|
|
|
+ rollClubThreeDetails.setHeatNo(String.join(",", heatNos));
|
|
|
rollClubThreeDetails.setBilletNo(x.getBilletNos());
|
|
|
+ rollClubThreeDetails.setShiftGroup(billetBasicInfo.getShiftGroup());
|
|
|
+ rollClubThreeDetails.setShift(billetBasicInfo.getShift());
|
|
|
rollClubThreeDetails.setStorageBillId(storageBill.getId());
|
|
|
rollClubThreeDetails.setStackStorey(x.getLayer());
|
|
|
rollClubThreeDetails.setStackNum(x.getAddress());
|
|
@@ -713,19 +648,22 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
}else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
|
|
|
RollOutShippDetails rollOutShippDetails = new RollOutShippDetails();
|
|
|
BeanUtils.copyProperties(x, rollOutShippDetails);
|
|
|
+ rollOutShippDetails.setHeatNo(String.join(",", heatNos));
|
|
|
rollOutShippDetails.setBilletNo(x.getBilletNos());
|
|
|
+ rollOutShippDetails.setShiftGroup(billetBasicInfo.getShiftGroup());
|
|
|
+ rollOutShippDetails.setShift(billetBasicInfo.getShift());
|
|
|
rollOutShippDetails.setStorageBillId(storageBill.getId());
|
|
|
rollOutShippDetails.setStackStorey(x.getLayer());
|
|
|
rollOutShippDetails.setStackNum(x.getAddress());
|
|
|
rollOutShippDetails.setLicensePlate(storageBill.getLicensePlate());
|
|
|
+ rollOutShippDetails.setId(String.valueOf(IdWorker.getId()));
|
|
|
rollOutShippDetails.setCreateTime(new Date());
|
|
|
rollOutShippDetails.setUpdateTime(new Date());
|
|
|
- rollOutShippDetails.setId(String.valueOf(IdWorker.getId()));
|
|
|
addRollOutShippDetailsList.add(rollOutShippDetails);
|
|
|
}
|
|
|
});
|
|
|
stackingDownLogService.saveBatch(stackingDownLogList);
|
|
|
- // 根据所去的目的地 保存装运明细到对应的明细表
|
|
|
+ // 根据所去的目的地 保存到对应的明细表
|
|
|
if ("roll_club_two".equals(loadingParams.getDestinationTable())){
|
|
|
rollClubTwoDetailsService.saveBatch(addRollClubTwoDetailsList);
|
|
|
}else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
@@ -733,6 +671,18 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
}else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
|
|
|
rollOutShippDetailsService.saveBatch(addRollOutShippDetailsList);
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public JSONObject stackDepartHandle(LoadingParams loadingParams) {
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ // 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
+ BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
+
|
|
|
+ BilletHotsend billetHotsend = loadingParams.getBilletHotsend();
|
|
|
+
|
|
|
+ List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = loadingParams.getStackingAndLoadingVehiclesList();
|
|
|
// 获取所有的坯号集合
|
|
|
List<String> billetNosList = stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getBilletNos)
|
|
|
.flatMap(billetNos -> {
|
|
@@ -742,11 +692,53 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
return java.util.stream.Stream.empty();
|
|
|
}
|
|
|
}).collect(Collectors.toList());
|
|
|
- //5 查询并批量更新钢坯基础信息 belongTable
|
|
|
LambdaQueryWrapper<BilletBasicInfo> queryWrapperBB = new LambdaQueryWrapper<BilletBasicInfo>()
|
|
|
.eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
|
|
|
.in(BilletBasicInfo::getBilletNo, billetNosList);
|
|
|
List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperBB);
|
|
|
+ List<RollClubCommon> rollClubCommonList= new ArrayList<>();
|
|
|
+ billetBasicInfoList.forEach(x ->{
|
|
|
+ RollClubCommon rollClubCommon = new RollClubCommon();
|
|
|
+ BeanUtils.copyProperties(x, rollClubCommon);
|
|
|
+ rollClubCommon.setCcmNo(x.getCcmNo().toString());
|
|
|
+ rollClubCommonList.add(rollClubCommon);
|
|
|
+ });
|
|
|
+
|
|
|
+ StorageBill storageBill =loadingParams.getStorageBill();
|
|
|
+
|
|
|
+ handleStackDepartCommon(billetHotsend, stackingAndLoadingVehiclesList, loadingParams, billetHotsendTypeConfig, storageBill);
|
|
|
+ Map<String, List<RollClubCommon>> rollClubCommonListttt = groupByShiftAttributes(rollClubCommonList);
|
|
|
+ for (Map.Entry<String, List<RollClubCommon>> entry : rollClubCommonListttt.entrySet()) {
|
|
|
+ String[] parts = entry.getKey().split(",");
|
|
|
+ billetHotsend.setHeatNo(parts[0]);// 炉号
|
|
|
+ billetHotsend.setShiftGroup(parts[1]);// 班组
|
|
|
+ billetHotsend.setShift(parts[2]);// 班别
|
|
|
+ List<RollClubCommon> groupRollClubCommonList = entry.getValue();
|
|
|
+ LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
+ .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
|
+ .eq(BilletHotsend::getShift, billetHotsend.getShift())
|
|
|
+ .eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());
|
|
|
+ BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper);
|
|
|
+ if (oConvertUtils.isEmpty(idExistBh)){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ result.put("fail", "钢坯热送单为空,垛位发车失败");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ billetHotsend.setId(idExistBh.getId());
|
|
|
+ billetHotsend.setStackNum(idExistBh.getStackNum() - groupRollClubCommonList.size());
|
|
|
+ // 钢坯热送基础信息存在,但是钢坯信息不存在 直接返回
|
|
|
+ if ("roll_club_two".equals(loadingParams.getDestinationTable())){
|
|
|
+ billetHotsend.setRollclubtwoNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubtwoNum()) ? idExistBh.getRollclubtwoNum() + groupRollClubCommonList.size() : groupRollClubCommonList.size());
|
|
|
+ }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
|
+ billetHotsend.setRollclubthreeNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubthreeNum()) ? idExistBh.getRollclubthreeNum() + groupRollClubCommonList.size() : groupRollClubCommonList.size());
|
|
|
+ }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
|
|
|
+ billetHotsend.setRolloutshippNum(oConvertUtils.isNotEmpty(idExistBh.getRolloutshippNum()) ? idExistBh.getRolloutshippNum() + groupRollClubCommonList.size() : groupRollClubCommonList.size());
|
|
|
+ }
|
|
|
+ billetHotsend.setUpdateTime(new Date());
|
|
|
+ billetHotsendBaseService.updateById(billetHotsend);
|
|
|
+ }
|
|
|
+ //5 获取所有的坯号集合 查询并批量更新钢坯基础信息 belongTable
|
|
|
billetBasicInfoList.forEach(x ->{
|
|
|
x.setBelongTable(loadingParams.getDestinationTable());
|
|
|
x.setBhtcId(loadingParams.getDestinationId());
|
|
@@ -818,55 +810,23 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
storageCarLog.setAmount(dd);// 支数
|
|
|
storageCarLog.setDataTime(new Date());
|
|
|
storageCarLogService.save(storageCarLog);
|
|
|
+ result.put("success", "堆垛发车操作成功");
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public void addStackInfo(LoadingParams loadingParams) {
|
|
|
- // 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
- BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
- List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = loadingParams.getStackingAndLoadingVehiclesList();
|
|
|
- BilletHotsend billetHotsend = new BilletHotsend();
|
|
|
- BeanUtils.copyProperties(loadingParams.getBilletHotsend(), billetHotsend);
|
|
|
- String cacheShint = loadingParams.getBilletHotsend().getShift();
|
|
|
- String cacheShintGroup = loadingParams.getBilletHotsend().getShiftGroup();
|
|
|
- //1 新保存 钢坯热送基础信息
|
|
|
- HeatsActuals heatsActuals = heatsActualsService.getOne(new LambdaQueryWrapper<HeatsActuals>().eq(HeatsActuals::getCasterCode, billetHotsend.getCcmNo()).eq(HeatsActuals::getHeatsCode, billetHotsend.getHeatNo()));
|
|
|
- if (heatsActuals != null) {
|
|
|
- cacheShint = heatsActuals.getShift();
|
|
|
- cacheShintGroup = heatsActuals.getShiftGroup();
|
|
|
- }
|
|
|
- if (oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
|
|
|
- return;
|
|
|
- }
|
|
|
- LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
- .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
|
- .eq(BilletHotsend::getShift, cacheShint)
|
|
|
- .eq(BilletHotsend::getShiftGroup, cacheShintGroup);
|
|
|
- BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper);
|
|
|
- if (oConvertUtils.isNotEmpty(idExistBh)){
|
|
|
- // 钢坯热送基础信息存在,但是钢坯信息不存在 直接返回
|
|
|
- billetHotsend.setStackNum(idExistBh.getStackNum() + stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
|
|
|
- LambdaUpdateWrapper<BilletHotsend> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
- .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
|
- .eq(BilletHotsend::getShift, cacheShint)
|
|
|
- .eq(BilletHotsend::getShiftGroup, cacheShintGroup)
|
|
|
- .set(BilletHotsend::getStackNum, billetHotsend.getStackNum())
|
|
|
- .set(BilletHotsend::getShift, cacheShint)
|
|
|
- .set(BilletHotsend::getShiftGroup, cacheShintGroup);
|
|
|
- billetHotsendBaseService.update(billetHotsend, updateWrapper);
|
|
|
- } else {
|
|
|
- // 钢坯热送基础信息不存在,但是钢坯信息不存在 保存钢坯热送基础信息
|
|
|
- billetHotsend.setStackNum(stackingAndLoadingVehiclesList.size() * 4);
|
|
|
- billetHotsend.setShiftGroup(cacheShintGroup);
|
|
|
- billetHotsend.setShift(cacheShint);
|
|
|
- billetHotsendBaseService.save(billetHotsend);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 堆垛保存 公共方法
|
|
|
+ * @param billetHotsend
|
|
|
+ * @param stackingAndLoadingVehiclesList
|
|
|
+ * @param loadingParams
|
|
|
+ * @param billetHotsendTypeConfig
|
|
|
+ */
|
|
|
+ private void handleAddStackInfo(BilletHotsend billetHotsend, List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList, LoadingParams loadingParams, BilletHotsendTypeConfig billetHotsendTypeConfig){
|
|
|
+ String keyShiftGroup = String.format("class:shift:group:%s", billetHotsend.getCcmNo());
|
|
|
+ String keyShift = String.format("class:shift:%s", billetHotsend.getCcmNo());
|
|
|
+ String finalCacheShintGroup = redisTemplate.opsForValue().get(keyShiftGroup).toString();
|
|
|
+ String finalCacheShint = redisTemplate.opsForValue().get(keyShift).toString();
|
|
|
// 2 发车后,动态更新容器中的垛位信息 初始化
|
|
|
- String finalCacheShint1 = cacheShint;
|
|
|
- String finalCacheShintGroup1 = cacheShintGroup;
|
|
|
stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
LambdaUpdateWrapper<StackingAndLoadingVehicles> queryWrapperSA = new LambdaUpdateWrapper<>();
|
|
|
queryWrapperSA.eq(StackingAndLoadingVehicles::getCcmNo, x.getCcmNo())
|
|
@@ -875,12 +835,18 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
.eq(StackingAndLoadingVehicles::getTypeConfigId, loadingParams.getBilletHotsendTypeConfigId());
|
|
|
StackingAndLoadingVehicles stackingAndLoadingVehicles = createInitializedVehicle();
|
|
|
BeanUtils.copyProperties(x, stackingAndLoadingVehicles);
|
|
|
- stackingAndLoadingVehicles.setShift(finalCacheShint1);
|
|
|
- stackingAndLoadingVehicles.setShiftGroup(finalCacheShintGroup1);
|
|
|
+ // 根据坯号查询 对应的钢坯基础信息,获取到炉号
|
|
|
+ String[] parts = x.getBilletNos().split(",");
|
|
|
+ //4 获取所有的坯号集合
|
|
|
+ LambdaQueryWrapper<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(BilletBasicInfo::getBilletNo, Arrays.asList(parts));
|
|
|
+ List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper);
|
|
|
+ BilletBasicInfo billetBasicInfo = billetBasicInfoList.stream().findFirst().orElse(null);
|
|
|
+ stackingAndLoadingVehicles.setShift(billetBasicInfo.getShift());
|
|
|
+ stackingAndLoadingVehicles.setShiftGroup(billetBasicInfo.getShiftGroup());
|
|
|
stackingAndLoadingVehicles.setCreateDate(new Date());
|
|
|
baseMapper.update(stackingAndLoadingVehicles, queryWrapperSA);
|
|
|
});
|
|
|
-
|
|
|
// 3 保存 起垛日志 stacking_up_log
|
|
|
List<StackingUpLog> stackingUpLogList = new ArrayList<>();
|
|
|
stackingAndLoadingVehiclesList.forEach(x ->{
|
|
@@ -888,17 +854,68 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
BeanUtils.copyProperties(x, stackingUpLog);
|
|
|
stackingUpLog.setId(String.valueOf(IdWorker.getId()));
|
|
|
stackingUpLog.setBilletNo(x.getBilletNos());
|
|
|
+ // 根据坯号查询 对应的钢坯基础信息,获取到炉号
|
|
|
+ String[] parts = x.getBilletNos().split(",");
|
|
|
+ //4 获取所有的坯号集合
|
|
|
+ LambdaQueryWrapper<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(BilletBasicInfo::getBilletNo, Arrays.asList(parts));
|
|
|
+ List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper);
|
|
|
+ BilletBasicInfo billetBasicInfo = billetBasicInfoList.stream().findFirst().orElse(null);
|
|
|
stackingUpLog.setAmount(4); // 支数
|
|
|
stackingUpLog.setLayer(x.getLayer());// 堆垛层号(1-20)
|
|
|
stackingUpLog.setAddress(x.getAddress());// 堆垛编号(1-9)
|
|
|
- stackingUpLog.setShift(finalCacheShint1);
|
|
|
- stackingUpLog.setShiftGroup(finalCacheShintGroup1);
|
|
|
+ stackingUpLog.setShift(billetBasicInfo.getShift());
|
|
|
+ stackingUpLog.setShiftGroup(billetBasicInfo.getShiftGroup());
|
|
|
stackingUpLog.setStackAddr(billetHotsendTypeConfig.getTypeName());
|
|
|
stackingUpLogList.add(stackingUpLog);
|
|
|
});
|
|
|
stackingUpLogService.saveBatch(stackingUpLogList);
|
|
|
// 根据铸机号、班次、班别 查询当天交班记录 存在就更新当前起跺总支数
|
|
|
- updateShiftInfoByType(billetHotsend.getCcmNo(), cacheShint, cacheShintGroup, stackingUpLogList.size() * 4, "stackingUp");
|
|
|
+ updateShiftInfoByType(billetHotsend.getCcmNo(), finalCacheShint, finalCacheShintGroup, stackingUpLogList.size() * 4, "stackingUp");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public JSONObject addStackInfo(LoadingParams loadingParams) {
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = loadingParams.getStackingAndLoadingVehiclesList();
|
|
|
+ if (oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
|
|
|
+ result.put("fail", "堆垛信息为空,保存失败");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ // 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
+ BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
+
|
|
|
+ BilletHotsend billetHotsend = loadingParams.getBilletHotsend();
|
|
|
+
|
|
|
+ handleAddStackInfo(billetHotsend, stackingAndLoadingVehiclesList, loadingParams, billetHotsendTypeConfig);
|
|
|
+
|
|
|
+ List<RollClubCommon> rollClubCommonList= loadingParams.getRollClubCommonList();
|
|
|
+ Map<String, List<RollClubCommon>> rollClubCommonListttt = groupByShiftAttributes(rollClubCommonList);
|
|
|
+ for (Map.Entry<String, List<RollClubCommon>> entry : rollClubCommonListttt.entrySet()) {
|
|
|
+ String[] parts = entry.getKey().split(",");
|
|
|
+ billetHotsend.setHeatNo(parts[0]);// 炉号
|
|
|
+ billetHotsend.setShiftGroup(parts[1]);// 班组
|
|
|
+ billetHotsend.setShift(parts[2]);// 班别
|
|
|
+ List<RollClubCommon> groupRollClubCommonList = entry.getValue();
|
|
|
+ LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
+ .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
|
+ .eq(BilletHotsend::getShift, billetHotsend.getShift())
|
|
|
+ .eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());
|
|
|
+ BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper);
|
|
|
+ if (oConvertUtils.isEmpty(idExistBh)){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ result.put("fail", "钢坯热送单为空,新增堆垛保存失败");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ billetHotsend.setId(idExistBh.getId());
|
|
|
+ // 钢坯热送基础信息存在,但是钢坯信息不存在 直接返回
|
|
|
+ billetHotsend.setStackNum(idExistBh.getStackNum() + groupRollClubCommonList.size()); // 堆垛总支数
|
|
|
+ billetHotsend.setUpdateTime(new Date());
|
|
|
+ billetHotsendBaseService.updateById(billetHotsend);
|
|
|
+ }
|
|
|
+
|
|
|
//4 获取所有的坯号集合
|
|
|
List<String> billetNosList = stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getBilletNos)
|
|
|
.flatMap(billetNoss -> {
|
|
@@ -918,6 +935,8 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
x.setBhtcId(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
});
|
|
|
billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
|
|
|
+ result.put("success", "保存堆垛操作成功");
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -993,7 +1012,14 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
return "钢坯叛废成功!";
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 根据班组班别对钢坯信息进行分组
|
|
|
+ * @param rollClubCommonList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static Map<String, List<RollClubCommon>> groupByShiftAttributes(List<RollClubCommon> rollClubCommonList) {
|
|
|
+ return rollClubCommonList.stream().collect(Collectors.groupingBy(rollClubCommon -> rollClubCommon.getHeatNo() + "," + rollClubCommon.getShiftGroup() + "," + rollClubCommon.getShift()));
|
|
|
+ }
|
|
|
/**
|
|
|
* 初始化StackingAndLoadingVehicles对象
|
|
|
* @return
|