|
@@ -763,13 +763,6 @@ public class SaleDeliveryController {
|
|
|
int rowNum = 1;
|
|
|
BigDecimal deliverMoney = BigDecimal.ZERO;
|
|
|
for (SaleDeliveryDetails o : deliveryDetailsList) {
|
|
|
- BigDecimal amount = o.getMoney() == null ? BigDecimal.ZERO : o.getMoney();
|
|
|
- deliverMoney = deliverMoney.add(amount);
|
|
|
- o.setRowNumber(rowNum++);
|
|
|
- if (o.getDeliveryTime() != null) {
|
|
|
- o.setDeliverDateText(DateUtils.date2Str(o.getDeliveryTime(), DateUtils.date_sdf.get()));
|
|
|
- }
|
|
|
-
|
|
|
BaseProductArchive findProduct = productArchiveList.stream().filter(e -> e.getId().equals(o.getProductId())).findFirst().orElse(null);
|
|
|
if (findProduct != null) {
|
|
|
o.setUnit(findProduct.getMeasurementUnit());
|
|
@@ -780,6 +773,15 @@ public class SaleDeliveryController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ BigDecimal amount = o.getMoney() == null ? BigDecimal.ZERO : o.getMoney();
|
|
|
+ deliverMoney = deliverMoney.add(amount);
|
|
|
+ o.setRowNumber(rowNum++);
|
|
|
+ if (o.getDeliveryTime() != null) {
|
|
|
+ o.setDeliverDateText(DateUtils.date2Str(o.getDeliveryTime(), DateUtils.date_sdf.get()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
SaleOrderProduct saleOrderProduct = saleOrderProductList.stream().filter(e -> e.getId().equals(o.getSourceId())).findFirst().orElse(null);
|
|
|
if (saleOrderProduct != null) {
|
|
|
if (oConvertUtils.isNotEmpty(saleOrderProduct.getDiscount()) && saleOrderProduct.getDiscount().intValue() != 0) {
|
|
@@ -811,7 +813,7 @@ public class SaleDeliveryController {
|
|
|
if (saleDelivery.getProject() != null) {
|
|
|
BaseProjectArchive projectArchive = baseProjectArchiveService.getById(saleDelivery.getProject());
|
|
|
if (projectArchive != null) {
|
|
|
- saleDelivery.setContactsNo(projectArchive.getName());
|
|
|
+ saleDelivery.setProjectCode(projectArchive.getCode());
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -870,19 +872,17 @@ public class SaleDeliveryController {
|
|
|
saleDelivery.setEmail(classEnt.getEmail());
|
|
|
}
|
|
|
}
|
|
|
- // 获取计产品档案
|
|
|
- List<BaseProductArchive> productArchiveList = new ArrayList<>();
|
|
|
- if (oConvertUtils.listIsNotEmpty(deliveryDetailsList)) {
|
|
|
- LambdaQueryWrapper<BaseProductArchive> productWrapper = new LambdaQueryWrapper<>();
|
|
|
- productWrapper.in(BaseProductArchive::getId, deliveryDetailsList.stream().map(SaleDeliveryDetails::getProductId).collect(Collectors.toList()));
|
|
|
- productArchiveList = baseProductArchiveService.list(productWrapper);
|
|
|
- }
|
|
|
+ // 获取产品档案
|
|
|
+ LambdaQueryWrapper<BaseProductArchive> productWrapper = new LambdaQueryWrapper<>();
|
|
|
+ productWrapper.in(BaseProductArchive::getId, deliveryDetailsList.stream().map(SaleDeliveryDetails::getProductId).collect(Collectors.toList()));
|
|
|
+ List<BaseProductArchive> productArchiveList = baseProductArchiveService.list(productWrapper);
|
|
|
+
|
|
|
// 获取销售订单行
|
|
|
List<SaleOrderProduct> saleOrderProductList = new ArrayList<>();
|
|
|
if (oConvertUtils.listIsNotEmpty(deliveryDetailsList)) {
|
|
|
- LambdaQueryWrapper<SaleOrderProduct> productWrapper = new LambdaQueryWrapper<>();
|
|
|
- productWrapper.in(SaleOrderProduct::getId, deliveryDetailsList.stream().map(SaleDeliveryDetails::getSourceId).collect(Collectors.toList()));
|
|
|
- saleOrderProductList = saleOrderProductService.list(productWrapper);
|
|
|
+ LambdaQueryWrapper<SaleOrderProduct> saleOrderProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ saleOrderProductLambdaQueryWrapper.in(SaleOrderProduct::getId, deliveryDetailsList.stream().map(SaleDeliveryDetails::getSourceId).collect(Collectors.toList()));
|
|
|
+ saleOrderProductList = saleOrderProductService.list(saleOrderProductLambdaQueryWrapper);
|
|
|
}
|
|
|
// 获取销售订单
|
|
|
if (oConvertUtils.isNotEmpty(saleDelivery.getSourceCode())) {
|
|
@@ -902,19 +902,17 @@ public class SaleDeliveryController {
|
|
|
saleDelivery.setPaymentTermsText(paymentTermsText);
|
|
|
List<DictModel> unitDictList = sysDictService.queryDictItemsByCode("measurement_unit");
|
|
|
|
|
|
+ // 过滤虚拟产品
|
|
|
+ deliveryDetailsList = deliveryDetailsList.stream().filter(e -> {
|
|
|
+ return productArchiveList.stream().filter(p->p.getId().equals(e.getProductId()) && p.getVirtualProduct()==0).count()>0;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
// 产品设置
|
|
|
int rowNum = 1;
|
|
|
BigDecimal deliverMoney = BigDecimal.ZERO;
|
|
|
for (SaleDeliveryDetails o : deliveryDetailsList) {
|
|
|
- BigDecimal amount = o.getMoney() == null ? BigDecimal.ZERO : o.getMoney();
|
|
|
- deliverMoney = deliverMoney.add(amount);
|
|
|
- o.setRowNumber(rowNum++);
|
|
|
- if (o.getDeliveryTime() != null) {
|
|
|
- o.setDeliverDateText(DateUtils.date2Str(o.getDeliveryTime(), DateUtils.date_sdf.get()));
|
|
|
- }
|
|
|
-
|
|
|
BaseProductArchive findProduct = productArchiveList.stream().filter(e -> e.getId().equals(o.getProductId())).findFirst().orElse(null);
|
|
|
if (findProduct != null) {
|
|
|
+
|
|
|
o.setUnit(findProduct.getMeasurementUnit());
|
|
|
if (findProduct.getMeasurementUnit() != null) {
|
|
|
DictModel findDict = unitDictList.stream().filter(d -> d.getValue().equals(findProduct.getMeasurementUnit())).findFirst().orElse(null);
|
|
@@ -923,6 +921,14 @@ public class SaleDeliveryController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ BigDecimal amount = o.getMoney() == null ? BigDecimal.ZERO : o.getMoney();
|
|
|
+ deliverMoney = deliverMoney.add(amount);
|
|
|
+ o.setRowNumber(rowNum++);
|
|
|
+ if (o.getDeliveryTime() != null) {
|
|
|
+ o.setDeliverDateText(DateUtils.date2Str(o.getDeliveryTime(), DateUtils.date_sdf.get()));
|
|
|
+ }
|
|
|
+
|
|
|
SaleOrderProduct saleOrderProduct = saleOrderProductList.stream().filter(e -> e.getId().equals(o.getSourceId())).findFirst().orElse(null);
|
|
|
if (saleOrderProduct != null) {
|
|
|
if (oConvertUtils.isNotEmpty(saleOrderProduct.getDiscount()) && saleOrderProduct.getDiscount().intValue() != 0) {
|
|
@@ -954,7 +960,7 @@ public class SaleDeliveryController {
|
|
|
if (saleDelivery.getProject() != null) {
|
|
|
BaseProjectArchive projectArchive = baseProjectArchiveService.getById(saleDelivery.getProject());
|
|
|
if (projectArchive != null) {
|
|
|
- saleDelivery.setContactsNo(projectArchive.getName());
|
|
|
+ saleDelivery.setProjectCode(projectArchive.getCode());
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -993,12 +999,12 @@ public class SaleDeliveryController {
|
|
|
List<String> noteList = new ArrayList<>();
|
|
|
deliveryDetailsList.forEach(p -> noteList.add(p.getNotes()));
|
|
|
|
|
|
- int startIndex = 18;
|
|
|
+ int startIndex = 17;
|
|
|
if ("随货发票".equals(templateName)) {
|
|
|
- startIndex = 19;
|
|
|
+ startIndex = 18;
|
|
|
}
|
|
|
ExcelExportUtils.excelInsertRowNotes(getOutputStream(saleDelivery.getBillCode() + ".xlsx", response),
|
|
|
- tempFilePath, startIndex, noteList, 2, 4);
|
|
|
+ tempFilePath, startIndex, noteList, 1, 4);
|
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|