|
@@ -2,8 +2,11 @@ package org.jeecg.modules.carUnit.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.jeecg.common.util.SpringContextUtils;
|
|
|
+import org.jeecg.modules.billet.shiftConfiguration.entity.ShiftConfiguration;
|
|
|
+import org.jeecg.modules.billet.shiftConfiguration.mapper.ShiftConfigurationMapper;
|
|
|
import org.jeecg.modules.billet.storageBill.vo.StorageCenterExportRow;
|
|
|
import org.jeecg.modules.billet.storageBill.vo.StorageCenterHeatNoInvoicingVO;
|
|
|
import org.jeecg.modules.billet.storageBill.vo.StorageCenterInvoicingVO;
|
|
@@ -31,11 +34,18 @@ import java.util.Optional;
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> implements ICarUnitService {
|
|
|
|
|
|
@Autowired
|
|
|
private CarUnitMapper carUnitMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ShiftConfigurationMapper shiftConfigurationMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysDictService sysDictService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<StorageCenterExportRow> buildExportData(List<StorageCenterInvoicingVO> records) {
|
|
|
List<StorageCenterExportRow> rows = new ArrayList<>();
|
|
@@ -62,6 +72,34 @@ public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> impl
|
|
|
.map(list -> list.get(0).getHeatNo())
|
|
|
.orElse("");
|
|
|
|
|
|
+ String shift = Optional.ofNullable(vo.getHeatNoDetails())
|
|
|
+ .filter(list -> !list.isEmpty())
|
|
|
+ .map(list -> list.get(0).getShift())
|
|
|
+ .orElse("");
|
|
|
+
|
|
|
+ String shiftGroup = Optional.ofNullable(vo.getHeatNoDetails())
|
|
|
+ .filter(list -> !list.isEmpty())
|
|
|
+ .map(list -> list.get(0).getShiftGroup())
|
|
|
+ .orElse("");
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(shift) && StringUtils.isNotBlank(shiftGroup)) {
|
|
|
+ LambdaQueryWrapper<ShiftConfiguration> shiftConfigurationWrapper = new LambdaQueryWrapper<>();
|
|
|
+ shiftConfigurationWrapper.eq(ShiftConfiguration::getDate, row.getFactoryDate())
|
|
|
+ .eq(ShiftConfiguration::getShift, shift)
|
|
|
+ .eq(ShiftConfiguration::getShiftGroup, shiftGroup)
|
|
|
+ .last("limit 1");
|
|
|
+
|
|
|
+ ShiftConfiguration shiftConfiguration = shiftConfigurationMapper.selectOne(shiftConfigurationWrapper);
|
|
|
+
|
|
|
+ if (shiftConfiguration != null) {
|
|
|
+ row.setBrand(sysDictService.queryDictTextByKey("billet_spec", shiftConfiguration.getSteelGrade()));
|
|
|
+ } else {
|
|
|
+ log.warn("未找到班次配置:日期={},shift={},shiftGroup={}", row.getFactoryDate(), shift, shiftGroup);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("shift 或 shiftGroup 为空,跳过 ShiftConfiguration 查询,heatNo={}", vo.getHeatNoDetails().get(0).getHeatNo());
|
|
|
+ }
|
|
|
+
|
|
|
row.setHeatNo(heatNo);
|
|
|
rows.add(row);
|
|
|
}
|
|
@@ -101,6 +139,34 @@ public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> impl
|
|
|
.map(list -> list.get(0).getHeatNo())
|
|
|
.orElse("");
|
|
|
|
|
|
+ String shift = Optional.ofNullable(vo.getHeatNoDetails())
|
|
|
+ .filter(list -> !list.isEmpty())
|
|
|
+ .map(list -> list.get(0).getShift())
|
|
|
+ .orElse("");
|
|
|
+
|
|
|
+ String shiftGroup = Optional.ofNullable(vo.getHeatNoDetails())
|
|
|
+ .filter(list -> !list.isEmpty())
|
|
|
+ .map(list -> list.get(0).getShiftGroup())
|
|
|
+ .orElse("");
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(shift) && StringUtils.isNotBlank(shiftGroup)) {
|
|
|
+ LambdaQueryWrapper<ShiftConfiguration> shiftConfigurationWrapper = new LambdaQueryWrapper<>();
|
|
|
+ shiftConfigurationWrapper.eq(ShiftConfiguration::getDate, row.getFactoryDate())
|
|
|
+ .eq(ShiftConfiguration::getShift, shift)
|
|
|
+ .eq(ShiftConfiguration::getShiftGroup, shiftGroup)
|
|
|
+ .last("limit 1");
|
|
|
+
|
|
|
+ ShiftConfiguration shiftConfiguration = shiftConfigurationMapper.selectOne(shiftConfigurationWrapper);
|
|
|
+
|
|
|
+ if (shiftConfiguration != null) {
|
|
|
+ row.setBrand(sysDictService.queryDictTextByKey("billet_spec", shiftConfiguration.getSteelGrade()));
|
|
|
+ } else {
|
|
|
+ log.warn("未找到班次配置:日期={},shift={},shiftGroup={}", row.getFactoryDate(), shift, shiftGroup);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("shift 或 shiftGroup 为空,跳过 ShiftConfiguration 查询,heatNo={}", vo.getHeatNoDetails().get(0).getHeatNo());
|
|
|
+ }
|
|
|
+
|
|
|
row.setHeatNo(heatNo);
|
|
|
rows.add(row);
|
|
|
}
|
|
@@ -177,7 +243,10 @@ public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> impl
|
|
|
row.setCcmNo(ccmNo);
|
|
|
row.setTransportUnit(getTransportUnitNameByCarNumber(detail.getLicensePlate()));
|
|
|
row.setWeightPerPiece(calcWeightPerPiece(detail.getWeight(), detail.getAmount()));
|
|
|
- row.setSize(detail.getSize());
|
|
|
+ BigDecimal result = BigDecimal.valueOf(detail.getSize()).divide(BigDecimal.valueOf(1000));
|
|
|
+ if (result != null) {
|
|
|
+ row.setSize("170*170*" + result.toPlainString());
|
|
|
+ }
|
|
|
row.setSpec(detail.getSpec());
|
|
|
String btype = Optional.ofNullable(detail.getBtype()).orElse("");
|
|
|
row.setBtype("0".equals(btype) ? "热坯" : "凉坯");
|
|
@@ -197,7 +266,10 @@ public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> impl
|
|
|
row.setTotalWeight(detail.getWeight());
|
|
|
row.setCcmNo(ccmNo);
|
|
|
row.setWeightPerPiece(calcWeightPerPiece(detail.getWeight(), detail.getAmount()));
|
|
|
- row.setSize(detail.getSize());
|
|
|
+ BigDecimal result = BigDecimal.valueOf(detail.getSize()).divide(BigDecimal.valueOf(1000));
|
|
|
+ if (result != null) {
|
|
|
+ row.setSize("170*170*" + result.toPlainString());
|
|
|
+ }
|
|
|
row.setSpec(detail.getSpec());
|
|
|
if (detail != null && detail.getCreateTime() != null) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|