You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1892 lines
84 KiB
XML

<?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.ruoyi.system.mapper.BroadDataMapper">
<resultMap type="com.ruoyi.system.domain.BoxPlanCompletion" id="selectplanCompletion">
<result property="plan_shift" column="config_name"/>
<result property="planned_number" column="planned_number"/>
<result property="quantity_number" column="config_value"/>
</resultMap>
<delete id="deleteWorkTime">
delete from HAIWEI.BASE_DAY_WBTIME where CREATE_TIME &lt; sysdate - interval '15' DAY
</delete>
<delete id="deleteBoxOutput">
delete from IMOS.BASE_BOX_OUTPUT_RECORD where CREATE_TIME &lt; sysdate - interval '10' DAY
</delete>
<select id="selectplanCompletion" resultType="com.ruoyi.system.domain.BoxOutput">
select sum(PLAN_QTY) qty, '计划数量' as name
from imos_ta_material
where DISPLAY_FLAG = 1
union
select sum(QTY3) as qty, '实际产量' as name
from IMOS.BASE_BOX_OUTPUT_RECORD xhq
left join (select * from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) where ROWNUM = 1) wb
on 1 = 1
where xhq.CREATE_TIME between
case when sysdate &lt;= wb.W_END then W_START else W_END end
and
case when sysdate &lt;= wb.W_END then W_END else B_END end
and QTY3 &gt; 0
</select>
<select id="selectStock" resultType="com.ruoyi.system.domain.BoxStock">
select substr(MATERIAL_NAME,
case
when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
else instr(MATERIAL_NAME, '/', 1, 1) + 1
end,
case
when instr(MATERIAL_NAME, ',', 1, 2) = 0 then Length(MATERIAL_NAME)+1
else instr(MATERIAL_NAME, ',', 1, 2)
end
-
case
when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
else instr(MATERIAL_NAME, '/', 1, 1) + 1
end) as order_type
, Sum(Store_Qty) as stock
, Store_Code
from IMOS_LO_BIN losd
where Store_Code =#{id}
and Material_Code is not null
and Store_Qty &gt; 0
group by material_name, Store_Code
order by material_name
</select>
<select id="selectOutputByType" resultType="com.ruoyi.system.domain.BoxOutput">
select substr(name,
case
when instr(name, '/', 1, 1) = 0 then instr(name, ',', 1, 1) + 1
else instr(name, '/', 1, 1) + 1
end,
case
when instr(name, ',', 1, 2) = 0 then Length(name) + 1
else instr(name, ',', 1, 2)
end
-
case
when instr(name, '/', 1, 1) = 0 then instr(name, ',', 1, 1) + 1
else instr(name, '/', 1, 1) + 1
end) as name,
sum(QTY3) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD xhq
left join (select * from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) where ROWNUM = 1) wb
on 1 = 1
where xhq.CREATE_TIME between case when sysdate &lt;= wb.W_END then W_START else W_END end
and case when sysdate &lt;= wb.W_END then W_END else B_END end
and QTY3 > 0
group by name
</select>
<select id="xk_selectStockOccupancy" resultType="com.ruoyi.system.domain.OrderInfo">
select round(count(STORE_BIN) / 3.3, 2) as rate, Store_Code as name
from IMOS_LO_BIN_DETIAL losd
where Store_Code in ('S001', 'S002')
and MATERIAL_STATE = '1'
group by Store_Code
</select>
<select id="getUHullPlanInfo" resultType="com.ruoyi.system.domain.OrderInfo">
select PLAN_NO as plan_code,
substr(MATERIAL_NAME,6,Length(MATERIAL_NAME)) as name,
PLAN_QTY as plan_number,
ACTUAL_QTY as actual_number,
round(ACTUAL_QTY / PLAN_QTY * 100,2) as rate,
START_TIME as day
from IMOS_PR_PLAN t
where process_code = 1002
and delete_flag = '0'
and to_char(plan_date, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
order by START_TIME desc
</select>
<select id="selectOutputByTimeDY" resultType="com.ruoyi.system.domain.BoxOutput">
select TO_CHAR(CREATION_DATE, 'hh24') || ':30' as name,
sum(ACTUAL_QTY) as qty
from IMOS_PR_PLAN t
where process_code = 1002
and delete_flag = '0'
and CREATION_DATE > (select *
from (select CREATE_TIME from HAIWEI.XK_H_QTY order by CREATE_TIME desc)
where ROWNUM = 1)
group by TO_CHAR(CREATION_DATE, 'hh24')
</select>
<select id="selectOutputByTime1" resultType="com.ruoyi.system.domain.BoxOutput">
select name, qty
from (
select '19:30' as name, sum(QTY3) as qty,1 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
select W_END as day1, W_END + interval '1' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;= day1 and ippb.CREATE_TIME &lt; day2
union
select '20:30' as name, sum(QTY3) as qty, 2 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
-- 2022-07-28 20:30:00
select W_END + interval '1' HOUR as day1, W_END + interval '2' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
union
select '21:30' as name, sum(QTY3) as qty, 3 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
-- 2022-07-28 21:30:00
select W_END + interval '2' HOUR as day1, W_END + interval '3' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
union
select '22:30' as name, sum(QTY3) as qty, 4 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
-- 2022-07-28 22:30:00
select W_END + interval '3' HOUR as day1, W_END + interval '4' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
union
select '23:30' as name, sum(QTY3) as qty, 5 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
-- 2022-07-28 23:30:00
select W_END + interval '4' HOUR as day1, W_END + interval '5' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
union
select '00:30' as name, sum(QTY3) as qty, 6 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
-- 2022-07-29 00:30:00
select W_END + interval '5' HOUR as day1, W_END + interval '6' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
union
select '01:30' as name, sum(QTY3) as qty, 7 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
-- 2022-07-29 01:30:00
select W_END + interval '6' HOUR as day1, W_END + interval '7' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
union
select '02:30' as name, sum(QTY3) as qty, 8 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
select W_END + interval '7' HOUR as day1, W_END + interval '8' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
union
select '03:30' as name, sum(QTY3) as qty, 9 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
select W_END + interval '8' HOUR as day1, W_END + interval '9' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
union
select '04:30' as name, sum(QTY3) as qty, 10 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
select W_END + interval '9' HOUR as day1, W_END + interval '10' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
union
select '05:30' as name, sum(QTY3) as qty, 11 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
select W_END + interval '10' HOUR as day1, W_END + interval '11' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
union
select '06:30' as name, sum(QTY3) as qty, 12 as ord
from IMOS.BASE_BOX_OUTPUT_RECORD ippb
left join (
select W_END + interval '11' HOUR as day1, W_END + interval '12' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where ippb.CREATE_TIME &gt;
= day1 and ippb.CREATE_TIME &lt;
day2
)
order by ord
</select>
<select id="selectOutputByTime" resultType="com.ruoyi.system.domain.BoxOutput">
select '07:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '07:30:00', 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '08:30:00', 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '08:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '08:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '09:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '09:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '09:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '10:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '10:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '10:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '11:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '11:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '11:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '12:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '12:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '12:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '13:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '13:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '13:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '14:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '14:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '14:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '15:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '15:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '15:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '16:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '16:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '16:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '17:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '17:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '17:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '18:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
union
select '18:30' as name, nvl(sum(QTY3),0) as qty
from IMOS.BASE_BOX_OUTPUT_RECORD
where CREATE_TIME &gt;= to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '18:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and CREATE_TIME &lt; to_date(to_char(SYSDATE
, 'yyyy-MM-dd') || '19:30:00'
, 'yyyy-MM-dd hh24:mi:ss')
and qty3>0
</select>
<select id="fp_selectOrderExecutionDay" resultType="com.ruoyi.system.domain.OrderInfo">
select name,
STATION_NO,
target,
status,
plan_number,
(h1 + h2 + h3 + h4 + h5 + h6 + h7 + H8 + h9 + H10 + h11 + h12) as qty,
round((h1 + h2 + h3 + h4 + h5 + h6 + h7 + H8 + h9 + H10 + h11 + h12) / CURRENTPLAN_QTY * 100, 2) as rate,
h1,
h2,
h3,
h4,
h5,
h6,
h7,
H8,
h9,
H10,
h11,
h12
from (
select substr(MATERIAL_NAME,
case
when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
else instr(MATERIAL_NAME, '/', 1, 1) + 1
end,
case
when instr(MATERIAL_NAME, ',', 1, 2) = 0 then Length(MATERIAL_NAME) + 1
else instr(MATERIAL_NAME, ',', 1, 2)
end
-
case
when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
else instr(MATERIAL_NAME, '/', 1, 1) + 1
end) as name,
STATION_NO,
(select QTY
from (select QTY, row_number() over (order by CREATE_TIME desc) row_n from HAIWEI.BASE_FP_PLANQTY)
where row_n = 1) as target,
case
when PRODUCT_STATUS = 0 then '未生产'
else '生产中' end as status,
nvl(plan_number, 0) as plan_number,
PRODUCT_QTY as qty,
round(PRODUCT_QTY / CURRENTPLAN_QTY * 100, 2) as rate,
CURRENTPLAN_QTY,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '07:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY1
else 0 end as h1,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '08:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY2
else 0 end as h2,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '09:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY3
else 0 end as h3,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '10:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY4
else 0 end as h4,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '11:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY5
else 0 end as h5,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '12:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY6
else 0 end h6,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '13:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY7
else 0 end h7,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '14:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY8
else 0 end h8,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '15:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY9
else 0 end h9,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '16:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY10
else 0 end h10,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '17:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY11
else 0 end h11,
case
when sysdate &gt;
to_date(to_char(sysdate, 'yyyy-mm-dd') || '18:29:59', 'yyyy-mm-dd hh24:mi:ss')
then
HOUR_QTY12
else 0 end h12
from IMOS_PR_FOAMING_MONITOR ipr
left join (
select round(PLAN_QTY / num, 0) as plan_number, itm.MATERIAL_NAME AS NAME
from imos_ta_material itm
left join (select count(1) as num, MATERIAL_NAME
from IMOS_PR_FOAMING_MONITOR
group by MATERIAL_NAME) cou
on cou.MATERIAL_NAME = itm.MATERIAL_NAME
where DISPLAY_FLAG = 1
) ta
on ta.name = ipr.MATERIAL_NAME
order by to_number(STATION_NO))
</select>
<select id="fp_selectOrderExecution" resultType="com.ruoyi.system.domain.OrderInfo">
select substr(MATERIAL_NAME,
case
when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
else instr(MATERIAL_NAME, '/', 1, 1) + 1
end,
case
when instr(MATERIAL_NAME, ',', 1, 2) = 0 then Length(MATERIAL_NAME) + 1
else instr(MATERIAL_NAME, ',', 1, 2)
end
-
case
when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
else instr(MATERIAL_NAME, '/', 1, 1) + 1
end) as name,
nvl(plan_number, 0) as plan_number,
sum(PRODUCT_QTY) as actual_number,
round( sum(PRODUCT_QTY)/nvl(plan_number, 1)*100,2) as rate
from IMOS_PR_FOAMING_MONITOR irfm
left join (
select PLAN_QTY plan_number, MATERIAL_NAME as name1
from imos_ta_material
where DISPLAY_FLAG = 1) plan on plan.name1 = MATERIAL_NAME
where PRODUCT_QTY > 0
group by MATERIAL_NAME, plan_number
</select>
<select id="fp_selectOrderExecutionPlan" resultType="com.ruoyi.system.domain.OrderInfo">
-- select substr(MATERIAL_NAME,
-- case
-- when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
-- else instr(MATERIAL_NAME, '/', 1, 1) + 1
-- end,
-- case
-- when instr(MATERIAL_NAME, ',', 1, 2) = 0 then Length(MATERIAL_NAME) + 1
-- else instr(MATERIAL_NAME, ',', 1, 2)
-- end
-- -
-- case
-- when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
-- else instr(MATERIAL_NAME, '/', 1, 1) + 1
-- end) as name,
-- nvl(plan_number, 0) as plan_number,
-- nvl(sum(PRODUCT_QTY) ,0) as actual_number,
-- case when nvl(plan_number, 0) =0 then 100.00 else
-- round( nvl(sum(PRODUCT_QTY) ,0)/nvl(plan_number, 1)*100,2) end as rate
-- from IMOS_PR_FOAMING_MONITOR irfm
-- left join (
-- select PLAN_QTY plan_number, MATERIAL_NAME as name1,MATERIAL_CODE as code
-- from imos_ta_material
-- where DISPLAY_FLAG = 1) plan on plan.code = replace(MATERIAL_CODE,chr(10),'')
-- where PRODUCT_QTY > 0
-- group by MATERIAL_NAME, plan_number
select substr(plan.name1,
case
when instr(plan.name1, '/', 1, 1) = 0 then instr(plan.name1, ',', 1, 1) + 1
else instr(plan.name1, '/', 1, 1) + 1
end,
case
when instr(plan.name1, ',', 1, 2) = 0 then Length(plan.name1) + 1
else instr(plan.name1, ',', 1, 2)
end
-
case
when instr(plan.name1, '/', 1, 1) = 0 then instr(plan.name1, ',', 1, 1) + 1
else instr(plan.name1, '/', 1, 1) + 1
end) as name,
nvl(plan_number, 0) as plan_number,
nvl(sum(PRODUCT_QTY) ,0) as actual_number,
round( nvl(sum(PRODUCT_QTY) ,0)/nvl(plan_number, 1)*100,2) as rate
from IMOS_PR_FOAMING_MONITOR irfm
RIGHT JOIN (
select PLAN_QTY plan_number, MATERIAL_NAME as name1,MATERIAL_CODE as code
from imos_ta_material
where DISPLAY_FLAG = 1) plan on plan.code = replace(MATERIAL_CODE,chr(10),'')
group by plan.name1, plan_number
</select>
<select id="selectFpOrderInfo" resultType="com.ruoyi.system.domain.BoxOutput">
select sum(PLAN_QTY) qty, '当班计划' as name
from imos_ta_material
where DISPLAY_FLAG = 1
union
select sum(PRODUCT_QTY) qty, '实际产量' as name
from IMOS_PR_FOAMING_MONITOR
</select>
<select id="selectFpStock" resultType="com.ruoyi.system.domain.BoxOutput">
select substr(MATERIAL_NAME,
case
when instr(MATERIAL_NAME, '-', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
else instr(MATERIAL_NAME, '-', 1, 1) + 1
end,
case
when instr(MATERIAL_NAME, ',', 1, 2) = 0 then Length(MATERIAL_NAME) + 1
else instr(MATERIAL_NAME, ',', 1, 2)
end
-
case
when instr(MATERIAL_NAME, '-', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
else instr(MATERIAL_NAME, '-', 1, 1) + 1
end) as name,
sum(STORE_QTY) as qty
from IMOS_LO_BIN
where MATERIAL_NAME like '发泡箱体%'
and STORE_QTY > 0
group by MATERIAL_NAME
</select>
<select id="zhou_selectOrderRateTatle" resultType="com.ruoyi.system.domain.BoxOutput">
select count(1) as qty, '订单数量' as name
from IMOS_PR_ORDER
where to_char(FINISH_DATE, 'yyyy-MM-dd') in (
select to_char(DAY, 'yyyy-MM-dd')
from haiwei.BASE_PRODUCT_QTY
where DAY between (TRUNC(sysdate, 'D') + 1) and (TRUNC(sysdate, 'D') + 7))
union
select count(1) as qty, '完成数量' as name
from IMOS_PR_ORDER
where to_char(FINISH_DATE, 'yyyy-MM-dd') in (
select to_char(DAY, 'yyyy-MM-dd')
from haiwei.BASE_PRODUCT_QTY
where DAY between (TRUNC(sysdate, 'D') + 1) and (TRUNC(sysdate, 'D') + 7))
and ORDER_QTY - ACTUAL_QTY &lt; 6
union
select round(
(
select count(1)
from IMOS_PR_ORDER
where to_char(FINISH_DATE, 'yyyy-MM-dd') in (
select to_char(DAY, 'yyyy-MM-dd')
from haiwei.BASE_PRODUCT_QTY
where DAY between (TRUNC(sysdate, 'D') + 1) and (TRUNC(sysdate, 'D') + 7))
and ORDER_QTY - ACTUAL_QTY &lt; 6
) /
(
select count(1)
from IMOS_PR_ORDER
where to_char(FINISH_DATE, 'yyyy-MM-dd') in (
select to_char(DAY, 'yyyy-MM-dd')
from haiwei.BASE_PRODUCT_QTY
where DAY between (TRUNC(sysdate, 'D') + 1) and (TRUNC(sysdate, 'D') + 7))
) * 100, 2) as qty, '清单率' as name
from DUAL
-- union
-- select count(1)as qty, '入库订单统计' as name
-- from IMOS_PR_PRODUCT_BARCODE ippb
-- where DETIAL_TYPE_CODE = '1004'
-- and to_char(SCAN_TIME, 'yyyy-MM-dd') =to_char(SYSDATE, 'yyyy-MM-dd')
</select>
<select id="zhou_selectQaItemInfo" resultMap="MTKBeen">
select case
when ITEM_CODE = '1001' then '成品检漏'
when ITEM_CODE = '1002' then '内胆检漏'
when ITEM_CODE = '1003' then '安全检测'
when ITEM_CODE = '1005' then '测温性能'
when ITEM_CODE = '1006' then '成品外观' end as code,
to_char(CREATION_DATE, 'MM-dd') as name,
round((CASE
WHEN SUM(ALL_QTY) = 0 THEN 0.00
ELSE (SUM(ALL_QTY) - SUM(H_Unqualified_Qty)) / SUM(ALL_QTY) END) *
100.00, 2) as rate
from view_imos_pr_barcode sqlwhere
where CREATION_DATE between (TRUNC(sysdate, 'D') + 1) and (TRUNC(sysdate, 'D') + 7)
and ITEM_CODE in ('1001', '1002', '1003', '1005', '1006')
group by ITEM_CODE, to_char(CREATION_DATE, 'MM-dd')
union
select '横坐标' as code,
to_char(day, 'MM-dd') name,
0 rate
from HAIWEI.BASE_PRODUCT_QTY
where DAY between (TRUNC(sysdate, 'D') + 1) and (TRUNC(sysdate, 'D') + 7)
</select>
<select id="zhou_selectProductInStore" resultMap="MTKBeen">
select to_char(DAY, 'MM-dd') as code, qty+QTY_B as qty, '计划' as name
from haiwei.BASE_PRODUCT_QTY
where DAY between (TRUNC(sysdate, 'D') + 1) and (TRUNC(sysdate, 'D') + 7)
union
select wb.day as code, count(1) as qty, '产量' as name
from IMOS.IMOS_PR_PRODUCT_BARCODE ba
left join (select to_char(bpq.DAY, 'MM-dd') as day, W_START, B_END
from haiwei.BASE_PRODUCT_QTY bpq
left join haiwei.BASE_DAY_WBTIME wb on to_char(bpq.DAY, 'yyyy-MM-dd') = wb.CREATE_DAY
where DAY = (TRUNC(sysdate, 'D') + 1)
) wb on 1=1
where PRODUCTION_DATE between W_START and B_END
group by wb.day
union
select wb.day as code, count(1) as qty, '产量' as name
from IMOS.IMOS_PR_PRODUCT_BARCODE ba
left join (select to_char(bpq.DAY, 'MM-dd') as day, W_START, B_END
from haiwei.BASE_PRODUCT_QTY bpq
left join haiwei.BASE_DAY_WBTIME wb on to_char(bpq.DAY, 'yyyy-MM-dd') = wb.CREATE_DAY
where DAY = (TRUNC(sysdate, 'D') + 2)
) wb on 1=1
where PRODUCTION_DATE between W_START and B_END
group by wb.day
union
select wb.day as code, count(1) as qty, '产量' as name
from IMOS.IMOS_PR_PRODUCT_BARCODE ba
left join (select to_char(bpq.DAY, 'MM-dd') as day, W_START, B_END
from haiwei.BASE_PRODUCT_QTY bpq
left join haiwei.BASE_DAY_WBTIME wb on to_char(bpq.DAY, 'yyyy-MM-dd') = wb.CREATE_DAY
where DAY = (TRUNC(sysdate, 'D') + 3)
) wb on 1=1
where PRODUCTION_DATE between W_START and B_END
group by wb.day
union
select wb.day as code, count(1) as qty, '产量' as name
from IMOS.IMOS_PR_PRODUCT_BARCODE ba
left join (select to_char(bpq.DAY, 'MM-dd') as day, W_START, B_END
from haiwei.BASE_PRODUCT_QTY bpq
left join haiwei.BASE_DAY_WBTIME wb on to_char(bpq.DAY, 'yyyy-MM-dd') = wb.CREATE_DAY
where DAY = (TRUNC(sysdate, 'D') + 4)
) wb on 1=1
where PRODUCTION_DATE between W_START and B_END
group by wb.day
union
select wb.day as code, count(1) as qty, '产量' as name
from IMOS.IMOS_PR_PRODUCT_BARCODE ba
left join (select to_char(bpq.DAY, 'MM-dd') as day, W_START, B_END
from haiwei.BASE_PRODUCT_QTY bpq
left join haiwei.BASE_DAY_WBTIME wb on to_char(bpq.DAY, 'yyyy-MM-dd') = wb.CREATE_DAY
where DAY = (TRUNC(sysdate, 'D') + 5)
) wb on 1=1
where PRODUCTION_DATE between W_START and B_END
group by wb.day
union
select wb.day as code, count(1) as qty, '产量' as name
from IMOS.IMOS_PR_PRODUCT_BARCODE ba
left join (select to_char(bpq.DAY, 'MM-dd') as day, W_START, B_END
from haiwei.BASE_PRODUCT_QTY bpq
left join haiwei.BASE_DAY_WBTIME wb on to_char(bpq.DAY, 'yyyy-MM-dd') = wb.CREATE_DAY
where DAY = (TRUNC(sysdate, 'D') + 6)
) wb on 1=1
where PRODUCTION_DATE between W_START and B_END
group by wb.day
union
select wb.day as code, count(1) as qty, '产量' as name
from IMOS.IMOS_PR_PRODUCT_BARCODE ba
left join (select to_char(bpq.DAY, 'MM-dd') as day, W_START, B_END
from haiwei.BASE_PRODUCT_QTY bpq
left join haiwei.BASE_DAY_WBTIME wb on to_char(bpq.DAY, 'yyyy-MM-dd') = wb.CREATE_DAY
where DAY = (TRUNC(sysdate, 'D') + 7)
) wb on 1=1
where PRODUCTION_DATE between W_START and B_END
group by wb.day
</select>
<select id="zhou_selectQaInfo" resultType="com.ruoyi.system.domain.BoxOutput">
select *
from (
select count(1) as qty,
QUALITY_DEFECTS_DESC as name
from IMOS_QA_PRODUCT_QUALITY
where CREATION_DATE between (TRUNC(sysdate, 'D') + 1) and (TRUNC(sysdate, 'D') + 7)
group by QUALITY_DEFECTS_DESC, ITEM_CODE
order by count(1) desc
)
where ROWNUM &lt; 11
</select>
<select id="pqk_selectOrderInfo" resultType="com.ruoyi.system.domain.OrderInfo">
select substr(ORDER_NO, 5, length(ORDER_NO)) as plan_code,
substr(MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
length(MATERIAL_NAME)) as name ,
ORDER_QTY as plan_number,
ACTUAL_QTY as actual_number
from IMOS_PR_ORDER
where to_char(FINISH_DATE, 'yyyy-MM-dd') in
(
select to_char(DAY, 'yyyy-MM-dd')
from (
select DAY, ROWNUM as qt
from haiwei.BASE_PRODUCT_QTY
where DAY &lt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
order by DAY desc)
where qt &lt; 4
)
</select>
<!-- 通过入库查订单 select ORDER_NO as name,
round(SUM(ACTUAL_QTY) / sum(PLAN_QTY) * 100, 2) as qty
from IMOS_PR_PLAN
where ORDER_NO in (
select IMOS_PR_PRODUCT_IN.ORDER_NO
from IMOS_PR_PRODUCT_IN
where TO_CHAR(CREATION_DATE, 'YYYY-MM-DD') = TO_CHAR(SYSDATE, 'YYYY-MM-DD')
)
group by ORDER_NO
order by plan_number desc-->
<select id="zhou_selectOrderRateInfo" resultType="com.ruoyi.system.domain.OrderInfo">
select substr(ORDER_NO, 5, length(ORDER_NO)) as plan_code,
substr(MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
length(MATERIAL_NAME)) as name,
ORDER_QTY as plan_number,
ACTUAL_QTY as actual_number,
substr(MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
case
when instr(MATERIAL_NAME, ',', 1, 2) =0 then instr(MATERIAL_NAME, ',', 1, 1)
else instr(MATERIAL_NAME, ',', 1, 2) end - instr(MATERIAL_NAME, '-', 1, 1) -1
) as name_sub,
FINISH_DATE as day,
round(ACTUAL_QTY / ORDER_QTY * 100, 2) as rate
from IMOS_PR_ORDER
where to_char(FINISH_DATE, 'yyyy-MM-dd') in
(
select to_char(DAY, 'yyyy-MM-dd')
from haiwei.BASE_PRODUCT_QTY
where DAY between (TRUNC(sysdate, 'D') + 1) and (TRUNC(sysdate, 'D') + 7)
)
order by FINISH_DATE
</select>
<select id="pqk_selectQualityInfo" resultType="com.ruoyi.system.domain.QualityInfo">
select *
from (
select QUALITY_DEFECTS_DESC as type,
base.ITEM_NAME as item,
count(1) as qty,
round(count(1) / (
select sum(qty)
from (
select QUALITY_DEFECTS_DESC as type,
base.ITEM_NAME as item,
count(1) as qty
from IMOS_QA_PRODUCT_QUALITY record
left join IMOS_QA_QUALITY_ITEM base on record.ITEM_CODE = base.ITEM_CODE
where to_char(record.CREATION_DATE, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
group by base.ITEM_NAME, QUALITY_DEFECTS_DESC
order by count(1) desc)
where ROWNUM &lt; 11
)*100 ,2) as rate
from IMOS_QA_PRODUCT_QUALITY record
left join IMOS_QA_QUALITY_ITEM base on record.ITEM_CODE = base.ITEM_CODE
where to_char(record.CREATION_DATE, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
group by base.ITEM_NAME, QUALITY_DEFECTS_DESC
order by count(1) desc)
where ROWNUM &lt; 11
</select>
<select id="fp_selectDeviceStation" resultType="com.ruoyi.system.domain.DeviceStation">
select STATION_NO,
nvl(FOAMING_PARA_POLPRESSURE,'0') as pol_yl,
nvl(FOAMING_PARA_SOPRESSURE, '0') as so_yl,
nvl(FOAMING_PARA_POLTEMPERATURE, '0') as pol_wd,
nvl(FOAMING_PARA_SOTEMPERATURE, '0') as so_wd
from IMOS_PR_FOAMING_STATION
where FOAMING_PARA_POLPRESSURE is not null
order by to_number(STATION_NO)
</select>
<select id="fp_selectStationHourInfo" resultType="com.ruoyi.system.domain.FPStationHourInfo">
select substr(MATERIAL_NAME,
case
when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
else instr(MATERIAL_NAME, '/', 1, 1) + 1
end,
case
when instr(MATERIAL_NAME, ',', 1, 2) = 0 then Length(MATERIAL_NAME) + 1
else instr(MATERIAL_NAME, ',', 1, 2)
end
-
case
when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1
else instr(MATERIAL_NAME, '/', 1, 1) + 1
end) as name,
STATION_NO,
(select QTY
from (select QTY, row_number() over (order by CREATE_TIME desc) row_n from HAIWEI.BASE_FP_PLANQTY)
where row_n = 1) as target,
case
when PRODUCT_STATUS = 0 then '未生产'
else '生产中' end as status,
nvl(plan_number, 0) as plan_number,
PRODUCT_QTY as qty,
round(PRODUCT_QTY / CURRENTPLAN_QTY * 100, 2) as rate,
HOUR_QTY1 as h1,
HOUR_QTY2 as h2,
HOUR_QTY3 as h3,
HOUR_QTY4 as h4,
HOUR_QTY5 as h5,
HOUR_QTY6 h6,
HOUR_QTY7 h7,
HOUR_QTY8 h8,
HOUR_QTY9 h9,
HOUR_QTY10 h10,
HOUR_QTY11 h11,
HOUR_QTY12 h12
from IMOS_PR_FOAMING_MONITOR ipr
left join (
select round(PLAN_QTY / num, 0) as plan_number, itm.MATERIAL_NAME AS NAME
from imos_ta_material itm
left join (select count(1) as num, MATERIAL_NAME
from IMOS_PR_FOAMING_MONITOR
group by MATERIAL_NAME) cou
on cou.MATERIAL_NAME = itm.MATERIAL_NAME
where DISPLAY_FLAG = 1
) ta
on ta.name = ipr.MATERIAL_NAME
order by to_number(STATION_NO)
</select>
<insert id="deleteTimp1">
TRUNCATE TABLE temp1
</insert>
<insert id="insertTimp1">
insert into haiwei.temp1 (
select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day,
(select * from (select RHYTHM from haiwei.BASE_RHYTHM where ROWNUM = 1 order by ID desc)) as rhy
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select * from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) where ROWNUM = 1) wb on 1 = 1
where ippb.PRODUCTION_DATE between case when sysdate &lt;= wb.W_END then W_START else W_END end
and case when sysdate &lt; = wb.W_END then W_END else B_END end
and DETIAL_TYPE_CODE = '1004'
)
</insert>
<select id="zz_selectLossInfo" resultType="com.ruoyi.system.domain.BoxOutput">
select ROUND(sum(ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - t3.RHYTHM) / 60, 2)-
nvl(case
when sysdate &gt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '09:30:00', 'yyyy-MM-dd hh24:mi:ss')
then
case
when sysdate &gt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '14:30:00', 'yyyy-MM-dd hh24:mi:ss')
then 60 else 30 end
end
, 0) as qty,
1 as name
from (select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select *
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1) wb
on 1 = 1
where ippb.PRODUCTION_DATE between
case
when #{state} = 1 then W_START
when #{state} = 2 then W_END end
and
case
when #{state} = 1 then W_END
when #{state} = 2 then B_END end
and DETIAL_TYPE_CODE = '1004') t1
left join
(select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select *
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1) wb
on 1 = 1
where ippb.PRODUCTION_DATE between
case
when #{state} = 1 then W_START
when #{state} = 2 then W_END end
and
case
when #{state} = 1 then W_END
when #{state} = 2 then B_END end
and DETIAL_TYPE_CODE = '1004') t2 on t1.row_number = t2.row_number + 1
left join
(select * from (select RHYTHM from haiwei.BASE_RHYTHM order by ID desc) where ROWNUM = 1) t3 on 1 = 1
where 0 &lt; ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - t3.RHYTHM
union
select count(1) as qty,
2 as name
from (select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select *
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1) wb
on 1 = 1
where ippb.PRODUCTION_DATE between
case
when #{state} = 1 then W_START
when #{state} = 2 then W_END end
and
case
when #{state} = 1 then W_END
when #{state} = 2 then B_END end
and DETIAL_TYPE_CODE = '1004') t1
left join
(select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select *
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1) wb
on 1 = 1
where ippb.PRODUCTION_DATE between
case
when #{state} = 1 then W_START
when #{state} = 2 then W_END end
and
case
when #{state} = 1 then W_END
when #{state} = 2 then B_END end
and DETIAL_TYPE_CODE = '1004') t2 on t1.row_number = t2.row_number + 1
left join
(select * from (select RHYTHM from haiwei.BASE_RHYTHM order by ID desc) where ROWNUM = 1) t3 on 1 = 1
where 0 &lt; ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - t3.RHYTHM
and ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - t3.RHYTHM &lt; = 180
union
select count(1) as qty,
3 as name
from (select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select *
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1) wb
on 1 = 1
where ippb.PRODUCTION_DATE between
case
when #{state} = 1 then W_START
when #{state} = 2 then W_END end
and
case
when #{state} = 1 then W_END
when #{state} = 2 then B_END end
and DETIAL_TYPE_CODE = '1004') t1
left join
(select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select *
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1) wb
on 1 = 1
where ippb.PRODUCTION_DATE between
case
when #{state} = 1 then W_START
when #{state} = 2 then W_END end
and
case
when #{state} = 1 then W_END
when #{state} = 2 then B_END end
and DETIAL_TYPE_CODE = '1004') t2 on t1.row_number = t2.row_number + 1
left join
(select * from (select RHYTHM from haiwei.BASE_RHYTHM order by ID desc) where ROWNUM = 1) t3 on 1 = 1
where 180 &lt; ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - t3.RHYTHM
and ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - t3.RHYTHM &lt; = 600
union
select
case when qty &lt; 0 then 0 else qty end as qty,name
from
(
select count(1)-nvl(case
when sysdate &gt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '09:30:00', 'yyyy-MM-dd hh24:mi:ss')
then
case
when sysdate &gt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '14:30:00', 'yyyy-MM-dd hh24:mi:ss')
then 2 else 1 end
end
, 0) as qty,
4 as name
from (select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select *
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1) wb
on 1 = 1
where ippb.PRODUCTION_DATE between
case
when #{state} = 1 then W_START
when #{state} = 2 then W_END end
and
case
when #{state} = 1 then W_END
when #{state} = 2 then B_END end
and DETIAL_TYPE_CODE = '1004') t1
left join
(select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select *
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1) wb
on 1 = 1
where ippb.PRODUCTION_DATE between
case
when #{state} = 1 then W_START
when #{state} = 2 then W_END end
and
case
when #{state} = 1 then W_END
when #{state} = 2 then B_END end
and DETIAL_TYPE_CODE = '1004') t2 on t1.row_number = t2.row_number + 1
left join
(select * from (select RHYTHM from haiwei.BASE_RHYTHM order by ID desc) where ROWNUM = 1) t3 on 1 = 1
where 600 &lt; ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - t3.RHYTHM
)
</select>
<select id="pqk_selectProductInStore" resultType="com.ruoyi.system.domain.BoxOutput">
select nvl(count(1), 0) as qty,
substr(
MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
instr(MATERIAL_NAME, ',', 1, 2) - 2 - instr(MATERIAL_NAME, '-', 1, 1) + 1) as name
from IMOS_PR_PRODUCT_BARCODE ippb
left join (select * from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) where ROWNUM = 1) wb
on 1 = 1
where ippb.SCAN_TIME between
case
when sysdate &lt;= wb.W_END then W_START
else W_END end
and case when sysdate &lt;= wb.W_END then W_END else B_END end
and DETIAL_TYPE_CODE = '1004'
group by MATERIAL_NAME
</select>
<select id="mtk_selectInStore3d" resultType="com.ruoyi.system.domain.BoxOutput">
select
substr(MATERIAL_NAME,
case
when instr(MATERIAL_NAME, '-', 1, 1) = 0 then 1
else instr(MATERIAL_NAME, '-', 1, 1) + 1
end,
instr(MATERIAL_NAME, ',', 1, 1)
-
case
when instr(MATERIAL_NAME, '-', 1, 1) = 0 then 1
else instr(MATERIAL_NAME, '-', 1, 1) + 1
end) as name,
sum(IN_QTY ) as qty
from IMOS_PR_PRODUCT_IN
where CREATION_DATE
between to_date(to_char(SYSDATE-2, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
group by MATERIAL_NAME
</select>
<select id="selectNowXkOutPut" resultType="com.ruoyi.system.domain.BoxOutput">
select (
case when
TO_CHAR(SYSDATE, 'hh24')-1 &lt; 0
then '23:30' else TO_CHAR(SYSDATE, 'hh24')-1 || ':30' end
) as name,
nvl(sum(actual_qty), 0) as qty
from IMOS.IMOS_PR_PLAN xhq
left join (select * from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) where ROWNUM = 1) wb on 1 = 1
where to_date(xhq.START_TIME, 'yyyy-MM-dd hh24:mi:ss') between case when sysdate &lt;= wb.W_END then W_START else W_END end
and case when sysdate &lt;= wb.W_END then W_END else B_END end
and plan_date is not null
and process_code = 1002
and delete_flag = '0'
</select>
<select id="selectNowXkOutPut1" resultType="int">
select nvl(sum(actual_qty), 0)
from IMOS.IMOS_PR_PLAN ipp
left join (select * from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) where ROWNUM = 1) wb on 1=1
where plan_date is not null
and process_code = 1002
and delete_flag = '0'
and to_date(ipp.START_TIME, 'yyyy-MM-dd hh24:mi:ss') between case when sysdate &lt; = wb.W_END then W_START else W_END end
and case when sysdate &lt; = wb.W_END then W_END else B_END end
-- select nvl(sum(actual_qty), 0)
-- from IMOS.IMOS_PR_PLAN
-- where plan_date is not null
-- and process_code = 1002
-- and delete_flag = '0'
-- -- and to_char(plan_date, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
-- and CREATION_DATE &gt;
-- case
-- when to_char(sysdate, 'hh24') &gt; 7 and to_char(sysdate, 'hh24') &lt; 20 then to_date(
-- to_char(SYSDATE, 'yyyy-MM-dd') || '07:30:00',
-- 'yyyy-MM-dd hh24:mi:ss')
-- when to_char(sysdate, 'hh24') &lt; 7 then to_date(to_char(SYSDATE - 1, 'yyyy-MM-dd') || '19:30:00',
-- 'yyyy-MM-dd hh24:mi:ss')
-- else to_date(to_char(SYSDATE - 1, 'yyyy-MM-dd') || '19:30:00', 'yyyy-MM-dd hh24:mi:ss')
-- end
-- and CREATION_DATE &lt;
-- case
-- when to_char(sysdate, 'hh24') &gt; 7 and to_char(sysdate, 'hh24') &lt; 20 then to_date(
-- to_char(SYSDATE, 'yyyy-MM-dd') || '19:30:00',
-- 'yyyy-MM-dd hh24:mi:ss')
-- when to_char(sysdate, 'hh24') &lt; 7 then to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '07:30:00',
-- 'yyyy-MM-dd hh24:mi:ss')
-- else to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '24:00:00', 'yyyy-MM-dd hh24:mi:ss')
-- end
</select>
<select id="selectXK_H_QTY" resultType="int">
select * from ( select nvl(ZS_C, 0) from haiwei.XK_H_QTY order by CREATE_TIME desc) where ROWNUM=1
</select>
<insert id="insertXK_H_QTY">
insert into XK_H_QTY(H_NAME, QTY, QTY_C,ZS_C)
values (#{name},#{nowOut},#{cha},#{zs})
</insert>
<select id="selectTeamGroups" resultType="integer">
select case when sysdate &lt; = W_END then 0 else 1 end
from (select *
from (select w_end from BASE_DAY_WBTIME BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1)
</select>
<select id="zz_selectProductInByDay" resultType="com.ruoyi.system.domain.BoxOutput">
select to_char(PRODUCTION_DATE, 'hh24') || ':30' as name, count(1) as qty
from IMOS_PR_PRODUCT_BARCODE
where to_char(PRODUCTION_DATE, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
group by to_char(PRODUCTION_DATE, 'hh24')
order by to_char(PRODUCTION_DATE, 'hh24')
</select>
<select id="zz_selectProductInByTeamNight" resultType="com.ruoyi.system.domain.BoxOutput">
select name,qty
from (
select '19:30' as name, nvl(count(1), 0) as qty,1 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
select W_END as day1, W_END + interval '1' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '20:30' as name, nvl(count(1), 0) as qty,2 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
-- 2022-07-28 20:30:00
select W_END + interval '1' HOUR as day1, W_END + interval '2' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '21:30' as name, nvl(count(1), 0) as qty,3 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
-- 2022-07-28 21:30:00
select W_END + interval '2' HOUR as day1, W_END + interval '3' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '22:30' as name, nvl(count(1), 0) as qty,4 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
-- 2022-07-28 22:30:00
select W_END + interval '3' HOUR as day1, W_END + interval '4' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '23:30' as name, nvl(count(1), 0) as qty,5 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
-- 2022-07-28 23:30:00
select W_END + interval '4' HOUR as day1, W_END + interval '5' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '00:30' as name, nvl(count(1), 0) as qty,6 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
-- 2022-07-29 00:30:00
select W_END + interval '5' HOUR as day1, W_END + interval '6' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '01:30' as name, nvl(count(1), 0) as qty,7 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
-- 2022-07-29 01:30:00
select W_END + interval '6' HOUR as day1, W_END + interval '7' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '02:30' as name, nvl(count(1), 0) as qty,8 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
select W_END + interval '7' HOUR as day1, W_END + interval '8' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '03:30' as name, nvl(count(1), 0) as qty,9 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
select W_END + interval '8' HOUR as day1, W_END + interval '9' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '04:30' as name, nvl(count(1), 0) as qty,10 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
select W_END + interval '9' HOUR as day1, W_END + interval '10' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '05:30' as name, nvl(count(1), 0) as qty,11 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
select W_END + interval '10' HOUR as day1, W_END + interval '11' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
union
select '06:30' as name, nvl(count(1), 0) as qty,12 as ord
from IMOS_PR_PRODUCT_BARCODE ippb
left join (
select W_END + interval '11' HOUR as day1, W_END + interval '12' HOUR as day2
from (select W_END, row_number() over (order by CREATE_TIME desc) as qt from haiwei.BASE_DAY_WBTIME)
where qt = 1
) t1 on 1 = 1
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between day1 and day2
)
order by ord
</select>
<select id="zz_selectProductInByTeam" resultType="com.ruoyi.system.domain.BoxOutput">
select '07:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '07:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '08:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '08:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '08:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '09:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '09:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '09:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '10:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '10:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '10:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '11:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '11:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '11:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '12:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '12:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '12:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '13:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '13:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '13:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '14:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '14:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '14:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '15:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '15:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '15:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '16:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '16:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '16:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '17:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '17:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '17:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '18:30:00', 'yyyy-MM-dd hh24:mi:ss')
union
select '18:30' as name, nvl(count(1),0) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and SCAN_TIME between to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '18:30:00', 'yyyy-MM-dd hh24:mi:ss')
and to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '19:30:00', 'yyyy-MM-dd hh24:mi:ss')
</select>
<select id="selectOneBadRateByDay" resultType="com.ruoyi.system.domain.BoxOutput">
select nvl(qty1, 0) as qty,
name,
nvl(round((qty1 / a.qty) * 100, 2), 0) as rate
from (
select to_char(PRODUCTION_DATE, 'hh24') || ':30' as name, count(1) as qty
from IMOS_PR_PRODUCT_BARCODE
where to_char(PRODUCTION_DATE, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
group by to_char(PRODUCTION_DATE, 'hh24')
order by to_char(PRODUCTION_DATE, 'hh24')
) a
left join (select count(1) as qty1, to_char(CREATION_DATE, 'hh24') || ':30' as name1
from IMOS_QA_PRODUCT_QUALITY
where ITEM_CODE = '1006'
and to_char(CREATION_DATE, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
group by to_char(CREATION_DATE, 'hh24')) on name = name1
order by name
</select>
<select id="selectOneBadRate" resultType="com.ruoyi.system.domain.BoxOutput">
select sum(qty) as qty,
name,
sum (rate) as rate
from
(select nvl(qty1,0) as qty,
name,
nvl(round((qty1/a.qty)*100,2),0) as rate
from (
select to_char(PRODUCTION_DATE, 'hh24') || ':30' as name, count(1) as qty
from IMOS_PR_PRODUCT_BARCODE ippb
left join (select * from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) where ROWNUM = 1) wb
on 1 = 1
where ippb.PRODUCTION_DATE between
case
when #{state} = 1 then W_START
when #{state} = 2 then W_END
end
and
case
when #{state} = 1 then W_END
when #{state} = 2 then B_END
end
and DETIAL_TYPE_CODE = '1004'
group by to_char(PRODUCTION_DATE, 'hh24')
order by to_char(PRODUCTION_DATE, 'hh24')
) a
left join (select count(1) as qty1, to_char(CREATION_DATE, 'hh24') || ':30' as name1
from IMOS_QA_PRODUCT_QUALITY
where ITEM_CODE = '1006'
and to_char(CREATION_DATE, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
group by to_char(CREATION_DATE, 'hh24')) on name=name1
union
select 0 as qty ,case
when #{state} = 1 then '07:30'
when #{state} = 2 then '19:30'
end as name ,0 as rate from dual
)
group by name
order by name
</select>
<select id="zz_selectInStoreTag" resultType="com.ruoyi.system.domain.BoxOutput">
select * from (select RHYTHM as qty, '节拍' as name from haiwei.BASE_RHYTHM where ROWNUM = 1 order by ID desc)
</select>
<select id="zz_selectProductInTarget" resultType="com.ruoyi.system.domain.BoxOutput">
-- select sum(QTY) as qty, '目标' as name
-- from haiwei.BASE_PRODUCT_QTY
-- where DAY between (TRUNC(sysdate, 'D') + 1) and (TRUNC(sysdate, 'D') + 7)
-- union
-- select sum(QTY) as qty, '进度目标' as name
-- from haiwei.BASE_PRODUCT_QTY
-- where to_char(DAY, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
select case
when sysdate &lt; W_END then QTY
else
case when QTY_B = 0 then QTY else QTY_B end end as qty,
'进度目标' as name
from haiwei.BASE_PRODUCT_QTY bqty
left join (select * from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) where ROWNUM = 1) wb
on 1 = 1
where to_char(DAY, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
union
select count(1) as qty,'实际' as name
from IMOS.IMOS_PR_PRODUCT_BARCODE
where to_char(PRODUCTION_DATE, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
</select>
<select id="zz_countNightProductInTag" resultType="integer">
select case
when sysdate &lt; W_END then 0
else QTY_B
end as qty
from haiwei.BASE_PRODUCT_QTY bqty
left join (select * from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) where ROWNUM = 1) wb
on 1 = 1
where to_char(DAY, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
</select>
<select id="zz_selectInStoreOrderInfo" resultType="com.ruoyi.system.domain.OrderInfo">
select ippi.ORDER_NO as plan_code,
po.ACTUAL_QTY as actual_number,
substr(ippi.MATERIAL_NAME,
case
when instr(ippi.MATERIAL_NAME, '/', 1, 1) = 0 then 0
else instr(ippi.MATERIAL_NAME, '/', 1, 1) + 1
end,
length(ippi.MATERIAL_NAME)) as name,
ORDER_QTY as plan_number ,
round( po.ACTUAL_QTY/ORDER_QTY *100,2) as reat,
ippi.CREATION_DATE as day
from IMOS_PR_PRODUCT_IN ippi
left join IMOS.IMOS_PR_ORDER po on ippi.ORDER_NO = po.ORDER_NO
where to_char(ippi.CREATION_DATE, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd') and ippi. DELETE_FLAG=0
</select>
<select id="mtk_selectOrderInfoBy3dTatle" resultType="com.ruoyi.system.domain.BoxOutput">
select count(1) as qty, '订单数量' as name
from IMOS_PR_ORDER
where to_char(FINISH_DATE, 'yyyy-MM-dd') in (
select to_char(DAY, 'yyyy-MM-dd')
from (
select DAY, ROWNUM as qt
from haiwei.BASE_PRODUCT_QTY
where DAY &lt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
order by DAY desc)
where qt &lt; 4)
union
select count(1) as qty, '完成数量' as name
from IMOS_PR_ORDER
where to_char(FINISH_DATE, 'yyyy-MM-dd') in (
select to_char(DAY, 'yyyy-MM-dd')
from (
select DAY, ROWNUM as qt
from haiwei.BASE_PRODUCT_QTY
where DAY &lt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
order by DAY desc)
where qt &lt; 4)
and ORDER_QTY - ACTUAL_QTY &lt; 6
union
select round(
(
select count(1)
from IMOS_PR_ORDER
where to_char(FINISH_DATE, 'yyyy-MM-dd') in (
select to_char(DAY, 'yyyy-MM-dd')
from (
select DAY, ROWNUM as qt
from haiwei.BASE_PRODUCT_QTY
where DAY &lt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
order by DAY desc)
where qt &lt; 4)
and ORDER_QTY - ACTUAL_QTY &lt; 6
) /
(
select count(1)
from IMOS_PR_ORDER
where to_char(FINISH_DATE, 'yyyy-MM-dd') in (
select to_char(DAY, 'yyyy-MM-dd')
from (
select DAY, ROWNUM as qt
from haiwei.BASE_PRODUCT_QTY
where DAY &lt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
order by DAY desc)
where qt &lt; 4)
) * 100, 2) as qty, '清单率' as name
from DUAL
union
select count(1)as qty, '入库订单统计' as name
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and to_char(SCAN_TIME, 'yyyy-MM-dd') =to_char(SYSDATE, 'yyyy-MM-dd')
</select>
<select id="mtk_selectOrderInfoBy3d" resultType="com.ruoyi.system.domain.BoxOutput">
select substr(ORDER_NO, 5, length(ORDER_NO)) || '(' || substr(
substr(MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
length(MATERIAL_NAME)),
0,
instr(
substr(MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
length(MATERIAL_NAME)), ',', 1, 1) - 1) || ')' as name
,
round(ACTUAL_QTY / ORDER_QTY * 100, 2) as rate,
case when round(ACTUAL_QTY / ORDER_QTY * 100, 2) &lt; 100 then 1 else 0 end as qty
from IMOS_PR_ORDER
where to_char(FINISH_DATE,'yyyy-MM-dd') =
(
select to_char(DAY, 'yyyy-MM-dd')
from (
select DAY,ROWNUM as qt
from haiwei.BASE_PRODUCT_QTY
where DAY &lt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
order by DAY desc)
where qt =3)
union
select substr(ORDER_NO, 5, length(ORDER_NO)) || '(' || substr(
substr(MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
length(MATERIAL_NAME)),
0,
instr(
substr(MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
length(MATERIAL_NAME)), ',', 1, 1) - 1) || ')' as name
,
round(ACTUAL_QTY / ORDER_QTY * 100, 2) as rate,
case when round(ACTUAL_QTY / ORDER_QTY * 100, 2) &lt; 100 then 2 else 0 end as qty
from IMOS_PR_ORDER
where to_char(FINISH_DATE,'yyyy-MM-dd') =
(
select to_char(DAY, 'yyyy-MM-dd')
from (
select DAY,ROWNUM as qt
from haiwei.BASE_PRODUCT_QTY
where DAY &lt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
order by DAY desc)
where qt =2)
union
select substr(ORDER_NO, 5, length(ORDER_NO)) || '(' || substr(
substr(MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
length(MATERIAL_NAME)),
0,
instr(
substr(MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
length(MATERIAL_NAME)), ',', 1, 1) - 1) || ')' as name
,
round(ACTUAL_QTY / ORDER_QTY * 100, 2) as rate,
case when round(ACTUAL_QTY / ORDER_QTY * 100, 2) &lt; 100 then 3 else 0 end as qty
from IMOS_PR_ORDER
where to_char(FINISH_DATE,'yyyy-MM-dd') =
(
select to_char(DAY, 'yyyy-MM-dd')
from (
select DAY,ROWNUM as qt
from haiwei.BASE_PRODUCT_QTY
where DAY &lt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
order by DAY desc)
where qt =1)
</select>
<select id="zz_selectOneBadRateMb" resultType="com.ruoyi.system.domain.BoxOutput">
select * from (select rate,'不合格率目标' from haiwei.BASE_ONE_UNQUQLIFIED_RATE order by CREATE_TIME desc) where ROWNUM=1
</select>
<select id="zz_countNightProductIn" resultType="integer">
select count(1)
from IMOS.IMOS_PR_PRODUCT_BARCODE
where PRODUCTION_DATE &gt; (
select W_END + interval '5' MINUTE
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc )
where ROWNUM = 1
)
and ROWNUM &lt; 10
</select>
<select id="mtk_selectQAZD" resultType="com.ruoyi.system.domain.BoxOutput">
select round((CASE
WHEN Sum_Value = 0 THEN 0.00
ELSE (Sum_Value - H_Unqualified_Qty) / Sum_Value END) *
100.00, 2) as rate,
case
when ITEM_CODE = '1001' then '成品检漏'
when ITEM_CODE = '1002' then '内胆检漏'
when ITEM_CODE = '1003' then '安全检测'
when ITEM_CODE = '1005' then '测温性能'
when ITEM_CODE = '1006' then '成品外观' end as name
from (
select ITEM_CODE,
SUM(ALL_QTY) AS Sum_Value,
SUM(H_Unqualified_Qty) H_Unqualified_Qty
from view_imos_pr_barcode sqlwhere
where SCAN_TIME between
to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
and
to_date(to_char(SYSDATE+1, 'yyyy-MM-dd') || '00:59:00', 'yyyy-MM-dd hh24:mi:ss')
and ITEM_CODE in ('1001', '1002', '1003', '1005', '1006')
group by ITEM_CODE
)
</select>
<select id="mtk_selectInstoreNumByday" resultType="com.ruoyi.system.domain.BoxOutput">
select nvl(count(1),0) as qty,
substr(
MATERIAL_NAME,
instr(MATERIAL_NAME, '-', 1, 1) + 1,
instr(MATERIAL_NAME, ',', 1, 1) - 2 - instr(MATERIAL_NAME, '-', 1, 1) + 1) as name
from IMOS_PR_PRODUCT_BARCODE ippb
where DETIAL_TYPE_CODE = '1004'
and to_char(SCAN_TIME, 'yyyy-MM-dd') =to_char(SYSDATE, 'yyyy-MM-dd')
group by MATERIAL_NAME
</select>
<resultMap id="MTKBeen" type="com.ruoyi.system.domain.MTKBeen">
<result column="code" property="code"/>
<collection property="list" javaType="java.util.List" resultMap="BoxOutputBeen"/>
</resultMap>
<resultMap id="BoxOutputBeen" type="com.ruoyi.system.domain.BoxOutput">
<result column="name" property="name"/>
<result column="qty" property="qty"/>
<result column="rate" property="rate"/>
</resultMap>
<select id="mtk_sselectQATop3" resultMap="MTKBeen">
-- 1002,内胆预装检漏
-- 1003,安全检测
-- 1001,成品检漏
-- 1005,测温附加检测
-- 1006,成品外观检测
select *
from (
select count(1) as qty,
QUALITY_DEFECTS_DESC as name,
'成品检漏' as code
from IMOS_QA_PRODUCT_QUALITY
where to_char(CREATION_DATE, 'yyyy-MM-dd') = to_char(SYSDATE, 'yyyy-MM-dd')
and ITEM_CODE = '1001'
group by QUALITY_DEFECTS_DESC, ITEM_CODE
order by count(1) desc)
where ROWNUM &lt; 4
union
select *
from (
select count(1) as qty,
QUALITY_DEFECTS_DESC as name,
'内胆检漏' as code
from IMOS_QA_PRODUCT_QUALITY
where to_char(CREATION_DATE, 'yyyy-MM-dd') = to_char(SYSDATE, 'yyyy-MM-dd')
and ITEM_CODE = '1002'
group by QUALITY_DEFECTS_DESC, ITEM_CODE
order by count(1) desc)
where ROWNUM &lt; 4
union
select *
from (
select count(1) as qty,
QUALITY_DEFECTS_DESC as name,
'安全检测' as code
from IMOS_QA_PRODUCT_QUALITY
where to_char(CREATION_DATE, 'yyyy-MM-dd') = to_char(SYSDATE, 'yyyy-MM-dd')
and ITEM_CODE = '1003'
group by QUALITY_DEFECTS_DESC, ITEM_CODE
order by count(1) desc)
where ROWNUM &lt; 4
union
select *
from (
select count(1) as qty,
QUALITY_DEFECTS_DESC as name,
'测温性能' as code
from IMOS_QA_PRODUCT_QUALITY
where to_char(CREATION_DATE, 'yyyy-MM-dd') = to_char(SYSDATE, 'yyyy-MM-dd')
and ITEM_CODE = '1005'
group by QUALITY_DEFECTS_DESC, ITEM_CODE
order by count(1) desc)
where ROWNUM &lt; 4
union
select *
from (
select count(1) as qty,
QUALITY_DEFECTS_DESC as name,
'成品外观' as code
from IMOS_QA_PRODUCT_QUALITY
where to_char(CREATION_DATE, 'yyyy-MM-dd') = to_char(SYSDATE, 'yyyy-MM-dd')
and ITEM_CODE = '1006'
group by QUALITY_DEFECTS_DESC, ITEM_CODE
order by count(1) desc)
where ROWNUM &lt; 4
union
select *
from (
select count(1) as qty,
QUALITY_DEFECTS_DESC as name,
'柱状图' as code
from IMOS_QA_PRODUCT_QUALITY
where to_char(CREATION_DATE, 'yyyy-MM-dd') = to_char(SYSDATE, 'yyyy-MM-dd')
group by QUALITY_DEFECTS_DESC, ITEM_CODE
order by count(1) desc)
where ROWNUM &lt; 11
</select>
<select id="yue_selectProductInStore" resultType="com.ruoyi.system.domain.BoxOutput">
select to_number(to_char(PRODUCTION_DATE, 'MM')) as name, count(1) as qty
from IMOS.IMOS_PR_PRODUCT_BARCODE
where PRODUCTION_DATE > TRUNC(sysdate, 'YYYY')
group by to_char(PRODUCTION_DATE, 'MM')
order by name
</select>
<select id="yue_selectMonthQANumber" resultType="com.ruoyi.system.domain.BoxOutput">
select round(qty / (select count(1)
from IMOS_PR_PRODUCT_BARCODE
where PRODUCTION_DATE &gt; LAST_DAY(ADD_MONTHS(
to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
, -1)) + 1) * 100, 2) as rate,
name
from (
select count(1) as qty,
QUALITY_DEFECTS_DESC as name
from IMOS_QA_PRODUCT_QUALITY
where CREATION_DATE &gt; LAST_DAY(ADD_MONTHS(
to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '00:00:00', 'yyyy-MM-dd hh24:mi:ss')
, -1)) + 1
group by QUALITY_DEFECTS_DESC, ITEM_CODE
order by count(1) desc
)
where ROWNUM &lt; 11
</select>
</mapper>