This commit is contained in:
JIAL 2024-06-24 17:12:42 +08:00
commit fb7003b066
6 changed files with 399 additions and 31 deletions

View File

@ -0,0 +1,11 @@
#for tests only !
#Mon Jun 24 15:12:56 CST 2024
jco.destination.pool_capacity=10
jco.client.lang=ZH
jco.client.ashost=172.19.0.125
jco.client.saprouter=
jco.client.user=RFC
jco.client.sysnr=00
jco.destination.peak_limit=10
jco.client.passwd=654321
jco.client.client=800

View File

@ -1,5 +1,8 @@
package com.ruoyi.web.controller.quot; package com.ruoyi.web.controller.quot;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -33,6 +36,8 @@ import com.ruoyi.technicalConfirm.service.IQuotJsqrService;
import com.ruoyi.web.utils.IdUtils; import com.ruoyi.web.utils.IdUtils;
import com.ruoyi.web.utils.SendNotice.NoticeUtil; import com.ruoyi.web.utils.SendNotice.NoticeUtil;
import com.ruoyi.web.utils.rbExcel.excelUtil; import com.ruoyi.web.utils.rbExcel.excelUtil;
import org.apache.commons.io.FileUtils;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -853,11 +858,11 @@ public class QuotController extends BaseController
} }
/** /**
* 报价单生成 * 报价单生成-PC
* @param quot * @param quot
* @return * @return
*/ */
@Log(title = "报价单生成", businessType = BusinessType.OTHER) @Log(title = "报价单生成-PC", businessType = BusinessType.OTHER)
@PostMapping("/madeQuot") @PostMapping("/madeQuot")
@PreAuthorize("@ss.hasPermi('quot:quot:madeQuot')") @PreAuthorize("@ss.hasPermi('quot:quot:madeQuot')")
public void madeQuot(HttpServletResponse response, @RequestBody Quot quot) public void madeQuot(HttpServletResponse response, @RequestBody Quot quot)
@ -866,6 +871,62 @@ public class QuotController extends BaseController
excelUtil.exportQuotExcel(response,quot,list); excelUtil.exportQuotExcel(response,quot,list);
} }
/**
* 报价单生成-Mobile
* @param quot
* @return
*/
@Log(title = "报价单生成-Mobile", businessType = BusinessType.OTHER)
@PostMapping("/madeQuotMobile")
@PreAuthorize("@ss.hasPermi('quot:quot:madeQuot')")
public AjaxResult madeQuotMobile(HttpServletResponse response, @RequestBody Quot quot)
{
List<QuotMaterial> list = quot.getQuotMaterialList();
File excelFile = null;
String url = "";
try {
File directory = new File("MobileQuotFile/");
// 如果文件夹不存在则创建文件夹
if (!directory.exists()) {
directory.mkdir();
}
excelFile = new File("MobileQuotFile/" + quot.getQuotCode() + ".xls");
File file = excelUtil.exportMobileQuotExcel(response, excelFile, quot, list);
MultipartFile multipartFile = convert(file);
/** 上传清单附件 **/
String relation_id = quot.getQuotId();
if (!StringUtils.isEmpty(relation_id)) {
if (!multipartFile.isEmpty()) {
QuotFile quotFile = new QuotFile();
quotFile.setFileId(UUID.fastUUID().toString());
url = FileUploadUtils.uploadMinio(multipartFile, "quot-manage", "quotMobile/" + relation_id);
}else{
return error("系统异常,生成反馈附件为空!");
}
}
/** 上传清单附件 **/
FileUtils.delete(excelFile);
}catch(Exception e){
return error("系统异常");
}
return success(url);
}
/**
* File转MultipartFile
* @param file
* @return
* @throws IOException
*/
public static MultipartFile convert(File file) throws IOException {
FileInputStream input = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile("file",
file.getName(), "application/vnd.ms-excel;charset=UTF-8", input);
return multipartFile;
}
/** /**
* 报价组驳回 * 报价组驳回
*/ */

View File

