Commit b7946e2c authored by 温志超's avatar 温志超

更新报表

parent 33222867
......@@ -139,7 +139,10 @@ public interface ProFeedbackMapper {
List<FeedbackResponse> getListByUser(FeedbackRequest feedbackRequest);
List<FeedbackResponse> getListByDefect(FeedbackRequest feedbackRequest);
int selectCount(@Param("taskIds")List<Long> taskIds);
List<WorkOrderProgressFeedbackListResponse> getFeedbackList(@Param("workorderCode")String workorderCode,@Param("taskId") Long taskId);
}
package com.ximai.mes.report.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
public class DefectReportController {
}
......@@ -34,7 +34,7 @@ public class FeedbackController extends BaseController {
@PreAuthorize("@ss.hasPermi('mes:pro:feedback:get')")
@Log(title = "生产报工记录", businessType = BusinessType.QUERY)
@GetMapping("/getList")
public TableDataInfo<FeedbackResponse> getList( FeedbackRequest feedbackRequest) {
public TableDataInfo<FeedbackResponse> getList(FeedbackRequest feedbackRequest) {
startPage();
List<FeedbackResponse> feedbackResponseList = feedbackService.getList(feedbackRequest);
return getDataTable(feedbackResponseList);
......@@ -167,4 +167,24 @@ public class FeedbackController extends BaseController {
}
return getDataTable(feedbackResponseList);
}
@ApiOperation("生产报工记录:统计方式不合格原因")
@PreAuthorize("@ss.hasPermi('mes:pro:feedback:get')")
@Log(title = "生产报工记录:统计方式不合格原因", businessType = BusinessType.QUERY)
@GetMapping("/getListByDefect")
public TableDataInfo<FeedbackResponse> getListByDefect( FeedbackRequest feedbackRequest) {
startPage();
List<FeedbackResponse> feedbackResponseList = feedbackService.getListByDefect(feedbackRequest);
DecimalFormat df = new DecimalFormat("0.00%");
for(FeedbackResponse feedbackResponse : feedbackResponseList){
if(feedbackResponse.getQuantityFeedback() != null
&& feedbackResponse.getQuantityFeedback().compareTo(BigDecimal.ZERO) != 0
&& feedbackResponse.getQuantityUnqualify()!= null ){
feedbackResponse.setQualificationRate(df.format((feedbackResponse.getQuantityQualify().divide(feedbackResponse.getQuantityFeedback(),2, RoundingMode.HALF_UP).doubleValue())));
}else{
feedbackResponse.setQualificationRate("0.00%");
}
}
return getDataTable(feedbackResponseList);
}
}
......@@ -9,20 +9,6 @@ import lombok.Data;
import java.util.Date;
@Data
public class FeedbackRequest {
// 工单类型(下拉选择工单类型)
// 项目号(工单项目号)
// 订单号(工单订单号)
// 生产工单(生产工单号)
// 任务号(工序任务号)
// 产品编码(产品编码)
// 产品名称(点击放大镜单选产品信息,也可直接输入名称执行搜索)
// 工序(点击放大镜单选工序,也可直接输入名称执行搜索)
// 车间(点击放大镜单选车间,也可直接输入名称执行搜索)
// 工作中心(点击放大镜单选工作中心,也可直接输入名称执行搜索)
// 工作单元(点击放大镜单选工作单元,也可直接输入名称执行搜索)
// 报工人员(点击放大镜单选报工人员,也可直接输入名称执行搜索)
// 报工时间(选择开始截至时间)
/**
* 工单类型
......@@ -128,4 +114,17 @@ public class FeedbackRequest {
@ApiModelProperty("报工结束")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endDate;
@ApiModelProperty("是否筛查不良")
private Boolean defectStatus;
@ApiModelProperty("不良原因描述")
private String abnormalReason;
@ApiModelProperty("不良原因ID")
private Long abnormalId;
}
......@@ -40,5 +40,4 @@ public class WorkOrderProgressRequest {
*/
@ApiModelProperty( "产品名称")
private String productName;
}
......@@ -136,6 +136,9 @@ public class FeedbackResponse extends ProFeedback {
@ApiModelProperty( "异常原因")
private String abnormalReason;
@ApiModelProperty("异常备注")
private String abnormalRemark;
@ApiModelProperty("标准工时")
private BigDecimal stdWorkingTime;
......@@ -163,4 +166,8 @@ public class FeedbackResponse extends ProFeedback {
@ApiModelProperty("车间名称")
private String workshopName;
}
......@@ -19,4 +19,6 @@ public interface FeedbackService {
List<FeedbackResponse> getListByProcess(FeedbackRequest feedbackRequest);
List<FeedbackResponse> getListByUser(FeedbackRequest feedbackRequest);
List<FeedbackResponse> getListByDefect(FeedbackRequest feedbackRequest);
}
......@@ -49,4 +49,9 @@ public class FeedbackServiceImp implements FeedbackService {
public List<FeedbackResponse> getListByUser(FeedbackRequest feedbackRequest) {
return proFeedbackMapper.getListByUser(feedbackRequest);
}
@Override
public List<FeedbackResponse> getListByDefect(FeedbackRequest feedbackRequest) {
return proFeedbackMapper.getListByDefect(feedbackRequest);
}
}
......@@ -200,21 +200,31 @@
LEFT JOIN md_item it ON it.item_id = f.item_id
left join md_workunit mw on workunit.workunit_id = mw.workunit_id
left join md_workstation workstation on workstation.workstation_id = mw.workstation_id
<where>
<if test="workorderType != null and workorderType != ''">and workorder.workorder_Type = #{workorderType}</if>
<if test="customerProjectNo!= null and customerProjectNo != '' ">and workorder.customer_Project_No like '%${customerProjectNo}%'</if>
<if test="orderCode != null and orderCode != '' ">and workorder.order_Code like '%${orderCode}%'</if>
<if test="workorderCode != null and workorderCode != '' ">and workorder.workorder_Code like '%${workorderCode}%' </if>
<if test="taskCode != null and taskCode != '' ">and pt.task_Code like '%${taskCode}%'</if>
<if test="productCode != null and productCode != '' ">and workorder.product_Code like '%${productCode}%' </if>
<if test=" productId != null">and workorder.product_Id = #{productId}</if>
<if test=" processId != null ">and pt.process_id = #{processId}</if>
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '%${userName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
</where>
<where>
<if test="workorderType != null and workorderType != ''">and workorder.workorder_Type = #{workorderType}</if>
<if test="customerProjectNo!= null and customerProjectNo != '' ">and workorder.customer_Project_No like '%${customerProjectNo}%'</if>
<if test="orderCode != null and orderCode != '' ">and workorder.order_Code like '%${orderCode}%'</if>
<if test="workorderCode != null and workorderCode != '' ">and workorder.workorder_Code like '%${workorderCode}%' </if>
<if test="taskCode != null and taskCode != '' ">and pt.task_Code like '%${taskCode}%'</if>
<if test="productCode != null and productCode != '' ">and workorder.product_Code like '%${productCode}%' </if>
<if test=" productId != null">and workorder.product_Id = #{productId}</if>
<if test=" processId != null ">and pt.process_id = #{processId}</if>
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '%${userName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
<if test=" abnormal_id != null">and f.abnormal_id = #{abnormalId}</if>
<if test=" productName != null and productName != '' ">and workorder.product_Name like '%${productName}%'</if>
<if test=" processName != null and processName != '' ">and pt.process_name like '%${processName}%'</if>
<if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if>
<if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if>
<if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if>
<if test=" abnormalReason != null and abnormalReason != '' ">and f.abnormal_reason like '%${abnormalReason}%'</if>
<if test="defectStatus != null">f.quantity_unqualify > 0 </if>
</where>
</select>
<select id="getListByWorkOrder" resultType="com.ximai.mes.report.response.FeedbackResponse">
select
......@@ -250,6 +260,7 @@
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '%${userName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
<if test=" abnormal_id != null">and f.abnormal_id = #{abnormalId}</if>
<if test=" productName != null and productName != '' ">and workorder.product_Name like '%${productName}%'</if>
......@@ -257,9 +268,8 @@
<if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if>
<if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if>
<if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if>
<if test=" abnormalReason != null and abnormalReason != '' ">and f.abnormal_reason like '%${abnormalReason}%'</if>
<if test="defectStatus != null">f.quantity_unqualify > 0 </if>
</where>
group by
workorder.workorder_Type,
......@@ -297,14 +307,18 @@
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '% ${userName}%'</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '%${userName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
<if test=" abnormal_id != null">and f.abnormal_id = #{abnormalId}</if>
<if test=" productName != null and productName != '' ">and workorder.product_Name like '%${productName}%'</if>
<if test=" processName != null and processName != '' ">and pt.process_name like '%${processName}%'</if>
<if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if>
<if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if>
<if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if>
<if test=" abnormalReason != null and abnormalReason != '' ">and f.abnormal_reason like '%${abnormalReason}%'</if>
<if test="defectStatus != null">f.quantity_unqualify > 0 </if>
</where>
group by
workstation.workshop_code,
......@@ -337,14 +351,18 @@
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '% ${userName}%'</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '%${userName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
<if test=" abnormal_id != null">and f.abnormal_id = #{abnormalId}</if>
<if test=" productName != null and productName != '' ">and workorder.product_Name like '%${productName}%'</if>
<if test=" processName != null and processName != '' ">and pt.process_name like '%${processName}%'</if>
<if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if>
<if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if>
<if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if>
<if test=" abnormalReason != null and abnormalReason != '' ">and f.abnormal_reason like '%${abnormalReason}%'</if>
<if test="defectStatus != null">f.quantity_unqualify > 0 </if>
</where>
group by
workstation.workstation_code,
......@@ -377,8 +395,9 @@
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '% ${userName}%'</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '%${userName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
<if test=" abnormal_id != null">and f.abnormal_id = #{abnormalId}</if>
<if test=" productName != null and productName != '' ">and workorder.product_Name like '%${productName}%'</if>
......@@ -386,6 +405,8 @@
<if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if>
<if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if>
<if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if>
<if test=" abnormalReason != null and abnormalReason != '' ">and f.abnormal_reason like '%${abnormalReason}%'</if>
<if test="defectStatus != null">f.quantity_unqualify > 0 </if>
</where>
group by
workunit.workunit_code,
......@@ -418,9 +439,9 @@
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '% ${userName}%'</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '%${userName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
<if test=" abnormal_id != null">and f.abnormal_id = #{abnormalId}</if>
<if test=" productName != null and productName != '' ">and workorder.product_Name like '%${productName}%'</if>
......@@ -428,6 +449,8 @@
<if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if>
<if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if>
<if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if>
<if test=" abnormalReason != null and abnormalReason != '' ">and f.abnormal_reason like '%${abnormalReason}%'</if>
<if test="defectStatus != null">f.quantity_unqualify > 0 </if>
</where>
group by
pt.process_code,
......@@ -460,9 +483,9 @@
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '% ${userName}%'</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '%${userName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
<if test=" abnormal_id != null">and f.abnormal_id = #{abnormalId}</if>
<if test=" productName != null and productName != '' ">and workorder.product_Name like '%${productName}%'</if>
......@@ -470,6 +493,8 @@
<if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if>
<if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if>
<if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if>
<if test=" abnormalReason != null and abnormalReason != '' ">and f.abnormal_reason like '%${abnormalReason}%'</if>
<if test="defectStatus != null">f.quantity_unqualify > 0 </if>
</where>
group by
f.user_name,
......@@ -490,6 +515,50 @@
<if test="taskId != null">and feedback.task_id = #{taskId}</if>
</where>
</select>
<select id="getListByDefect" resultType="com.ximai.mes.report.response.FeedbackResponse">
select
f.abnormal_reason,
f.abnormal_remark,
sum(f.quantity) quantity,
sum(f.quantity_qualify) quantity_qualify,
sum(f.quantity_unqualify) quantity_unqualify,
sum(f.quantity_feedback) quantity_feedback
from pro_feedback f
left join pro_task_workunit workunit on workunit.task_id = f.task_id
left join pro_task pt on f.task_id = pt.task_id
left join pro_workorder workorder on workorder.workorder_id = f.workorder_id
LEFT JOIN md_item it ON it.item_id = f.item_id
left join md_workunit mw on workunit.workunit_id = mw.workunit_id
left join md_workstation workstation on workstation.workstation_id = mw.workstation_id
<where>
<if test="workorderType != null and workorderType != ''">and workorder.workorder_Type = #{workorderType}</if>
<if test="customerProjectNo!= null and customerProjectNo != '' ">and workorder.customer_Project_No like '%${customerProjectNo}%'</if>
<if test="orderCode != null and orderCode != '' ">and workorder.order_Code like '%${orderCode}%'</if>
<if test="workorderCode != null and workorderCode != '' ">and workorder.workorder_Code like '%${workorderCode}%' </if>
<if test="taskCode != null and taskCode != '' ">and pt.task_Code like '%${taskCode}%'</if>
<if test="productCode != null and productCode != '' ">and workorder.product_Code like '%${productCode}%' </if>
<if test=" productId != null">and workorder.product_Id = #{productId}</if>
<if test=" processId != null ">and pt.process_id = #{processId}</if>
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '%${userName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
<if test=" abnormal_id != null">and f.abnormal_id = #{abnormalId}</if>
<if test=" productName != null and productName != '' ">and workorder.product_Name like '%${productName}%'</if>
<if test=" processName != null and processName != '' ">and pt.process_name like '%${processName}%'</if>
<if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if>
<if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if>
<if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if>
<if test=" abnormalReason != null and abnormalReason != '' ">and f.abnormal_reason like '%${abnormalReason}%'</if>
<if test="defectStatus != null">f.quantity_unqualify > 0 </if>
</where>
group by
f.abnormal_reason,
f.abnormal_remark
</select>
<insert id="insertProFeedback" parameterType="ProFeedback" useGeneratedKeys="true" keyProperty="recordId">
insert into pro_feedback
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment