diff --git a/ABAP_AS_WITH_POOL.jcoDestination b/ABAP_AS_WITH_POOL.jcoDestination new file mode 100644 index 0000000..23c8d59 --- /dev/null +++ b/ABAP_AS_WITH_POOL.jcoDestination @@ -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 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java index c1b9e16..872b730 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java @@ -1,5 +1,8 @@ package com.ruoyi.web.controller.quot; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; import java.math.BigDecimal; import java.text.SimpleDateFormat; 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.SendNotice.NoticeUtil; 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.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -853,11 +858,11 @@ public class QuotController extends BaseController } /** - * 报价单生成 + * 报价单生成-PC * @param quot * @return */ - @Log(title = "报价单生成", businessType = BusinessType.OTHER) + @Log(title = "报价单生成-PC", businessType = BusinessType.OTHER) @PostMapping("/madeQuot") @PreAuthorize("@ss.hasPermi('quot:quot:madeQuot')") public void madeQuot(HttpServletResponse response, @RequestBody Quot quot) @@ -866,6 +871,62 @@ public class QuotController extends BaseController 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 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; + } + /** * 报价组驳回 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java index f130ed0..5709903 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java @@ -264,7 +264,7 @@ public class RedBookController extends BaseController @DataSource(DataSourceType.MASTER) @Log(title = "生成询价单", businessType = BusinessType.INSERT) @PostMapping("/madeXjQuot") - public AjaxResult madeXjQuot(HttpServletResponse response, @RequestBody OAQuot quot) throws Exception + public AjaxResult madeXjQuot(HttpServletResponse response, @RequestBody OAQuot quot) { Quot xjquot = new Quot(); File excelFile = null; @@ -320,12 +320,12 @@ public class RedBookController extends BaseController }else{ return error("系统异常,询价单号为空!"); } + /** 上传清单附件 **/ + FileUtils.delete(excelFile); }catch(Exception e){ return error("系统异常"); } - /** 上传清单附件 **/ - FileUtils.delete(excelFile); return success(xjquot); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java index 930500d..96260b4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java @@ -332,7 +332,7 @@ public class excelUtil { } /** - * 报价单生成 + * 报价单生成-PC * @param response * @param quot * @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 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 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.close(); - + response.flushBuffer(); } catch (RowsExceededException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/ruoyi-ui/src/api/quot/quot.js b/ruoyi-ui/src/api/quot/quot.js index 5fbd4db..6214d6f 100644 --- a/ruoyi-ui/src/api/quot/quot.js +++ b/ruoyi-ui/src/api/quot/quot.js @@ -154,7 +154,7 @@ export function feedbackQuot(data) { }) } -//生成报价单 +//生成报价单-PC export function madeQuot(data) { return request({ url: '/quot/quot/madeQuot', @@ -166,6 +166,18 @@ export function madeQuot(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) { diff --git a/ruoyi-ui/src/views/mobile/quoteMobile/operation/add.vue b/ruoyi-ui/src/views/mobile/quoteMobile/operation/add.vue index dfba867..fe0175f 100644 --- a/ruoyi-ui/src/views/mobile/quoteMobile/operation/add.vue +++ b/ruoyi-ui/src/views/mobile/quoteMobile/operation/add.vue @@ -216,7 +216,7 @@ import { checkPermi,checkRole} from '@/utils/permission';// 权限判断函数 import CustomerSelect from "@/views/components/Tools/Mobile/CustomerSelect/index.vue"; 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 { getDicts } from "@/api/system/dict/data"; @@ -368,7 +368,7 @@ export default { const roles = this.$store.state.user.roles; if(roles && roles.indexOf('SALES_MAN') !== -1){//业务员下载附件更新处理状态为1-已处理 // 更新报价单状态为已处理 - setHandle(this.form.quotId).then(response => { + setHandle(this.formData.quotId).then(response => { window.open(fileUrl, "_blank"); }) }else{ @@ -445,7 +445,7 @@ export default { const roles = this.$store.state.user.roles; if(roles && roles.indexOf('SALES_MAN') !== -1){//业务员下载附件更新处理状态为1-已处理 // 更新报价单状态为已处理 - setHandle(this.form.quotId).then(response => { + setHandle(this.formData.quotId).then(response => { this.madeQuotFile(); }) }else{ @@ -454,28 +454,12 @@ export default { }, madeQuotFile(){ this.formData.quotMaterialList = this.quotMaterialList; - madeQuot(this.formData).then(response => { + madeQuotMobile(this.formData).then(response => { this.$modal.msgSuccess("生成报价单成功"); - // 处理返回的文件流 - 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); - } + this.downloadFile(response.msg); }); }, + /** 保存按钮 */ saveForm() { this.$refs["elForm"].validate(valid => { @@ -666,7 +650,7 @@ export default { }, //下载附件 downloadFile(fileUrl){ - window.open(fileUrl, "_blank"); + window.open(fileUrl,"_blank"); }, //删除附件