企业微信报表接口

master
Yangwl 7 months ago
parent f1f472e3f3
commit 4b323702f6

@ -0,0 +1,36 @@
package com.op.mes.controller;
import com.op.mes.domain.H5;
import com.op.mes.service.H5ApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.Max;
import java.util.List;
/**
* H5
*
* @author ruoyi
* @date 2024-07-04
*/
@RestController
@RequestMapping("/h5")
public class H5ApiController {
@Autowired
private H5ApiService h5ApiService;
@GetMapping("/dailyProductDetil")
public List<H5> list(H5 h5)
{
String workTime=h5.getFeedbackTime();
List<H5> list = h5ApiService.dailyProductDetil(workTime);
return list;
}
}

@ -0,0 +1,149 @@
package com.op.mes.domain;
public class H5 {
private String workOrderCode;
private String lineName;
private String productName;
private String category;
private String specifications;
private String StandardStaffing;
private String actualEmployment;
private String productionDuration;
private int planProduction;
private int production;
private String hourlyProduction;
private String standardEfficiency;
private String actualEfficiency;
private String efficiencyAcRate;
private String feedbackTime;
private String parentOrder;
public int getPlanProduction() {
return planProduction;
}
public void setPlanProduction(int planProduction) {
this.planProduction = planProduction;
}
public String getWorkOrderCode() {
return workOrderCode;
}
public void setWorkOrderCode(String workOrderCode) {
this.workOrderCode = workOrderCode;
}
public String getParentOrder() {
return parentOrder;
}
public void setParentOrder(String parentOrder) {
this.parentOrder = parentOrder;
}
public String getFeedbackTime() {
return feedbackTime;
}
public void setFeedbackTime(String feedbackTime) {
this.feedbackTime = feedbackTime;
}
public String getLineName() {
return lineName;
}
public void setLineName(String lineName) {
this.lineName = lineName;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getSpecifications() {
return specifications;
}
public void setSpecifications(String specifications) {
this.specifications = specifications;
}
public String getStandardStaffing() {
return StandardStaffing;
}
public void setStandardStaffing(String standardStaffing) {
StandardStaffing = standardStaffing;
}
public String getActualEmployment() {
return actualEmployment;
}
public void setActualEmployment(String actualEmployment) {
this.actualEmployment = actualEmployment;
}
public String getProductionDuration() {
return productionDuration;
}
public void setProductionDuration(String productionDuration) {
this.productionDuration = productionDuration;
}
public int getProduction() {
return production;
}
public void setProduction(int production) {
this.production = production;
}
public String getHourlyProduction() {
return hourlyProduction;
}
public void setHourlyProduction(String hourlyProduction) {
this.hourlyProduction = hourlyProduction;
}
public String getStandardEfficiency() {
return standardEfficiency;
}
public void setStandardEfficiency(String standardEfficiency) {
this.standardEfficiency = standardEfficiency;
}
public String getActualEfficiency() {
return actualEfficiency;
}
public void setActualEfficiency(String actualEfficiency) {
this.actualEfficiency = actualEfficiency;
}
public String getEfficiencyAcRate() {
return efficiencyAcRate;
}
public void setEfficiencyAcRate(String efficiencyAcRate) {
this.efficiencyAcRate = efficiencyAcRate;
}
}

@ -0,0 +1,21 @@
package com.op.mes.mapper;
import com.op.mes.domain.H5;
import java.util.List;
public interface H5ApiMapper {
/**
*
* @param h5
* @return
*/
public List<H5> selectMesLineProdceList(H5 h5);
/**
*
* @param h5
* @return
*/
public List<H5> selectMesLineProsdceLists(H5 h5);
}

@ -0,0 +1,9 @@
package com.op.mes.service;
import com.op.mes.domain.H5;
import java.util.List;
public interface H5ApiService {
List<H5> dailyProductDetil(String workTime);
}

@ -0,0 +1,31 @@
package com.op.mes.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.mes.domain.H5;
import com.op.mes.mapper.H5ApiMapper;
import com.op.mes.service.H5ApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class H5ApiServiceImpl implements H5ApiService {
@Autowired
private H5ApiMapper h5ApiMapper;
@Override
@DS("#header.poolName")
public List<H5> dailyProductDetil(String workTime) {
//查询当天的生产情况
H5 h5=new H5();
h5.setFeedbackTime(workTime);
//母单报工信息
List<H5> h5List=h5ApiMapper.selectMesLineProdceList(h5);
return h5List;
}
}

@ -0,0 +1,133 @@
<?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.mes.mapper.H5ApiMapper">
<resultMap type="H5" id="H5Result">
<result property="workOrderCode" column="workorder_code"/>
<result property="lineName" column="machine_name"/>
<result property="productName" column="product_name"/>
<result property="category" column="category"/>
<result property="specifications" column="umrez"/>
<result property="StandardStaffing" column="man_standar"/>
<result property="actualEmployment" column="use_man"/>
<result property="productionDuration" column="work_time"/>
<result property="planProduction" column="plan_production"/>
<result property="production" column="quantity_feedback"/>
<result property="parentOrder" column="parent_order"/>
<result property="standardEfficiency" column="standardEfficiency"/>
<result property="actualEfficiency" column="actualEfficiency"/>
<result property="efficiencyAcRate" column="efficiencyAcRate"/>
</resultMap>
<select id="selectMesLineProdceList" parameterType="H5" resultMap="H5Result">
SELECT
mrw.workorder_code,
mrw.machine_name,
mrw.product_code,
mrw.product_name,
bpa.category,
bp.umrez,
SUM ( mrw.quantity ) AS plan_production,
SUM ( mrw.quantity_feedback ) AS quantity_feedback,
MAX(A.quantity_s) AS quantity_s,
MAX(A.quantity_s_total) AS quantity_s_total,
bpa.man_standar,
MAX(A.use_man) AS use_man,
SUM(A.work_time) AS work_time,
mrw.parent_order ,
bpa.iei,
FORMAT(ROUND((bpa.iei / bp.umrez / bpa.man_standar), 1), '0.#') AS standardEfficiency,
FORMAT(ROUND(
CASE
WHEN MAX(A.use_man) = 0 OR SUM(A.work_time) = 0 THEN NULL
ELSE SUM(mrw.quantity_feedback) / MAX(A.use_man) / SUM(A.work_time)
END,
1
), '0.#') AS actualEfficiency,
FORMAT(
CASE
WHEN (bpa.iei / bp.umrez / bpa.man_standar) = 0
THEN NULL
ELSE (CAST(
ROUND(
CASE
WHEN MAX(A.use_man) = 0 OR SUM(A.work_time) = 0 THEN NULL
ELSE SUM(mrw.quantity_feedback) / MAX(A.use_man) / SUM(A.work_time)
END,
1
) AS DECIMAL(10,1))
/ CAST(
ROUND((bpa.iei / bp.umrez / bpa.man_standar), 1) AS DECIMAL(10,1)
) * 100
)
END,
'0.#'
) + '%' AS efficiencyAcRate
FROM
[dbo].[mes_report_work] mrw
LEFT JOIN base_product_attached bpa ON bpa.product_code = RIGHT ( mrw.product_code, 11 )
LEFT JOIN base_product bp ON bp.product_code = mrw.product_code
LEFT JOIN (
SELECT
mrws.workorder_code,
mrws.parent_order,
MAX(mrws.use_man) AS use_man,
MAX(pow.quantity_split) AS quantity_s,
SUM(mrws.quantity_feedback) AS quantity_s_total,
SUM (mrws.work_time ) AS work_time
FROM
[dbo].[mes_report_work] mrws
LEFT JOIN pro_order_workorder pow ON mrws.workorder_code=pow.workorder_code
WHERE
CAST (mrws.feedback_time AS DATE ) = #{feedbackTime}
AND mrws.parent_order != '0'
GROUP BY
mrws.workorder_code,
mrws.parent_order
) A ON A.parent_order= mrw.workorder_code
WHERE
CAST ( mrw.feedback_time AS DATE ) = #{feedbackTime}
AND mrw.parent_order = '0'
GROUP BY
mrw.workorder_code,
mrw.machine_name,
mrw.product_code,
mrw.product_name,
bpa.category,
bp.umrez,
bpa.man_standar,
mrw.use_man,
mrw.parent_order,
bpa.iei
ORDER BY mrw.machine_name ASC
</select>
<select id="selectMesLineProsdceLists" parameterType="H5" resultMap="H5Result">
SELECT
mrw.workorder_code,
mrw.machine_name,
mrw.product_code,
SUM ( mrw.quantity ) AS plan_production,
SUM ( mrw.quantity_feedback ) AS quantity_feedback,
mrw.use_man,
SUM ( mrw.work_time ) AS work_time,
mrw.parent_order
FROM
[dbo].[mes_report_work] mrw
LEFT JOIN base_product_attached bpa ON bpa.product_code = RIGHT(mrw.product_code, 11)
LEFT JOIN base_product bp ON bp.product_code = mrw.product_code
<where>
<if test="feedbackTime != null and feedbackTime != ''">
CAST ( mrw.feedback_time AS DATE ) = #{feedbackTime}
</if>
AND mrw.parent_order != '0'
</where>
GROUP BY
mrw.workorder_code,
mrw.machine_name,
mrw.product_code,
mrw.use_man,
mrw.parent_order;
</select>
</mapper>
Loading…
Cancel
Save