Эх сурвалжийг харах

储运中心导出修改定尺以及牌号展示

lingpeng.li 1 сар өмнө
parent
commit
478afbdc99

+ 5 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/impl/StorageBillServiceImpl.java

@@ -3969,6 +3969,8 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         List<StorageCenterInvoicingVO> resultList = heatsActuals.stream()
                 .map(heat -> {
                     String heatNo = heat.getHeatsCode();
+                    String shift = heat.getShift();
+                    String shiftGroup = heat.getShiftGroup();
                     Date createTime = heat.getCreateTime();
                     List<BilletBasicInfo> billets = groupedByHeatNo.getOrDefault(heatNo, Collections.emptyList());
 
@@ -4070,6 +4072,9 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                     heatNoDetail.setHeatNoWeight(sumWeight);
                     heatNoDetail.setHeatNoAmount(sumAmount);
                     heatNoDetail.setCreateTime(createTime);
+                    heatNoDetail.setShift(shift);
+                    heatNoDetail.setShiftGroup(shiftGroup);
+                    heatNoDetail.setCreateTime(createTime);
 
                     StorageCenterInvoicingVO vo = new StorageCenterInvoicingVO();
                     vo.setHeatNoDetails(Collections.singletonList(heatNoDetail));

+ 2 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/vo/StorageCenterExportRow.java

@@ -50,8 +50,8 @@ public class StorageCenterExportRow {
     private String btype;
 
     @ExcelProperty("定尺")
-    @ColumnWidth(10)
-    private Integer size;
+    @ColumnWidth(15)
+    private String size;
 
     @ExcelProperty("规格")
     @ColumnWidth(16)

+ 6 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/vo/StorageCenterInvoicingVO.java

@@ -62,5 +62,11 @@ public class StorageCenterInvoicingVO {
         @ApiModelProperty(value = "创建时间")
         private Date createTime;
 
+        @ApiModelProperty(value = "班组")
+        private String shiftGroup;
+
+        @ApiModelProperty(value = "班别")
+        private String shift;
+
     }
 }

+ 74 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/CarUnitServiceImpl.java

@@ -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");