From 6504f975a45070623fe0d67d6dd9be9a938d666c Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Mon, 28 Oct 2024 12:34:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/IWCInterfaceServiceImpl.java | 16 +++ .../controller/QcStaticTableController.java | 124 ++++++++++++++++++ .../QcCheckReportInventoryServiceImpl.java | 32 +++++ .../impl/QcStaticTableServiceImpl.java | 2 + .../quality/QcCheckReportIncomeMapper.xml | 6 +- .../service/impl/SysUserServiceImpl.java | 2 +- 6 files changed, 178 insertions(+), 4 deletions(-) diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java index ce6ec285..b8ee2c4d 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java @@ -436,6 +436,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { }else if(workOrders.size()>=3){ BigDecimal gamng = null; + BigDecimal bottomQua = BigDecimal.ZERO; for(int n=0;n 1){ + //查询base_product的report_rate//箱子-大盒-小盒 + BigDecimal reportRate = mesReportWorkMapper.getReportRate(workOrders.get(n).getProductCode()); + if(reportRate != null){ + BigDecimal newQuantity = bottomQua.divide(reportRate,2, RoundingMode.HALF_UP); + sHzWorks.setQuantityFeedback(newQuantity); + }else{ + sHzWorks.setQuantityFeedback(sHzWorks.getQuantityFeedback()); + } + } sHzWorks.setMachineCode(mesReportWork.getMachineCode()); sapRson = this.reportHzToSap3(sHzWorks); logger.info("==========================三层(第"+n+"层)以上工单("+sHzWorks.getWorkorderCodeSap()+")报工结束:" @@ -668,6 +683,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { SapRFW sapRFW = new SapRFW(); sapRFW.setAufnr(workOrder.getWorkorderCodeSap());//虚拟工单号 sapRFW.setGamng(workOrder.getQuantityFeedback().toString());//报工数量 + SapRFW.lt_gs ltgs = new SapRFW.lt_gs();//生产订单报工工时修改 ltgs.setConf_activity1(workOrder.getSac1());//机器 ltgs.setConf_activity2(workOrder.getSac2());//人工 diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java index 07f499be..8cd962c9 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java @@ -7,6 +7,7 @@ import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.stream.Collectors; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; @@ -597,6 +598,89 @@ public class QcStaticTableController extends BaseController { public List getTableHzDataSC(@RequestBody QcStaticTable qcStaticTable) { return qcStaticTableService.getTableHzDataSC(qcStaticTable); } + @Log(title = "首检分析报表统计", businessType = BusinessType.EXPORT) + @PostMapping("/exportSCTable") + public void exportSCTable(HttpServletResponse response, QcStaticTable qcStaticTable) { + QcStaticTable titledto = qcStaticTableService.getTableHzTitle(qcStaticTable); + + List list0 = qcStaticTableService.getTableHzDataSC(qcStaticTable); + List list = list0.stream() + .filter(hmap -> !hmap.get("sampleQuality").equals("0")) + .collect(Collectors.toList()); + List title2Cols = titledto.getColumns1(); + //String titleRow1 = String.join(",", title2Cols); + String titleRow1 = "首检分析报表"; + //表格结构数据 + ArrayList excelCols = new ArrayList<>(); + excelCols.add(new ExcelCol("时间", "timeCol", 15)); + excelCols.add(new ExcelCol("抽检数", "sampleQuality", 10)); + + for (int n = 0; n < title2Cols.size(); n++) { + excelCols.add(new ExcelCol(title2Cols.get(n), "col" + (n), 15)); + } + excelCols.add(new ExcelCol("不良数", "noOkQua", 10)); + excelCols.add(new ExcelCol("不良率(%)", "noOkRate", 10)); + + String titleName = "首检统计分析报表"; + SXSSFWorkbook workbook = null; + try { + //设置响应头 + response.setHeader("Content-disposition", + "attachment; filename=" + titleName); + response.setContentType("application/octet-stream;charset=UTF-8"); + ServletOutputStream outputStream = response.getOutputStream(); + //调用工具类 + workbook = ExcelMapUtil.initWorkbook(titleName, titleRow1, excelCols, list); + workbook.write(outputStream); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (workbook != null) { + workbook.dispose(); + } + } + } + + @Log(title = "来料分析报表统计", businessType = BusinessType.EXPORT) + @PostMapping("/exportIncomeTable") + public void exportIncomeTable(HttpServletResponse response, QcStaticTable qcStaticTable) { + QcStaticTable titledto = qcStaticTableService.getTableHzTitle(qcStaticTable); + + List list = qcStaticTableService.getTableHzDataSC(qcStaticTable); + List title2Cols = titledto.getColumns1(); + //String titleRow1 = String.join(",", title2Cols); + String titleRow1 = "巡检分析报表"; + //表格结构数据 + ArrayList excelCols = new ArrayList<>(); + excelCols.add(new ExcelCol("时间", "timeCol", 15)); + excelCols.add(new ExcelCol("抽检批次", "sampleQuality", 10)); + + for (int n = 0; n < title2Cols.size(); n++) { + excelCols.add(new ExcelCol(title2Cols.get(n), "col" + (n), 15)); + } + excelCols.add(new ExcelCol("不良数", "noOkQua", 10)); + excelCols.add(new ExcelCol("不良率(%)", "noOkRate", 10)); + + String titleName = "来料统计分析报表"; + SXSSFWorkbook workbook = null; + try { + //设置响应头 + response.setHeader("Content-disposition", + "attachment; filename=" + titleName); + response.setContentType("application/octet-stream;charset=UTF-8"); + ServletOutputStream outputStream = response.getOutputStream(); + //调用工具类 + workbook = ExcelMapUtil.initWorkbook(titleName, titleRow1, excelCols, list); + workbook.write(outputStream); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (workbook != null) { + workbook.dispose(); + } + } + } + @PostMapping("/getTableHzNoOkDataSC") public List getTableHzNoOkDataSC(@RequestBody QcStaticTable qcStaticTable) { return qcStaticTableService.getTableHzNoOkDataSC(qcStaticTable); @@ -619,6 +703,46 @@ public class QcStaticTableController extends BaseController { util.exportExcel(response, list, "巡检检验结果明细"); } + @Log(title = "巡检检验结果统计", businessType = BusinessType.EXPORT) + @PostMapping("/exportXJTable") + public void exportXJTable(HttpServletResponse response, QcStaticTable qcStaticTable) { + QcStaticTable titledto = qcStaticTableService.getTableHzTitle(qcStaticTable); + + List list = qcStaticTableService.getTableHzData(qcStaticTable); + List title2Cols = titledto.getColumns1(); + //String titleRow1 = String.join(",", title2Cols); + String titleRow1 = "巡检分析报表"; + //表格结构数据 + ArrayList excelCols = new ArrayList<>(); + excelCols.add(new ExcelCol("时间", "timeCol", 15)); + excelCols.add(new ExcelCol("抽样数", "sampleQuality", 10)); + + for (int n = 0; n < title2Cols.size(); n++) { + excelCols.add(new ExcelCol(title2Cols.get(n), "col" + (n), 15)); + } + excelCols.add(new ExcelCol("不良数", "noOkQua", 10)); + excelCols.add(new ExcelCol("不良率(%)", "noOkRate", 10)); + + String titleName = "巡检分析报表"; + SXSSFWorkbook workbook = null; + try { + //设置响应头 + response.setHeader("Content-disposition", + "attachment; filename=" + titleName); + response.setContentType("application/octet-stream;charset=UTF-8"); + ServletOutputStream outputStream = response.getOutputStream(); + //调用工具类 + workbook = ExcelMapUtil.initWorkbook(titleName, titleRow1, excelCols, list); + workbook.write(outputStream); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (workbook != null) { + workbook.dispose(); + } + } + } + /** * 定量值明细分析--表头-- **/ diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportInventoryServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportInventoryServiceImpl.java index b2345eaf..13fa058c 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportInventoryServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportInventoryServiceImpl.java @@ -17,6 +17,8 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -208,7 +210,27 @@ public class QcCheckReportInventoryServiceImpl implements IQcCheckReportInventor qcCheckReportIncome.setDelFlag("0"); qcCheckReportIncome.setTypeCode("inventory"); List dtos = qcCheckReportIncomeMapper.getPrintXJList(qcCheckReportIncome); + + if(!CollectionUtils.isEmpty(dtos)){ + //查找受控文件--fileNo + qcCheckReportIncome.setCheckType("checkTypeCC"); + + try { + String dateFormatPattern = "yyyy-MM-dd HH:mm:ss"; + SimpleDateFormat dateFormat = new SimpleDateFormat(dateFormatPattern); + Date date = dateFormat.parse(qcCheckReportIncome.getCheckTimeStart()); + qcCheckReportIncome.setIncomeTime(date); + } catch (ParseException e) { + System.err.println("日期格式不正确: " + e.getMessage()); + } + String fileNo = qcCheckReportIncomeMapper.getStandardNo(qcCheckReportIncome); + if(com.op.common.core.utils.StringUtils.isNotBlank(fileNo)){ + dtos.get(0).setFileNo(fileNo); + } + } + int n = 1; + String checkManName = ""; for(QcCheckReportIncome dto:dtos){ dto.setXh(n++); List batchnos = qcStaticTableMapper.getBatchnos(dto.getOrderNo()); @@ -217,6 +239,16 @@ public class QcCheckReportInventoryServiceImpl implements IQcCheckReportInventor ordernoStr += batchno + ";"; }; dto.setIncomeBatchNo(ordernoStr); + + if(dto.getCheckResult().equals("Y")){ + dto.setCheckResult("无质量问题"); + }else{ + dto.setRemark(dto.getRemark()+";"+dto.getAttr3()); + } + + checkManName+=dto.getCheckManName()+";"; + + dto.setCheckManName(checkManName); } return dtos; } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java index dd389615..5ea97a53 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java @@ -1056,8 +1056,10 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService { colMap.put("sampleQuality",sampl.getSampleQuality().replaceAll("\\..*", "")); BigDecimal noOkRate = new BigDecimal(noOkNumR.getNoOkQuality()).multiply(new BigDecimal("100.00")) .divide(new BigDecimal(sampl.getSampleQuality()),2, BigDecimal.ROUND_HALF_UP); + colMap.put("noOkQua",noOkNumR.getNoOkQuality()); colMap.put("noOkRate",noOkRate); }else{ + colMap.put("noOkQua","0"); colMap.put("sampleQuality","0"); colMap.put("noOkRate","0"); } diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml index c2e99d75..223d25fb 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml @@ -45,7 +45,7 @@ - + @@ -284,10 +284,10 @@