@ -264,7 +264,7 @@ public class RedBookController extends BaseController
@DataSource(DataSourceType.MASTER) @DataSource(DataSourceType.MASTER)
@Log(title = "生成询价单", businessType = BusinessType.INSERT) @Log(title = "生成询价单", businessType = BusinessType.INSERT)
@PostMapping("/madeXjQuot") @PostMapping("/madeXjQuot")
public AjaxResult madeXjQuot(HttpServletResponse response, @RequestBody OAQuot quot) throws Exception public AjaxResult madeXjQuot(HttpServletResponse response, @RequestBody OAQuot quot)
{ {
Quot xjquot = new Quot(); Quot xjquot = new Quot();
File excelFile = null; File excelFile = null;
@ -320,12 +320,12 @@ public class RedBookController extends BaseController
}else{ }else{
return error("系统异常,询价单号为空!"); return error("系统异常,询价单号为空!");
} }
/** 上传清单附件 **/
FileUtils.delete(excelFile);
}catch(Exception e){ }catch(Exception e){
return error("系统异常"); return error("系统异常");
} }
/** 上传清单附件 **/
FileUtils.delete(excelFile);
return success(xjquot); return success(xjquot);
} }

View File

@ -332,7 +332,7 @@ public class excelUtil {
} }
/** /**
* 报价单生成 * 报价单生成-PC
* @param response * @param response
* @param quot * @param quot
* @param list * @param list
@ -636,6 +636,306 @@ public class excelUtil {
} }
/**
* 报价单生成-Mobile
* @param response
* @param quot
* @param list
*/
public static File exportMobileQuotExcel(HttpServletResponse response,File excelFile, Quot quot, List<QuotMaterial> list){
response.setContentType("application/vnd.ms-excel");
BigDecimal totalmoney = BigDecimal.ZERO;
File jnlogo_file = new File("logon/"+IdUtils.createNo("jnlogo_",3)+".png");
File wc_file = new File("logon/"+IdUtils.createNo("wc_",3)+".png");
try {
WritableWorkbook wwb = Workbook.createWorkbook(excelFile);
// 新建一张表
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.RIGHT, BorderLineStyle.THIN);
label = new Label(1, i, "3、分支电缆为多芯分支价格不包其它附件不含安装费数量以供方实际测量为准",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, "",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);
InputStream fileInputStream = new ClassPathResource("/jnlogo.png").getInputStream();
//转换
FileUtils.copyInputStreamToFile(fileInputStream, jnlogo_file);
//设置图片位置前两个参数为插入图片的单元格坐标后面是设置从插入的单元格开始横向和纵向分别要占用的单元格个数最后传入图片文件
WritableImage image=new WritableImage(0.3, 0.2, 1.25, 2.55,jnlogo_file);
wsheet.addImage(image);
InputStream fileInputStream2 = new ClassPathResource("/wc.png").getInputStream();
//转换
FileUtils.copyInputStreamToFile(fileInputStream2, wc_file);
//设置图片位置前两个参数为插入图片的单元格坐标后面是设置从插入的单元格开始横向和纵向分别要占用的单元格个数最后传入图片文件
image=new WritableImage(6.7, 0.2, 1.20, 2.65,wc_file);
wsheet.addImage(image);
wsheet.getSettings().setBottomMargin(0.7d);
wsheet.getSettings().setTopMargin(0.7d);
wsheet.getSettings().setLeftMargin(0.6d);
wsheet.getSettings().setRightMargin(0.2d);
wwb.write();
wwb.close();
} 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();
}finally {
try {
FileUtils.delete(jnlogo_file);
FileUtils.delete(wc_file);
} catch (IOException e) {
e.printStackTrace();
}
}
return excelFile;
}
/** /**
* 生成询价单-清单附件 * 生成询价单-清单附件
@ -708,7 +1008,7 @@ public class excelUtil {
} }
wwb.write(); wwb.write();
wwb.close(); wwb.close();
response.flushBuffer();
} catch (RowsExceededException e) { } catch (RowsExceededException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();

View File

@ -154,7 +154,7 @@ export function feedbackQuot(data) {
}) })
} }
//生成报价单 //生成报价单-PC
export function madeQuot(data) { export function madeQuot(data) {
return request({ return request({
url: '/quot/quot/madeQuot', url: '/quot/quot/madeQuot',
@ -166,6 +166,18 @@ export function madeQuot(data) {
data: data data: data
}) })
} }
//生成报价单-Mobile
export function madeQuotMobile(data) {
return request({
url: '/quot/quot/madeQuotMobile',
method: 'post',
headers: {
'X-Authorization': getToken()
},
data: data
})
}
//驳回按钮 //驳回按钮
export function rejectQuot(data) { export function rejectQuot(data) {

View File

@ -216,7 +216,7 @@
import { checkPermi,checkRole} from '@/utils/permission';// import { checkPermi,checkRole} from '@/utils/permission';//
import CustomerSelect from "@/views/components/Tools/Mobile/CustomerSelect/index.vue"; import CustomerSelect from "@/views/components/Tools/Mobile/CustomerSelect/index.vue";
import { NumberAdd } from '@/utils/number';// import { NumberAdd } from '@/utils/number';//
import { changQuotPrintStatus,listQuot, getQuot, getReturnUpdateQuot, delQuot, addQuot, updateQuot, quotFileList, quotFileDelete, commitQuot, commitJsQuot, commitHjQuot, commitJswQuot, commitOAQuot, feedbackQuot, madeQuot, rejectQuot, setHandle } from "@/api/quot/quot"; import { changQuotPrintStatus,listQuot, getQuot, getReturnUpdateQuot, delQuot, addQuot, updateQuot, quotFileList, quotFileDelete, commitQuot, commitJsQuot, commitHjQuot, commitJswQuot, commitOAQuot, feedbackQuot, madeQuot, rejectQuot, setHandle ,madeQuotMobile } from "@/api/quot/quot";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { getDicts } from "@/api/system/dict/data"; import { getDicts } from "@/api/system/dict/data";
@ -368,7 +368,7 @@ export default {
const roles = this.$store.state.user.roles; const roles = this.$store.state.user.roles;
if(roles && roles.indexOf('SALES_MAN') !== -1){//1- if(roles && roles.indexOf('SALES_MAN') !== -1){//1-
// //
setHandle(this.form.quotId).then(response => { setHandle(this.formData.quotId).then(response => {
window.open(fileUrl, "_blank"); window.open(fileUrl, "_blank");
}) })
}else{ }else{
@ -445,7 +445,7 @@ export default {
const roles = this.$store.state.user.roles; const roles = this.$store.state.user.roles;
if(roles && roles.indexOf('SALES_MAN') !== -1){//1- if(roles && roles.indexOf('SALES_MAN') !== -1){//1-
// //
setHandle(this.form.quotId).then(response => { setHandle(this.formData.quotId).then(response => {
this.madeQuotFile(); this.madeQuotFile();
}) })
}else{ }else{
@ -454,28 +454,12 @@ export default {
}, },
madeQuotFile(){ madeQuotFile(){
this.formData.quotMaterialList = this.quotMaterialList; this.formData.quotMaterialList = this.quotMaterialList;
madeQuot(this.formData).then(response => { madeQuotMobile(this.formData).then(response => {
this.$modal.msgSuccess("生成报价单成功"); this.$modal.msgSuccess("生成报价单成功");
// this.downloadFile(response.msg);
const content = response;
const blob = new Blob([content]);
const fileName = this.formData.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);
}
}); });
}, },
/** 保存按钮 */ /** 保存按钮 */
saveForm() { saveForm() {
this.$refs["elForm"].validate(valid => { this.$refs["elForm"].validate(valid => {
@ -666,7 +650,7 @@ export default {
}, },
// //
downloadFile(fileUrl){ downloadFile(fileUrl){
window.open(fileUrl, "_blank"); window.open(fileUrl,"_blank");
}, },
// //