'123'
This commit is contained in:
parent
dab6735b7d
commit
d8d2f3a6b0
|
@ -4,14 +4,12 @@ import java.util.List;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.constant.WebsocketConst;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.MinioUtil;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.ruoyi.customer.domain.Customer;
|
||||
import com.ruoyi.priceVerification.domain.QuotHj;
|
||||
import com.ruoyi.priceVerification.service.IQuotHjService;
|
||||
import com.ruoyi.quot.domain.QuotFile;
|
||||
|
@ -22,6 +20,7 @@ import com.ruoyi.technicalConfirm.domain.QuotJsqr;
|
|||
import com.ruoyi.technicalConfirm.service.IQuotJsqrService;
|
||||
import com.ruoyi.web.utils.IdUtils;
|
||||
import com.ruoyi.web.utils.SendNotice.NoticeUtil;
|
||||
import com.ruoyi.web.utils.rbExcel.excelUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -95,6 +94,7 @@ public class QuotController extends BaseController
|
|||
public AjaxResult changQuotPrintStatus(@RequestBody Quot quot)
|
||||
{
|
||||
quot.setQuotPrintUserName(getUsername());
|
||||
quot.setUpdateTime(DateUtils.getNowDate());
|
||||
return toAjax(quotService.changQuotPrintStatus(quot));
|
||||
}
|
||||
|
||||
|
@ -455,6 +455,19 @@ public class QuotController extends BaseController
|
|||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 报价单生成
|
||||
* @param quot
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "报价单生成", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/madeQuot")
|
||||
public void madeQuot(HttpServletResponse response, @RequestBody Quot quot)
|
||||
{
|
||||
List<QuotMaterial> list = quot.getQuotMaterialList();
|
||||
excelUtil.exportQuotExcel(response,quot,list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报价组驳回
|
||||
*/
|
||||
|
|
|
@ -18,9 +18,9 @@ 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.rbExcel.excelUtil;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
|
@ -203,7 +203,7 @@ public class RedBookController extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* 报价单生成
|
||||
* 保存红本报价单
|
||||
* @param quot
|
||||
* @return
|
||||
*/
|
||||
|
@ -244,7 +244,7 @@ public class RedBookController extends BaseController
|
|||
* @return
|
||||
*/
|
||||
@DataSource(DataSourceType.MASTER)
|
||||
@Log(title = "报价单生成", businessType = BusinessType.OTHER)
|
||||
@Log(title = "电子红本报价单生成", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/madeQuot")
|
||||
public void madeQuot(HttpServletResponse response, @RequestBody OAQuot quot)
|
||||
{
|
||||
|
@ -257,7 +257,6 @@ public class RedBookController extends BaseController
|
|||
excelUtil.exportExcel(response,quot,list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取调价日期
|
||||
* @param oAQuot
|
||||
|
|
|
@ -1,324 +0,0 @@
|
|||
package com.ruoyi.web.controller.redBook;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.redBook.domain.OAQuot;
|
||||
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.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class excelUtil {
|
||||
|
||||
public static void exportExcel(HttpServletResponse response, OAQuot quot, List<OAQuotProduct> list){
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
BigDecimal totalmoney = BigDecimal.ZERO;
|
||||
try {
|
||||
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 QuotCustomer = quot.getQuotCustomer();
|
||||
QuotCustomer = StringUtils.isEmpty(QuotCustomer)?"":QuotCustomer;
|
||||
String QuotProject = quot.getQuotProject();
|
||||
QuotProject = StringUtils.isEmpty(QuotProject)?"":QuotProject;
|
||||
String QuotLxr = quot.getQuotLxr();
|
||||
QuotLxr = StringUtils.isEmpty(QuotLxr)?"":QuotLxr;
|
||||
String QuotLxrdh = quot.getQuotLxrdh();
|
||||
QuotLxrdh = StringUtils.isEmpty(QuotLxrdh)?"":QuotLxrdh;
|
||||
|
||||
String[] bjs = {"询价单位:"+QuotCustomer,"业务联系人:"+QuotLxr,"项目名称:"+QuotProject,"联 系 电 话:"+QuotLxrdh,"询价日期:","编 制:","报价日期:","审 核:"};
|
||||
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(0,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(0, 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-3,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-3, "备注",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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,649 @@
|
|||
package com.ruoyi.web.utils.rbExcel;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.quot.domain.Quot;
|
||||
import com.ruoyi.quot.domain.QuotMaterial;
|
||||
import com.ruoyi.redBook.domain.OAQuot;
|
||||
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.Number;
|
||||
import jxl.write.*;
|
||||
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.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报价单生成工具
|
||||
*/
|
||||
public class excelUtil {
|
||||
|
||||
/**
|
||||
* 电子红本报价单生成
|
||||
* @param response
|
||||
* @param quot
|
||||
* @param list
|
||||
*/
|
||||
public static void exportExcel(HttpServletResponse response, OAQuot quot, List<OAQuotProduct> list){
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
BigDecimal totalmoney = BigDecimal.ZERO;
|
||||
try {
|
||||
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 QuotCustomer = quot.getQuotCustomer();
|
||||
QuotCustomer = StringUtils.isEmpty(QuotCustomer)?"":QuotCustomer;
|
||||
String QuotProject = quot.getQuotProject();
|
||||
QuotProject = StringUtils.isEmpty(QuotProject)?"":QuotProject;
|
||||
String QuotLxr = quot.getQuotLxr();
|
||||
QuotLxr = StringUtils.isEmpty(QuotLxr)?"":QuotLxr;
|
||||
String QuotLxrdh = quot.getQuotLxrdh();
|
||||
QuotLxrdh = StringUtils.isEmpty(QuotLxrdh)?"":QuotLxrdh;
|
||||
|
||||
String[] bjs = {"询价单位:"+QuotCustomer,"业务联系人:"+QuotLxr,"项目名称:"+QuotProject,"联 系 电 话:"+QuotLxrdh,"询价日期:","编 制:","报价日期:","审 核:"};
|
||||
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, String.valueOf(s.getCount()),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(0,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(0, 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-3,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-3, "备注",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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 报价单生成
|
||||
* @param response
|
||||
* @param quot
|
||||
* @param list
|
||||
*/
|
||||
public static void exportQuotExcel(HttpServletResponse response, Quot quot, List<QuotMaterial> list){
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
BigDecimal totalmoney = BigDecimal.ZERO;
|
||||
try {
|
||||
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 QuotCustomer = quot.getQuotCustomerName();//客户
|
||||
String QuotProject = quot.getQuotProject();//项目
|
||||
String QuotLxr = quot.getQuotContacts();//联系人
|
||||
QuotLxr = StringUtils.isEmpty(QuotLxr)?"":QuotLxr;
|
||||
String QuotLxrdh = quot.getQuotPhone();//联系电话
|
||||
QuotLxrdh = StringUtils.isEmpty(QuotLxrdh)?"":QuotLxrdh;
|
||||
String QuotXjrq = DateUtils.dateTime(quot.getQuotInquiryDate());//询价日期
|
||||
String QuotBjrq = DateUtils.dateTime(new Date());//报价日期
|
||||
|
||||
String[] bjs = {"询价单位:"+QuotCustomer,"业务联系人:"+QuotLxr,"项目名称:"+QuotProject,"联 系 电 话:"+QuotLxrdh,"询价日期:"+QuotXjrq,"编 制:","报价日期:"+QuotBjrq,"审 核:"};
|
||||
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<QuotMaterial> it = list.iterator(); it.hasNext();)
|
||||
{
|
||||
QuotMaterial 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.getMatXingh(),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(2, i, s.getMatGuig(),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(3,i,s.getMatDiany(),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(4,i,s.getMatDanw(),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
label = new Label(5,i,String.valueOf(s.getMatSl()),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
|
||||
BigDecimal matQuotPrice = s.getMatQuotPrice();
|
||||
matQuotPrice = matQuotPrice==null?BigDecimal.ZERO:matQuotPrice;
|
||||
label = new Label(6, i, String.valueOf(matQuotPrice),wff_merge);
|
||||
label.setCellFormat(cellFormat);
|
||||
wsheet.addCell(label);
|
||||
|
||||
BigDecimal matQuotAllPrice = s.getMatQuotAllPrice();
|
||||
matQuotAllPrice = matQuotAllPrice==null?BigDecimal.ZERO:matQuotAllPrice;
|
||||
label = new Label(7, i, String.valueOf(matQuotAllPrice),wff_merge);
|
||||
|
||||
totalmoney = totalmoney.add(matQuotAllPrice);
|
||||
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(0,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(0, 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-3,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-3, "备注",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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -49,6 +49,8 @@ public class Quot extends BaseEntity
|
|||
/** 地址 */
|
||||
private String quotAddress;
|
||||
|
||||
/** 联系人 */
|
||||
private String quotContacts;
|
||||
/** 联系电话 */
|
||||
private String quotPhone;
|
||||
|
||||
|
@ -216,6 +218,9 @@ public class Quot extends BaseEntity
|
|||
{
|
||||
return quotAddress;
|
||||
}
|
||||
public String getQuotContacts() { return quotContacts; }
|
||||
|
||||
public void setQuotContacts(String quotContacts) { this.quotContacts = quotContacts; }
|
||||
public void setQuotPhone(String quotPhone)
|
||||
{
|
||||
this.quotPhone = quotPhone;
|
||||
|
|
|
@ -47,6 +47,22 @@ public class QuotMaterial extends BaseEntity
|
|||
@Excel(name = "备注")
|
||||
private String matRemark;
|
||||
|
||||
/** 料价 */
|
||||
private BigDecimal matMatprice;
|
||||
|
||||
/** 红本价 */
|
||||
private BigDecimal matPrice;
|
||||
|
||||
/** 报价 */
|
||||
private BigDecimal matQuotPrice;
|
||||
|
||||
/** 报价金额 */
|
||||
private BigDecimal matQuotAllPrice;
|
||||
|
||||
/** 料价价差率 */
|
||||
private String matMatpriceDiff;
|
||||
|
||||
|
||||
/** */
|
||||
private String quotId;
|
||||
|
||||
|
@ -110,6 +126,21 @@ public class QuotMaterial extends BaseEntity
|
|||
public String getMatRemark() { return matRemark; }
|
||||
|
||||
public void setMatRemark(String matRemark) { this.matRemark = matRemark; }
|
||||
public BigDecimal getMatMatprice() { return matMatprice; }
|
||||
|
||||
public void setMatMatprice(BigDecimal matMatprice) { this.matMatprice = matMatprice; }
|
||||
public BigDecimal getMatPrice() { return matPrice; }
|
||||
|
||||
public void setMatPrice(BigDecimal matPrice) { this.matPrice = matPrice; }
|
||||
public BigDecimal getMatQuotPrice() { return matQuotPrice; }
|
||||
|
||||
public void setMatQuotPrice(BigDecimal matQuotPrice) { this.matQuotPrice = matQuotPrice; }
|
||||
public BigDecimal getMatQuotAllPrice() { return matQuotAllPrice; }
|
||||
|
||||
public void setMatQuotAllPrice(BigDecimal matQuotAllPrice) { this.matQuotAllPrice = matQuotAllPrice; }
|
||||
public String getMatMatpriceDiff() { return matMatpriceDiff; }
|
||||
|
||||
public void setMatMatpriceDiff(String matMatpriceDiff) { this.matMatpriceDiff = matMatpriceDiff; }
|
||||
public void setQuotId(String quotId)
|
||||
{
|
||||
this.quotId = quotId;
|
||||
|
@ -119,17 +150,4 @@ public class QuotMaterial extends BaseEntity
|
|||
{
|
||||
return quotId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("matId", getMatId())
|
||||
.append("matXingh", getMatXingh())
|
||||
.append("matGuig", getMatGuig())
|
||||
.append("matDiany", getMatDiany())
|
||||
.append("matDanw", getMatDanw())
|
||||
.append("matSl", getMatSl())
|
||||
.append("quotId", getQuotId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public class QuotServiceImpl implements IQuotService
|
|||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
int batchSize = 200; // 每批次插入的数据量
|
||||
int batchSize = 100; // 每批次插入的数据量
|
||||
for (int i = 0; i < list.size(); i += batchSize) {
|
||||
int toIndex = Math.min(i + batchSize, list.size());
|
||||
List<QuotMaterial> subList = list.subList(i, toIndex);
|
||||
|
|
|
@ -126,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="selectQuotByQuotId" parameterType="String" resultMap="QuotQuotMaterialResult">
|
||||
select a.quot_id, a.quot_code, a.quot_salesman_code, a.quot_salesman_bm, a.quot_salesman_name, a.quot_customer_name,
|
||||
select a.quot_id, a.quot_code, a.quot_salesman_code, a.quot_salesman_bm, a.quot_salesman_name, a.quot_customer_bm,a.quot_customer_name,
|
||||
a.quot_salesman_dept_id, a.quot_salesman_dept_name, a.quot_address, a.quot_phone, a.quot_inquiry_date,
|
||||
a.quot_project, a.quot_quotation_date, a.quot_quotation_from, a.quot_quotation_require, a.quot_feedback_explanation,
|
||||
a.quot_quantity, a.quot_total_price, a.quot_check_user_name, u2.nick_name quot_check_user_nickname, a.quot_approval_status,
|
||||
|
@ -154,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where a.quot_id = #{quotId}
|
||||
</select>
|
||||
|
||||
<select id="checkExistQuot" parameterType="Quot" resultMap="QuotResult">
|
||||
<select id="checkExistQuot" parameterType="String" resultType="String">
|
||||
select count(1) from quot where quot_salesman_code != #{quotSalesmanCode}
|
||||
and quot_customer_bm = #{quotCustomerBm} and quot_project = #{quotProject}
|
||||
and quot_approval_status in ('1','2')
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import request from '@/utils/request'
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
// 打印状态修改
|
||||
export function changQuotPrintStatus(quotId, quotPrint) {
|
||||
|
@ -118,6 +119,19 @@ export function feedbackQuot(data) {
|
|||
})
|
||||
}
|
||||
|
||||
//生成报价单
|
||||
export function madeQuot(data) {
|
||||
return request({
|
||||
url: '/quot/quot/madeQuot',
|
||||
method: 'post',
|
||||
responseType: "blob", // 表明返回服务器返回的数据类型
|
||||
headers: {
|
||||
'X-Authorization': getToken()
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
//驳回按钮
|
||||
export function rejectQuot(data) {
|
||||
return request({
|
||||
|
|
|
@ -1285,6 +1285,7 @@
|
|||
<span v-hasPermi="['quot:quot:assist']"><el-button type="primary" plain @click="commitJsForm" v-if="this.form.quotApprovalStatus == '1'&&this.form.quotJsxzApprovalStatus == '0'">提交技术协助</el-button></span>
|
||||
<span style="margin-left: 10px" v-hasPermi="['quot:quot:assistHj']"><el-button type="primary" plain @click="commitHjForm" v-if="this.form.quotApprovalStatus == '1'&&this.form.quotHjApprovalStatus == '0'">提交核价审核</el-button></span>
|
||||
|
||||
<span style="margin-left: 10px" v-hasPermi="['quot:quot:madeQuot']"><el-button type="warning" style="float:left" plain @click="madeQuot" v-if="this.form.quotApprovalStatus == '1'&&this.form.quotJsxzApprovalStatus != '1'&&this.form.quotHjApprovalStatus != '1'">生成报价单</el-button></span>
|
||||
<span style="margin-left: 10px" v-hasPermi="['quot:quot:feedback']"><el-button type="primary" plain @click="feedbackQuotForm" v-if="this.form.quotApprovalStatus == '1'&&this.form.quotJsxzApprovalStatus != '1'&&this.form.quotHjApprovalStatus != '1'">提交反馈</el-button></span>
|
||||
<span style="margin-left: 10px" v-hasPermi="['quot:quot:reject']"><el-button type="danger" plain @click="rejectQuotForm" v-if="this.form.quotApprovalStatus == '1'&&this.form.quotJsxzApprovalStatus != '1'&&this.form.quotHjApprovalStatus != '1'">驳回</el-button></span>
|
||||
</div>
|
||||
|
@ -1361,7 +1362,7 @@
|
|||
</style>
|
||||
<script>
|
||||
import { NumberAdd } from '@/utils/number';// 数值计算
|
||||
import { changQuotPrintStatus,listQuot, getQuot, getReturnUpdateQuot, delQuot, addQuot, updateQuot, quotFileList, quotFileDelete, commitQuot, commitJsQuot, commitHjQuot, feedbackQuot, rejectQuot } from "@/api/quot/quot";
|
||||
import { changQuotPrintStatus,listQuot, getQuot, getReturnUpdateQuot, delQuot, addQuot, updateQuot, quotFileList, quotFileDelete, commitQuot, commitJsQuot, commitHjQuot, feedbackQuot, madeQuot, rejectQuot } from "@/api/quot/quot";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { checkPermi } from '@/utils/permission';// 权限判断函数
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
|
@ -1509,6 +1510,7 @@ export default {
|
|||
return changQuotPrintStatus(row.quotId, row.quotPrint);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功");
|
||||
this.getList();
|
||||
}).catch(function() {
|
||||
row.quotPrint = row.quotPrint === "0" ? "1" : "0";
|
||||
});
|
||||
|
@ -1666,7 +1668,6 @@ export default {
|
|||
this.getQuotFkFileList();
|
||||
},
|
||||
|
||||
|
||||
/** 产品数据导入按钮操作 */
|
||||
handleImport() {
|
||||
this.productUpload.title = "产品数据导入";
|
||||
|
@ -1771,6 +1772,32 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
/** 报价组生成报价单按钮 */
|
||||
madeQuot(){
|
||||
this.form.quotMaterialList = this.quotMaterialList;
|
||||
madeQuot(this.form).then(response => {
|
||||
this.$modal.msgSuccess("生成报价单成功");
|
||||
// 处理返回的文件流
|
||||
const content = response;
|
||||
const blob = new Blob([content]);
|
||||
const fileName = this.form.quotCode +".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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** 报价组报价单驳回按钮 */
|
||||
rejectQuotForm() {
|
||||
rejectQuot(this.form).then(response => {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="提交状态" prop="quotApprovalStatus">
|
||||
<!--<el-form-item label="提交状态" prop="quotApprovalStatus">
|
||||
<el-select v-model="queryParams.quotApprovalStatus" placeholder="请选择提交状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.rb_quot_approval_status"
|
||||
|
@ -29,7 +29,7 @@
|
|||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item>-->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
|
@ -239,10 +239,10 @@
|
|||
}
|
||||
},
|
||||
created() {
|
||||
const roles = this.$store.state.user.roles;
|
||||
/*const roles = this.$store.state.user.roles;
|
||||
if(roles && roles.indexOf('QUOT') !== -1 ){//报价组默认查看待审核 单据
|
||||
this.queryParams.quotApprovalStatus = '1';
|
||||
}
|
||||
}*/
|
||||
this.getList();
|
||||
this.getVersionList();
|
||||
},
|
||||
|
@ -412,7 +412,11 @@
|
|||
// 处理返回的文件流
|
||||
const content = response;
|
||||
const blob = new Blob([content]);
|
||||
const fileName = "BJD_"+this.getTodayCourse()+".xls";
|
||||
|
||||
let fileName = "BJD_"+this.getTodayCourse()+".xls";
|
||||
if(this.form.quotCode){
|
||||
fileName = "BJD_"+this.form.quotCode+".xls";
|
||||
}
|
||||
if ("download" in document.createElement("a")) {
|
||||
// 非IE下载
|
||||
const elink = document.createElement("a");
|
||||
|
|
Loading…
Reference in New Issue