Browse Source

询报价单导出

fenghaifu 3 months ago
parent
commit
07f2e6cf9e

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

@@ -24,6 +24,7 @@ import com.alibaba.excel.write.metadata.fill.FillWrapper;
 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.BaseExchangeRate;
 import org.jeecg.modules.baseCode.entity.BaseProductClass;
 import org.jeecg.modules.baseCode.entity.BaseTemplates;
@@ -722,7 +723,7 @@ public class PurInquiryFormController {
             response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
             response.setCharacterEncoding("utf-8");
             try {
-                String fileName = URLEncoder.encode("采购询价单" + purInquiryForm.getBillCode(), "UTF-8").replaceAll("\\+", "%20");
+                String fileName = URLEncoder.encode(purInquiryForm.getBillCode(), "UTF-8").replaceAll("\\+", "%20");
                 response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
 
                 String filePath = uploadpath + templates.getTemplateFile();
@@ -738,6 +739,7 @@ public class PurInquiryFormController {
                         purInquiryForm.setProductionClass(classEnt.getName());
                     }
                 }
+                purInquiryForm.setBillDateText(DateUtils.date2Str(purInquiryForm.getBillDate(), DateUtils.date_sdf.get()));
                 String getInquirySuppiler = purInquiryForm.getInquirySuppiler();
                 if (StringUtils.isNotBlank(getInquirySuppiler)) {
 
@@ -754,6 +756,11 @@ public class PurInquiryFormController {
                 purInquiryForm.setPurchaseman(sysUser.getRealname());
                 purInquiryForm.setPurchasePhone(sysUser.getPhone());
                 purInquiryForm.setPurchaseEmail(sysUser.getEmail());
+                //
+                int rowNum = 1;
+                for (PurInquiryFormProduct product : productList){
+                    product.setRowNumber(rowNum++);
+                }
                 // 组合填充时,因为多组填充的数据量不确定,需要在多组填充完之后另起一行
                 FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).forceNewRow(Boolean.TRUE).build();
                 excelWriter.fill(new FillWrapper(productList), fillConfig, writeSheet);

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

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

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

@@ -21,6 +21,7 @@ import com.alibaba.excel.write.metadata.fill.FillWrapper;
 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.BaseProductClass;
 import org.jeecg.modules.baseCode.entity.BaseShipArchive;
 import org.jeecg.modules.baseCode.entity.BaseTemplates;
@@ -524,8 +525,6 @@ public class SaleQuotationController {
 //        saleQuotation1.setId("1874732508546240513");
         BaseTemplates templates = baseTemplatesService.getByTemplateType("销售报价单");
         SaleQuotation saleQuotation = saleQuotationService.getById(saleQuotation1.getId());
-        LambdaQueryWrapper<PurInquiryFormProduct> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(PurInquiryFormProduct::getHeadId, saleQuotation.getId());
         List<SaleQuotationProduct> productList = saleQuotationProductService.selectByMainId(saleQuotation.getId());
         List<SaleQuotationShip> saleQuotationShipList = saleQuotationShipService.selectByMainId(saleQuotation.getId());
         if (templates != null) {
@@ -588,6 +587,13 @@ public class SaleQuotationController {
 
                     saleQuotation.setQualityGrade(productList.get(0).getQualityGrade());
                 }
+                //
+                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());

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

@@ -220,4 +220,6 @@ public class SaleQuotation implements Serializable {
     private String qualityGrade;
     @TableField(exist = false)
     private BigDecimal orderMoney;
+    @TableField(exist = false)
+    private String billDateText;
 }

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

@@ -1,10 +1,8 @@
 package org.jeecg.modules.saleCode.entity;
 
 import java.io.Serializable;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableLogic;
+
+import com.baomidou.mybatisplus.annotation.*;
 import org.jeecg.common.constant.ProvinceCityArea;
 import org.jeecg.common.util.SpringContextUtils;
 import lombok.Data;
@@ -184,4 +182,7 @@ public class SaleQuotationProduct implements Serializable {
     private String currencyGys;//供应商币种
     private BigDecimal exchangeRateGys;//美元汇率
     private BigDecimal taxPriceGys;//供应商采购单价
+    @TableField(exist = false)
+    private Integer rowNumber;
+
 }