|
@@ -39,6 +39,8 @@ public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> impl
|
|
|
@Override
|
|
|
public List<StorageCenterExportRow> buildExportData(List<StorageCenterInvoicingVO> records) {
|
|
|
List<StorageCenterExportRow> rows = new ArrayList<>();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
|
|
|
for (StorageCenterInvoicingVO vo : records) {
|
|
|
Integer ccmNo = Optional.ofNullable(vo.getHeatNoDetails())
|
|
@@ -49,6 +51,27 @@ public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> impl
|
|
|
StorageCenterHeatNoInvoicingVO invoicing = vo.getStorageCenterHeatNoInvoicing();
|
|
|
if (invoicing == null) continue;
|
|
|
|
|
|
+ // 棒一 rollClubOneDetails
|
|
|
+ if (invoicing.getRollClubOneDetails() != null && invoicing.getRollClubOneDetails() != null) {
|
|
|
+ for (StorageCenterHeatNoInvoicingVO.RollSendDetail detail : invoicing.getRollClubOneDetails().getRollSendDetails()) {
|
|
|
+ StorageCenterExportRow row = ontherConvert(detail, ccmNo, "棒一");
|
|
|
+ String dateString = Optional.ofNullable(vo.getHeatNoDetails())
|
|
|
+ .filter(list -> !list.isEmpty())
|
|
|
+ .map(list -> list.get(0).getCreateTime())
|
|
|
+ .map(sdf::format)
|
|
|
+ .orElse("");
|
|
|
+
|
|
|
+ String heatNo = Optional.ofNullable(vo.getHeatNoDetails())
|
|
|
+ .filter(list -> !list.isEmpty())
|
|
|
+ .map(list -> list.get(0).getHeatNo())
|
|
|
+ .orElse("");
|
|
|
+
|
|
|
+ row.setFactoryDate(dateString);
|
|
|
+ row.setHeatNo(heatNo);
|
|
|
+ rows.add(row);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 棒二 rollClubTwoDetails
|
|
|
if (invoicing.getRollClubTwoDetails() != null && invoicing.getRollClubThreeDetails() != null) {
|
|
|
for (StorageCenterHeatNoInvoicingVO.RollChargeDetail detail : invoicing.getRollClubTwoDetails().getRollChargeDetails()) {
|
|
@@ -72,6 +95,27 @@ public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> impl
|
|
|
rows.add(row);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 高线 rollHeightDetails
|
|
|
+ if (invoicing.getRollHeightDetails() != null && invoicing.getRollHeightDetails() != null) {
|
|
|
+ for (StorageCenterHeatNoInvoicingVO.RollSendDetail detail : invoicing.getRollHeightDetails().getRollSendDetails()) {
|
|
|
+ StorageCenterExportRow row = ontherConvert(detail, ccmNo, "高线");
|
|
|
+ String dateString = Optional.ofNullable(vo.getHeatNoDetails())
|
|
|
+ .filter(list -> !list.isEmpty())
|
|
|
+ .map(list -> list.get(0).getCreateTime())
|
|
|
+ .map(sdf::format)
|
|
|
+ .orElse("");
|
|
|
+
|
|
|
+ String heatNo = Optional.ofNullable(vo.getHeatNoDetails())
|
|
|
+ .filter(list -> !list.isEmpty())
|
|
|
+ .map(list -> list.get(0).getHeatNo())
|
|
|
+ .orElse("");
|
|
|
+
|
|
|
+ row.setFactoryDate(dateString);
|
|
|
+ row.setHeatNo(heatNo);
|
|
|
+ rows.add(row);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return rows;
|
|
@@ -144,12 +188,32 @@ 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());
|
|
|
row.setSpec(detail.getSpec());
|
|
|
+ String btype = Optional.ofNullable(detail.getBtype()).orElse("");
|
|
|
+ row.setBtype("0".equals(btype) ? "热坯" : "凉坯");
|
|
|
+
|
|
|
row.setBrand(getBrandNum(detail.getBrandNum()));
|
|
|
|
|
|
return row;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private static StorageCenterExportRow ontherConvert(StorageCenterHeatNoInvoicingVO.RollSendDetail detail, Integer ccmNo, String endpoint) {
|
|
|
+ StorageCenterExportRow row = new StorageCenterExportRow();
|
|
|
+
|
|
|
+ row.setEndPoint(endpoint);
|
|
|
+ row.setLicensePlate("辊道");
|
|
|
+ row.setAmount(detail.getAmount());
|
|
|
+ row.setTotalWeight(detail.getWeight());
|
|
|
+ row.setCcmNo(ccmNo);
|
|
|
+ row.setWeightPerPiece(calcWeightPerPiece(detail.getWeight(), detail.getAmount()));
|
|
|
+ row.setSize(detail.getSize());
|
|
|
+ row.setSpec(detail.getSpec());
|
|
|
+
|
|
|
+ return row;
|
|
|
+ }
|
|
|
+
|
|
|
private static BigDecimal calcWeightPerPiece(BigDecimal total, Integer amount) {
|
|
|
if (total == null || amount == null || amount == 0) return BigDecimal.ZERO;
|
|
|
return total.divide(BigDecimal.valueOf(amount), 3, RoundingMode.HALF_UP);
|