只有活动中的工单才能进行报工
parent
ad6f335ffc
commit
4362014544
@ -0,0 +1,54 @@
|
||||
package com.op.quality.controller;
|
||||
|
||||
import com.op.common.core.utils.StringUtils;
|
||||
import com.op.quality.domain.QcCheckType;
|
||||
import com.op.quality.domain.QcInterface;
|
||||
import com.op.quality.service.IQcInterfaceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 质量看板接口
|
||||
*
|
||||
* @author zxl
|
||||
* @date 2023-11-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/qcInterface")
|
||||
public class QcInterfaceController {
|
||||
|
||||
@Autowired
|
||||
private IQcInterfaceService qcInterfaceService;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
@GetMapping("/getDictData")
|
||||
public List<QcInterface> getDictData(QcInterface qcInterface) {
|
||||
return qcInterfaceService.getDictData(qcInterface);
|
||||
}
|
||||
|
||||
/**
|
||||
* 来料--订单异常信息
|
||||
* @param qcInterface
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getOverallInfo")
|
||||
public List<QcInterface> getOverallInfo(QcInterface qcInterface) {
|
||||
return qcInterfaceService.getOverallInfo(qcInterface);
|
||||
}
|
||||
|
||||
/**
|
||||
* 来料--异常分布
|
||||
* @param qcInterface
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getCheckProjectsPie")
|
||||
public List<QcInterface> getCheckProjectsPie(QcInterface qcInterface) {
|
||||
return qcInterfaceService.getCheckProjectsPie(qcInterface);
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.op.quality.domain;
|
||||
|
||||
import com.op.common.core.annotation.Excel;
|
||||
import com.op.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 看板
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-10-12
|
||||
*/
|
||||
public class QcInterface extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String ymdType;
|
||||
private String ymdTypeName;
|
||||
private String dictType;
|
||||
private String factoryCode;
|
||||
private String quality;
|
||||
private String ymd;
|
||||
private String projectName;
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getYmd() {
|
||||
return ymd;
|
||||
}
|
||||
|
||||
public void setYmd(String ymd) {
|
||||
this.ymd = ymd;
|
||||
}
|
||||
|
||||
public String getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public void setQuality(String quality) {
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
public String getFactoryCode() {
|
||||
return factoryCode;
|
||||
}
|
||||
|
||||
public void setFactoryCode(String factoryCode) {
|
||||
this.factoryCode = factoryCode;
|
||||
}
|
||||
|
||||
public String getYmdType() {
|
||||
return ymdType;
|
||||
}
|
||||
|
||||
public void setYmdType(String ymdType) {
|
||||
this.ymdType = ymdType;
|
||||
}
|
||||
|
||||
public String getYmdTypeName() {
|
||||
return ymdTypeName;
|
||||
}
|
||||
|
||||
public void setYmdTypeName(String ymdTypeName) {
|
||||
this.ymdTypeName = ymdTypeName;
|
||||
}
|
||||
|
||||
public String getDictType() {
|
||||
return dictType;
|
||||
}
|
||||
|
||||
public void setDictType(String dictType) {
|
||||
this.dictType = dictType;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.op.quality.mapper;
|
||||
|
||||
import com.op.quality.domain.QcCheckProject;
|
||||
import com.op.quality.domain.QcCheckType;
|
||||
import com.op.quality.domain.QcInterface;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 质量看板Mapper接口
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-10-13
|
||||
*/
|
||||
@Mapper
|
||||
public interface QcInterfaceMapper {
|
||||
|
||||
List<QcInterface> getDictData(QcInterface qcInterface);
|
||||
|
||||
List<QcInterface> getOverallInfo(QcInterface qcInterface);
|
||||
|
||||
List<QcInterface> getCheckProjectsPie(QcInterface qcInterface);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.op.quality.service;
|
||||
|
||||
|
||||
import com.op.quality.domain.QcCheckType;
|
||||
import com.op.quality.domain.QcInterface;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-10-13
|
||||
*/
|
||||
public interface IQcInterfaceService {
|
||||
|
||||
List<QcInterface> getDictData(QcInterface qcInterface);
|
||||
|
||||
List<QcInterface> getOverallInfo(QcInterface qcInterface);
|
||||
|
||||
List<QcInterface> getCheckProjectsPie(QcInterface qcInterface);
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.op.quality.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.op.common.core.utils.DateUtils;
|
||||
import com.op.quality.domain.QcCheckType;
|
||||
import com.op.quality.domain.QcInterface;
|
||||
import com.op.quality.mapper.QcInterfaceMapper;
|
||||
import com.op.quality.service.IQcInterfaceService;
|
||||
import com.op.system.api.domain.SysDictData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验项目维护Service业务层处理
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-10-13
|
||||
*/
|
||||
@Service
|
||||
public class QcInterfaceServiceImpl implements IQcInterfaceService {
|
||||
@Autowired
|
||||
private QcInterfaceMapper qcInterfaceMapper;
|
||||
|
||||
@Override
|
||||
public List<QcInterface> getDictData(QcInterface qcInterface) {
|
||||
DynamicDataSourceContextHolder.push("master");
|
||||
return qcInterfaceMapper.getDictData(qcInterface);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QcInterface> getOverallInfo(QcInterface qcInterface) {
|
||||
DynamicDataSourceContextHolder.push(qcInterface.getFactoryCode());
|
||||
|
||||
String nowYMD = DateUtils.getDate();
|
||||
qcInterface.setYmd(nowYMD);
|
||||
List<QcInterface> dtos = qcInterfaceMapper.getOverallInfo(qcInterface);
|
||||
if(!CollectionUtils.isEmpty(dtos)&&dtos.size()==2){
|
||||
QcInterface qif = new QcInterface();
|
||||
qif.setYmdTypeName("okRate");
|
||||
if(dtos.get(1).getQuality().equals("0")){
|
||||
qif.setQuality("100%");
|
||||
}else{
|
||||
BigDecimal okRate = (new BigDecimal(dtos.get(0).getQuality())
|
||||
.subtract(new BigDecimal(dtos.get(1).getQuality())))
|
||||
.multiply(new BigDecimal("100"))
|
||||
.divide(new BigDecimal(dtos.get(0).getQuality()),2, RoundingMode.HALF_UP);
|
||||
qif.setQuality(okRate.toString()+"%");
|
||||
}
|
||||
dtos.add(qif);
|
||||
}
|
||||
return dtos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QcInterface> getCheckProjectsPie(QcInterface qcInterface) {
|
||||
DynamicDataSourceContextHolder.push(qcInterface.getFactoryCode());
|
||||
|
||||
String nowYMD = DateUtils.getDate();
|
||||
qcInterface.setYmd(nowYMD);
|
||||
List<QcInterface> dtos = qcInterfaceMapper.getCheckProjectsPie(qcInterface);
|
||||
|
||||
return dtos;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.op.quality.mapper.QcInterfaceMapper">
|
||||
|
||||
|
||||
<select id="getDictData" resultType="com.op.quality.domain.QcInterface">
|
||||
select dict_label ymdTypeName,
|
||||
dict_value ymdType
|
||||
from sys_dict_data
|
||||
where dict_type = #{dictType} and status = '0'
|
||||
</select>
|
||||
<select id="getOverallInfo" resultType="com.op.quality.domain.QcInterface">
|
||||
select count(0) quality,'all' ymdTypeName
|
||||
from wms_raw_order_in
|
||||
where active_flag = '1'
|
||||
<if test='ymdType=="yyyy"'>
|
||||
and CONVERT(varchar(4),receipt_time, 120) = SUBSTRING(#{ymd},0,5)
|
||||
</if>
|
||||
<if test='ymdType=="mm"'>
|
||||
and CONVERT(varchar(7),receipt_time, 120) =SUBSTRING(#{ymd},0,8)
|
||||
</if>
|
||||
<if test='ymdType=="dd"'>
|
||||
and CONVERT(varchar(10),receipt_time, 120) = SUBSTRING(#{ymd},0,11)
|
||||
</if>
|
||||
union ALL
|
||||
select count(0),'unOk'
|
||||
from qc_check_unqualified qcu
|
||||
left join qc_check_type qct on qcu.type = qct.order_code
|
||||
where qct.type_code = #{typeCode} and qcu.del_flag = '0'
|
||||
<if test='ymdType=="yyyy"'>
|
||||
and CONVERT(varchar(4),qcu.create_time, 120) = SUBSTRING(#{ymd},0,5)
|
||||
</if>
|
||||
<if test='ymdType=="mm"'>
|
||||
and CONVERT(varchar(7),qcu.create_time, 120) = SUBSTRING(#{ymd},0,8)
|
||||
</if>
|
||||
<if test='ymdType=="dd"'>
|
||||
and CONVERT(varchar(10),qcu.create_time, 120) = SUBSTRING(#{ymd},0,11)
|
||||
</if>
|
||||
</select>
|
||||
<select id="getCheckProjectsPie" resultType="com.op.quality.domain.QcInterface">
|
||||
select count(0) quality,
|
||||
qctd.project_no,
|
||||
qctd.rule_name projectName
|
||||
from qc_check_task_detail qctd
|
||||
left join qc_check_task qct on qctd.belong_to = qct.record_id
|
||||
where qct.check_result = 'N' and qct.type_code = #{typeCode}
|
||||
<if test='ymdType=="yyyy"'>
|
||||
and CONVERT(varchar(4),qctd.update_time, 120) = SUBSTRING(#{ymd},0,5)
|
||||
</if>
|
||||
<if test='ymdType=="mm"'>
|
||||
and CONVERT(varchar(7),qcu.update_time, 120) = SUBSTRING(#{ymd},0,8)
|
||||
</if>
|
||||
<if test='ymdType=="dd"'>
|
||||
and CONVERT(varchar(10),qcu.update_time, 120) = SUBSTRING(#{ymd},0,11)
|
||||
</if>
|
||||
group by qctd.project_no,qctd.rule_name
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue