|
@@ -3,7 +3,8 @@
|
|
|
<mapper namespace="com.github.zuihou.business.statisticalAnalysis.dao.ProductLinePerformanceMapper">
|
|
<mapper namespace="com.github.zuihou.business.statisticalAnalysis.dao.ProductLinePerformanceMapper">
|
|
|
<!-- 分页 -->
|
|
<!-- 分页 -->
|
|
|
<select id="pageList" resultType="com.github.zuihou.business.operationManagementCenter.entity.TaskNode">
|
|
<select id="pageList" resultType="com.github.zuihou.business.operationManagementCenter.entity.TaskNode">
|
|
|
- SELECT tmp1.productionlineId,tmp1.productionlineName,tmp1.statisticalDate,tmp1.start_time,tmp1.end_time,SUM(TIMESTAMPDIFF(MINUTE, tmp1.start_time, tmp1.end_time) / 60) AS statisticalHours, tmp1.org_id FROM
|
|
|
|
|
|
|
+ SELECT tmp1.productionlineId,tmp1.productionlineName,tmp1.statisticalDate,tmp1.start_time,tmp1.end_time,SUM(
|
|
|
|
|
+ IF(TIMESTAMPDIFF(MINUTE,tmp1.start_time,tmp1.end_time)<![CDATA[ <= ]]>30,TIMESTAMPDIFF(MINUTE,tmp1.start_time, tmp1.end_time ), 0))/60 AS statisticalHours, tmp1.org_id FROM
|
|
|
(SELECT
|
|
(SELECT
|
|
|
izz.id AS productionlineId,
|
|
izz.id AS productionlineId,
|
|
|
izz.name AS productionlineName,
|
|
izz.name AS productionlineName,
|
|
@@ -21,6 +22,7 @@
|
|
|
AND c.id = d.task_id
|
|
AND c.id = d.task_id
|
|
|
AND d.loading_user_id = e.id
|
|
AND d.loading_user_id = e.id
|
|
|
AND d.exe_status = '3'
|
|
AND d.exe_status = '3'
|
|
|
|
|
+ AND ioo.single_task_flag = '0'
|
|
|
AND d.loading_user_id IS NOT NULL) tmp1 ${ew.customSqlSegment} GROUP BY tmp1.statisticalDate,tmp1.productionlineId ORDER BY tmp1.productionlineId,tmp1.statisticalDate
|
|
AND d.loading_user_id IS NOT NULL) tmp1 ${ew.customSqlSegment} GROUP BY tmp1.statisticalDate,tmp1.productionlineId ORDER BY tmp1.productionlineId,tmp1.statisticalDate
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -32,7 +34,8 @@
|
|
|
date_format(d.start_time,'%Y-%m') AS statisticalDate,
|
|
date_format(d.start_time,'%Y-%m') AS statisticalDate,
|
|
|
d.start_time,
|
|
d.start_time,
|
|
|
d.end_time,
|
|
d.end_time,
|
|
|
- SUM(TIMESTAMPDIFF(MINUTE, d.start_time,d.end_time) / 60) AS statisticalHours
|
|
|
|
|
|
|
+ SUM(IF(TIMESTAMPDIFF(MINUTE,d.start_time,d.end_time)>30,TIMESTAMPDIFF(MINUTE,d.start_time, d.end_time ), 0))/60 AS delayHours,
|
|
|
|
|
+ SUM(IF(TIMESTAMPDIFF(MINUTE,d.start_time,d.end_time)<![CDATA[ <= ]]>30,TIMESTAMPDIFF(MINUTE,d.start_time, d.end_time ), 0))/60 AS statisticalHours
|
|
|
FROM imcs_base_300_0000.imcs_z_zone izz,
|
|
FROM imcs_base_300_0000.imcs_z_zone izz,
|
|
|
imcs_base_300_0000.imcs_o_order ioo,
|
|
imcs_base_300_0000.imcs_o_order ioo,
|
|
|
imcs_base_300_0000.imcs_t_task c,
|
|
imcs_base_300_0000.imcs_t_task c,
|
|
@@ -43,6 +46,7 @@
|
|
|
AND c.id = d.task_id
|
|
AND c.id = d.task_id
|
|
|
AND d.loading_user_id = e.id
|
|
AND d.loading_user_id = e.id
|
|
|
AND d.exe_status = '3'
|
|
AND d.exe_status = '3'
|
|
|
|
|
+ AND ioo.single_task_flag = '0'
|
|
|
AND d.loading_user_id IS NOT NULL and izz.id = #{productionlineId} and date_format(d.start_time,'%Y-%m') = #{statisticalDate} GROUP BY statisticalDate,d.loading_user_id order by e.name
|
|
AND d.loading_user_id IS NOT NULL and izz.id = #{productionlineId} and date_format(d.start_time,'%Y-%m') = #{statisticalDate} GROUP BY statisticalDate,d.loading_user_id order by e.name
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -115,16 +119,16 @@
|
|
|
<select id="procedureSum" resultType="com.github.zuihou.tenant.dto.ProcedureSumDto">
|
|
<select id="procedureSum" resultType="com.github.zuihou.tenant.dto.ProcedureSumDto">
|
|
|
select ioo.order_no,
|
|
select ioo.order_no,
|
|
|
itw.bom_name,
|
|
itw.bom_name,
|
|
|
- count(itw.procedure_id) as totalNum,
|
|
|
|
|
- sum(if(itw.is_end = 0 ,1,0)) as awaitNum,
|
|
|
|
|
- sum(if(itw.is_end = 1 ,1,0)) as endNum,
|
|
|
|
|
- sum(if(itw.test_result = 0 ,1,0)) as scrapNum
|
|
|
|
|
|
|
+ ioo.product_num as totalNum,
|
|
|
|
|
+ sum(if(itw.is_end = '0' ,1,0)) as awaitNum,
|
|
|
|
|
+ sum(if(itw.is_end = '1' ,1,0)) as endNum,
|
|
|
|
|
+ sum(if(itw.test_result = '0' ,1,0)) as scrapNum
|
|
|
from imcs_o_order ioo
|
|
from imcs_o_order ioo
|
|
|
- left join imcs_t_task itt on ioo.id = itt.order_id
|
|
|
|
|
left join imcs_t_workpiece itw on ioo.id = itw.order_id
|
|
left join imcs_t_workpiece itw on ioo.id = itw.order_id
|
|
|
<where>
|
|
<where>
|
|
|
|
|
+ ioo.single_task_flag='0'
|
|
|
<if test=" vo.bomName != null and vo.bomName != ''">
|
|
<if test=" vo.bomName != null and vo.bomName != ''">
|
|
|
- itw.bom_name like concat('%', #{vo.bomName}, '%')
|
|
|
|
|
|
|
+ and itw.bom_name like concat('%', #{vo.bomName}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
group by itw.order_no, itw.bom_name
|
|
group by itw.order_no, itw.bom_name
|
|
@@ -135,14 +139,13 @@
|
|
|
select * from (
|
|
select * from (
|
|
|
select ioo.order_no,
|
|
select ioo.order_no,
|
|
|
itw.bom_name,
|
|
itw.bom_name,
|
|
|
- itt.procedure_name,
|
|
|
|
|
- count(itw.procedure_id) as totalNum,
|
|
|
|
|
- sum(if(itw.is_end = 0 ,1,0)) as awaitNum,
|
|
|
|
|
- sum(if(itw.is_end = 1 ,1,0)) as endNum,
|
|
|
|
|
- sum(if(itw.test_result = 0 ,1,0)) as scrapNum ,
|
|
|
|
|
- itt.procedure_sort
|
|
|
|
|
|
|
+ ibbp.name as procedureName,
|
|
|
|
|
+ count(itw.procedure_id) as totalNum,
|
|
|
|
|
+ sum(if(itw.is_end = '0' ,1,0)) as awaitNum,
|
|
|
|
|
+ sum(if(itw.is_end = '1' ,1,0)) as endNum,
|
|
|
|
|
+ sum(if(itw.test_result = '0' ,1,0)) as scrapNum ,
|
|
|
|
|
+ ibbp.sort as procedure_sort
|
|
|
from imcs_o_order ioo
|
|
from imcs_o_order ioo
|
|
|
- left join imcs_t_task itt on ioo.id = itt.order_id
|
|
|
|
|
left join imcs_t_workpiece itw on ioo.id = itw.order_id
|
|
left join imcs_t_workpiece itw on ioo.id = itw.order_id
|
|
|
left join imcs_b_bom_procedure ibbp on ibbp.bom_id = itw.bom_id
|
|
left join imcs_b_bom_procedure ibbp on ibbp.bom_id = itw.bom_id
|
|
|
<where>
|
|
<where>
|
|
@@ -150,7 +153,7 @@
|
|
|
ioo.order_no like concat('%', #{params.orderNo}, '%')
|
|
ioo.order_no like concat('%', #{params.orderNo}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
- group by itw.order_no, itw.bom_name, itt.procedure_name
|
|
|
|
|
|
|
+ group by itw.order_no, itw.bom_name, ibbp.name
|
|
|
) t
|
|
) t
|
|
|
order by t.procedure_sort;
|
|
order by t.procedure_sort;
|
|
|
</select>
|
|
</select>
|
|
@@ -277,48 +280,49 @@
|
|
|
|
|
|
|
|
<select id="resourceRate" resultType="com.github.zuihou.tenant.vo.DeviceResourceDetailVo">
|
|
<select id="resourceRate" resultType="com.github.zuihou.tenant.vo.DeviceResourceDetailVo">
|
|
|
select
|
|
select
|
|
|
- t.resourceId,
|
|
|
|
|
- t.resourceName,
|
|
|
|
|
- t.resourceCode,
|
|
|
|
|
- t.bomName,
|
|
|
|
|
- t.start_time,
|
|
|
|
|
- t.end_time,
|
|
|
|
|
- t.startHour,
|
|
|
|
|
- t.endHour
|
|
|
|
|
|
|
+ t.resourceId,
|
|
|
|
|
+ t.resourceName,
|
|
|
|
|
+ t.bomName,
|
|
|
|
|
+ t.nodeEndTime as startTime,
|
|
|
|
|
+ t.taskEndTime as endTime,
|
|
|
|
|
+ t.startHour,
|
|
|
|
|
+ t.endHour,
|
|
|
|
|
+ t.expectTime,
|
|
|
|
|
+ t.realTime
|
|
|
from(
|
|
from(
|
|
|
- SELECT
|
|
|
|
|
- itp.id AS resourceId,
|
|
|
|
|
- itp.NAME AS resourceName,
|
|
|
|
|
- itp.code as resourceCode,
|
|
|
|
|
- ibb.NAME AS bomName,
|
|
|
|
|
- c.procedure_no,
|
|
|
|
|
- (select itn.end_time from imcs_base_300_0000.imcs_t_task_node itn where itn.task_id = c.id and itn.node_name =
|
|
|
|
|
- '放本序设备') as start_time,
|
|
|
|
|
- c.end_time,
|
|
|
|
|
- DATE_FORMAT((select itn.end_time from imcs_base_300_0000.imcs_t_task_node itn where itn.task_id = c.id and
|
|
|
|
|
- itn.node_name = '放本序设备'),'%H') as startHour,
|
|
|
|
|
- DATE_FORMAT(c.end_time,'%H') as endHour
|
|
|
|
|
- FROM
|
|
|
|
|
- imcs_base_300_0000.imcs_z_zone a,
|
|
|
|
|
- imcs_base_300_0000.imcs_z_zone_productionresource b,
|
|
|
|
|
- imcs_base_300_0000.imcs_tenant_productionresource itp,
|
|
|
|
|
- imcs_base_300_0000.imcs_t_task c,
|
|
|
|
|
- imcs_base_300_0000.imcs_b_bom ibb
|
|
|
|
|
- WHERE
|
|
|
|
|
- a.id = b.zone_id
|
|
|
|
|
- AND b.resource_id = c.resource_id
|
|
|
|
|
- AND b.resource_id = itp.id
|
|
|
|
|
- AND c.bom_id = ibb.id
|
|
|
|
|
- AND c.start_time IS NOT NULL
|
|
|
|
|
- AND c.`status` in (2,3)
|
|
|
|
|
- AND c.procedure_no LIKE 'OP%0'
|
|
|
|
|
- AND c.end_time BETWEEN #{params.startTime} and #{params.endTime}
|
|
|
|
|
- <if test="params.resourceId !=null and params.resourceId !=''">
|
|
|
|
|
- AND b.resource_id = #{params.resourceId}
|
|
|
|
|
- </if>
|
|
|
|
|
- ) t
|
|
|
|
|
- where t.start_time is not null
|
|
|
|
|
- order by t.start_time ASC
|
|
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ itp.id AS resourceId,
|
|
|
|
|
+ itp.NAME AS resourceName,
|
|
|
|
|
+ ibb.NAME AS bomName,
|
|
|
|
|
+ c.procedure_no,
|
|
|
|
|
+ n.end_time as nodeEndTime,
|
|
|
|
|
+ c.end_time as taskEndTime,
|
|
|
|
|
+ Round(p.rated_workHours) AS expectTime,
|
|
|
|
|
+ TIMESTAMPDIFF(MINUTE, n.end_time, ifnull(c.end_time, Now())) AS realTime,
|
|
|
|
|
+ DATE_FORMAT(n.end_time, '%H') as startHour,
|
|
|
|
|
+ DATE_FORMAT(c.end_time, '%H') as endHour
|
|
|
|
|
+ FROM
|
|
|
|
|
+ imcs_base_300_0000.imcs_tenant_productionresource itp,
|
|
|
|
|
+ imcs_base_300_0000.imcs_t_task c,
|
|
|
|
|
+ imcs_base_300_0000.imcs_b_bom_procedure p,
|
|
|
|
|
+ imcs_base_300_0000.imcs_t_task_node n,
|
|
|
|
|
+ imcs_base_300_0000.imcs_b_bom ibb
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ itp.id = c.resource_id
|
|
|
|
|
+ AND c.bom_id = ibb.id
|
|
|
|
|
+ AND c.procedure_id = p.id
|
|
|
|
|
+ AND n.exe_status='3'
|
|
|
|
|
+ AND c.start_time IS NOT NULL
|
|
|
|
|
+ AND c.`status` in (2,3)
|
|
|
|
|
+ AND n.node_name = '放本序设备'
|
|
|
|
|
+ AND c.id = n.task_id
|
|
|
|
|
+ AND c.end_time BETWEEN #{params.startTime} and #{params.endTime}
|
|
|
|
|
+ <if test="params.resourceId !=null and params.resourceId !=''">
|
|
|
|
|
+ AND c.resource_id = #{params.resourceId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ) t
|
|
|
|
|
+ where t.nodeEndTime is not null
|
|
|
|
|
+ order by t.nodeEndTime ASC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|