diff --git a/ABAP_AS_WITH_POOL.jcoDestination b/ABAP_AS_WITH_POOL.jcoDestination index 5af05ab..8dfc3c9 100644 --- a/ABAP_AS_WITH_POOL.jcoDestination +++ b/ABAP_AS_WITH_POOL.jcoDestination @@ -1,5 +1,5 @@ #for tests only ! -#Mon Jun 17 15:48:27 CST 2024 +#Wed Jun 19 10:12:57 CST 2024 jco.destination.pool_capacity=10 jco.client.lang=ZH jco.client.ashost=172.19.0.125 @@ -7,5 +7,5 @@ jco.client.saprouter= jco.client.user=RFC jco.client.sysnr=00 jco.destination.peak_limit=10 -jco.client.passwd=654321 +jco.client.passwd=dbTq!8PGYoMxt}M?DFv(:oQQUwH:qM9KKr$k^CHW9U;kE9uK jco.client.client=800 diff --git a/BJD_20240619000073.xls b/BJD_20240619000073.xls new file mode 100644 index 0000000..47a4b42 Binary files /dev/null and b/BJD_20240619000073.xls differ diff --git a/BJD_20240619000099.xls b/BJD_20240619000099.xls new file mode 100644 index 0000000..70389b3 Binary files /dev/null and b/BJD_20240619000099.xls differ diff --git a/BJD_20240619000115.xls b/BJD_20240619000115.xls new file mode 100644 index 0000000..250d54b Binary files /dev/null and b/BJD_20240619000115.xls differ diff --git a/RB_BJD_AHP20240619092621195275 b/RB_BJD_AHP20240619092621195275 new file mode 100644 index 0000000..afbc2a1 Binary files /dev/null and b/RB_BJD_AHP20240619092621195275 differ diff --git a/RB_BJD_DHW20240619093313731913.xls b/RB_BJD_DHW20240619093313731913.xls new file mode 100644 index 0000000..70a56c6 Binary files /dev/null and b/RB_BJD_DHW20240619093313731913.xls differ diff --git a/RB_BJD_ENZ20240619091135080348 b/RB_BJD_ENZ20240619091135080348 new file mode 100644 index 0000000..038ae47 Binary files /dev/null and b/RB_BJD_ENZ20240619091135080348 differ diff --git a/RB_BJD_GXW20240619091043295970 b/RB_BJD_GXW20240619091043295970 new file mode 100644 index 0000000..478661d Binary files /dev/null and b/RB_BJD_GXW20240619091043295970 differ diff --git a/RB_BJD_IXK20240619091608786202 b/RB_BJD_IXK20240619091608786202 new file mode 100644 index 0000000..722866f Binary files /dev/null and b/RB_BJD_IXK20240619091608786202 differ diff --git a/RB_BJD_RUH20240619094420010842.xls b/RB_BJD_RUH20240619094420010842.xls new file mode 100644 index 0000000..a63a33e Binary files /dev/null and b/RB_BJD_RUH20240619094420010842.xls differ diff --git a/RB_BJD_SNP20240619093101696539.xls b/RB_BJD_SNP20240619093101696539.xls new file mode 100644 index 0000000..6f82684 Binary files /dev/null and b/RB_BJD_SNP20240619093101696539.xls differ diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 4edb9ec..dd07567 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -145,6 +145,11 @@ cxf-rt-transports-http-jetty 3.4.3 + + org.springframework + spring-test + 5.2.12.RELEASE + 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 7f2e38d..7883790 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 @@ -29,12 +29,15 @@ import com.ruoyi.web.utils.ListSplitUtil; import com.ruoyi.web.utils.rbExcel.excelUtil; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mock.web.MockMultipartFile; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.annotation.PostConstruct; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import java.io.*; import java.math.BigDecimal; import java.util.*; import java.util.concurrent.ExecutionException; @@ -260,52 +263,75 @@ public class RedBookController extends BaseController @DataSource(DataSourceType.MASTER) @Log(title = "生成询价单", businessType = BusinessType.INSERT) @PostMapping("/madeXjQuot") - public void madeXjQuot(HttpServletResponse response, @RequestBody OAQuot quot) + public AjaxResult madeXjQuot(HttpServletResponse response, @RequestBody OAQuot quot) throws Exception { - Quot xjquot = new Quot(); - xjquot.setQuotId(UUID.fastUUID().toString()); - String quotCode = redBookService.getCode("BJD"); - xjquot.setQuotCode(quotCode); - xjquot.setQuotApprovalStatus("0"); - xjquot.setQuotSalesmanCode(getUsername()); - xjquot.setQuotSalesmanBm(getLoginUser().getUser().getSapUserBm()); - xjquot.setQuotSalesmanName(getLoginUser().getUser().getNickName()); - xjquot.setQuotSalesmanDeptId(getLoginUser().getUser().getDept().getDeptId()+""); - xjquot.setQuotSalesmanDeptName(getLoginUser().getUser().getDept().getDeptName()); - xjquot.setCreateBy(getUsername()); - iQuotService.insertQuot(xjquot); + try{ + xjquot.setQuotId(UUID.fastUUID().toString()); + String quotCode = redBookService.getCode("BJD"); + xjquot.setQuotCode(quotCode); + xjquot.setQuotApprovalStatus("0"); + xjquot.setQuotSalesmanCode(getUsername()); + xjquot.setQuotSalesmanBm(getLoginUser().getUser().getSapUserBm()); + xjquot.setQuotSalesmanName(getLoginUser().getUser().getNickName()); + xjquot.setQuotSalesmanDeptId(getLoginUser().getUser().getDept().getDeptId()+""); + xjquot.setQuotSalesmanDeptName(getLoginUser().getUser().getDept().getDeptName()); + xjquot.setCreateBy(getUsername()); + iQuotService.insertQuot(xjquot); - /** 上传清单附件 **/ - /* String relation_id = xjquot.getQuotId(); - if(!StringUtils.isEmpty(relation_id)){ - if (!file.isEmpty()) - { - QuotFile quotFile= new QuotFile(); - quotFile.setFileId(UUID.fastUUID().toString()); + List list = quot.getSelectedResultData(); + File file = excelUtil.exportXjQuotExcel(response,xjquot,list); + MultipartFile multipartFile = convert(file); - String url = FileUploadUtils.uploadMinio(file,"quot-manage", "quot/"+relation_id); - int index = url.lastIndexOf("/")+1; - String fileName = url.substring(index);//获取文件名 + /** 上传清单附件 **/ + String relation_id = xjquot.getQuotId(); + if(!StringUtils.isEmpty(relation_id)){ + if (!multipartFile.isEmpty()) + { + QuotFile quotFile= new QuotFile(); + quotFile.setFileId(UUID.fastUUID().toString()); + String url = FileUploadUtils.uploadMinio(multipartFile,"quot-manage", "quot/"+relation_id); + int index = url.lastIndexOf("/")+1; + String fileName = url.substring(index);//获取文件名 - int index2 = url.indexOf("/quot/"); - String fileBucketName = url.substring(index2);//获取文件对应文件服务器中地址-供后面删除功能用 + int index2 = url.indexOf("/quot/"); + String fileBucketName = url.substring(index2);//获取文件对应文件服务器中地址-供后面删除功能用 - quotFile.setFileName(fileName); - quotFile.setFileBucketName(fileBucketName); - quotFile.setFileUrl(url); - quotFile.setFileSize(file.getSize()); - quotFile.setFileTime(DateUtils.getTime()); - quotFile.setFileType("quotXjFile"); - quotFile.setRelationId(relation_id); - quotFileService.insertQuotFile(quotFile); + quotFile.setFileName(fileName); + quotFile.setFileBucketName(fileBucketName); + quotFile.setFileUrl(url); + quotFile.setFileSize(multipartFile.getSize()); + quotFile.setFileTime(DateUtils.getTime()); + quotFile.setFileType("quotXjFile"); + quotFile.setRelationId(relation_id); + quotFileService.insertQuotFile(quotFile); + }else{ + return error("系统异常,生成清单附件为空!"); + } + }else{ + return error("系统异常,询价单号为空!"); } - }else{ - return error("系统异常,询价单号为空!"); - }*/ + }catch(Exception e){ + return error("系统异常"); + } + /** 上传清单附件 **/ - // return success(xjquot); + return success(xjquot); } + + /** + * 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; + } + /** * 报价单提交 * @param quot 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 55b421b..67d6134 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 @@ -9,9 +9,11 @@ import com.ruoyi.redBook.domain.OAQuotProduct; import com.ruoyi.web.utils.IdUtils; import jxl.HeaderFooter; import jxl.Workbook; +import jxl.format.*; import jxl.format.Alignment; import jxl.format.Border; import jxl.format.BorderLineStyle; +import jxl.format.Colour; import jxl.format.VerticalAlignment; import jxl.write.Number; import jxl.write.*; @@ -23,10 +25,7 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.ResourcePatternResolver; import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; import java.math.BigDecimal; import java.net.URL; import java.util.Date; @@ -665,4 +664,91 @@ public class excelUtil { } } + + + /** + * 生成询价单-清单附件 + * @param response + * @param quot + * @param list + */ + public static File exportXjQuotExcel(HttpServletResponse response, Quot quot, List list){ + File excelFile = null; + try { + excelFile = new File(quot.getQuotCode()+".xls"); + 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,11,WritableFont.BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.WHITE); + WritableCellFormat wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.CENTRE); + wff_merge.setBackground(jxl.format.Colour.GREY_50_PERCENT); // 设置单元格的背景颜色 + + 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); + + // 列宽 + wsheet.setColumnView(0, 18); + wsheet.setColumnView(1, 18); + wsheet.setColumnView(2, 18); + wsheet.setColumnView(3, 18); + wsheet.setColumnView(4, 18); + + i++; + //数据 + WritableCellFormat cellFormat=new WritableCellFormat(); + cellFormat.setAlignment(Alignment.LEFT); + + int j=1; + + for(Iterator it = list.iterator(); it.hasNext();) + { + OAQuotProduct s = it.next(); + wsheet.setRowView(i,400); + label = new Label(0, i, s.getName_1(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(1, i, s.getSpec(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(2,i, s.getVoltage(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(3,i, s.getStu(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(4,i, String.valueOf(s.getCount()),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + i++; + j++; + } + 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(); + } + return excelFile; + } } diff --git a/ruoyi-ui/src/api/redBook/redBook.js b/ruoyi-ui/src/api/redBook/redBook.js index 9726e89..bac7bdb 100644 --- a/ruoyi-ui/src/api/redBook/redBook.js +++ b/ruoyi-ui/src/api/redBook/redBook.js @@ -108,7 +108,7 @@ export function saveQuot(data) { data: data }) } -//生成报价单 +//生成询价单 export function madeXjQuot(data) { return request({ url: '/redBook/redBook/madeXjQuot', diff --git a/ruoyi-ui/src/views/redBook/productSelect.vue b/ruoyi-ui/src/views/redBook/productSelect.vue index c92935c..52f16b6 100644 --- a/ruoyi-ui/src/views/redBook/productSelect.vue +++ b/ruoyi-ui/src/views/redBook/productSelect.vue @@ -8,7 +8,7 @@ 搜索 - + 生成询价单 生成报价单 保存 清空信息 @@ -784,27 +784,7 @@ handleMadeXjQuotClick() { this.form.selectedResultData = this.selectedResultData; madeXjQuot(this.form).then(response => { - //this.$modal.msgSuccess("生成询价单成功,单号:"+response.data.quotCode); - // 处理返回的文件流 - const content = response; - const blob = new Blob([content]); - const fileName = "RB_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); - } - - + this.$modal.msgSuccess("生成询价单成功,单号:"+response.data.quotCode); }); }, diff --git a/ruoyi-ui/src/views/statisticsQuot/statisticsQuot/index.vue b/ruoyi-ui/src/views/statisticsQuot/statisticsQuot/index.vue index 6b651bb..8289cd3 100644 --- a/ruoyi-ui/src/views/statisticsQuot/statisticsQuot/index.vue +++ b/ruoyi-ui/src/views/statisticsQuot/statisticsQuot/index.vue @@ -84,11 +84,6 @@ - - -