Browse Source

导出增加计量单位

fenghaifu 3 tháng trước cách đây
mục cha
commit
6606747d93

+ 17 - 5
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurInquiryFormController.java

@@ -26,16 +26,15 @@ import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.aspect.annotation.PermissionData;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.baseCode.entity.BaseExchangeRate;
+import org.jeecg.modules.baseCode.entity.BaseProductArchive;
 import org.jeecg.modules.baseCode.entity.BaseProductClass;
 import org.jeecg.modules.baseCode.entity.BaseTemplates;
-import org.jeecg.modules.baseCode.service.IBaseExchangeRateService;
-import org.jeecg.modules.baseCode.service.IBaseProductClassService;
-import org.jeecg.modules.baseCode.service.IBaseTemplatesService;
-import org.jeecg.modules.baseCode.service.ISerialPatternService;
+import org.jeecg.modules.baseCode.service.*;
 import org.jeecg.modules.cuspCode.entity.CuspSupplierProfile;
 import org.jeecg.modules.cuspCode.service.ICuspSupplierProfileService;
 import org.jeecg.modules.purCode.service.IPurPurchaseQuotationProductService;
 import org.jeecg.modules.purCode.vo.SupplierQuotationDetails;
+import org.jeecg.modules.saleCode.entity.SaleQuotationProduct;
 import org.jeecg.modules.saleCode.vo.SaleInquiryFormAlert;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysUserService;
