'123'
This commit is contained in:
parent
0179891d08
commit
53898cfc71
|
@ -106,6 +106,23 @@
|
|||
<scope>system</scope>
|
||||
<systemPath>${basedir}/src/main/resources/lib/sapjco3.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<systemPath>${basedir}/src/main/resources/lib/dom4j-1.6.1.jar</systemPath>
|
||||
<scope>system</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.32</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jexcelapi</groupId>
|
||||
<artifactId>jxl</artifactId>
|
||||
<version>2.6.12</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -10,23 +10,17 @@ import com.ruoyi.common.enums.BusinessType;
|
|||
import com.ruoyi.common.enums.DataSourceType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.ruoyi.customer.domain.Customer;
|
||||
import com.ruoyi.quote.domain.CalculateRBParamDto;
|
||||
import com.ruoyi.redBook.domain.OAQuotProduct;
|
||||
import com.ruoyi.redBook.domain.Product;
|
||||
import com.ruoyi.redBook.domain.OAQuot;
|
||||
import com.ruoyi.redBook.domain.RbVersionDateResult;
|
||||
import com.ruoyi.redBook.service.IRedBookService;
|
||||
import com.ruoyi.web.utils.IdUtils;
|
||||
import com.ruoyi.web.utils.SapFunction.RfcResult;
|
||||
import com.ruoyi.web.utils.SapFunction.SapRfcUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 红本管理Controller
|
||||
|
@ -213,14 +207,19 @@ public class RedBookController extends BaseController
|
|||
@DataSource(DataSourceType.MASTER)
|
||||
@Log(title = "报价单生成", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/madeQuot")
|
||||
public AjaxResult madeQuot(@RequestBody OAQuot quot)
|
||||
public void madeQuot(HttpServletResponse response, @RequestBody OAQuot quot)
|
||||
{
|
||||
quot.setQuot_id(UUID.fastUUID().toString());
|
||||
quot.setQuotCode(IdUtils.createNo("BJD_",2));
|
||||
quot.setCreateBy(getUsername());
|
||||
redBookService.insertOAQuot(quot);
|
||||
return success();
|
||||
|
||||
List<OAQuotProduct> list = quot.getSelectedResultData();
|
||||
|
||||
excelUtil.exportExcel(response, list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取调价日期
|
||||
* @param oAQuot
|
||||
|
|
|
@ -0,0 +1,323 @@
|
|||
package com.ruoyi.web.controller.redBook;
|
||||
|
||||
import com.ruoyi.redBook.domain.OAQuotProduct;
|
||||
import jxl.HeaderFooter;
|
||||
import jxl.Workbook;
|
||||
import jxl.format.Alignment;
|
||||
import jxl.format.Border;
|
||||
import jxl.format.BorderLineStyle;
|
||||
import jxl.format.VerticalAlignment;
|
||||
import jxl.write.*;
|
||||
import jxl.write.Number;
|
||||
import jxl.write.biff.RowsExceededException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class excelUtil {
|
||||
|
||||
public static void exportExcel(HttpServletResponse response, List<OAQuotProduct> list){
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
BigDecimal totalmoney = BigDecimal.ZERO;
|
||||
try {
|
||||
/*Date now = new Date();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMddss");//
|
||||
String sNow = dateFormat.format(now);
|
||||
String fileName = "BJD_" + sNow;
|
||||
|
||||
// 生成文件名
|
||||
response.addHeader("Content-Disposition",
|
||||
"attachment; filename=\"" + fileName + ".xls" + "\"");*/
|
||||
OutputStream os = response.getOutputStream();
|
||||
WritableWorkbook wwb = Workbook.createWorkbook(os);
|
||||
|
||||
// 新建一张表
|
||||
WritableSheet wsheet = wwb.createSheet("报价单", 0);
|
||||
Label label = new Label(0, 0, "");
|
||||
int i= 0;
|
||||
//设置单头
|
||||
WritableFont wf_merge = new WritableFont(WritableFont.ARIAL,16,WritableFont.BOLD,false);
|
||||
WritableCellFormat wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setAlignment(Alignment.CENTRE);
|
||||
wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE);
|
||||
//wff_merge.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
|
||||
wsheet.mergeCells(0,i,7,i);
|
||||
wsheet.setRowView(i,600);
|
||||
label = new Label(0, i, "无 锡 江 南 电 缆 有 限 公 司",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
i++;
|
||||
|
||||
wf_merge = new WritableFont(WritableFont.ARIAL,15,WritableFont.BOLD,false);
|
||||
wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setAlignment(Alignment.CENTRE);
|
||||
wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE);
|
||||
wsheet.mergeCells(0,i,7,i);
|
||||
wsheet.setRowView(i,600);
|
||||
label = new Label(0, i, "WUXI JIANGNAN CABLE CO.,LTD.",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
i++;
|
||||
//
|
||||
wsheet.mergeCells(0,i,7,i);
|
||||
wsheet.setRowView(i,500);
|
||||
wf_merge = new WritableFont(WritableFont.ARIAL,15,WritableFont.NO_BOLD,false);
|
||||
wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE);
|
||||
//wff_merge.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
|
||||
wff_merge.setAlignment(Alignment.CENTRE);
|
||||
label = new Label(0, i, "产品报价单",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
i++;
|
||||
//
|
||||
wsheet.mergeCells(0,i,7,i);
|
||||
wsheet.setRowView(i,500);
|
||||
wf_merge = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false);
|
||||
wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setAlignment(Alignment.CENTRE);
|
||||
wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE);
|
||||
label = new Label(0, i, "中国线缆行业十强 中国制造业企业500强 中国民营企业500强 全国用户满意标杆企业",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
i++;
|
||||
//报价信息
|
||||
wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false);
|
||||
wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setAlignment(Alignment.LEFT);
|
||||
wsheet.setRowView(i,380);
|
||||
String[] bjs = {"询价单位:","业务联系人:","项目名称:","联 系 电 话:","询价日期:","编 制:","报价日期:","审 核:"};
|
||||
int k=0;
|
||||
while(k<bjs.length){
|
||||
wsheet.mergeCells(0,i,3,i);
|
||||
label = new Label(0, i, bjs[k],wff_merge);
|
||||
wsheet.setRowView(i,450);
|
||||
k++;
|
||||
wsheet.addCell(label);
|
||||
wsheet.mergeCells(4,i,7,i);
|
||||
label = new Label(4, i, bjs[k],wff_merge);
|
||||
k++;
|
||||
wsheet.addCell(label);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
wsheet.mergeCells(0,i,7,i);
|
||||
wsheet.setRowView(i,380);
|
||||
label = new Label(0, i, "非常感谢您对本公司的信任与支持!有关产品的报价清单如下:",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
i++;
|
||||
|
||||
//产品信息
|
||||
wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.BOLD,false);
|
||||
wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setAlignment(Alignment.CENTRE);
|
||||
wff_merge.setBorder(Border.ALL, BorderLineStyle.THIN);
|
||||
wsheet.setRowView(i,400);
|
||||
label = new Label(0, i, "序号",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(1, i, "产品型号",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(2, i, "规格",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(3, i, "电压",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(4, i, "单位",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(5, i, "数量",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(6, i, "单价(元)",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(7, i, "金额(元)",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
// 列宽
|
||||
wsheet.setColumnView(0, 7);
|
||||
wsheet.setColumnView(1, 16);
|
||||
wsheet.setColumnView(2, 18);
|
||||
wsheet.setColumnView(3, 10);
|
||||
wsheet.setColumnView(4, 7);
|
||||
wsheet.setColumnView(5, 10);
|
||||
wsheet.setColumnView(6, 14);
|
||||
wsheet.setColumnView(7, 15);
|
||||
wsheet.setColumnView(9, 20);
|
||||
i++;
|
||||
//数据
|
||||
Number labelN = new Number(0,0,0);
|
||||
WritableCellFormat cellFormat=new WritableCellFormat();
|
||||
cellFormat.setAlignment(Alignment.LEFT);
|
||||
cellFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
|
||||
|
||||
WritableCellFormat cellFormat2=new WritableCellFormat();
|
||||
cellFormat2.setAlignment(Alignment.CENTRE);
|
||||
cellFormat2.setBorder(Border.NONE, BorderLineStyle.THIN);
|
||||
|
||||
int j=1;
|
||||
|
||||
for(Iterator<OAQuotProduct> it = list.iterator(); it.hasNext();)
|
||||
{
|
||||
OAQuotProduct s = it.next();
|
||||
wsheet.setRowView(i,400);
|
||||
labelN = new Number(0, i,j,wff_merge);
|
||||
labelN.setCellFormat(cellFormat);
|
||||
wsheet.addCell(labelN);
|
||||
label = new Label(1, i, s.getName_1(),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(2, i, s.getSpec(),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(3,i,s.getVoltage(),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(4,i,s.getStu(),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(5,i,"1",wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(6, i, String.valueOf(s.getSetPrice()),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(7, i, String.valueOf(s.getAllPrice()),wff_merge);
|
||||
|
||||
totalmoney = totalmoney.add(s.getAllPrice());
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
|
||||
label = new Label(9, i, s.getName_0(),wff_merge);
|
||||
label.setCellFormat(cellFormat2);
|
||||
wsheet.addCell(label);
|
||||
|
||||
if(j>2000)
|
||||
break; //200改为2000
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
|
||||
if(list.size()<=2000)
|
||||
{
|
||||
wsheet.mergeCells(1,i,6,i);
|
||||
wsheet.setRowView(i,400);
|
||||
wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false);
|
||||
wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setAlignment(Alignment.LEFT);
|
||||
wff_merge.setBorder(Border.ALL, BorderLineStyle.THIN);
|
||||
label = new Label(0, i, "",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(1, i, " 合计(元):",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(7, i, " "+totalmoney,wff_merge);
|
||||
wsheet.addCell(label);
|
||||
i++;
|
||||
}
|
||||
|
||||
wsheet.setRowView(i,390);
|
||||
wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false);
|
||||
wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setAlignment(Alignment.LEFT);
|
||||
wff_merge.setBorder(Border.RIGHT, BorderLineStyle.THIN);
|
||||
wsheet.mergeCells(1,i,7,i);
|
||||
label = new Label(1, i, "1、请审核报价单,如数量有误,价格以单价为准,如型号规格或产品工艺不符,需重新报价;",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
i++;
|
||||
wsheet.setRowView(i,390);
|
||||
wsheet.mergeCells(1,i,7,i);
|
||||
label = new Label(1, i, "2、本报价为含税、含运费价,此价为即时参考价,具体单价因考虑付款等因素以签订合同为准;",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
i++;
|
||||
wsheet.setRowView(i,390);
|
||||
wsheet.mergeCells(1,i,7,i);
|
||||
label = new Label(1, i, "报价为国内报价,如需出口,须提供相应信息另行报价; ",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
i++;
|
||||
wsheet.setRowView(i,390);
|
||||
wsheet.mergeCells(1,i,7,i);
|
||||
|
||||
wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false);
|
||||
wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setAlignment(Alignment.LEFT);
|
||||
wff_merge.setBorder(Border.BOTTOM, BorderLineStyle.THIN);
|
||||
wff_merge.setBorder(Border.RIGHT, BorderLineStyle.THIN);
|
||||
|
||||
label = new Label(1, i, "3、分支电缆为多芯分支价格,不包其它附件,不含安装费,数量以供方实际测量为准;",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
/*i++;
|
||||
wsheet.setRowView(i,390);
|
||||
wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false);
|
||||
wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setAlignment(jxl.format.Alignment.LEFT);
|
||||
wff_merge.setBorder(jxl.format.Border.BOTTOM,jxl.format.BorderLineStyle.THIN);
|
||||
wff_merge.setBorder(jxl.format.Border.RIGHT,jxl.format.BorderLineStyle.THIN);
|
||||
wsheet.mergeCells(1,i,7,i);
|
||||
// label = new Label(1, i, "4、产品交货总数和单根交货长度允许有±1%公差,如有不符对方要求,需重制作报价单。",wff_merge);
|
||||
wsheet.addCell(label);*/
|
||||
|
||||
wsheet.mergeCells(0,i-4,0,i);
|
||||
wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false);
|
||||
wff_merge = new WritableCellFormat(wf_merge);
|
||||
wff_merge.setAlignment(Alignment.CENTRE);
|
||||
wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE);
|
||||
wff_merge.setBorder(Border.ALL, BorderLineStyle.THIN);
|
||||
label = new Label(0, i-4, "备注",wff_merge);
|
||||
wsheet.addCell(label);
|
||||
|
||||
// 获取当前类加载器
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
// 获取资源的URL
|
||||
URL resourceUrl = classLoader.getResource("jnlogo.png");
|
||||
File file=new File(resourceUrl.getPath());
|
||||
//设置图片位置,前两个参数为插入图片的单元格坐标,后面是设置从插入的单元格开始横向和纵向分别要占用的单元格个数,最后传入图片文件
|
||||
WritableImage image=new WritableImage(0.3, 0.2, 1.25, 2.55,file);
|
||||
wsheet.addImage(image);
|
||||
|
||||
// 获取当前类加载器
|
||||
ClassLoader classLoader2 = Thread.currentThread().getContextClassLoader();
|
||||
// 获取资源的URL
|
||||
URL resourceUrl2 = classLoader2.getResource("wc.png");
|
||||
file=new File(resourceUrl2.getPath());
|
||||
//设置图片位置,前两个参数为插入图片的单元格坐标,后面是设置从插入的单元格开始横向和纵向分别要占用的单元格个数,最后传入图片文件
|
||||
image=new WritableImage(6.7, 0.2, 1.20, 2.65,file);
|
||||
wsheet.addImage(image);
|
||||
|
||||
wsheet.getSettings().setBottomMargin(0.7d);
|
||||
wsheet.getSettings().setTopMargin(0.7d);
|
||||
wsheet.getSettings().setLeftMargin(0.6d);
|
||||
wsheet.getSettings().setRightMargin(0.2d);
|
||||
|
||||
HeaderFooter footer = new HeaderFooter();
|
||||
footer.getCentre().append("第 ");
|
||||
footer.getCentre().appendPageNumber();
|
||||
footer.getCentre().append(" 页,共 ");
|
||||
footer.getCentre().appendTotalPages();
|
||||
footer.getCentre().append(" 页 ");
|
||||
footer.getCentre().setFontName("ARIAL");
|
||||
footer.getCentre().setFontSize(13);
|
||||
wsheet.getSettings().setFooter(footer);
|
||||
|
||||
|
||||
wsheet.getSettings().setPrintTitles(0, 8, 0, 7);
|
||||
|
||||
|
||||
|
||||
wwb.write();
|
||||
|
||||
wwb.close();
|
||||
os.close();
|
||||
response.flushBuffer();
|
||||
|
||||
|
||||
} catch (RowsExceededException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (WriteException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
|
@ -4,7 +4,8 @@ import java.math.BigDecimal;
|
|||
|
||||
public class OAQuotProduct {
|
||||
private String uid_0;//版本uid
|
||||
private String name_0;//型号
|
||||
private String name_0;//产品型号
|
||||
private String name_1;//型号
|
||||
private String spec;//规格
|
||||
private String voltage;//电压
|
||||
private String stu;//单位
|
||||
|
@ -14,6 +15,9 @@ public class OAQuotProduct {
|
|||
private String quot_product_id;//id
|
||||
private String quot_id;//报价单id
|
||||
|
||||
private BigDecimal per;//一次折扣
|
||||
private BigDecimal per2;//二次折扣
|
||||
|
||||
public String getUid_0() { return uid_0; }
|
||||
|
||||
public void setUid_0(String uid_0) { this.uid_0 = uid_0; }
|
||||
|
@ -26,6 +30,10 @@ public class OAQuotProduct {
|
|||
this.name_0 = name_0;
|
||||
}
|
||||
|
||||
public String getName_1() { return name_1; }
|
||||
|
||||
public void setName_1(String name_1) { this.name_1 = name_1; }
|
||||
|
||||
public String getSpec() {
|
||||
return spec;
|
||||
}
|
||||
|
@ -69,4 +77,12 @@ public class OAQuotProduct {
|
|||
public String getQuot_id() { return quot_id; }
|
||||
|
||||
public void setQuot_id(String quot_id) { this.quot_id = quot_id; }
|
||||
|
||||
public BigDecimal getPer() { return per; }
|
||||
|
||||
public void setPer(BigDecimal per) { this.per = per; }
|
||||
|
||||
public BigDecimal getPer2() { return per2; }
|
||||
|
||||
public void setPer2(BigDecimal per2) { this.per2 = per2; }
|
||||
}
|
||||
|
|
|
@ -105,9 +105,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</insert>
|
||||
|
||||
<insert id="batchOAQuotProduct">
|
||||
insert into OAQuotProduct(quot_product_id, name_0, spec, voltage,stu,setPrice,count,allPrice,quot_id) values
|
||||
insert into OAQuotProduct(quot_product_id, name_0, spec, voltage,stu,setPrice,count,allPrice,per,per2,quot_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.quot_product_id}, #{item.name_0}, #{item.spec}, #{item.voltage}, #{item.stu},cast(#{item.setPrice,jdbcType=DECIMAL} as decimal(18,2)), cast(#{item.count,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.allPrice,jdbcType=DECIMAL} as decimal(18,2)), #{item.quot_id})
|
||||
( #{item.quot_product_id}, #{item.name_0}, #{item.spec}, #{item.voltage}, #{item.stu},cast(#{item.setPrice,jdbcType=DECIMAL} as decimal(18,2)), cast(#{item.count,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.allPrice,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.per,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.per2,jdbcType=DECIMAL} as decimal(18,2)), #{item.quot_id})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
@ -122,14 +122,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="queryRedBPriceByParams" resultType="OAQuotProduct">
|
||||
SELECT a.红本价格 AS setPrice, a.namevoltage AS name_0, a.规格 AS spec, a.电压等级 AS voltage
|
||||
FROM rb_productbase_price a
|
||||
FROM rb_product_price a
|
||||
JOIN (VALUES
|
||||
<foreach collection="params" item="param" open="(" separator="),(" close=")">
|
||||
#{param.uid_0}, #{param.name_0}, #{param.spec}, #{param.voltage}
|
||||
</foreach>
|
||||
) AS v(version_uid_0,型号, 规格, 电压等级)
|
||||
) AS v(version_uid_0,产品型号, 规格, 电压等级)
|
||||
ON a.version_uid_0 = v.version_uid_0
|
||||
AND a.namevoltage = v.型号
|
||||
AND a.namevoltage = v.产品型号
|
||||
AND a.规格 = v.规格
|
||||
AND a.电压等级 = v.电压等级
|
||||
</select>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import request from '@/utils/request'
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
// 金额计算
|
||||
export function toDecimal(x){
|
||||
|
@ -105,6 +106,10 @@ export function madeQuot(data) {
|
|||
return request({
|
||||
url: '/redBook/redBook/madeQuot',
|
||||
method: 'post',
|
||||
responseType: "blob", // 表明返回服务器返回的数据类型
|
||||
headers: {
|
||||
'X-Authorization': getToken()
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
|
||||
<el-table width="100%" v-loading="searchResultLoading" ref="searchResultTable" :data="searchResultPagedData" @row-dblclick="handleRowDblclick">
|
||||
<el-table-column label="版本uid" align="center" prop="uid_0" v-if="false"/>
|
||||
<el-table-column label="型号" align="center" prop="name_0" width="180"/>
|
||||
<el-table-column label="产品型号" align="center" prop="name_0" width="180"/>
|
||||
<el-table-column label="型号" align="center" prop="model" width="180" v-if="false"/>
|
||||
<el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/>
|
||||
<el-table-column label="电压" align="center" prop="voltage"/>
|
||||
<el-table-column label="红本价(元)" align="center" prop="price"/>
|
||||
|
@ -71,30 +72,31 @@
|
|||
<el-card id="scroll" class="box-card scrollable" :style="{'overflow': 'auto','max-height': scrollableHeight,'height': scrollableHeight}">
|
||||
<el-row :gutter="8">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="询价单位" prop="cusCode">
|
||||
<el-form-item label="询价单位" prop="quotCustomer">
|
||||
<el-input v-model="form.quotCustomer" placeholder="请输入询价单位" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目名称" prop="cusSapCode">
|
||||
<el-form-item label="项目名称" prop="quotProject">
|
||||
<el-input v-model="form.quotProject" placeholder="请输入项目名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="8">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系人" prop="cusCode">
|
||||
<el-form-item label="联系人" prop="quotLxr">
|
||||
<el-input v-model="form.quotLxr" placeholder="请输入业务联系人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系电话" prop="cusSapCode">
|
||||
<el-form-item label="联系电话" prop="quotLxrdh">
|
||||
<el-input v-model="form.quotLxrdh" placeholder="请输入联系电话"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<span>批量调折扣率:
|
||||
<el-row :gutter="8">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="批量调折扣率" label-width="100px">
|
||||
<el-input style="width:10%" v-model="perc" size="small" @blur="changeData"></el-input>
|
||||
<el-input style="width:10%;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input>
|
||||
总价:<span style="color:red">{{sumSelectedResultData}}</span>
|
||||
|
@ -107,7 +109,10 @@
|
|||
@click.native="selectRbDate(item.value)"
|
||||
/>
|
||||
</el-select>
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="selectedResultLoading" width="100%;" :height="tableHeight" :row-class-name="selectedResultIndex" style="margin-top:5px" ref="selectedResultTable" :data="selectedResultData">
|
||||
<el-table-column fixed="left" label="" align="center" prop="index" width="50"/>
|
||||
<el-table-column fixed="left" label="操作" align="center" width="60" class-name="small-padding fixed-width">
|
||||
|
@ -116,19 +121,20 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="版本uid" align="center" prop="uid_0" v-if="false"/>
|
||||
<el-table-column fixed="left" label="型号" align="center" prop="name_0" width="180"/>
|
||||
<el-table-column fixed="left" label="产品型号" align="center" prop="name_0"/>
|
||||
<el-table-column label="型号" align="center" prop="name_1" width="180" v-if="false"/>
|
||||
<el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/>
|
||||
<el-table-column label="电压" align="center" prop="voltage" width="80"/>
|
||||
<el-table-column label="红本价(元)" align="center" prop="price" width="100"/>
|
||||
<el-table-column label="单位" align="center" prop="stu" width="50"/>
|
||||
<el-table-column label="一次折扣" align="center" prop="percent" width="80">
|
||||
<el-table-column label="一次折扣" align="center" prop="per" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.percent" @blur="changeRowData"/>
|
||||
<el-input v-model="scope.row.per" @blur="changeRowData"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="二次折扣" align="center" prop="percent2" width="80">
|
||||
<el-table-column label="二次折扣" align="center" prop="per2" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.percent2" @blur="changeRowData"/>
|
||||
<el-input v-model="scope.row.per2" @blur="changeRowData"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" align="center" prop="setPrice" width="80"/>
|
||||
|
@ -137,7 +143,7 @@
|
|||
<el-input v-model="scope.row.count" @blur="changeRowData"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总价" align="center" prop="allPrice"/>
|
||||
<el-table-column label="总价" align="center" prop="allPrice" width="80"/>
|
||||
</el-table>
|
||||
<!--<pagination
|
||||
v-show="selectedResultTotal>0"
|
||||
|
@ -265,7 +271,7 @@
|
|||
/*设置内容高度*/
|
||||
this.scrollableHeight = (window.innerHeight - 160) + 'px';
|
||||
/*设置已选择结果表格高度*/
|
||||
this.tableHeight = (window.innerHeight - 350) + 'px';
|
||||
this.tableHeight = (window.innerHeight - 380) + 'px';
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
@ -482,25 +488,27 @@
|
|||
handleRowDblclick(row, event, column) {
|
||||
const uid_0 = row.uid_0;
|
||||
const name_0 = row.name_0;
|
||||
const model = row.model;
|
||||
const spec = row.spec;
|
||||
const voltage = row.voltage;
|
||||
const price = row.price;
|
||||
const stu = row.stu;
|
||||
const percent = '0.8';
|
||||
const percent2 = '';
|
||||
const per = '0.8';
|
||||
const per2 = '';
|
||||
const count = '1';
|
||||
const setPrice = toDecimal(price * percent);
|
||||
const setPrice = toDecimal(price * per);
|
||||
const allPrice = toDecimal(count * setPrice);
|
||||
|
||||
const rowDate = {
|
||||
uid_0: uid_0,
|
||||
name_0: name_0,
|
||||
name_1: model,
|
||||
spec: spec,
|
||||
voltage: voltage,
|
||||
price: price,
|
||||
stu: stu,
|
||||
percent: percent,
|
||||
percent2: percent2,
|
||||
per: per,
|
||||
per2: per2,
|
||||
setPrice: setPrice,
|
||||
count: count,
|
||||
allPrice: allPrice
|
||||
|
@ -592,8 +600,8 @@
|
|||
// 进行其他计算
|
||||
this.$set(this.selectedResultData, index, {
|
||||
...row,
|
||||
percent: this.perc,
|
||||
percent2: this.perc2,
|
||||
per: this.perc,
|
||||
per2: this.perc2,
|
||||
setPrice: toDecimal(row.price * (this.perc?this.perc:1) * (this.perc2?this.perc2:1)),
|
||||
allPrice: toDecimal(row.count * row.price * (this.perc?this.perc:1) * (this.perc2?this.perc2:1)),
|
||||
});
|
||||
|
@ -606,8 +614,8 @@
|
|||
// 进行其他计算
|
||||
this.$set(this.selectedResultData, index, {
|
||||
...row,
|
||||
setPrice: toDecimal(row.price * (row.percent?row.percent:1) * (row.percent2?row.percent2:1)),
|
||||
allPrice: toDecimal(row.count * row.price * (row.percent?row.percent:1) * (row.percent2?row.percent2:1)),
|
||||
setPrice: toDecimal(row.price * (row.per?row.per:1) * (row.per2?row.per2:1)),
|
||||
allPrice: toDecimal(row.count * row.price * (row.per?row.per:1) * (row.per2?row.per2:1)),
|
||||
});
|
||||
})
|
||||
},
|
||||
|
@ -621,7 +629,25 @@
|
|||
this.form.selectedResultData = this.selectedResultData;
|
||||
madeQuot(this.form).then(response => {
|
||||
this.$modal.msgSuccess("生成报价单成功");
|
||||
|
||||
// 处理返回的文件流
|
||||
const content = response;
|
||||
const blob = new Blob([content]);
|
||||
const fileName = "BJD_"+this.getTodayCourse()+".xls";
|
||||
if ("download" in document.createElement("a")) {
|
||||
// 非IE下载
|
||||
const elink = document.createElement("a");
|
||||
elink.download = fileName;
|
||||
elink.style.display = "none";
|
||||
elink.href = URL.createObjectURL(blob);
|
||||
document.body.appendChild(elink);
|
||||
elink.click();
|
||||
URL.revokeObjectURL(elink.href); // 释放URL 对象
|
||||
document.body.removeChild(elink);
|
||||
}
|
||||
else {
|
||||
// IE10+下载
|
||||
navigator.msSaveBlob(blob, fileName);
|
||||
}
|
||||
});
|
||||
},
|
||||
//获取调价日期
|
||||
|
@ -640,6 +666,7 @@
|
|||
});
|
||||
});
|
||||
this.selectedResultLoading = true;
|
||||
//更新已选结果数据-单价、金额
|
||||
updateSelectedResultData(this.selectedResultData).then(response => {
|
||||
for (let i = 0; i < this.selectedResultData.length; i++) {
|
||||
for (let j = 0; j < response.data.length; j++) {
|
||||
|
@ -650,8 +677,8 @@
|
|||
this.selectedResultData[i].voltage === response.data[j].voltage
|
||||
) {
|
||||
this.selectedResultData[i].price = response.data[j].setPrice;
|
||||
const setPrice = toDecimal(this.selectedResultData[i].price * (this.selectedResultData[i].percent?this.selectedResultData[i].percent:1) * (this.selectedResultData[i].percent2?this.selectedResultData[i].percent2:1));
|
||||
const allPrice = toDecimal(this.selectedResultData[i].count * this.selectedResultData[i].price * (this.selectedResultData[i].percent?this.selectedResultData[i].percent:1) * (this.selectedResultData[i].percent2?this.selectedResultData[i].percent2:1));
|
||||
const setPrice = toDecimal(this.selectedResultData[i].price * (this.selectedResultData[i].per?this.selectedResultData[i].per:1) * (this.selectedResultData[i].per2?this.selectedResultData[i].per2:1));
|
||||
const allPrice = toDecimal(this.selectedResultData[i].count * this.selectedResultData[i].price * (this.selectedResultData[i].per?this.selectedResultData[i].per:1) * (this.selectedResultData[i].per2?this.selectedResultData[i].per2:1));
|
||||
|
||||
this.selectedResultData[i].setPrice = setPrice;
|
||||
this.selectedResultData[i].allPrice = allPrice;
|
||||
|
@ -660,8 +687,27 @@
|
|||
}
|
||||
this.selectedResultLoading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取当前时间
|
||||
getTodayCourse(){
|
||||
const myDate = new Date();
|
||||
//获取当前年
|
||||
const year = myDate.getFullYear();
|
||||
//获取当前月
|
||||
const month = myDate.getMonth() + 1;
|
||||
//获取当前日
|
||||
const date = myDate.getDate();
|
||||
const h = myDate.getHours(); //获取当前小时数(0-23)
|
||||
const m = myDate.getMinutes(); //获取当前分钟数(0-59)
|
||||
const s = myDate.getSeconds();
|
||||
return year + '-' + this.p(month) + "-" + this.p(date) + " " + this.p(h) + ':' + this.p(m) + ":" + this.p(s)
|
||||
},
|
||||
p(s) {
|
||||
return s < 10 ? '0' + s : s;
|
||||
},
|
||||
},
|
||||
|
||||
updated(){
|
||||
// 监听数据变化时,滚动条保持在底部
|
||||
let div = document.getElementById("scroll")
|
||||
|
|
Loading…
Reference in New Issue