|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.billet.stackingAndLoadingVehicles.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
@@ -35,6 +36,7 @@ import org.jeecg.modules.billet.storageCarLog.service.IStorageCarLogService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
@@ -452,6 +454,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public void loadingHandle(LoadingParams loadingParams) {
|
|
|
// 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
|
|
@@ -476,8 +479,13 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
.eq(BilletHotsend::getShiftGroup, cacheShintGroup);
|
|
|
BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper);
|
|
|
if (oConvertUtils.isNotEmpty(idExistBh)){
|
|
|
+ if (idExistBh.getStackNum() < stackingAndLoadingVehiclesList.size() * 4){
|
|
|
+ billetHotsend.setStackNum(stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
|
|
|
+ log.info("{}{}", ">>>>>>>>>堆垛总支数计算出现异常:", JSON.toJSON(loadingParams));
|
|
|
+ }else {
|
|
|
+ billetHotsend.setStackNum(idExistBh.getStackNum() - stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
|
|
|
+ }
|
|
|
// 钢坯热送基础信息存在,但是钢坯信息不存在 直接返回
|
|
|
- billetHotsend.setStackNum(idExistBh.getStackNum() - stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
|
|
|
LambdaUpdateWrapper<BilletHotsend> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
.eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
@@ -549,15 +557,17 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
billetBasicInfoList.forEach(x ->{
|
|
|
x.setBelongTable("stacking_and_loading_vehicles");
|
|
|
x.setUpdateTime(new Date());
|
|
|
- x.setBhtcId(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
+ x.setBhtcId(loadingParams.getDestinationId());
|
|
|
});
|
|
|
billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
|
|
|
StorageBill storageBill = loadingParams.getStorageBill();
|
|
|
storageBill.setAmountTotal(stackingAndLoadingVehiclesList.size() * 4);
|
|
|
+ storageBill.setDestination(loadingParams.getDestination());
|
|
|
storageBillService.updateById(storageBill);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public void stackDepartHandle(LoadingParams loadingParams) {
|
|
|
// 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
|
|
@@ -582,8 +592,13 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
.eq(BilletHotsend::getShiftGroup, cacheShintGroup);
|
|
|
BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper);
|
|
|
if (oConvertUtils.isNotEmpty(idExistBh)){
|
|
|
+ if (idExistBh.getStackNum() < stackingAndLoadingVehiclesList.size() * 4){
|
|
|
+ billetHotsend.setStackNum(stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
|
|
|
+ log.info("{}{}", ">>>>>>>>>堆垛总支数计算出现异常:", JSON.toJSON(loadingParams));
|
|
|
+ }else {
|
|
|
+ billetHotsend.setStackNum(idExistBh.getStackNum() - stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
|
|
|
+ }
|
|
|
// 钢坯热送基础信息存在,但是钢坯信息不存在 直接返回
|
|
|
- billetHotsend.setStackNum(idExistBh.getStackNum() - stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
|
|
|
LambdaUpdateWrapper<BilletHotsend> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
.eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
@@ -647,32 +662,24 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
//5 查询并批量更新钢坯基础信息 belongTable
|
|
|
LambdaQueryWrapper<BilletBasicInfo> queryWrapperBB = new LambdaQueryWrapper<BilletBasicInfo>()
|
|
|
.eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
|
|
|
- .eq(BilletBasicInfo::getHeatNo, billetHotsend.getHeatNo())
|
|
|
.in(BilletBasicInfo::getBilletNo, billetNosList);
|
|
|
List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperBB);
|
|
|
billetBasicInfoList.forEach(x ->{
|
|
|
x.setBelongTable("stacking_and_loading_vehicles");
|
|
|
- x.setBhtcId(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
+ x.setBhtcId(loadingParams.getDestinationId());
|
|
|
});
|
|
|
billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
|
|
|
// 6 更新装运单 storage_bill 新增储运信息
|
|
|
StorageBill storageBill = loadingParams.getStorageBill();
|
|
|
- LambdaQueryWrapper<StorageBill> queryWrapperSB = new LambdaQueryWrapper<>();
|
|
|
- queryWrapperSB.eq(StorageBill::getCcmNo, storageBill.getCcmNo())
|
|
|
- .eq(StorageBill::getShift, finalCacheShint1)
|
|
|
- .eq(StorageBill::getShiftGroup, finalCacheShintGroup1)
|
|
|
- .eq(StorageBill::getLicensePlate, storageBill.getLicensePlate());
|
|
|
- List<StorageBill> storageBillList = storageBillService.list(queryWrapperSB);
|
|
|
- storageBill.setCarNum(oConvertUtils.listIsEmpty(storageBillList) ? 0 : storageBillList.size() + 1);// 本车车次
|
|
|
storageBill.setTypeConfigId(loadingParams.getBilletHotsendTypeConfigId()); // 钢坯配置类型ID
|
|
|
- storageBill.setDestination(loadingParams.getStorageBill().getDestination());// 目的地
|
|
|
+ storageBill.setDestination(loadingParams.getDestination());// 目的地
|
|
|
storageBill.setAmountTotal(storageBill.getAmountTotal() + stackingAndLoadingVehiclesList.size() * 4);
|
|
|
storageBill.setOutTime(new Date());
|
|
|
storageBillService.updateById(storageBill);
|
|
|
// 7 发车后,新增钢坯堆垛储运信息,生成储运单 storage_car_log
|
|
|
StorageCarLog storageCarLog = new StorageCarLog();
|
|
|
BeanUtils.copyProperties(storageBill, storageCarLog);
|
|
|
- storageCarLog.setDestination(billetHotsendTypeConfig.getTypeName());// 目的地
|
|
|
+ storageCarLog.setDestination(loadingParams.getDestination());// 目的地
|
|
|
storageCarLog.setCarNm(storageBill.getLicensePlate());// 车牌号
|
|
|
storageCarLog.setTypeConfigId(billetHotsendTypeConfig.getId()); // 钢坯配置类型ID
|
|
|
storageCarLog.setHeatNo(billetHotsend.getHeatNo());
|
|
@@ -690,6 +697,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public void addStackInfo(LoadingParams loadingParams) {
|
|
|
// 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
|
|
@@ -778,7 +786,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
//5 查询并批量更新钢坯基础信息 belongTable
|
|
|
LambdaQueryWrapper<BilletBasicInfo> queryWrapperBB = new LambdaQueryWrapper<BilletBasicInfo>()
|
|
|
.eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
|
|
|
- .eq(BilletBasicInfo::getHeatNo, billetHotsend.getHeatNo())
|
|
|
.in(BilletBasicInfo::getBilletNo, billetNosList);
|
|
|
List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperBB);
|
|
|
billetBasicInfoList.forEach(x ->{
|