Merge remote-tracking branch 'origin/master'

highway
wws 12 months ago
commit e0a5330e98

@ -244,7 +244,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
private int createOrderPlan(EquPlan plan){
Date nowtime = DateUtils.getNowDate();
String createBy = SecurityUtils.getUsername();
String createBy = "job";
int sce = 0;
/**equ_plan->equ_order********************************************************************/
EquOrder order = new EquOrder();

@ -44,13 +44,13 @@ public class QcCheckReportIncomeController extends BaseController {
public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){
qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start
if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){
qcCheckReportIncome.setCheckTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end
qcCheckReportIncome.setCheckTimeEnd(dateEndStr);//end
}
// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){

@ -44,13 +44,13 @@ public class QcCheckReportProduceController extends BaseController {
public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){
qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start
if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){
qcCheckReportIncome.setCheckTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end
qcCheckReportIncome.setCheckTimeEnd(dateEndStr);//end
}
startPage();

@ -44,13 +44,13 @@ public class QcCheckReportProductController extends BaseController {
public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){
qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start
if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){
qcCheckReportIncome.setCheckTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end
qcCheckReportIncome.setCheckTimeEnd(dateEndStr);//end
}
// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){

@ -1,7 +1,13 @@
package com.op.quality.controller;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.DateUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -39,6 +45,17 @@ public class QcStaticTableController extends BaseController {
@RequiresPermissions("quality:qcTableIncome:list")
@GetMapping("/getIncomeTableList")
public TableDataInfo getIncomeTableList(QcStaticTable qcStaticTable) {
if(StringUtils.isNotBlank(qcStaticTable.getSupplierCode())){
List<String> codes = Arrays.asList(qcStaticTable.getSupplierCode().split(","));
qcStaticTable.setSupplierCodes(codes);
}
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcStaticTable.getYearMonth())){
LocalDate date = LocalDate.now();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM");
String ymStr = dtf.format(date);
qcStaticTable.setYearMonth(ymStr);//end
}
startPage();
List<QcStaticTable> list = qcStaticTableService.selectQcStaticTableList(qcStaticTable);
return getDataTable(list);

@ -1,10 +1,10 @@
package com.op.quality.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import java.util.List;
/**
* qc_static_table
*
@ -14,110 +14,146 @@ import com.op.common.core.web.domain.BaseEntity;
public class QcStaticTable extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
private String id;
private String supplierId;
@Excel(name = "供应商编号")
private String supplierCode;
@Excel(name = "供应商名称")
private String supplierName;
private List<String> supplierCodes;
private String yearMonth;
private int batchs;
private int okBatchs;
private int noOkBatchs;
private int nums;
private int okNums;
private int noOkNums;
private String typeCode;
private String checkResult;
private String noOkBatchRate;
private String noOkNumRate;
public String getNoOkNumRate() {
return noOkNumRate;
}
public void setNoOkNumRate(String noOkNumRate) {
this.noOkNumRate = noOkNumRate;
}
public String getNoOkBatchRate() {
return noOkBatchRate;
}
public void setNoOkBatchRate(String noOkBatchRate) {
this.noOkBatchRate = noOkBatchRate;
}
public int getOkBatchs() {
return okBatchs;
}
public void setOkBatchs(int okBatchs) {
this.okBatchs = okBatchs;
}
/** 文件名称 */
@Excel(name = "文件名称")
private String fileName;
public int getNoOkBatchs() {
return noOkBatchs;
}
/** 文件地址 */
@Excel(name = "文件地址")
private String fileAddress;
public void setNoOkBatchs(int noOkBatchs) {
this.noOkBatchs = noOkBatchs;
}
/** 版本号 */
@Excel(name = "版本号")
private String version;
public int getNums() {
return nums;
}
/** 备用1 */
@Excel(name = "备用1")
private String attr1;
public void setNums(int nums) {
this.nums = nums;
}
/** 备用2 */
@Excel(name = "备用2")
private String attr2;
public int getOkNums() {
return okNums;
}
/** 备用3 */
@Excel(name = "备用3")
private String attr3;
public void setOkNums(int okNums) {
this.okNums = okNums;
}
/** 备用4 */
@Excel(name = "备用4")
private String attr4;
public int getNoOkNums() {
return noOkNums;
}
public void setId(String id) {
this.id = id;
public void setNoOkNums(int noOkNums) {
this.noOkNums = noOkNums;
}
public String getId() {
return id;
public String getCheckResult() {
return checkResult;
}
public void setFileName(String fileName) {
this.fileName = fileName;
public void setCheckResult(String checkResult) {
this.checkResult = checkResult;
}
public String getFileName() {
return fileName;
public String getTypeCode() {
return typeCode;
}
public void setFileAddress(String fileAddress) {
this.fileAddress = fileAddress;
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public String getFileAddress() {
return fileAddress;
public int getBatchs() {
return batchs;
}
public void setVersion(String version) {
this.version = version;
public void setBatchs(int batchs) {
this.batchs = batchs;
}
public String getVersion() {
return version;
public String getYearMonth() {
return yearMonth;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
public void setYearMonth(String yearMonth) {
this.yearMonth = yearMonth;
}
public String getAttr1() {
return attr1;
public List<String> getSupplierCodes() {
return supplierCodes;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
public void setSupplierCodes(List<String> supplierCodes) {
this.supplierCodes = supplierCodes;
}
public String getAttr2() {
return attr2;
public String getSupplierId() {
return supplierId;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
public void setSupplierId(String supplierId) {
this.supplierId = supplierId;
}
public String getAttr3() {
return attr3;
public String getSupplierCode() {
return supplierCode;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
public void setSupplierCode(String supplierCode) {
this.supplierCode = supplierCode;
}
public String getAttr4() {
return attr4;
public String getSupplierName() {
return supplierName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("fileName", getFileName())
.append("fileAddress", getFileAddress())
.append("version", getVersion())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
}

@ -1,9 +1,12 @@
package com.op.quality.mapper;
import java.util.List;
import java.util.Map;
import com.op.quality.domain.QcStaticTable;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -21,5 +24,10 @@ public interface QcStaticTableMapper {
* @return
*/
public List<QcStaticTable> selectQcStaticTableList(QcStaticTable qcStaticTable);
@MapKey("supplierCode")
public Map<String, QcStaticTable> selectPcMap(@Param("qc")QcStaticTable qcStaticTable,
@Param("codes")List<QcStaticTable> tabledtos);
@MapKey("supplierCode")
public Map<String, QcStaticTable> selectNumMap(@Param("qc")QcStaticTable qcStaticTable,
@Param("codes")List<QcStaticTable> tabledtos);
}

@ -1,6 +1,8 @@
package com.op.quality.service.impl;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
@ -9,6 +11,7 @@ import org.springframework.stereotype.Service;
import com.op.quality.mapper.QcStaticTableMapper;
import com.op.quality.domain.QcStaticTable;
import com.op.quality.service.IQcStaticTableService;
import org.springframework.util.CollectionUtils;
/**
* Service
@ -30,7 +33,75 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
@Override
@DS("#header.poolName")
public List<QcStaticTable> selectQcStaticTableList(QcStaticTable qcStaticTable) {
return qcStaticTableMapper.selectQcStaticTableList(qcStaticTable);
qcStaticTable.setTypeCode("material");
/**base_supplier**供应商**/
List<QcStaticTable> tabledtos = qcStaticTableMapper.selectQcStaticTableList(qcStaticTable);
if(CollectionUtils.isEmpty(tabledtos)){
return null;
}
/**qc_check_task**总批数**/
Map<String,QcStaticTable> pcMap = qcStaticTableMapper.selectPcMap(qcStaticTable,tabledtos);
if(pcMap==null){
return null;
}
/**qc_check_task**不合格批次数**/
qcStaticTable.setCheckResult("N");
Map<String,QcStaticTable> noOkPcMap = qcStaticTableMapper.selectPcMap(qcStaticTable,tabledtos);
/**qc_check_task**不合格数量**/
qcStaticTable.setCheckResult("N");
Map<String,QcStaticTable> noOkNumMap = qcStaticTableMapper.selectNumMap(qcStaticTable,tabledtos);
for(QcStaticTable tabledto:tabledtos){
QcStaticTable pcdto = pcMap.get(tabledto.getSupplierCode());
QcStaticTable numdto = noOkPcMap.get(tabledto.getSupplierCode());
QcStaticTable noOkNumdto = noOkNumMap.get(tabledto.getSupplierCode());
if(pcdto!=null){
//总批次
tabledto.setBatchs(pcdto.getBatchs());
//总数量
tabledto.setNums(pcdto.getNums());
}else{
tabledto.setBatchs(0);
tabledto.setNums(0);
}
if(numdto!=null){
//不合格批次
tabledto.setNoOkBatchs(numdto.getBatchs());
}else{
tabledto.setNoOkBatchs(0);
}
//合格批次
int okBatchs = tabledto.getBatchs()-tabledto.getNoOkBatchs();
tabledto.setOkBatchs(okBatchs);
//批次合格率
if(tabledto.getBatchs() != 0){
BigDecimal noOkBatchRate = new BigDecimal(tabledto.getNoOkBatchs()).multiply(new BigDecimal("100.00"))
.divide(new BigDecimal(tabledto.getBatchs()))
.setScale(2,BigDecimal.ROUND_HALF_UP);
tabledto.setNoOkBatchRate(noOkBatchRate.toString()+"%");
}else{
tabledto.setNoOkBatchRate("0.00%");
}
//不合格数量
if(noOkNumdto!=null){
tabledto.setNoOkNums(noOkNumdto.getNoOkNums());
}else{
tabledto.setNoOkNums(0);
}
//合格数量
tabledto.setOkNums(tabledto.getNums()-tabledto.getNoOkNums());
//数量不良率
if(tabledto.getNums() != 0){
BigDecimal noOkNumRate = new BigDecimal(tabledto.getNoOkNums()).multiply(new BigDecimal("100.00"))
.divide(new BigDecimal(tabledto.getNums()))
.setScale(2,BigDecimal.ROUND_HALF_UP);
tabledto.setNoOkNumRate(noOkNumRate.toString()+"%");
}else{
tabledto.setNoOkNumRate("0.00%");
}
}
return tabledtos;
}
}

@ -5,8 +5,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.op.quality.mapper.QcStaticTableMapper">
<select id="selectQcStaticTableList" parameterType="QcStaticTable" resultType="QcStaticTable">
<select id="selectQcStaticTableList" parameterType="com.op.quality.domain.QcStaticTable" resultType="com.op.quality.domain.QcStaticTable">
SELECT
bs.supplier_id supplierId,
bs.supplier_code supplierCode,
bs.zh_desc supplierName
from base_supplier bs
where bs.del_flag = '0' and bs.active_flag = '1'
<if test="supplierCodes != null and supplierCodes.size()>0">
and bs.supplier_code in
<foreach collection="supplierCodes" item="supplierCode" index="index" separator="," open="(" close=")">
#{supplierCode}
</foreach>
</if>
</select>
<select id="selectPcMap" resultType="com.op.quality.domain.QcStaticTable">
SELECT
qct.supplier_code supplierCode,qct.supplier_name supplierName,
count(0) batchs,sum(qct.quality) nums
from qc_check_task qct
left join qc_check_type qc on qc.order_code = qct.check_type
where qc.type_code = #{qc.typeCode}
and qct.del_flag = '0'
and CONVERT(varchar(7),qct.income_time, 120) = #{qc.yearMonth}
<if test="qc.checkResult != null">
and qct.check_result = #{qc.checkResult}
</if>
<if test="codes != null and codes.size()>0">
and qct.supplier_code in
<foreach collection="codes" item="item" index="index" separator="," open="(" close=")">
#{item.supplierCode}
</foreach>
</if>
group by qct.supplier_code,qct.supplier_name
</select>
<select id="selectNumMap" resultType="com.op.quality.domain.QcStaticTable">
SELECT
qct.supplier_code supplierCode,qct.supplier_name supplierName,
sum(qct.noOk_quality) noOkNums
from qc_check_task qct
left join qc_check_type qc on qc.order_code = qct.check_type
where qc.type_code = #{qc.typeCode}
and qct.del_flag = '0'
and CONVERT(varchar(7),qct.income_time, 120) = #{qc.yearMonth}
<if test="codes != null and codes.size()>0">
and qct.supplier_code in
<foreach collection="codes" item="item" index="index" separator="," open="(" close=")">
#{item.supplierCode}
</foreach>
</if>
group by qct.supplier_code,qct.supplier_name
</select>
</mapper>

Loading…
Cancel
Save