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

更新报表

parent 19b1a5ac
package com.ximai.mes.report.controller;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ximai.common.annotation.Log;
import com.ximai.common.core.controller.BaseController;
import com.ximai.common.core.domain.AjaxResult;
import com.ximai.common.core.page.TableDataInfo;
import com.ximai.common.enums.BusinessType;
import com.ximai.mes.report.request.DailyProductionReportRequest;
import com.ximai.mes.report.request.FeedbackRequest;
import com.ximai.mes.report.response.FeedbackResponse;
import com.ximai.mes.report.service.DailyProductionReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Api("日产能对比统计")
@RestController
@RequestMapping("/dailyProductionReport")
public class DailyProductionReportController extends BaseController {
@Autowired
DailyProductionReportService dailyProductionReportService;
@ApiOperation("日产能对比统计:获取日期表头")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "日产能对比统计:获取日期表头", businessType = BusinessType.QUERY)
@GetMapping("/getDatas")
public AjaxResult<List> getDatas(DailyProductionReportRequest dailyProductionReportRequest) {
List data = dailyProductionReportService.getDatas(dailyProductionReportRequest);
return AjaxResult.success(data);
}
@ApiOperation("日产能对比统计:统计方式工序")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "日产能对比统计:统计方式工序", businessType = BusinessType.QUERY)
@GetMapping("/getListByProcess")
public AjaxResult<List> getListByWorkOrder(DailyProductionReportRequest dailyProductionReportRequest) {
List data = dailyProductionReportService.getListByProcess(dailyProductionReportRequest);
return AjaxResult.success(data);
}
@ApiOperation("日产能对比统计:统计方式车间")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "日产能对比统计:统计方式车间", businessType = BusinessType.QUERY)
@GetMapping("/getListByWorkshop")
public AjaxResult<List> getListByWorkshop(DailyProductionReportRequest dailyProductionReportRequest) {
List data = dailyProductionReportService.getListByWorkshop(dailyProductionReportRequest);
return AjaxResult.success(data);
}
@ApiOperation("日产能对比统计:统计方式工作中心")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "日产能对比统计:统计方式工作中心", businessType = BusinessType.QUERY)
@GetMapping("/getListByWorkstation")
public AjaxResult<List> getListByWorkstation(DailyProductionReportRequest dailyProductionReportRequest) {
List data = dailyProductionReportService.getListByWorkstation(dailyProductionReportRequest);
return AjaxResult.success(data);
}
@ApiOperation("日产能对比统计:统计方式工作单元")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "日产能对比统计:统计方式工作单元", businessType = BusinessType.QUERY)
@GetMapping("/getListByWorkunit")
public AjaxResult<List> getListByWorkunit(DailyProductionReportRequest dailyProductionReportRequest) {
List data = dailyProductionReportService.getListByWorkunit(dailyProductionReportRequest);
return AjaxResult.success(data);
}
@ApiOperation("日产能对比统计:统计方式报工人员")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "日产能对比统计:统计方式报工人员", businessType = BusinessType.QUERY)
@GetMapping("/getListByUser")
public AjaxResult<List> getListByUser(DailyProductionReportRequest dailyProductionReportRequest) {
List data = dailyProductionReportService.getListByUser(dailyProductionReportRequest);
return AjaxResult.success(data);
}
}
package com.ximai.mes.report.mapper;
import com.ximai.mes.report.request.DailyProductionReportRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface DailyProductionReportMapper {
List<Map> getListByProcess(DailyProductionReportRequest dailyProductionReportRequest);
List<Map> getListByWorkshop(DailyProductionReportRequest dailyProductionReportRequest);
List<Map> getListByWorkstation(DailyProductionReportRequest dailyProductionReportRequest);
List<Map> getListByWorkunit(DailyProductionReportRequest dailyProductionReportRequest);
List<Map> getListByUser(DailyProductionReportRequest dailyProductionReportRequest);
}
package com.ximai.mes.report.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class DailyProductionReportRequest {
@ApiModelProperty("开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startDate;
@ApiModelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endDate;
/**
* 工序ID
*/
@ApiModelProperty( "工序ID")
private Long processId;
/**
* 工序编码
*/
@ApiModelProperty( "工序编码")
private String processCode;
/**
* 工序编码
*/
@ApiModelProperty( "工序名称")
private String processName;
/**
* 车间ID
*/
@ApiModelProperty("车间ID")
private Long workshopId;
@ApiModelProperty("车间名称")
private String workshopName;
/**
* 工作中心ID
*/
@ApiModelProperty( "工作中心ID")
private Long workstationId;
/**
* 工作中心名称
*/
@ApiModelProperty( "工作中心名称")
private String workstationName;
/**
*
*/
@ApiModelProperty("工作单元ID")
private Long workunitId;
@ApiModelProperty("作业单元名称")
private String workunitName;
@ApiModelProperty("报工人员名称")
private String userName;
@ApiModelProperty("报工人员昵称")
private String nickName;
}
package com.ximai.mes.report.service;
import com.ximai.mes.report.request.DailyProductionReportRequest;
import java.util.List;
import java.util.Map;
public interface DailyProductionReportService {
List getListByProcess(DailyProductionReportRequest dailyProductionReportRequest);
List getDatas(DailyProductionReportRequest dailyProductionReportRequest);
List getListByWorkshop(DailyProductionReportRequest dailyProductionReportRequest);
List getListByWorkstation(DailyProductionReportRequest dailyProductionReportRequest);
List getListByWorkunit(DailyProductionReportRequest dailyProductionReportRequest);
List getListByUser(DailyProductionReportRequest dailyProductionReportRequest);
}
......@@ -375,7 +375,7 @@
<select id="getListByWorkunit" resultType="com.ximai.mes.report.response.FeedbackResponse">
select
mw.workunit_code,
workunit.workunit_name,
mw.workunit_name,
sum(f.quantity) quantity,
sum(f.quantity_qualify) quantity_qualify,
sum(f.quantity_unqualify) quantity_unqualify,
......@@ -415,7 +415,7 @@
</where>
group by
mw.workunit_code,
workunit.workunit_name
mw.workunit_name
</select>
<select id="getListByProcess" resultType="com.ximai.mes.report.response.FeedbackResponse">
select
......
<?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.ximai.mes.report.mapper.DailyProductionReportMapper">
<select id="getListByProcess" resultType="java.util.Map">
SELECT
process.process_code AS "工序编号",
process.process_name AS "工序名称",
DATE_FORMAT( f.feedback_time, '%Y-%m-%d' ) AS "报工日期",
sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
sum( f.quantity_qualify + f.quantity_unqualify) AS "报工数量"
FROM
pro_feedback f
JOIN pro_task_workunit workunit ON workunit.task_id = f.task_id
JOIN pro_task pt ON f.task_id = pt.task_id
JOIN pro_process process ON process.process_id = pt.process_id
<where>
<if test=" processId != null ">and process.process_id = #{processId}</if>
<if test=" processName != null and processName != '' ">and process.process_name like '%${processName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
</where>
GROUP BY
process.process_code,
process.process_name,
DATE_FORMAT( f.feedback_time, '%Y-%m-%d' )
</select>
<select id="getListByWorkshop" resultType="java.util.Map">
SELECT
workstation.workshop_code as '车间编码',
workstation.workshop_name as '车间名称',
DATE_FORMAT( f.feedback_time, '%Y-%m-%d' ) AS "报工日期",
sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
sum( f.quantity_qualify + f.quantity_unqualify) AS "报工数量"
FROM
pro_feedback f
JOIN pro_task_workunit workunit ON workunit.task_id = f.task_id
JOIN pro_task pt ON f.task_id = pt.task_id
JOIN pro_process process ON process.process_id = pt.process_id
join pro_workorder workorder on workorder.workorder_id = f.workorder_id
JOIN md_item it ON it.item_id = f.item_id
join md_workunit mw on workunit.workunit_id = mw.workunit_id
join md_workstation workstation on workstation.workstation_id = mw.workstation_id
<where>
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
</where>
group by
workstation.workshop_code,
workstation.workshop_name,
DATE_FORMAT( f.feedback_time, '%Y-%m-%d' )
</select>
<select id="getListByWorkstation" resultType="java.util.Map">
SELECT
workstation.workstation_code AS "工作中心编码",
workstation.workstation_name AS "工作中心名称",
DATE_FORMAT( f.feedback_time, '%Y-%m-%d' ) AS "报工日期",
sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
sum( f.quantity_qualify + f.quantity_unqualify) AS "报工数量"
FROM
pro_feedback f
JOIN pro_task_workunit workunit ON workunit.task_id = f.task_id
JOIN pro_task pt ON f.task_id = pt.task_id
JOIN pro_process process ON process.process_id = pt.process_id
join pro_workorder workorder on workorder.workorder_id = f.workorder_id
JOIN md_item it ON it.item_id = f.item_id
join md_workunit mw on workunit.workunit_id = mw.workunit_id
join md_workstation workstation on workstation.workstation_id = mw.workstation_id
<where>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
</where>
group by
workstation.workstation_code,
workstation.workstation_name,
DATE_FORMAT( f.feedback_time, '%Y-%m-%d' )
</select>
<select id="getListByWorkunit" resultType="java.util.Map">
SELECT
mw.workunit_code AS "工作单元编码",
mw.workunit_name AS "工作单元名称",
DATE_FORMAT( f.feedback_time, '%Y-%m-%d' ) AS "报工日期",
sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
sum( f.quantity_qualify + f.quantity_unqualify) AS "报工数量"
FROM
pro_feedback f
JOIN pro_task_workunit workunit ON workunit.task_id = f.task_id
JOIN pro_task pt ON f.task_id = pt.task_id
JOIN pro_process process ON process.process_id = pt.process_id
join pro_workorder workorder on workorder.workorder_id = f.workorder_id
JOIN md_item it ON it.item_id = f.item_id
join md_workunit mw on workunit.workunit_id = mw.workunit_id
join md_workstation workstation on workstation.workstation_id = mw.workstation_id
<where>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
</where>
group by
mw.workunit_code,
mw.workunit_name,
DATE_FORMAT( f.feedback_time, '%Y-%m-%d' )
</select>
<select id="getListByUser" resultType="java.util.Map">
SELECT
IFNULL(f.user_name,'无') AS "报工人员编码",
f.nick_name AS "报工人员名称",
DATE_FORMAT( f.feedback_time, '%Y-%m-%d' ) AS "报工日期",
sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
sum( f.quantity_qualify + f.quantity_unqualify) AS "报工数量"
FROM
pro_feedback f
JOIN pro_task_workunit workunit ON workunit.task_id = f.task_id
JOIN pro_task pt ON f.task_id = pt.task_id
JOIN pro_process process ON process.process_id = pt.process_id
join pro_workorder workorder on workorder.workorder_id = f.workorder_id
JOIN md_item it ON it.item_id = f.item_id
join md_workunit mw on workunit.workunit_id = mw.workunit_id
join md_workstation workstation on workstation.workstation_id = mw.workstation_id
<where>
<if test="userName != null and userName != ''">and f.user_name like concat('%', #{userName}, '%')</if>
<if test=" nickName != null and nickName != '' ">and f.nick_Name like '%${nickName}%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
</where>
group by
IFNULL(f.user_name,'无'),
f.nick_name,
DATE_FORMAT( f.feedback_time, '%Y-%m-%d' )
</select>
</mapper>
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