@@ -106,6 +105,8 @@ public class PurInquiryFormController {
     private IBaseProductClassService baseProductClassService;
     @Autowired
     private ICuspSupplierProfileService cuspSupplierProfileService;
+    @Autowired
+    private IBaseProductArchiveService baseProductArchiveService;
 
     @Value(value = "${jeecg.path.upload}")
     private String uploadpath;
@@ -765,10 +766,21 @@ public class PurInquiryFormController {
                 purInquiryForm.setPurchaseman(sysUser.getRealname());
                 purInquiryForm.setPurchasePhone(sysUser.getPhone());
                 purInquiryForm.setPurchaseEmail(sysUser.getEmail());
-                //
+                // 获取计产品档案
+                List<BaseProductArchive> productArchiveList = new ArrayList<>();
+                if (oConvertUtils.listIsNotEmpty(productList)){
+                    LambdaQueryWrapper<BaseProductArchive> productWrapper = new LambdaQueryWrapper<>();
+                    productWrapper.in(BaseProductArchive::getId, productList.stream().map(PurInquiryFormProduct::getProductId).collect(Collectors.toList()));
+                    productArchiveList = baseProductArchiveService.list(productWrapper);
+                }
+                // 产品设置
                 int rowNum = 1;
                 for (PurInquiryFormProduct product : productList){
                     product.setRowNumber(rowNum++);
+                    BaseProductArchive findProduct = productArchiveList.stream().filter(e->e.getId().equals(product.getProductId())).findFirst().orElse(null);
+                    if (findProduct != null){
+                        product.setUnit(findProduct.getMeasurementUnit());
+                    }
                 }
                 // 组合填充时,因为多组填充的数据量不确定,需要在多组填充完之后另起一行
                 FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).forceNewRow(Boolean.TRUE).build();

+ 20 - 4
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurOrderController.java

@@ -24,8 +24,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.aspect.annotation.PermissionData;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.baseCode.entity.BaseProductArchive;
 import org.jeecg.modules.baseCode.entity.BaseProductClass;
 import org.jeecg.modules.baseCode.entity.BaseTemplates;
+import org.jeecg.modules.baseCode.service.IBaseProductArchiveService;
 import org.jeecg.modules.baseCode.service.IBaseProductClassService;
 import org.jeecg.modules.baseCode.service.IBaseTemplatesService;
 import org.jeecg.modules.baseCode.service.ISerialPatternService;
@@ -100,6 +102,8 @@ public class PurOrderController {
     private IBaseProductClassService baseProductClassService;
     @Autowired
     private ICuspSupplierProfileService cuspSupplierProfileService;
+    @Autowired
+    private IBaseProductArchiveService baseProductArchiveService;
 
     @Value(value = "${jeecg.path.upload}")
     private String uploadpath;
@@ -852,21 +856,33 @@ public class PurOrderController {
                 purOrder.setPurchaseman(sysUser.getRealname());
                 purOrder.setPurchasePhone(sysUser.getPhone());
                 purOrder.setPurchaseEmail(sysUser.getEmail());
-                //
+                // 获取计产品档案
+                List<BaseProductArchive> productArchiveList = new ArrayList<>();
+                if (oConvertUtils.listIsNotEmpty(productList)){
+                    LambdaQueryWrapper<BaseProductArchive> productWrapper = new LambdaQueryWrapper<>();
+                    productWrapper.in(BaseProductArchive::getId, productList.stream().map(PurOrderProduct::getProductId).collect(Collectors.toList()));
+                    productArchiveList = baseProductArchiveService.list(productWrapper);
+                }
+                // 产品设置
                 int rowNum = 1;
-
-                BigDecimal orderMoney = new BigDecimal(0);
+                BigDecimal orderMoney = BigDecimal.ZERO;
                 for (PurOrderProduct product : productList){
                     product.setRowNumber(rowNum++);
-                    orderMoney = orderMoney.add(product.getTaxAmount());
+                    BigDecimal amount = product.getTaxAmount() == null ? BigDecimal.ZERO: product.getTaxAmount();
+                    orderMoney = orderMoney.add(amount);
                     if (product.getDeliveryTime() != null){
                         product.setDeliverDateText(DateUtils.date2Str(product.getDeliveryTime(), DateUtils.date_sdf.get()));
                     }
+                    BaseProductArchive findProduct = productArchiveList.stream().filter(e->e.getId().equals(product.getProductId())).findFirst().orElse(null);
+                    if (findProduct != null){
+                        product.setUnit(findProduct.getMeasurementUnit());
+                    }
                 }
                 if(productList.size() > 0){
 
                     purOrder.setQualityGrade(productList.get(0).getQualityGrade());
                 }
+                orderMoney  = orderMoney.setScale(2);
                 purOrder.setOrderMoney(orderMoney);
                 // 组合填充时,因为多组填充的数据量不确定,需要在多组填充完之后另起一行
                 FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).forceNewRow(Boolean.TRUE).build();

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurInquiryForm.java

@@ -187,4 +187,6 @@ public class PurInquiryForm implements Serializable {
     private String email;
     @TableField(exist = false)
     private String billDateText;
+    @TableField(exist = false)
+    private String unit;
 }

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProduct.java

@@ -157,4 +157,6 @@ public class PurOrderProduct implements Serializable {
     private Integer rowNumber;
     @TableField(exist = false)
     private String deliverDateText;
+    @TableField(exist = false)
+    private String unit;
 }

+ 9 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleInvoiceController.java

@@ -629,4 +629,13 @@ public class SaleInvoiceController {
         return Result.OK("文件导入失败!");
     }
 
+    /**
+     * 导出发票
+     *
+     */
+    @RequestMapping(value = "/exportBillXls")
+    public void exportBillXls(HttpServletResponse response, SaleOrder saleOrder1) throws Exception {
+
+    }
+
 }

+ 29 - 8
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleOrderController.java

@@ -24,13 +24,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.aspect.annotation.PermissionData;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.baseCode.entity.BaseProductArchive;
 import org.jeecg.modules.baseCode.entity.BaseProductClass;
 import org.jeecg.modules.baseCode.entity.BaseShipArchive;
 import org.jeecg.modules.baseCode.entity.BaseTemplates;
-import org.jeecg.modules.baseCode.service.IBaseProductClassService;
-import org.jeecg.modules.baseCode.service.IBaseShipArchiveService;
-import org.jeecg.modules.baseCode.service.IBaseTemplatesService;
-import org.jeecg.modules.baseCode.service.ISerialPatternService;
+import org.jeecg.modules.baseCode.service.*;
 import org.jeecg.modules.cuspCode.entity.CuspCustomerProfile;
 import org.jeecg.modules.cuspCode.service.ICuspCustomerProfileService;
 import org.jeecg.modules.purCode.entity.PurCommissionRequest;
@@ -114,6 +112,8 @@ public class SaleOrderController {
     private ICuspCustomerProfileService cuspCustomerProfileService;
     @Autowired
     private IBaseShipArchiveService baseShipArchiveService;
+    @Autowired
+    private IBaseProductArchiveService baseProductArchiveService;
 
     @Value(value = "${jeecg.path.upload}")
     private String uploadpath;
@@ -907,11 +907,32 @@ public class SaleOrderController {
                         saleOrder.setEmail(classEnt.getEmail());
                     }
                 }
+                // 获取计产品档案
+                List<BaseProductArchive> productArchiveList = new ArrayList<>();
+                if (oConvertUtils.listIsNotEmpty(productList)){
+                    LambdaQueryWrapper<BaseProductArchive> productWrapper = new LambdaQueryWrapper<>();
+                    productWrapper.in(BaseProductArchive::getId, productList.stream().map(SaleOrderProduct::getProductId).collect(Collectors.toList()));
+                    productArchiveList = baseProductArchiveService.list(productWrapper);
+                }
+                // 产品设置
+                int rowNum = 1;
                 BigDecimal orderMoney = BigDecimal.ZERO;
                 for(SaleOrderProduct o:productList){
                     BigDecimal amount = o.getTaxAmount() == null ? BigDecimal.ZERO: o.getTaxAmount();
                     orderMoney = orderMoney.add(amount);
+                    o.setRowNumber(rowNum++);
+                    if (o.getDeliveryTime() != null){
+                        o.setDeliverDateText(DateUtils.date2Str(o.getDeliveryTime(), DateUtils.date_sdf.get()));
+                    }
+                    if (oConvertUtils.isNotEmpty(o.getDiscount())){
+                        o.setDiscountText(o.getDiscount().intValue()+"%");
+                    }
+                    BaseProductArchive findProduct = productArchiveList.stream().filter(e->e.getId().equals(o.getProductId())).findFirst().orElse(null);
+                    if (findProduct != null){
+                        o.setUnit(findProduct.getMeasurementUnit());
+                    }
                 }
+                orderMoney = orderMoney.setScale(2);
                 saleOrder.setOrderMoney(orderMoney);
 
                 String shipname = "";
@@ -938,11 +959,11 @@ public class SaleOrderController {
                 }
                 //
                 saleOrder.setBillDateText(DateUtils.date2Str(saleOrder.getBillDate(), DateUtils.date_sdf.get()));
-
-                int rowNum = 1;
-                for (SaleOrderProduct product : productList){
-                    product.setRowNumber(rowNum++);
+                if (oConvertUtils.isNotEmpty(saleOrder.getDoubleDiscount())){
+                    saleOrder.setDiscountText(saleOrder.getDoubleDiscount().intValue()+"%");
+                    saleOrder.setDiscountMoney(orderMoney.subtract(new BigDecimal(saleOrder.getConvertedAmount())).setScale(2));
                 }
+
                 // 制单人信息
                 SysUser sysUser = sysUserService.getUserByName(saleOrder.getCreateBy());
                 saleOrder.setSalesPhone(sysUser.getPhone());

+ 19 - 8
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleQuotationController.java

@@ -22,13 +22,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.aspect.annotation.PermissionData;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.baseCode.entity.BaseProductArchive;
 import org.jeecg.modules.baseCode.entity.BaseProductClass;
 import org.jeecg.modules.baseCode.entity.BaseShipArchive;
 import org.jeecg.modules.baseCode.entity.BaseTemplates;
-import org.jeecg.modules.baseCode.service.IBaseProductClassService;
-import org.jeecg.modules.baseCode.service.IBaseShipArchiveService;
-import org.jeecg.modules.baseCode.service.IBaseTemplatesService;
-import org.jeecg.modules.baseCode.service.ISerialPatternService;
+import org.jeecg.modules.baseCode.service.*;
 import org.jeecg.modules.cuspCode.entity.CuspCustomerProfile;
 import org.jeecg.modules.cuspCode.entity.CuspSupplierProfile;
 import org.jeecg.modules.cuspCode.service.ICuspCustomerProfileService;
@@ -106,6 +104,8 @@ public class SaleQuotationController {
     private ICuspCustomerProfileService cuspCustomerProfileService;
     @Autowired
     private IBaseShipArchiveService baseShipArchiveService;
+    @Autowired
+    private IBaseProductArchiveService baseProductArchiveService;
 
     @Value(value = "${jeecg.path.upload}")
     private String uploadpath;
@@ -558,10 +558,24 @@ public class SaleQuotationController {
                         saleQuotation.setEmail(classEnt.getEmail());
                     }
                 }
+                // 获取计产品档案
+                List<BaseProductArchive> productArchiveList = new ArrayList<>();
+                if (oConvertUtils.listIsNotEmpty(productList)){
+                    LambdaQueryWrapper<BaseProductArchive> productWrapper = new LambdaQueryWrapper<>();
+                    productWrapper.in(BaseProductArchive::getId, productList.stream().map(SaleQuotationProduct::getProductId).collect(Collectors.toList()));
+                    productArchiveList = baseProductArchiveService.list(productWrapper);
+                }
+                // 产品设置
+                int rowNum = 1;
                 BigDecimal orderMoney = BigDecimal.ZERO;
                 for(SaleQuotationProduct o:productList){
                     BigDecimal amount = o.getTaxAmount() == null ? BigDecimal.ZERO: o.getTaxAmount();
                     orderMoney = orderMoney.add(amount);
+                    o.setRowNumber(rowNum++);
+                    BaseProductArchive findProduct = productArchiveList.stream().filter(e->e.getId().equals(o.getProductId())).findFirst().orElse(null);
+                    if (findProduct != null){
+                        o.setUnit(findProduct.getMeasurementUnit());
+                    }
                 }
                 saleQuotation.setOrderMoney(orderMoney);
 
@@ -590,10 +604,7 @@ public class SaleQuotationController {
                 //
                 saleQuotation.setBillDateText(DateUtils.date2Str(saleQuotation.getBillDate(), DateUtils.date_sdf.get()));
 
-                int rowNum = 1;
-                for (SaleQuotationProduct product : productList){
-                    product.setRowNumber(rowNum++);
-                }
+
                 // 制单人信息
                 SysUser sysUser = sysUserService.getUserByName(saleQuotation.getCreateBy());
                 saleQuotation.setSalesPhone(sysUser.getPhone());

+ 5 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleOrder.java

@@ -253,6 +253,7 @@ public class SaleOrder implements Serializable {
 //    收款金额(collected money)
     private java.math.BigDecimal collectedMoney;
 
+
     //导出字段使用
     @TableField(exist = false)
     private String salesPhone;
@@ -275,4 +276,8 @@ public class SaleOrder implements Serializable {
     private String qualityGrade;
     @TableField(exist = false)
     private String billDateText;
+    @TableField(exist = false)
+    private BigDecimal discountMoney;
+    @TableField(exist = false)
+    private String discountText;
 }

+ 6 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleOrderProduct.java

@@ -167,4 +167,10 @@ public class SaleOrderProduct implements Serializable {
 
     @TableField(exist = false)
     private Integer rowNumber;
+    @TableField(exist = false)
+    private String deliverDateText;
+    @TableField(exist = false)
+    private String discountText;
+    @TableField(exist = false)
+    private String unit;
 }