质量分析图表

master
zhaoxiaolin 2 years ago
parent a72bdf8068
commit f221f0ec05

@ -17,7 +17,7 @@ import java.util.List;
public class ChartDTO { public class ChartDTO {
private String name; private String name;
private String type; private String type;
private List<Integer> data; private List<Double> data;
public String getType() { public String getType() {
return type; return type;
@ -27,11 +27,11 @@ public class ChartDTO {
this.type = type; this.type = type;
} }
public List<Integer> getData() { public List<Double> getData() {
return data; return data;
} }
public void setData(List<Integer> data) { public void setData(List<Double> data) {
this.data = data; this.data = data;
} }

@ -0,0 +1,126 @@
package com.op.system.api.domain.quality;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.TreeEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* sys_factory
*
* @author Open Platform
* @date 2023-07-03
*/
public class FactoryDto extends TreeEntity {
private static final long serialVersionUID = 1L;
/** 工厂id */
private Long factoryId;
/** 部门名称 */
@Excel(name = "工厂名称")
private String factoryName;
/** 负责人 */
@Excel(name = "负责人")
private String leader;
/** 联系电话 */
@Excel(name = "联系电话")
private String phone;
/** 邮箱 */
@Excel(name = "邮箱")
private String email;
/** 部门状态0正常 */
@Excel(name = "工厂状态")
private String status;
/** 删除标志0代表存在 */
private String delFlag;
/** 工厂编码 */
@Excel(name = "工厂编码")
private String factoryCode;
public void setFactoryId(Long factoryId) {
this.factoryId = factoryId;
}
public Long getFactoryId() {
return factoryId;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getFactoryName() {
return factoryName;
}
public void setLeader(String leader) {
this.leader = leader;
}
public String getLeader() {
return leader;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPhone() {
return phone;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("factoryId", getFactoryId())
.append("parentId", getParentId())
.append("ancestors", getAncestors())
.append("factoryName", getFactoryName())
.append("orderNum", getOrderNum())
.append("leader", getLeader())
.append("phone", getPhone())
.append("email", getEmail())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.toString();
}
}

@ -186,14 +186,14 @@ public class OpenServiceImpl implements OpenService {
sysSapLog.setCreateTime(DateUtils.getNowDate()); sysSapLog.setCreateTime(DateUtils.getNowDate());
openMapper.addSapLog(sysSapLog); openMapper.addSapLog(sysSapLog);
//R r = remoteSapService.sapRFWOrder(sapRFW); R r = remoteSapService.sapRFWOrder(sapRFW);
//上传成功更改mes_report_work状态 //上传成功更改mes_report_work状态
//if (r.getCode() == 200) { if (r.getCode() == 200) {
work.setUploadStatus("1"); work.setUploadStatus("1");
//} else { } else {
// work.setUploadStatus("2"); work.setUploadStatus("2");
// work.setUploadMsg(r.getMsg()); work.setUploadMsg(r.getMsg());
//} }
work.setUploadTime(DateUtils.getNowDate()); work.setUploadTime(DateUtils.getNowDate());
openMapper.updateSyncSapStatus(work); openMapper.updateSyncSapStatus(work);
//工单完成数量>工单数量:关闭订单 //工单完成数量>工单数量:关闭订单

@ -279,20 +279,14 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
sysSapLog.setReqcode("请求"); sysSapLog.setReqcode("请求");
sysSapLog.setCreateTime(DateUtils.getNowDate()); sysSapLog.setCreateTime(DateUtils.getNowDate());
proOrderMapper.addSapLog(sysSapLog); proOrderMapper.addSapLog(sysSapLog);
//未来生产要打开
// R<List<String>> r = remoteSapService.SapCreateOrder(sapList);
// logger.info("sap工单回传" + r.getMsg());
// if (500 == r.getCode()) {
// logger.error("sap工单回传" + r.getMsg());
// return 0;
// }
// List<String> returnCodes = r.getData();
//未来生产要删掉
List<String> returnCodes = new ArrayList<>();
for(SapCreateOrder xnsap:sapList){
returnCodes.add("test");
}
R<List<String>> r = remoteSapService.SapCreateOrder(sapList);
logger.info("sap工单回传" + r.getMsg());
if (500 == r.getCode()) {
logger.error("sap工单回传" + r.getMsg());
return 0;
}
List<String> returnCodes = r.getData();
if (!CollectionUtils.isEmpty(returnCodes)) { if (!CollectionUtils.isEmpty(returnCodes)) {
for (String sapCode : returnCodes) { for (String sapCode : returnCodes) {
ProOrderWorkorder oworkSap = new ProOrderWorkorder(); ProOrderWorkorder oworkSap = new ProOrderWorkorder();

@ -1,15 +1,18 @@
package com.op.quality.controller; package com.op.quality.controller;
import java.math.BigDecimal;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; 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.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.DateUtils;
import com.op.system.api.domain.quality.ChartDTO; import com.op.system.api.domain.quality.ChartDTO;
import com.op.system.api.domain.quality.FactoryDto;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -86,26 +89,68 @@ public class QcStaticTableController extends BaseController {
qcStaticTable.setYmArrayStart(ymStr); qcStaticTable.setYmArrayStart(ymStr);
qcStaticTable.setYmArrayEnd(ymStr); qcStaticTable.setYmArrayEnd(ymStr);
} }
if(StringUtils.isNotBlank(qcStaticTable.getMaterialCode())){
qcStaticTable.setMaterialCode("'"+qcStaticTable.getMaterialCode().replace(",","','")+"'");
}
//xAxis; //xAxis;
if(qcStaticTable.getYmArrayStart().equals(qcStaticTable.getYmArrayEnd())){ if(qcStaticTable.getYmArrayStart().equals(qcStaticTable.getYmArrayEnd())){
/**月内每日**/ /**月内每日**/
List<String> days = this.getXNames(qcStaticTable.getYmArrayStart()+"-01", List<String> days = this.getXNames(qcStaticTable.getYmArrayStart()+"-01",
qcStaticTable.getYmArrayEnd()+"-01","ymd"); qcStaticTable.getYmArrayEnd()+"-01","ymd");
resultdto.setxAxis(days); resultdto.setxAxis(days);
qcStaticTable.setDataType("ymd");
qcStaticTable.setYmArrayStart(days.get(0));
qcStaticTable.setYmArrayEnd(days.get(days.size()-1));
}else{ }else{
/**年内各月**/ /**年内各月**/
List<String> months = this.getXNames(qcStaticTable.getYmArrayStart(),qcStaticTable.getYmArrayEnd(),"ym"); List<String> months = this.getXNames(qcStaticTable.getYmArrayStart(),qcStaticTable.getYmArrayEnd(),"ym");
resultdto.setxAxis(months); resultdto.setxAxis(months);
}
//series;//legend.data qcStaticTable.setDataType("ym");
List<QcStaticTable> seriesdtos= qcStaticTableService.getProduceChartData(qcStaticTable); qcStaticTable.setYmArrayStart(months.get(0));
ChartDTO chartDTO = new ChartDTO(); qcStaticTable.setYmArrayEnd(months.get(months.size()-1));
for(QcStaticTable seriesdto:seriesdtos){
chartDTO.setName(seriesdto.getMaterialName());
chartDTO.setType("line");
} }
resultdto.setSeries(null);
List<QcStaticTable> serieDTOs = qcStaticTableService.getProduceNames(qcStaticTable);
//legendData
List<String> pnames = serieDTOs.stream().map(u -> u.getMaterialName()).collect(Collectors.toList());
resultdto.setLegendData(pnames);
Map<String,QcStaticTable> seriesdtos= null;
if("ymd".equals(qcStaticTable.getDataType())){//ymd
//code->materialCode+yyyy-mm-dd
seriesdtos= qcStaticTableService.getProduceChartData(qcStaticTable);
}else{//ym
//code->materialCode+yyyy-mm-dd
seriesdtos= qcStaticTableService.getProduceChartDataYM(qcStaticTable);
}
List<ChartDTO> seriesChart = new ArrayList<>();
for(QcStaticTable serieDTO:serieDTOs){
ChartDTO chartDTO = new ChartDTO();
chartDTO.setName(serieDTO.getMaterialName());
chartDTO.setType("line");
String keyPre = serieDTO.getMaterialCode();
List<Double> datas = new ArrayList<>();
for(String ymd:resultdto.getxAxis()){
String key = keyPre+ymd;
QcStaticTable mdata = seriesdtos.get(key);
if(mdata != null){
BigDecimal defectRate = (mdata.getaNoOkquality().add(mdata.getbNoOkquality()).multiply(new BigDecimal("0.65"))
.add(mdata.getcNoOkquality()).multiply(new BigDecimal(0.35)))
.divide(new BigDecimal(mdata.getSampleQuality()))
.setScale(2, BigDecimal.ROUND_HALF_UP);
datas.add(defectRate.doubleValue());
}else{
datas.add(0.00);
}
}
chartDTO.setData(datas);
seriesChart.add(chartDTO);
}
resultdto.setSeries(seriesChart);
return resultdto; return resultdto;
} }
@ -163,4 +208,8 @@ public class QcStaticTableController extends BaseController {
util.exportExcel(response, list, "质量系统报数据"); util.exportExcel(response, list, "质量系统报数据");
} }
@GetMapping("/getWorkcenterList")
public List<FactoryDto> getWorkcenterList(FactoryDto factoryDto) {
return qcStaticTableService.getWorkcenterList(factoryDto);
}
} }

@ -6,11 +6,10 @@ import com.op.common.core.utils.StringUtils;
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.web.domain.AjaxResult;
import com.op.common.core.web.page.TableDataInfo; import com.op.common.core.web.page.TableDataInfo;
import com.op.quality.domain.QcCheckTaskProduce; import com.op.quality.domain.*;
import com.op.quality.domain.QcCheckTaskWarehousing;
import com.op.quality.domain.QcProCheck;
import com.op.quality.service.IQcCheckTaskProduceService; import com.op.quality.service.IQcCheckTaskProduceService;
import com.op.quality.service.IQcCheckTaskWarehousingService; import com.op.quality.service.IQcCheckTaskWarehousingService;
import com.op.quality.service.IQcCheckTypeService;
import com.op.quality.service.QcProCheckService; import com.op.quality.service.QcProCheckService;
import com.op.system.api.RemoteMesService; import com.op.system.api.RemoteMesService;
import com.op.system.api.domain.dto.WCSDTO; import com.op.system.api.domain.dto.WCSDTO;
@ -34,12 +33,12 @@ public class QuaController extends BaseController {
@Autowired @Autowired
private RemoteMesService remoteMesService; private RemoteMesService remoteMesService;
@Autowired @Autowired
private IQcCheckTaskProduceService qcCheckTaskProduceService; private IQcCheckTaskProduceService qcCheckTaskProduceService;
@Autowired @Autowired
private IQcCheckTaskWarehousingService qcCheckTaskWarehousingService; private IQcCheckTaskWarehousingService qcCheckTaskWarehousingService;
@Autowired
private IQcCheckTypeService qcCheckTypeService;
@PostMapping("/saveQcProCheck") @PostMapping("/saveQcProCheck")
public R<Boolean> saveQcProCheck(@RequestBody QcProCheck qcProCheck) { public R<Boolean> saveQcProCheck(@RequestBody QcProCheck qcProCheck) {
@ -149,4 +148,39 @@ public class QuaController extends BaseController {
//添加检测任务 //添加检测任务
return success(qcCheckTaskWarehousingService.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing)); return success(qcCheckTaskWarehousingService.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing));
} }
/**
*
*/
@GetMapping(value = "getTopTaskInfo")
public AjaxResult getTopTaskInfo(QcCheckType qcCheckType) {
if(StringUtils.isBlank(qcCheckType.getFactoryCode())){
return error("[factoryCode]不能为空");
}
return success(qcCheckTypeService.getTopTaskInfo(qcCheckType));
}
/**
*
*/
@GetMapping(value = "getCheckType")
public AjaxResult getCheckType(QcCheckType qcCheckType) {
if(StringUtils.isBlank(qcCheckType.getFactoryCode())){
return error("[factoryCode]不能为空");
}
return success(qcCheckTypeService.getCheckType(qcCheckType));
}
/**
*
*/
@GetMapping(value = "getCheckTaskList")
public AjaxResult getCheckTaskList(QcCheckTaskIncome qcCheckTaskIncome) {
// if(StringUtils.isBlank(qcCheckType.getFactoryCode())){
// return error("[factoryCode]不能为空");
// }
// return success(qcCheckTypeService.getCheckType(qcCheckType));
return null;
}
} }

@ -7,7 +7,7 @@ import com.op.common.core.web.domain.BaseEntity;
/** /**
* qc_check_type * qc_check_type
* *
* @author Open Platform * @author Open Platform
* @date 2023-10-12 * @date 2023-10-12
*/ */
@ -24,7 +24,7 @@ public class QcCheckType extends BaseEntity {
/** 名称 */ /** 名称 */
@Excel(name = "名称") @Excel(name = "名称")
private String checkName; private String checkName;
private String checkType;
/** 类型编码 */ /** 类型编码 */
@Excel(name = "类型编码") @Excel(name = "类型编码")
private String typeCode; private String typeCode;
@ -44,6 +44,24 @@ public class QcCheckType extends BaseEntity {
/** 删除标识1删除0正常 */ /** 删除标识1删除0正常 */
private String delFlag; private String delFlag;
private int taskNum;
public int getTaskNum() {
return taskNum;
}
public String getCheckType() {
return checkType;
}
public void setCheckType(String checkType) {
this.checkType = checkType;
}
public void setTaskNum(int taskNum) {
this.taskNum = taskNum;
}
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }

@ -50,6 +50,33 @@ public class QcStaticTable extends BaseEntity {
private BigDecimal bNoOkquality; private BigDecimal bNoOkquality;
private BigDecimal cNoOkquality; private BigDecimal cNoOkquality;
private BigDecimal defectRate;//不良率 private BigDecimal defectRate;//不良率
private String materailDate;
private String dataType;
private String workCenter;
public String getWorkCenter() {
return workCenter;
}
public void setWorkCenter(String workCenter) {
this.workCenter = workCenter;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getMaterailDate() {
return materailDate;
}
public void setMaterailDate(String materailDate) {
this.materailDate = materailDate;
}
public BigDecimal getDefectRate() { public BigDecimal getDefectRate() {
return defectRate; return defectRate;

@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
/** /**
* Mapper * Mapper
* *
* @author Open Platform * @author Open Platform
* @date 2023-10-12 * @date 2023-10-12
*/ */
@ -15,7 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
public interface QcCheckTypeMapper { public interface QcCheckTypeMapper {
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
@ -23,7 +23,7 @@ public interface QcCheckTypeMapper {
/** /**
* *
* *
* @param qcCheckType * @param qcCheckType
* @return * @return
*/ */
@ -31,7 +31,7 @@ public interface QcCheckTypeMapper {
/** /**
* *
* *
* @param qcCheckType * @param qcCheckType
* @return * @return
*/ */
@ -39,7 +39,7 @@ public interface QcCheckTypeMapper {
/** /**
* *
* *
* @param qcCheckType * @param qcCheckType
* @return * @return
*/ */
@ -47,7 +47,7 @@ public interface QcCheckTypeMapper {
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
@ -55,9 +55,11 @@ public interface QcCheckTypeMapper {
/** /**
* *
* *
* @param ids * @param ids
* @return * @return
*/ */
public int deleteQcCheckTypeByIds(String[] ids); public int deleteQcCheckTypeByIds(String[] ids);
List<QcCheckType> getTopTaskInfo(QcCheckType qcCheckType);
} }

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.op.quality.domain.QcStaticTable; import com.op.quality.domain.QcStaticTable;
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;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -30,6 +31,12 @@ public interface QcStaticTableMapper {
@MapKey("supplierCode") @MapKey("supplierCode")
public Map<String, QcStaticTable> selectNumMap(@Param("qc")QcStaticTable qcStaticTable, public Map<String, QcStaticTable> selectNumMap(@Param("qc")QcStaticTable qcStaticTable,
@Param("codes")List<QcStaticTable> tabledtos); @Param("codes")List<QcStaticTable> tabledtos);
@MapKey("materailDate")
Map<String,QcStaticTable> getProduceChartData(QcStaticTable qcStaticTable);
List<QcStaticTable> getProduceChartData(QcStaticTable qcStaticTable); List<QcStaticTable> getProduceNames(QcStaticTable qcStaticTable);
@MapKey("materailDate")
Map<String, QcStaticTable> getProduceChartDataYM(QcStaticTable qcStaticTable);
List<FactoryDto> getWorkcenterList(FactoryDto factoryDto);
} }

@ -5,14 +5,14 @@ import com.op.quality.domain.QcCheckType;
/** /**
* Service * Service
* *
* @author Open Platform * @author Open Platform
* @date 2023-10-12 * @date 2023-10-12
*/ */
public interface IQcCheckTypeService { public interface IQcCheckTypeService {
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
@ -20,7 +20,7 @@ public interface IQcCheckTypeService {
/** /**
* *
* *
* @param qcCheckType * @param qcCheckType
* @return * @return
*/ */
@ -28,7 +28,7 @@ public interface IQcCheckTypeService {
/** /**
* *
* *
* @param qcCheckType * @param qcCheckType
* @return * @return
*/ */
@ -36,7 +36,7 @@ public interface IQcCheckTypeService {
/** /**
* *
* *
* @param qcCheckType * @param qcCheckType
* @return * @return
*/ */
@ -44,7 +44,7 @@ public interface IQcCheckTypeService {
/** /**
* *
* *
* @param ids * @param ids
* @return * @return
*/ */
@ -52,9 +52,13 @@ public interface IQcCheckTypeService {
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
public int deleteQcCheckTypeById(String id); public int deleteQcCheckTypeById(String id);
List<QcCheckType> getCheckType(QcCheckType qcCheckType);
List<QcCheckType> getTopTaskInfo(QcCheckType qcCheckType);
} }

@ -1,7 +1,10 @@
package com.op.quality.service; package com.op.quality.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.op.quality.domain.QcStaticTable; import com.op.quality.domain.QcStaticTable;
import com.op.system.api.domain.quality.FactoryDto;
/** /**
* Service * Service
@ -19,5 +22,11 @@ public interface IQcStaticTableService {
*/ */
public List<QcStaticTable> selectQcStaticTableList(QcStaticTable qcStaticTable); public List<QcStaticTable> selectQcStaticTableList(QcStaticTable qcStaticTable);
public List<QcStaticTable> getProduceChartData(QcStaticTable qcStaticTable); public Map<String,QcStaticTable> getProduceChartData(QcStaticTable qcStaticTable);
public List<QcStaticTable> getProduceNames(QcStaticTable qcStaticTable);
public Map<String, QcStaticTable> getProduceChartDataYM(QcStaticTable qcStaticTable);
List<FactoryDto> getWorkcenterList(FactoryDto factoryDto);
} }

@ -6,6 +6,7 @@ import java.util.Map;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.DateUtils;
import com.op.system.api.domain.quality.FactoryDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.op.quality.mapper.QcStaticTableMapper; import com.op.quality.mapper.QcStaticTableMapper;
@ -76,7 +77,7 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
//批次合格率 //批次合格率
if(tabledto.getBatchs() != 0){ if(tabledto.getBatchs() != 0){
BigDecimal noOkBatchRate = new BigDecimal(tabledto.getNoOkBatchs()).multiply(new BigDecimal("100.00")) BigDecimal noOkBatchRate = new BigDecimal(tabledto.getNoOkBatchs()).multiply(new BigDecimal("100.00"))
.divide(new BigDecimal(tabledto.getBatchs())) .divide(new BigDecimal(tabledto.getBatchs()),BigDecimal.ROUND_CEILING)
.setScale(2,BigDecimal.ROUND_HALF_UP); .setScale(2,BigDecimal.ROUND_HALF_UP);
tabledto.setNoOkBatchRate(noOkBatchRate.toString()+"%"); tabledto.setNoOkBatchRate(noOkBatchRate.toString()+"%");
}else{ }else{
@ -93,7 +94,7 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
//数量不良率 //数量不良率
if(tabledto.getNums() != 0){ if(tabledto.getNums() != 0){
BigDecimal noOkNumRate = new BigDecimal(tabledto.getNoOkNums()).multiply(new BigDecimal("100.00")) BigDecimal noOkNumRate = new BigDecimal(tabledto.getNoOkNums()).multiply(new BigDecimal("100.00"))
.divide(new BigDecimal(tabledto.getNums())) .divide(new BigDecimal(tabledto.getNums()),BigDecimal.ROUND_CEILING)
.setScale(2,BigDecimal.ROUND_HALF_UP); .setScale(2,BigDecimal.ROUND_HALF_UP);
tabledto.setNoOkNumRate(noOkNumRate.toString()+"%"); tabledto.setNoOkNumRate(noOkNumRate.toString()+"%");
}else{ }else{
@ -111,15 +112,29 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public List<QcStaticTable> getProduceChartData(QcStaticTable qcStaticTable) { public Map<String,QcStaticTable> getProduceChartData(QcStaticTable qcStaticTable) {
List<QcStaticTable> dtos = qcStaticTableMapper.getProduceChartData(qcStaticTable); Map<String,QcStaticTable> dtos = qcStaticTableMapper.getProduceChartData(qcStaticTable);
for(QcStaticTable dto:dtos){
BigDecimal defectRate = (dto.getaNoOkquality().add(dto.getbNoOkquality()).multiply(new BigDecimal("0.65"))
.add(dto.getcNoOkquality()).multiply(new BigDecimal(0.35)))
.divide(new BigDecimal(dto.getSampleQuality()));
dto.setDefectRate(defectRate);
}
return dtos; return dtos;
} }
@Override
@DS("#header.poolName")
public List<QcStaticTable> getProduceNames(QcStaticTable qcStaticTable) {
return qcStaticTableMapper.getProduceNames(qcStaticTable);
}
@Override
@DS("#header.poolName")
public Map<String, QcStaticTable> getProduceChartDataYM(QcStaticTable qcStaticTable) {
Map<String,QcStaticTable> dtos = qcStaticTableMapper.getProduceChartDataYM(qcStaticTable);
return dtos;
}
@Override
@DS("#header.poolName")
public List<FactoryDto> getWorkcenterList(FactoryDto factoryDto) {
return qcStaticTableMapper.getWorkcenterList(factoryDto);
}
} }

@ -3,6 +3,7 @@ package com.op.quality.service.serviceImpl;
import java.util.List; import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.utils.uuid.IdUtils;
@ -19,7 +20,7 @@ import javax.servlet.http.HttpServletRequest;
/** /**
* Service * Service
* *
* @author Open Platform * @author Open Platform
* @date 2023-10-12 * @date 2023-10-12
*/ */
@ -30,7 +31,7 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService {
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
@ -42,7 +43,7 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService {
/** /**
* *
* *
* @param qcCheckType * @param qcCheckType
* @return * @return
*/ */
@ -54,7 +55,7 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService {
/** /**
* *
* *
* @param qcCheckType * @param qcCheckType
* @return * @return
*/ */
@ -77,7 +78,7 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService {
/** /**
* *
* *
* @param qcCheckType * @param qcCheckType
* @return * @return
*/ */
@ -91,7 +92,7 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService {
/** /**
* *
* *
* @param ids * @param ids
* @return * @return
*/ */
@ -103,7 +104,7 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService {
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
@ -112,4 +113,17 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService {
public int deleteQcCheckTypeById(String id) { public int deleteQcCheckTypeById(String id) {
return qcCheckTypeMapper.deleteQcCheckTypeById(id); return qcCheckTypeMapper.deleteQcCheckTypeById(id);
} }
@Override
public List<QcCheckType> getCheckType(QcCheckType qcCheckType) {
DynamicDataSourceContextHolder.push(qcCheckType.getFactoryCode());// 这是数据源的key
return qcCheckTypeMapper.selectQcCheckTypeList(qcCheckType);
}
@Override
public List<QcCheckType> getTopTaskInfo(QcCheckType qcCheckType) {
DynamicDataSourceContextHolder.push(qcCheckType.getFactoryCode());// 这是数据源的key
return qcCheckTypeMapper.getTopTaskInfo(qcCheckType);
}
} }

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.quality.mapper.QcCheckTypeMapper"> <mapper namespace="com.op.quality.mapper.QcCheckTypeMapper">
<resultMap type="QcCheckType" id="QcCheckTypeResult"> <resultMap type="QcCheckType" id="QcCheckTypeResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="orderCode" column="order_code" /> <result property="orderCode" column="order_code" />
@ -20,27 +20,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectQcCheckTypeVo"> <sql id="selectQcCheckTypeVo">
select id, order_code, check_name, type_code, type_name, attr1, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_check_type select id, order_code, check_name, type_code, type_name, attr1, create_by,
create_time, update_by, update_time, factory_code, del_flag from qc_check_type
</sql> </sql>
<select id="selectQcCheckTypeList" parameterType="QcCheckType" resultMap="QcCheckTypeResult"> <select id="selectQcCheckTypeList" parameterType="QcCheckType" resultMap="QcCheckTypeResult">
<include refid="selectQcCheckTypeVo"/> <include refid="selectQcCheckTypeVo"/>
<where> <where>
<if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if> <if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
<if test="checkName != null and checkName != ''"> and check_name like concat('%', #{checkName}, '%')</if> <if test="checkName != null and checkName != ''"> and check_name like concat('%', #{checkName}, '%')</if>
<if test="typeCode != null and typeCode != ''"> and type_code = #{typeCode}</if> <if test="typeCode != null and typeCode != ''"> and type_code = #{typeCode}</if>
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if> <if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if> <if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if> <if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
and del_flag = '0'
</where> </where>
order by create_time order by create_time
</select> </select>
<select id="selectQcCheckTypeById" parameterType="String" resultMap="QcCheckTypeResult"> <select id="selectQcCheckTypeById" parameterType="String" resultMap="QcCheckTypeResult">
<include refid="selectQcCheckTypeVo"/> <include refid="selectQcCheckTypeVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="getTopTaskInfo" resultType="com.op.quality.domain.QcCheckType">
select qct.check_type checkType,
qc.check_name checkName,
count(0) taskNum,
'检验任务' attr1
from qc_check_task qct
left join qc_check_type qc on qct.check_type = qc.order_code
where qct.check_status = '0'
group by qct.check_type,qc.check_name
union ALL
select qcu.type,
qc.check_name,
count(0) taskNum,
'不合格处理'
from qc_check_unqualified qcu
left join qc_check_type qc on qcu.type = qc.order_code
where qcu.status != '2'
group by qcu.type,qc.check_name
</select>
<insert id="insertQcCheckType" parameterType="QcCheckType"> <insert id="insertQcCheckType" parameterType="QcCheckType">
insert into qc_check_type insert into qc_check_type
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -101,4 +123,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

@ -57,14 +57,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by qct.supplier_code,qct.supplier_name group by qct.supplier_code,qct.supplier_name
</select> </select>
<select id="getProduceChartData" resultType="com.op.quality.domain.QcStaticTable"> <select id="getProduceChartData" resultType="com.op.quality.domain.QcStaticTable">
select material_code materialCode, select concat(qct.material_code,CONVERT(varchar(10),qct.income_time, 120)) materailDate,
material_name materialName, qct.material_code materialCode,
sample_quality sampleQuality, qct.material_name materialName,
aNoOkquality, qct.sample_quality sampleQuality,
bNoOkquality, qct.aNoOkquality,
cNoOkquality qct.bNoOkquality,
from qc_check_task qct.cNoOkquality,
where del_flag = '0' qct.income_time
from qc_check_task qct
left join qc_check_type qc on qc.order_code = qct.check_type
where qct.del_flag = '0' and qc.type_code = 'produce'
<if test="materialCode != null "> and qct.material_code in (${materialCode})</if>
<if test="workCenter != null "> and qct.supplier_code = #{workCenter}</if>
<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>
</select>
<select id="getProduceNames" resultType="com.op.quality.domain.QcStaticTable">
select distinct qct.material_code materialCode,
qct.material_name materialName
from qc_check_task qct
left join qc_check_type qc on qc.order_code = qct.check_type
where qct.del_flag = '0' and qc.type_code = 'produce'
<if test="materialCode != null "> and qct.material_code in (${materialCode})</if>
<if test="workCenter != null "> and qct.supplier_code = #{workCenter}</if>
<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>
</select>
<select id="getProduceChartDataYM" resultType="com.op.quality.domain.QcStaticTable">
select
concat(qct.material_code,CONVERT(varchar(7),qct.income_time, 120)) materailDate,
qct.material_code materialCode,
qct.material_name materialName,
sum(qct.sample_quality) sampleQuality,
sum(qct.aNoOkquality) aNoOkquality,
sum(qct.bNoOkquality) bNoOkquality,
sum(qct.cNoOkquality) cNoOkquality,
CONVERT(varchar(7),qct.income_time, 120) incomeTime
from qc_check_task qct
left join qc_check_type qc on qc.order_code = qct.check_type
where qct.del_flag = '0' and qc.type_code = 'produce'
<if test="materialCode != null "> and qct.material_code in (${materialCode})</if>
<if test="workCenter != null "> and qct.supplier_code = #{workCenter}</if>
<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>
group by qct.material_code ,
qct.material_name ,
CONVERT(varchar(7),qct.income_time, 120)
</select>
<select id="getWorkcenterList" resultType="com.op.system.api.domain.quality.FactoryDto">
select factory_name factoryName,
factory_code factoryCode
from sys_factory where f_type = 'c'
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save