质量质检+工单管理界面加入母单信息+首页图表

master
zhaoxiaolin 1 year ago
parent 245301f4f8
commit f1f895ee20

@ -33,7 +33,7 @@ public class ProOrderWorkorder extends TreeEntity {
private String orderId;
/** 订单编码 */
@Excel(name = "子订单编码")
@Excel(name = "子订单编码")
private String orderCode;
/** 产品ID */
@ -211,7 +211,7 @@ public class ProOrderWorkorder extends TreeEntity {
}
private String prepareId;
@Excel(name = "子订单新编号")
private String workorderCodeSap;
/** 批次号 */
@ -219,9 +219,39 @@ public class ProOrderWorkorder extends TreeEntity {
private List<StringBuilder> batchNumList;
private List<String> batchInfo;
private String pproductCode;
@Excel(name = "母产品名称")
private String pproductName;
@Excel(name = "母订单新编号")
private String pworkorderCodeSap;
/** $column.columnComment */
private String factoryCode;
public String getPproductCode() {
return pproductCode;
}
public void setPproductCode(String pproductCode) {
this.pproductCode = pproductCode;
}
public String getPproductName() {
return pproductName;
}
public void setPproductName(String pproductName) {
this.pproductName = pproductName;
}
public String getPworkorderCodeSap() {
return pworkorderCodeSap;
}
public void setPworkorderCodeSap(String pworkorderCodeSap) {
this.pworkorderCodeSap = pworkorderCodeSap;
}
public List<String> getBatchInfo() {
return batchInfo;
}

@ -166,5 +166,6 @@ public interface ProOrderWorkorderMapper {
int updateWhiteWorkOrder(ProOrderWorkorder whiteOrder);
ProOrderWorkorder getPWorkOrder(ProOrderWorkorder whiteOrder);
}

@ -38,6 +38,11 @@
<result property="endFlag" column="end_flag" />
<result property="carNum" column="car_num" />
<result property="sortNo" column="sort_no" />
<result property="workorderCodeSap" column="workorder_code_sap" />
<result property="pproductCode" column="pproductCode" />
<result property="pproductName" column="pproductName" />
<result property="pworkorderCodeSap" column="pworkorderCodeSap" />
</resultMap>
<sql id="selectProOrderWorkorderVo">
@ -49,37 +54,33 @@
</sql>
<select id="selectProOrderWorkorderList" parameterType="ProOrderWorkorder" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
select pow.workorder_id, pow.workorder_code, pow.workorder_name, pow.order_id, pow.order_code,
pow.product_code, pow.product_name,pow.product_spc, pow.unit, pow.quantity_split,
pow.route_code, pow.prod_line_code, pow.product_date,
pow.shift_id, pow.parent_order,pow.status, pow.prod_type,pow.factory_code,
pow.end_flag,pow.car_num,pow.sort_no,
pow.workorder_code_sap,
ppow.product_code pproductCode,ppow.product_name pproductName,pow.workorder_code_sap pworkorderCodeSap
from pro_order_workorder pow
left join pro_order_workorder ppow on pow.parent_order = ppow.workorder_code
<where>
<if test="workorderCode != null and workorderCode != ''"> and workorder_code like concat('%', #{workorderCode}, '%')</if>
<if test="workorderName != null and workorderName != ''"> and workorder_name like concat('%', #{workorderName}, '%')</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="orderCode != null and orderCode != ''"> and order_code like concat('%', #{orderCode}, '%')</if>
<if test="productId != null and productId != ''"> and product_id = #{productId}</if>
<if test="productCode != null and productCode != ''"> and product_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="productSpc != null and productSpc != ''"> and product_spc = #{productSpc}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
<if test="quantityProduced != null "> and quantity_produced = #{quantityProduced}</if>
<if test="quantitySplit != null "> and quantity_split = #{quantitySplit}</if>
<if test="routeCode != null and routeCode != ''"> and route_code = #{routeCode}</if>
<if test="prodLineCode != null and prodLineCode != ''"> and prod_line_code = #{prodLineCode}</if>
<if test="productDate != null "> and product_date = #{productDate}</if>
<if test="shiftId != null and shiftId != ''"> and shift_id = #{shiftId}</if>
<if test="parentOrder != null and parentOrder != ''"> and parent_order = #{parentOrder}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="statusArray != null and statusArray != ''"> and status in (${statusArray})</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="attr4 != null and attr4 != ''"> and attr4 = #{attr4}</if>
<if test="prodType != null and prodType != ''"> and prod_type = #{prodType}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="endFlag != null and endFlag != ''"> and end_flag = #{endFlag}</if>
<if test="productDateStart != null "> and CONVERT(varchar(10),product_date, 120) >= '${productDateStart}'</if>
<if test="productDateEnd != null "> and '${productDateEnd}%' >= CONVERT(varchar(10),product_date, 120)</if>
and del_flag = '0'
<if test="workorderCode != null and workorderCode != ''"> and pow.workorder_code like concat('%', #{workorderCode}, '%')</if>
<if test="workorderName != null and workorderName != ''"> and pow.workorder_name like concat('%', #{workorderName}, '%')</if>
<if test="orderId != null and orderId != ''"> and pow.order_id = #{orderId}</if>
<if test="orderCode != null and orderCode != ''"> and pow.order_code like concat('%', #{orderCode}, '%')</if>
<if test="productCode != null and productCode != ''"> and pow.product_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''"> and pow.product_name like concat('%', #{productName}, '%')</if>
<if test="productDate != null "> and pow.product_date = #{productDate}</if>
<if test="shiftId != null and shiftId != ''"> and pow.shift_id = #{shiftId}</if>
<if test="parentOrder != null and parentOrder != ''"> and pow.parent_order = #{parentOrder}</if>
<if test="status != null and status != ''"> and pow.status = #{status}</if>
<if test="statusArray != null and statusArray != ''"> and pow.status in (${statusArray})</if>
<if test="prodType != null and prodType != ''"> and pow.prod_type = #{prodType}</if>
<if test="factoryCode != null and factoryCode != ''"> and pow.factory_code = #{factoryCode}</if>
<if test="endFlag != null and endFlag != ''"> and pow.end_flag = #{endFlag}</if>
<if test="productDateStart != null "> and CONVERT(varchar(10),pow.product_date, 120) >= '${productDateStart}'</if>
<if test="productDateEnd != null "> and '${productDateEnd}' >= CONVERT(varchar(10),pow.product_date, 120)</if>
and pow.del_flag = '0'
</where>
</select>

@ -3,6 +3,7 @@ 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.domain.QcLineChartDto;
import com.op.quality.service.IQcInterfaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -126,4 +127,10 @@ public class QcInterfaceController {
public List<QcInterface> getMonthOfYearContrast(@RequestBody QcInterface qcInterface) {
return qcInterfaceService.getMonthOfYearContrast(qcInterface);
}
@GetMapping("/getLineQcData")
public QcLineChartDto getLineQcData(QcInterface qcInterface) {
return qcInterfaceService.getLineQcData(qcInterface);
}
}

@ -47,6 +47,33 @@ public class QcInterface extends BaseEntity {
private List<String> data;
private String reasons;
private String typeCode;
private String productDateStart;
private String ProductDateEnd;
private String nameDate;
public String getNameDate() {
return nameDate;
}
public void setNameDate(String nameDate) {
this.nameDate = nameDate;
}
public String getProductDateStart() {
return productDateStart;
}
public void setProductDateStart(String productDateStart) {
this.productDateStart = productDateStart;
}
public String getProductDateEnd() {
return ProductDateEnd;
}
public void setProductDateEnd(String productDateEnd) {
ProductDateEnd = productDateEnd;
}
public String getTypeCode() {
return typeCode;

@ -0,0 +1,39 @@
package com.op.quality.domain;
import java.util.List;
/**
* echart
*
* @author Open Platform
* @date 2023-07-03
*/
public class QcLineChartDto {
private List<String> seriesNames;
private List<String> xAxisDatas;
private List<QcLineChartSeriesDto> seriesDatas;
public List<String> getSeriesNames() {
return seriesNames;
}
public void setSeriesNames(List<String> seriesNames) {
this.seriesNames = seriesNames;
}
public List<String> getxAxisDatas() {
return xAxisDatas;
}
public void setxAxisDatas(List<String> xAxisDatas) {
this.xAxisDatas = xAxisDatas;
}
public List<QcLineChartSeriesDto> getSeriesDatas() {
return seriesDatas;
}
public void setSeriesDatas(List<QcLineChartSeriesDto> seriesDatas) {
this.seriesDatas = seriesDatas;
}
}

@ -0,0 +1,48 @@
package com.op.quality.domain;
import java.util.List;
/**
* echart
*
* @author Open Platform
* @date 2023-07-03
*/
public class QcLineChartSeriesDto {
private String name;
private String type;
private String stack;
private List<String> data;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getStack() {
return stack;
}
public void setStack(String stack) {
this.stack = stack;
}
public List<String> getData() {
return data;
}
public void setData(List<String> data) {
this.data = data;
}
}

@ -41,4 +41,8 @@ public interface QcInterfaceMapper {
Map<String, QcInterface> getMothNoOkNum(QcInterface qcInterface);
List<QcCheckTaskDetail> getReasons(QcInterface dto);
List<String> getLineChartsNames(QcInterface qcInterface);
@MapKey("nameDate")
Map<String, QcInterface> getLineChartsDatas(QcInterface qcInterface);
}

@ -3,6 +3,7 @@ package com.op.quality.service;
import com.op.quality.domain.QcCheckType;
import com.op.quality.domain.QcInterface;
import com.op.quality.domain.QcLineChartDto;
import java.util.List;
import java.util.Map;
@ -35,4 +36,6 @@ public interface IQcInterfaceService {
QcInterface getLineDayNoOk(QcInterface qcInterface);
List<QcInterface> getMonthOfYearContrast(QcInterface qcInterface);
QcLineChartDto getLineQcData(QcInterface qcInterface);
}

@ -386,13 +386,16 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
qcCheckTask.setCheckResult(result);//检验结果Y合格 N不合格
BigDecimal noOkQquality = new BigDecimal("0");
if(qcCheckTaskIncome.getaNoOkquality()!=null){
noOkQquality.add(qcCheckTaskIncome.getaNoOkquality());
noOkQquality = noOkQquality.add(qcCheckTaskIncome.getaNoOkquality());
qcCheckTask.setaNoOkquality(qcCheckTaskIncome.getaNoOkquality());
}
if(qcCheckTaskIncome.getbNoOkquality()!=null){
noOkQquality.add(qcCheckTaskIncome.getbNoOkquality());
noOkQquality = noOkQquality.add(qcCheckTaskIncome.getbNoOkquality());
qcCheckTask.setbNoOkquality(qcCheckTaskIncome.getbNoOkquality());
}
if(qcCheckTaskIncome.getcNoOkquality()!=null){
noOkQquality.add(qcCheckTaskIncome.getcNoOkquality());
noOkQquality = noOkQquality.add(qcCheckTaskIncome.getcNoOkquality());
qcCheckTask.setcNoOkquality(qcCheckTaskIncome.getcNoOkquality());
}
if(qcCheckTask.getNoOkQuality()==null){
qcCheckTask.setNoOkQuality(noOkQquality);

@ -1,10 +1,9 @@
package com.op.quality.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcInterface;
import com.op.quality.domain.QcProCheck;
import com.op.quality.domain.*;
import com.op.quality.mapper.QcInterfaceMapper;
import com.op.quality.service.IQcInterfaceService;
import org.apache.commons.lang.StringUtils;
@ -319,6 +318,53 @@ public class QcInterfaceServiceImpl implements IQcInterfaceService {
return dtos;
}
@Override
@DS("#header.poolName")
public QcLineChartDto getLineQcData(QcInterface qcInterface) {
QcLineChartDto lineChartDto = new QcLineChartDto();
Calendar calendar = Calendar.getInstance();
Date now = calendar.getTime();
calendar.set(Calendar.DAY_OF_MONTH, 1);
Date firstDayOfMonth = calendar.getTime();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String startTime = dateFormat.format(firstDayOfMonth);
String endTime = dateFormat.format(now);
qcInterface.setProductDateStart(startTime);
qcInterface.setProductDateEnd(endTime);
//图例名称
List<String> seriesNames = qcInterfaceMapper.getLineChartsNames(qcInterface);
lineChartDto.setSeriesNames(seriesNames);
//日期名称数组
List<String> xAxisDatas = getDays(startTime,endTime);
lineChartDto.setxAxisDatas(xAxisDatas);
Map<String,QcInterface> productdatas = qcInterfaceMapper.getLineChartsDatas(qcInterface);
//值
List<QcLineChartSeriesDto> seriesDatas = new ArrayList<>();
QcLineChartSeriesDto lineChartSeriesDto = null;
for(String productName:seriesNames){
lineChartSeriesDto = new QcLineChartSeriesDto();
lineChartSeriesDto.setName(productName);
lineChartSeriesDto.setType("line");
List<String> datas = new ArrayList<>();
for(String dayStr:xAxisDatas) {
QcInterface data0 = productdatas.get(productName + dayStr);
if (data0 != null) {
BigDecimal rate = new BigDecimal(data0.getNoOkQuality())
.multiply(new BigDecimal(100))
.divide(new BigDecimal(data0.getQuality()),2,BigDecimal.ROUND_HALF_UP);
datas.add(rate.toString());
} else {
datas.add("0");
}
}
lineChartSeriesDto.setData(datas);
seriesDatas.add(lineChartSeriesDto);
}
lineChartDto.setSeriesDatas(seriesDatas);
return lineChartDto;
}
/**两个日期之间的所有日期**/
public static List<String> getDays(String startTime,String endTime) {

@ -48,8 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
'检验任务' attr1
from qc_check_task qct
left join qc_check_type qc on qct.check_type = qc.order_code
left join qc_user_material qum on qum.material_code = qct.material_code
where qct.check_status = '0' and qum.user_code = #{checkManCode}
where qct.check_status = '0' and qct.check_man_code = #{checkManCode}
group by qct.check_type,qc.check_name
union all
select '','',
@ -57,8 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
'不合格处理' attr1
from qc_check_unqualified qcu
left join qc_check_task qct on qcu.task_id = qct.record_id
left join qc_user_material qum on qum.material_code = qct.material_code
where qcu.status != '2' and qum.user_code = #{checkManCode}
where qcu.status != '2' and qct.check_man_code = #{checkManCode}
</select>
<insert id="insertQcCheckType" parameterType="QcCheckType">
insert into qc_check_type

@ -241,4 +241,23 @@
where belong_to = #{recordId}
and status = 'N' and del_flag='0'
</select>
<select id="getLineChartsNames" resultType="java.lang.String">
select
distinct supplier_name
from qc_check_task
where type_code = 'produce' and del_flag = '0'
and CONVERT(varchar(10),income_time, 120) >= #{productDateStart}
and #{productDateEnd} >= CONVERT(varchar(10),income_time, 120)
</select>
<select id="getLineChartsDatas" resultType="com.op.quality.domain.QcInterface">
select
sum(sample_quality) quality,
sum(noOk_quality) noOkQuality,
concat(supplier_name,CONVERT(varchar(10),income_time, 120)) nameDate
from qc_check_task
where type_code = 'produce' and del_flag = '0'
and CONVERT(varchar(10),income_time, 120) >= #{productDateStart}
and #{productDateEnd} >= CONVERT(varchar(10),income_time, 120)
group by supplier_name,CONVERT(varchar(10),income_time, 120)
</select>
</mapper>

Loading…
Cancel
Save