Merge remote-tracking branch 'origin/master'

master
mengjiao 8 months ago
commit a482c1b621

@ -0,0 +1,93 @@
package com.op.system.api.domain.mes;
//线体成型机类
public class ProLineDTO {
private String key;
private String label;
private String lineCode;
private String lineName;
private Long efficiency;
private String dh;
private String factoryDh;
private String umrez;
public String getUmrez() {
return umrez;
}
public void setUmrez(String umrez) {
this.umrez = umrez;
}
public String getFactoryDh() {
return factoryDh;
}
public void setFactoryDh(String factoryDh) {
this.factoryDh = factoryDh;
}
public Long getEfficiency() {
return efficiency;
}
public void setEfficiency(Long efficiency) {
this.efficiency = efficiency;
}
public String getDh() {
return dh;
}
public void setDh(String dh) {
this.dh = dh;
}
public String getLineCode() {
return lineCode;
}
public void setLineCode(String lineCode) {
this.lineCode = lineCode;
}
public String getLineName() {
return lineName;
}
public void setLineName(String lineName) {
this.lineName = lineName;
}
@Override
public String toString() {
return "ProLine{" +
"key='" + key + '\'' +
", label='" + label + '\'' +
'}';
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public ProLineDTO(String key, String label) {
this.key = key;
this.label = label;
}
public ProLineDTO() {
}
}

@ -14,10 +14,47 @@ import java.util.List;
* @author zxl * @author zxl
* @date 2023-07-18 * @date 2023-07-18
*/ */
public class ChartDTO { public class ChartDTO{
private String name; private String name;
private String type; private String type;
private List<Double> data; private List<Double> data;
private Label label;
public static class Label{
private Boolean show;
private String position;
public Label(Boolean show,String position) {
this.show = show;
this.position = position;
}
public void setShow(Boolean show) {
this.show = show;
}
public Boolean getShow() {
return show;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
}
public Label getLabel() {
return label;
}
public void setLabel(Label label) {
this.label = label;
}
public ChartDTO() {
this.label = new Label(true,"top");
}
public String getType() { public String getType() {
return type; return type;

@ -35,6 +35,7 @@ public class MesLine extends BaseEntity {
* 线 * 线
*/ */
private String lineName; private String lineName;
private String sapCode;
/** /**
* *
@ -84,6 +85,14 @@ public class MesLine extends BaseEntity {
private BigDecimal standarXl;//标准效率 private BigDecimal standarXl;//标准效率
private BigDecimal actXl;//实际效率 private BigDecimal actXl;//实际效率
public String getSapCode() {
return sapCode;
}
public void setSapCode(String sapCode) {
this.sapCode = sapCode;
}
public BigDecimal getHourEfficiency() { public BigDecimal getHourEfficiency() {
return hourEfficiency; return hourEfficiency;
} }

@ -1,9 +1,11 @@
package com.op.mes.mapper; package com.op.mes.mapper;
import java.util.List; import java.util.List;
import java.util.Map;
import com.op.mes.domain.MesLine; import com.op.mes.domain.MesLine;
import com.op.mes.domain.MesLineProduct; import com.op.mes.domain.MesLineProduct;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
@ -75,4 +77,6 @@ public interface MesLineMapper {
int insertLineProduct(MesLine mesLine); int insertLineProduct(MesLine mesLine);
void updateLineProduct(MesLine mesLine); void updateLineProduct(MesLine mesLine);
@MapKey("sapCode")
Map<String, MesLine> getEquMap();
} }

@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
@ -91,7 +92,8 @@ public class MesLineServiceImpl implements IMesLineService {
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public List<MesLine> selectMesLineList(MesLine mesLine) { public List<MesLine> selectMesLineList(MesLine mesLine) {
return mesLineMapper.selectMesLineList(mesLine); List<MesLine> dtos = mesLineMapper.selectMesLineList(mesLine);
return dtos;
} }
/** /**
@ -219,11 +221,17 @@ public class MesLineServiceImpl implements IMesLineService {
@Transactional @Transactional
public AjaxResult importOrder(List<MesLine> mesLineList) { public AjaxResult importOrder(List<MesLine> mesLineList) {
Map<String,MesLine> equMap = mesLineMapper.getEquMap();
for(MesLine mesLineProduct:mesLineList){ for(MesLine mesLineProduct:mesLineList){
String factoryCode = ServletUtils.getRequest().getHeader("PoolName").replace("ds_",""); String factoryCode = ServletUtils.getRequest().getHeader("PoolName").replace("ds_","");
mesLineProduct.setFactoryCode(factoryCode); mesLineProduct.setFactoryCode(factoryCode);
mesLineProduct.setCreateBy(SecurityUtils.getUsername()); mesLineProduct.setCreateBy(SecurityUtils.getUsername());
mesLineProduct.setCreateTime(DateUtils.getNowDate()); mesLineProduct.setCreateTime(DateUtils.getNowDate());
MesLine mesEqu = equMap.get(mesLineProduct.getLineCode());
if(mesEqu != null){
mesLineProduct.setLineCode(mesEqu.getLineCode());
}
} }
// 数据校验 // 数据校验

@ -227,5 +227,11 @@
where del_flag = '0' and line_code = #{lineCode} where del_flag = '0' and line_code = #{lineCode}
and product_code = #{productCode} and product_code = #{productCode}
</select> </select>
<select id="getEquMap" resultType="com.op.mes.domain.MesLine">
select sap_code sapCode,
equipment_code lineCode
from base_equipment
where equipment_type_code = 'equ_type_bzx' and del_flag = '0'
</select>
</mapper> </mapper>

@ -115,6 +115,8 @@ public class OpenController extends BaseController {
if (StringUtils.isBlank(qcCheckTaskProduce.getFactoryCode())) { if (StringUtils.isBlank(qcCheckTaskProduce.getFactoryCode())) {
return error("[factoryCode]不能为空"); return error("[factoryCode]不能为空");
} }
//工单未
//添加检测任务 //添加检测任务
int flag = openService.insertQcCheckTaskProduce(qcCheckTaskProduce); int flag = openService.insertQcCheckTaskProduce(qcCheckTaskProduce);
if(flag != -100){ if(flag != -100){

@ -303,7 +303,7 @@ public class ProOrderWorkorderController extends BaseController {
newBatch.setWorkorderCode(workorderCode); newBatch.setWorkorderCode(workorderCode);
return toAjax(proOrderWorkorderService.deleteWorkOrderBatch(newBatch)); return toAjax(proOrderWorkorderService.deleteWorkOrderBatch(newBatch));
} }
/**获取线体**/
@GetMapping("/getProdLineList") @GetMapping("/getProdLineList")
public List<ProLine> getProdLineList() { public List<ProLine> getProdLineList() {
return proOrderWorkorderService.getProdLineList(); return proOrderWorkorderService.getProdLineList();

@ -99,6 +99,7 @@
</if> </if>
and pow.del_flag = '0' and pow.del_flag = '0'
</where> </where>
order by pow.product_date desc
</select> </select>
<select id="getLevelWorkOrderList" parameterType="ProOrderWorkorder" resultMap="ProOrderWorkorderResult"> <select id="getLevelWorkOrderList" parameterType="ProOrderWorkorder" resultMap="ProOrderWorkorderResult">
select pow.workorder_id, pow.workorder_code, pow.workorder_name, pow.order_id, pow.order_code, select pow.workorder_id, pow.workorder_code, pow.workorder_name, pow.order_id, pow.order_code,
@ -193,6 +194,7 @@
</if> </if>
and pow.del_flag = '0' and pow.del_flag = '0'
</where> </where>
order by pow.product_date desc
</select> </select>
<select id="selectProOrderWorkorderByWorkorderId" parameterType="String" resultMap="ProOrderWorkorderResult"> <select id="selectProOrderWorkorderByWorkorderId" parameterType="String" resultMap="ProOrderWorkorderResult">
select pow.workorder_id, pow.workorder_code, pow.workorder_name, pow.order_id, pow.order_code, pow.product_id, select pow.workorder_id, pow.workorder_code, pow.workorder_name, pow.order_id, pow.order_code, pow.product_id,

@ -7,14 +7,13 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.op.common.core.domain.ExcelCol; import com.op.common.core.domain.ExcelCol;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.poi.ExcelMapUtil; import com.op.common.core.utils.poi.ExcelMapUtil;
import com.op.quality.domain.*; import com.op.quality.domain.*;
import com.op.system.api.domain.mes.ProLineDTO;
import com.op.system.api.domain.quality.ChartDTO; import com.op.system.api.domain.quality.ChartDTO;
import com.op.system.api.domain.quality.ChartSeriesDTO; import com.op.system.api.domain.quality.ChartSeriesDTO;
import com.op.system.api.domain.quality.FactoryDto; import com.op.system.api.domain.quality.FactoryDto;
@ -24,8 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -35,7 +32,6 @@ import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions; import com.op.common.security.annotation.RequiresPermissions;
import com.op.quality.service.IQcStaticTableService; import com.op.quality.service.IQcStaticTableService;
import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil; import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo; import com.op.common.core.web.page.TableDataInfo;
@ -651,6 +647,12 @@ public class QcStaticTableController extends BaseController {
} }
} }
} }
@GetMapping("/getProdLineList")
public List<ProLineDTO> getProdLineList() {
return qcStaticTableService.getProdLineList();
}
/** /**
* cpk-- * cpk--
**/ **/
@ -664,7 +666,41 @@ public class QcStaticTableController extends BaseController {
**/ **/
@GetMapping("/getTableCPKList") @GetMapping("/getTableCPKList")
@Log(title = "CPK分析报表-表格数据", businessType = BusinessType.QUERY) @Log(title = "CPK分析报表-表格数据", businessType = BusinessType.QUERY)
public List<HashMap> getTableCPKList(QcCPKInfo qcCPKInfo) { public QcCPKInfo getTableCPKList(QcCPKInfo qcCPKInfo) {
return qcStaticTableService.getTableCPKList(qcCPKInfo); return qcStaticTableService.getTableCPKList(qcCPKInfo);
} }
@PostMapping("/exportCPKList")
public void exportCPKList(HttpServletResponse response,QcCPKInfo qcCPKInfo) {
List<HashMap> list = qcStaticTableService.getTableCPKList(qcCPKInfo).getTableData();
QcCPKInfo titleCols = qcStaticTableService.getTableCPKTitle(qcCPKInfo);
List<String> title2Cols = titleCols.getTitleCol1();
String titleRow1 = "CPK明细报表";
//表格结构数据
ArrayList<ExcelCol> excelCols = new ArrayList<>();
excelCols.add(new ExcelCol("CPK品类", "cpkTypeName", 30));
for (int n = 0; n < title2Cols.size(); n++) {
excelCols.add(new ExcelCol(title2Cols.get(n), "date" + (n+1), 20));
}
excelCols.add(new ExcelCol("平均值", "cpkAvg", 30));
String titleName = "CPK明细";
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();
}
}
}
} }

@ -17,7 +17,6 @@ import java.util.List;
*/ */
public class QcCPKInfo extends BaseEntity { public class QcCPKInfo extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private List<String> titleCol1; private List<String> titleCol1;
private String checkType; private String checkType;
private String projectId; private String projectId;
@ -40,6 +39,25 @@ public class QcCPKInfo extends BaseEntity {
private BigDecimal upperDiff; private BigDecimal upperDiff;
private BigDecimal downDiff; private BigDecimal downDiff;
List<HashMap> tableData;
List<ChartDTO> echartData;
public List<HashMap> getTableData() {
return tableData;
}
public void setTableData(List<HashMap> tableData) {
this.tableData = tableData;
}
public List<ChartDTO> getEchartData() {
return echartData;
}
public void setEchartData(List<ChartDTO> echartData) {
this.echartData = echartData;
}
public BigDecimal getUpperDiff() { public BigDecimal getUpperDiff() {
return upperDiff; return upperDiff;
} }

@ -1,10 +1,10 @@
package com.op.quality.mapper; package com.op.quality.mapper;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.op.quality.domain.*; import com.op.quality.domain.*;
import com.op.system.api.domain.mes.ProLineDTO;
import com.op.system.api.domain.quality.FactoryDto; import com.op.system.api.domain.quality.FactoryDto;
import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -107,7 +107,13 @@ public interface QcStaticTableMapper {
String getActualValues(QcCPKInfo qcCPKInfo); String getActualValues(QcCPKInfo qcCPKInfo);
List<QcCPKInfo> getDlMxList(QcCPKInfo qcCPKInfo); List<QcCPKInfo> getDlMxList(QcCPKInfo qcCPKInfo);
List<QcStaticTable> getDLData(QcStaticTable qcStaticTable); @MapKey("yearMonth")
Map<String,QcStaticTable> getDLData(QcCPKInfo qcCPKInfo);
List<QcCPKInfo> getCpkTypeList(QcCPKInfo qcCPKInfo); List<QcCPKInfo> getCpkTypeList(QcCPKInfo qcCPKInfo);
List<ProLineDTO> getProdLineList();
@MapKey("yearMonth")
Map<String,QcStaticTable> getDLDataDay(QcCPKInfo qcCPKInfo);
} }

@ -8,6 +8,7 @@ import com.op.quality.domain.QcCPKInfo;
import com.op.quality.domain.QcCheckDetail; import com.op.quality.domain.QcCheckDetail;
import com.op.quality.domain.QcCheckType; import com.op.quality.domain.QcCheckType;
import com.op.quality.domain.QcStaticTable; import com.op.quality.domain.QcStaticTable;
import com.op.system.api.domain.mes.ProLineDTO;
import com.op.system.api.domain.quality.ChartSeriesDTO; import com.op.system.api.domain.quality.ChartSeriesDTO;
import com.op.system.api.domain.quality.FactoryDto; import com.op.system.api.domain.quality.FactoryDto;
@ -74,5 +75,7 @@ public interface IQcStaticTableService {
List<HashMap> getDLTableMXList(QcCPKInfo qcCPKInfo); List<HashMap> getDLTableMXList(QcCPKInfo qcCPKInfo);
QcCPKInfo getTableCPKTitle(QcCPKInfo qcCPKInfo); QcCPKInfo getTableCPKTitle(QcCPKInfo qcCPKInfo);
List<HashMap> getTableCPKList(QcCPKInfo qcCPKInfo); QcCPKInfo getTableCPKList(QcCPKInfo qcCPKInfo);
List<ProLineDTO> getProdLineList();
} }

@ -201,7 +201,7 @@ public class QcCheckUnqualifiedServiceImpl implements IQcCheckUnqualifiedService
mainObject.append("\"SQR\":"+"\""+task.getSqr()+"\"");//申请人-- mainObject.append("\"SQR\":"+"\""+task.getSqr()+"\"");//申请人--
mainObject.append(",\"CQ\":"+task.getOaFactory());//厂区-- mainObject.append(",\"CQ\":"+task.getOaFactory());//厂区--
mainObject.append(",\"LLLB\":"+task.getMaterialType());//来料类别【0、1】 mainObject.append(",\"LLLB\":"+task.getMaterialType());//来料类别【0、1】
mainObject.append(",\"MATNR\":"+"\""+task.getMaterialCode()+"\"");//物料编码 mainObject.append(",\"MATNR\":"+"\""+task.getMaterialCode().substring(7)+"\"");//物料编码
mainObject.append(",\"MAKTX\":"+"\""+task.getMaterialName()+"\"");//物料名称 mainObject.append(",\"MAKTX\":"+"\""+task.getMaterialName()+"\"");//物料名称
mainObject.append(",\"suppliernum\":"+"\""+task.getSupplierCode()+"\"");//供应商编码 mainObject.append(",\"suppliernum\":"+"\""+task.getSupplierCode()+"\"");//供应商编码
mainObject.append(",\"supplier\":"+"\""+task.getSupplierName()+"\"");//供应商名称 mainObject.append(",\"supplier\":"+"\""+task.getSupplierName()+"\"");//供应商名称
@ -262,7 +262,7 @@ public class QcCheckUnqualifiedServiceImpl implements IQcCheckUnqualifiedService
detailObject.append("\"colNames\":\"PROCODE,PRONAME,SCCODE,SCTOTAL,BJDATE,JYCODE,JYDATE,JYRESULT,CPCYS,JYBHGMS\""); detailObject.append("\"colNames\":\"PROCODE,PRONAME,SCCODE,SCTOTAL,BJDATE,JYCODE,JYDATE,JYRESULT,CPCYS,JYBHGMS\"");
detailObject.append(",\"details\":["); detailObject.append(",\"details\":[");
detailObject.append("{\"PROCODE\":\""+detailInfo.getMaterialCode()+"\"},");//产品编码 detailObject.append("{\"PROCODE\":\""+detailInfo.getMaterialCode().substring(7)+"\"},");//产品编码
detailObject.append("{\"PRONAME\":\""+detailInfo.getMaterialName()+"\"},");//产品名称 detailObject.append("{\"PRONAME\":\""+detailInfo.getMaterialName()+"\"},");//产品名称
detailObject.append("{\"SCCODE\":\""+detailInfo.getIncomeBatchNo()+"\"},");//批次号 detailObject.append("{\"SCCODE\":\""+detailInfo.getIncomeBatchNo()+"\"},");//批次号
detailObject.append("{\"SCTOTAL\":\""+detailInfo.getQuality()+"\"},");//数量 detailObject.append("{\"SCTOTAL\":\""+detailInfo.getQuality()+"\"},");//数量
@ -348,7 +348,7 @@ public class QcCheckUnqualifiedServiceImpl implements IQcCheckUnqualifiedService
StringBuffer mainObject = new StringBuffer(); StringBuffer mainObject = new StringBuffer();
mainObject.append("{"); mainObject.append("{");
mainObject.append("\"CPMC\":"+"\""+detailInfo.getMaterialName()+"\"");//产品名称 mainObject.append("\"CPMC\":"+"\""+detailInfo.getMaterialName()+"\"");//产品名称
mainObject.append(",\"CPBM\":"+"\""+detailInfo.getMaterialCode()+"\"");//产品编码 mainObject.append(",\"CPBM\":"+"\""+detailInfo.getMaterialCode().substring(7)+"\"");//产品编码
mainObject.append(",\"SQBM\":"+"\""+task.getSqbm()+"\"");//0品质保障部 mainObject.append(",\"SQBM\":"+"\""+task.getSqbm()+"\"");//0品质保障部
mainObject.append(",\"SQR\":"+"\""+task.getSqr()+"\"");//申请人:默认当前用户 mainObject.append(",\"SQR\":"+"\""+task.getSqr()+"\"");//申请人:默认当前用户
mainObject.append(",\"SQSJ\":"+"\""+DateUtils.parseDateToStr("yyyy-MM-dd",detailInfo.getCheckTime())+"\"");//申请时间 mainObject.append(",\"SQSJ\":"+"\""+DateUtils.parseDateToStr("yyyy-MM-dd",detailInfo.getCheckTime())+"\"");//申请时间
@ -377,4 +377,8 @@ public class QcCheckUnqualifiedServiceImpl implements IQcCheckUnqualifiedService
logger.info("流程Id 113455:"+ JSONObject.toJSONString(oaR)); logger.info("流程Id 113455:"+ JSONObject.toJSONString(oaR));
return oaR; return oaR;
} }
public static void main(String args[]){
String ss = "000000010101065500";
System.out.println(ss.substring(7));
}
} }

@ -1,6 +1,7 @@
package com.op.quality.service.impl; package com.op.quality.service.impl;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -8,7 +9,6 @@ import java.time.LocalDate;
import java.time.Month; import java.time.Month;
import java.time.YearMonth; import java.time.YearMonth;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.TextStyle;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -17,6 +17,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.StringUtils;
import com.op.quality.domain.*; import com.op.quality.domain.*;
import com.op.quality.mapper.QMSFileMapper; import com.op.quality.mapper.QMSFileMapper;
import com.op.system.api.domain.mes.ProLineDTO;
import com.op.system.api.domain.quality.ChartDTO; import com.op.system.api.domain.quality.ChartDTO;
import com.op.system.api.domain.quality.ChartSeriesDTO; import com.op.system.api.domain.quality.ChartSeriesDTO;
import com.op.system.api.domain.quality.FactoryDto; import com.op.system.api.domain.quality.FactoryDto;
@ -189,6 +190,8 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return qcStaticTableMapper.getXJDetail(qcStaticTable); return qcStaticTableMapper.getXJDetail(qcStaticTable);
} }
/** /**
* ["1.0.389","2.0.397","3.0.385","4.0.402"] * ["1.0.389","2.0.397","3.0.385","4.0.402"]
* @param qcCPKInfo * @param qcCPKInfo
@ -1253,8 +1256,8 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
public QcCPKInfo getTableCPKTitle(QcCPKInfo qcCPKInfo) { public QcCPKInfo getTableCPKTitle(QcCPKInfo qcCPKInfo) {
QcCPKInfo dto = new QcCPKInfo(); QcCPKInfo dto = new QcCPKInfo();
List<String> colName1 = null; List<String> colName1 = null;
if("week".equals(qcCPKInfo.getTableType())){//周报 if("day".equals(qcCPKInfo.getTableType())){//周报
colName1 = this.getDayOfYear(qcCPKInfo.getYmArrayStart(),qcCPKInfo.getYmArrayEnd());
}else{//月报 }else{//月报
colName1 = this.getMonthByMonth(qcCPKInfo.getYmArrayStart(),qcCPKInfo.getYmArrayEnd()); colName1 = this.getMonthByMonth(qcCPKInfo.getYmArrayStart(),qcCPKInfo.getYmArrayEnd());
} }
@ -1264,36 +1267,93 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} }
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public List<HashMap> getTableCPKList(QcCPKInfo qcCPKInfo) { public QcCPKInfo getTableCPKList(QcCPKInfo qcCPKInfo) {
QcCPKInfo resultDto = new QcCPKInfo();
//表头数据
List<String> colNameArray = null; List<String> colNameArray = null;
if("week".equals(qcCPKInfo.getTableType())){//周报 //数据列//cpkType,'-',q.ymdms
Map<String, QcStaticTable> mxMapData = null;
List<QcCPKInfo> cpkTypeList = cpkTypeList = qcStaticTableMapper.getCpkTypeList(qcCPKInfo);
if("day".equals(qcCPKInfo.getTableType())){//日报
colNameArray = this.getDayOfYear(qcCPKInfo.getYmArrayStart(),qcCPKInfo.getYmArrayEnd());
mxMapData = qcStaticTableMapper.getDLDataDay(qcCPKInfo);
}else{//月报 }else{//月报
colNameArray = this.getMonthByMonth(qcCPKInfo.getYmArrayStart(),qcCPKInfo.getYmArrayEnd()); colNameArray = this.getMonthByMonth(qcCPKInfo.getYmArrayStart(),qcCPKInfo.getYmArrayEnd());
mxMapData = qcStaticTableMapper.getDLData(qcCPKInfo);
} }
List<HashMap> mapData = new ArrayList<HashMap>(); List<HashMap> mapData = new ArrayList<HashMap>();
//列表数据 List<ChartDTO> echartData = new ArrayList<>();
//主列
List<QcCPKInfo> cpkTypeList = qcStaticTableMapper.getCpkTypeList(qcCPKInfo);
//数据列
List<QcCPKInfo> dxData = qcStaticTableMapper.getDlMxList(qcCPKInfo);
HashMap dmap = null; HashMap dmap = null;
for(QcCPKInfo cpkInfo:dxData){ ChartDTO edata = null;
// dmap = new HashMap(); for(QcCPKInfo cpkT:cpkTypeList){
// double USL = dto.getUpperDiff().doubleValue(); dmap = new HashMap();
// double LSL = dto.getDownDiff().doubleValue();
// double cpk = calculateCpk(data,USL,LSL); edata = new ChartDTO();
// BigDecimal cpkVal = new BigDecimal(Double.toString(cpk)).setScale(2, BigDecimal.ROUND_HALF_UP); edata.setType("line");
// for(int m=0;m<colNameArray.size();m++){ edata.setName(cpkT.getCpkTypeName());
// String index = (m+1)+""; List<Double> serisedata = new ArrayList<>();
// dmap.put("date"+index,cpkVal);
// } double USL = cpkT.getUpperDiff().doubleValue();
double LSL = cpkT.getDownDiff().doubleValue();
dmap.put("cpkTypeName",cpkT.getCpkTypeName());
int monthNum = 0;//有数据的月份
BigDecimal monthSum = BigDecimal.ZERO;
for(int m=0;m<colNameArray.size();m++){
String key = cpkT.getCpkType() + "-" + colNameArray.get(m);
QcStaticTable act = mxMapData.get(key);
if(act!=null){
String actArrayStr = act.getQuality().replace("[", "")
.replace("]", "")
.replace("\"", "");
List<String> actArray0 = Arrays.asList(actArrayStr.split(","));
List<String> actArray = new ArrayList<>();
for(String avg:actArray0){
if(avg.matches(".*\\..*\\..*")){
actArray.add(avg.substring(2));
}else{
actArray.add(avg);
}
}
double[] data = actArray.stream()
.mapToDouble(Double::parseDouble) // 将String转换为double
.toArray(); // 转换为double数组 ;
double cpk = calculateCpk(data,USL,LSL);
BigDecimal cpkVal = new BigDecimal(Double.toString(cpk)).setScale(2, BigDecimal.ROUND_HALF_UP);
String index = (m+1)+"";
dmap.put("date"+index,cpkVal);
monthSum = monthSum.add(cpkVal);
++monthNum;
serisedata.add(cpkVal.doubleValue());
}else{
String index = (m+1)+"";
dmap.put("date"+index,"0");
dmap.put("cpkAvg","0");
serisedata.add(0.0);
}
}
edata.setData(serisedata);
if(monthNum>0){
BigDecimal avgBD = monthSum.divide(new BigDecimal(monthNum),2,RoundingMode.HALF_UP);
dmap.put("cpkAvg",avgBD.toString());
}
mapData.add(dmap); mapData.add(dmap);
echartData.add(edata);
} }
//List<QcCPKInfo> myObjectList = convertList(mapData); resultDto.setTableData(mapData);
return mapData; resultDto.setEchartData(echartData);
return resultDto;
}
@Override
@DS("#header.poolName")
public List<ProLineDTO> getProdLineList() {
return qcStaticTableMapper.getProdLineList();
} }
//获取指定范围内得月份输出格式yyyy-mm //获取指定范围内得月份输出格式yyyy-mm
@ -1311,6 +1371,23 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} }
return months; return months;
} }
//获取指定年的周数
private List<String> getDayOfYear(String startM,String endM){
String dateFormat = "yyyy-MM-dd";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
LocalDate startDate = LocalDate.parse(startM, formatter);
LocalDate endDate = LocalDate.parse(endM, formatter);
List<String> dateList = new ArrayList<>();
LocalDate currentDate = startDate;
while (!currentDate.isAfter(endDate)) {
dateList.add(currentDate.format(formatter));
currentDate = currentDate.plusDays(1);
}
return dateList;
}
public static void main(String args[]){ public static void main(String args[]){
String ymd = "1、0.4016"; String ymd = "1、0.4016";
System.out.println(ymd.substring(2)); System.out.println(ymd.substring(2));

@ -464,8 +464,7 @@
<select id="getDLData" resultType="com.op.quality.domain.QcStaticTable"> <select id="getDLData" resultType="com.op.quality.domain.QcStaticTable">
SELECT SELECT
concat(q.material_code,'-',q.project_no,'-',CONVERT(varchar(10),q.ymdms, 120)) yearMonth, concat(q.cpkType,'-',q.ymdms) yearMonth,
material_code materialCode,
ymdms,rule_name ruleName, ymdms,rule_name ruleName,
project_no projectNo, project_no projectNo,
STUFF( STUFF(
@ -480,6 +479,7 @@
where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null
<if test="ymArrayStart != null ">and CONVERT(varchar(7),qct.income_time, 120) >= #{ymArrayStart}</if> <if test="ymArrayStart != null ">and CONVERT(varchar(7),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd} >=CONVERT(varchar(7),qct.income_time,120) </if> <if test="ymArrayEnd != null ">and #{ymArrayEnd} >=CONVERT(varchar(7),qct.income_time,120) </if>
<if test="checkLoc != null ">and qct.check_loc = #{checkLoc}</if>
and qctd.project_id = #{projectId} and bpa.cpk_type = #{cpkType} and qctd.project_id = #{projectId} and bpa.cpk_type = #{cpkType}
) t ) t
WHERE t.cpkType = q.cpkType and t.project_no = q.project_no and t.ymdms=q.ymdms WHERE t.cpkType = q.cpkType and t.project_no = q.project_no and t.ymdms=q.ymdms
@ -497,6 +497,7 @@
where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null
<if test="ymArrayStart != null ">and CONVERT(varchar(7),qct.income_time, 120) >= #{ymArrayStart}</if> <if test="ymArrayStart != null ">and CONVERT(varchar(7),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>=CONVERT(varchar(7),qct.income_time,120) </if> <if test="ymArrayEnd != null ">and #{ymArrayEnd}>=CONVERT(varchar(7),qct.income_time,120) </if>
<if test="checkLoc != null ">and qct.check_loc = #{checkLoc}</if>
and qctd.project_id = #{projectId} and bpa.cpk_type = #{cpkType} and qctd.project_id = #{projectId} and bpa.cpk_type = #{cpkType}
) q ) q
GROUP BY q.cpkType, q.ymdms,q.rule_name,q.project_no GROUP BY q.cpkType, q.ymdms,q.rule_name,q.project_no
@ -928,9 +929,58 @@
order by qct.income_time order by qct.income_time
</select> </select>
<select id="getCpkTypeList" resultType="com.op.quality.domain.QcCPKInfo"> <select id="getCpkTypeList" resultType="com.op.quality.domain.QcCPKInfo">
select material_code cpkType,sdd.dict_label select qpcu.material_code cpkType,
sdd.dict_label cpkTypeName,
qpcu.up_val upperDiff,
qpcu.down_val downDiff
from qc_product_cpk_upDown qpcu from qc_product_cpk_upDown qpcu
left join lanju_op_cloud.dbo.sys_dict_data sdd on sdd.dict_type = 'qms_category' and sdd.dict_value = qpcu.material_code left join lanju_op_cloud.dbo.sys_dict_data sdd on sdd.dict_type = 'qms_category'
where qpcu.del_flag = '0' and sdd.dict_value = qpcu.material_code
where qpcu.del_flag = '0' and qpcu.material_code = #{cpkType}
</select> </select>
<select id="getProdLineList" resultType="com.op.system.api.domain.mes.ProLineDTO">
select equipment_code lineCode,equipment_name lineName from base_equipment
where del_flag = '0' and equipment_type_code = 'equ_type_bzx'
</select>
<select id="getDLDataDay" resultType="com.op.quality.domain.QcStaticTable">
SELECT
concat(q.cpkType,'-',q.ymdms) yearMonth,
ymdms,rule_name ruleName,
project_no projectNo,
STUFF(
(SELECT ',' + t.actual_value
FROM (select
bpa.cpk_type cpkType,
CONVERT(varchar(10),qct.income_time, 120) ymdms,
qctd.rule_name, qctd.project_no,qctd.actual_value
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
left join base_product_attached bpa on concat('0000000',bpa.product_code) = qct.material_code
where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd} >=CONVERT(varchar(10),qct.income_time,120) </if>
<if test="checkLoc != null ">and qct.check_loc = #{checkLoc}</if>
and qctd.project_id = #{projectId} and bpa.cpk_type = #{cpkType}
) t
WHERE t.cpkType = q.cpkType and t.project_no = q.project_no and t.ymdms=q.ymdms
FOR xml path('')
),1,1,''
) quality
FROM (
select
bpa.cpk_type cpkType,
CONVERT(varchar(10),qct.income_time, 120) ymdms,
qctd.rule_name,qctd.project_no,qctd.actual_value
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
left join base_product_attached bpa on concat('0000000',bpa.product_code) = qct.material_code
where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>=CONVERT(varchar(10),qct.income_time,120) </if>
<if test="checkLoc != null ">and qct.check_loc = #{checkLoc}</if>
and qctd.project_id = #{projectId} and bpa.cpk_type = #{cpkType}
) q
GROUP BY q.cpkType, q.ymdms,q.rule_name,q.project_no
</select>
</mapper> </mapper>

Loading…
Cancel
Save