|
|
|
|
<?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>
|
|
|
|
|
|
|
|
|
|
<select id="selectplanCompletion" resultType="com.ruoyi.system.domain.BoxPlanCompletion">
|
|
|
|
|
select (SELECT *
|
|
|
|
|
FROM (select PLAN_NUMBER
|
|
|
|
|
from haiwei.BASE_BOX_PLAN
|
|
|
|
|
where rownum = 1
|
|
|
|
|
ORDER BY CREATE_TIME DESC)) AS planned_number,
|
|
|
|
|
nvl(sum(actual_qty), 0) AS quantity_number
|
|
|
|
|
|
|
|
|
|
from 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 >
|
|
|
|
|
case
|
|
|
|
|
when to_char(sysdate, 'hh24') > 7 and to_char(sysdate, 'hh24') < 20 then to_date(
|
|
|
|
|
to_char(SYSDATE, 'yyyy-MM-dd') || '07:30:00',
|
|
|
|
|
'yyyy-MM-dd hh24:mi:ss')
|
|
|
|
|
when to_char(sysdate, 'hh24') < 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 <
|
|
|
|
|
case
|
|
|
|
|
when to_char(sysdate, 'hh24') > 7 and to_char(sysdate, 'hh24') < 20 then to_date(
|
|
|
|
|
to_char(SYSDATE, 'yyyy-MM-dd') || '19:30:00',
|
|
|
|
|
'yyyy-MM-dd hh24:mi:ss')
|
|
|
|
|
when to_char(sysdate, 'hh24') < 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
|
|
|
|
|
-- CREATION_DATE 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') || '19:30:00', 'yyyy-MM-dd hh24:mi:ss')
|
|
|
|
|
group by to_char(plan_date, 'yyyy-MM-dd')
|
|
|
|
|
</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_STORE_DETIAL losd
|
|
|
|
|
where Store_Code =#{id}
|
|
|
|
|
and Material_Code is not null
|
|
|
|
|
and Store_Qty > 0
|
|
|
|
|
group by material_name, Store_Code
|
|
|
|
|
order by material_name
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectOutputByType" 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(ACTUAL_QTY) as qty
|
|
|
|
|
from IMOS_PR_PLAN
|
|
|
|
|
where
|
|
|
|
|
CREATION_DATE >
|
|
|
|
|
case
|
|
|
|
|
when to_char(sysdate, 'hh24') > 7 and to_char(sysdate, 'hh24') < 20 then to_date(
|
|
|
|
|
to_char(SYSDATE, 'yyyy-MM-dd') || '07:30:00',
|
|
|
|
|
'yyyy-MM-dd hh24:mi:ss')
|
|
|
|
|
when to_char(sysdate, 'hh24') < 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 <
|
|
|
|
|
case
|
|
|
|
|
when to_char(sysdate, 'hh24') > 7 and to_char(sysdate, 'hh24') < 20 then to_date(
|
|
|
|
|
to_char(SYSDATE, 'yyyy-MM-dd') || '19:30:00',
|
|
|
|
|
'yyyy-MM-dd hh24:mi:ss')
|
|
|
|
|
when to_char(sysdate, 'hh24') < 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
|
|
|
|
|
and PROCESS_CODE = 1002
|
|
|
|
|
and ACTUAL_QTY!=0
|
|
|
|
|
group by MATERIAL_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="selectOutputByTime" resultType="com.ruoyi.system.domain.BoxOutput">
|
|
|
|
|
-- select TO_CHAR(CREATION_DATE, 'hh24')||':30' as name ,Count(TASK_ID) as qty
|
|
|
|
|
-- from IMOS_LO_TASK_HISTORY
|
|
|
|
|
-- where detial_type_code = '1002'
|
|
|
|
|
-- and TASK_TYPE != 'O'
|
|
|
|
|
-- and TO_CHAR(CREATION_DATE, 'YYYY-MM-DD') = TO_CHAR(SYSDATE, 'YYYY-MM-DD')
|
|
|
|
|
-- and TO_CHAR(CREATION_DATE, 'hh24') > 7
|
|
|
|
|
-- group by TO_CHAR(CREATION_DATE, 'hh24')
|
|
|
|
|
-- order by name
|
|
|
|
|
select TO_CHAR(CREATION_DATE, 'hh24') || ':30' as name, Count(TASK_ID) as qty
|
|
|
|
|
from (
|
|
|
|
|
select CREATION_DATE, TASK_ID
|
|
|
|
|
from IMOS_LO_TASK_HISTORY
|
|
|
|
|
where detial_type_code = '1002'
|
|
|
|
|
and TASK_TYPE != 'O'
|
|
|
|
|
and CREATION_DATE >
|
|
|
|
|
case
|
|
|
|
|
when to_char(sysdate, 'hh24') > 7 and to_char(sysdate, 'hh24') < 20 then to_date(
|
|
|
|
|
to_char(SYSDATE, 'yyyy-MM-dd') || '07:30:00',
|
|
|
|
|
'yyyy-MM-dd hh24:mi:ss')
|
|
|
|
|
when to_char(sysdate, 'hh24') < 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 <
|
|
|
|
|
case
|
|
|
|
|
when to_char(sysdate, 'hh24') > 7 and to_char(sysdate, 'hh24') < 20 then to_date(
|
|
|
|
|
to_char(SYSDATE, 'yyyy-MM-dd') || '19:30:00',
|
|
|
|
|
'yyyy-MM-dd hh24:mi:ss')
|
|
|
|
|
when to_char(sysdate, 'hh24') < 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
|
|
|
|
|
-- and CREATION_DATE 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') || '19:30:00', 'yyyy-MM-dd hh24:mi:ss')
|
|
|
|
|
)
|
|
|
|
|
group by TO_CHAR(CREATION_DATE, 'hh24')
|
|
|
|
|
order by name
|
|
|
|
|
</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="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="pqk_selectProductInStore" 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,
|
|
|
|
|
IN_QTY as qty
|
|
|
|
|
from IMOS_PR_PRODUCT_IN
|
|
|
|
|
where TO_CHAR(CREATION_DATE, 'YYYY-MM-DD') = TO_CHAR(SYSDATE, 'YYYY-MM-DD')
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="pqk_selectOrderInfo" resultType="com.ruoyi.system.domain.OrderInfo">
|
|
|
|
|
select plan_code,
|
|
|
|
|
plan_number,
|
|
|
|
|
actual_number,
|
|
|
|
|
day,
|
|
|
|
|
round(actual_number/ plan_number * 100, 2) as rate
|
|
|
|
|
|
|
|
|
|
from (
|
|
|
|
|
select ORDER_NO as plan_code,
|
|
|
|
|
|
|
|
|
|
sum(PLAN_QTY) as plan_number,
|
|
|
|
|
SUM(ACTUAL_QTY) as actual_number,
|
|
|
|
|
to_char(sysdate, 'yyyy-MM-dd') as day
|
|
|
|
|
from IMOS_PR_PLAN
|
|
|
|
|
where DETIAL_TYPE_CODE = 1004
|
|
|
|
|
and TO_CHAR(CREATION_DATE, 'YYYY-MM-DD') = TO_CHAR(SYSDATE, 'YYYY-MM-DD')
|
|
|
|
|
group by ORDER_NO
|
|
|
|
|
)
|
|
|
|
|
order by rate desc
|
|
|
|
|
</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="pqk_selectQualityItem" resultType="com.ruoyi.system.domain.BoxOutput">
|
|
|
|
|
select count(1) as qty,
|
|
|
|
|
QUALITY_DEFECTS_DESC as name
|
|
|
|
|
from IMOS_QA_PRODUCT_QUALITY
|
|
|
|
|
where ITEM_CODE in (1006, 1001) and ROWNUM <6
|
|
|
|
|
and to_char(CREATION_DATE, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
|
|
|
|
|
-- and to_char(CREATION_DATE, 'yyyy-MM-dd') between to_char(sysdate - 1, 'yyyy-mm-dd') and to_char(sysdate + 1, 'yyyy-mm-dd')
|
|
|
|
|
group by QUALITY_DEFECTS_DESC
|
|
|
|
|
order by qty desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="pqk_selectQualityInfo" resultType="com.ruoyi.system.domain.QualityInfo">
|
|
|
|
|
select PRODUCT_BARCODE as code,
|
|
|
|
|
QUALITY_DEFECTS_DESC as qa,
|
|
|
|
|
base.ITEM_NAME as item,
|
|
|
|
|
to_char(record.CREATION_DATE, 'yyyy-MM-dd') as day,
|
|
|
|
|
case when ALLOW_FLAG = 0 then '不放行' else '放行' end as state
|
|
|
|
|
from IMOS_QA_PRODUCT_QUALITY record
|
|
|
|
|
left join IMOS_QA_QUALITY_ITEM base on record.ITEM_CODE = base.ITEM_CODE
|
|
|
|
|
where record.ITEM_CODE in (1006, 1001)
|
|
|
|
|
and to_char(record.CREATION_DATE, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')
|
|
|
|
|
-- and to_char(record.CREATION_DATE, 'yyyy-MM-dd') between to_char(sysdate-1,'yyyy-mm-dd') and to_char(sysdate+1,'yyyy-mm-dd')
|
|
|
|
|
order by record.CREATION_DATE desc
|
|
|
|
|
</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,
|
|
|
|
|
0 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">
|
|
|
|
|
delete from haiwei.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 haiwei.BASE_DAY_WBTIME where ROWNUM = 1 order by CREATE_TIME desc) wb on 1 = 1
|
|
|
|
|
where ippb.PRODUCTION_DATE between case when sysdate <= wb.W_END then W_START else W_END end
|
|
|
|
|
and case when sysdate < = 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) - 20) / 60, 2) as qty, 1 as name
|
|
|
|
|
from temp1 t1
|
|
|
|
|
left join TEMP1 t2 on t1.row_numbre = t2.row_numbre + 1
|
|
|
|
|
where ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - 20 > 0
|
|
|
|
|
union
|
|
|
|
|
select count(1) as qty, 2 as name
|
|
|
|
|
from temp1 t1
|
|
|
|
|
left join TEMP1 t2 on t1.row_numbre = t2.row_numbre + 2
|
|
|
|
|
where ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - 20 > 0
|
|
|
|
|
and ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - 20 <= 180
|
|
|
|
|
union
|
|
|
|
|
select count(1) as qty, 3 as name
|
|
|
|
|
from temp1 t1
|
|
|
|
|
left join TEMP1 t2 on t1.row_numbre = t2.row_numbre + 2
|
|
|
|
|
where ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - 20 > 180
|
|
|
|
|
and ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - 20 <= 600
|
|
|
|
|
union
|
|
|
|
|
select count(1) as qty, 4 as name
|
|
|
|
|
from temp1 t1
|
|
|
|
|
left join TEMP1 t2 on t1.row_numbre = t2.row_numbre + 2
|
|
|
|
|
where ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - 20 > 600
|
|
|
|
|
</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 (TO_CHAR(SYSDATE, 'hh24') || ':30') as name,
|
|
|
|
|
nvl(sum(actual_qty), 0) as qty
|
|
|
|
|
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') or
|
|
|
|
|
to_char(plan_date, 'yyyy-MM-dd') = to_char(sysdate-1, 'yyyy-MM-dd'))
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectNowXkOutPut1" resultType="int">
|
|
|
|
|
select nvl(sum(actual_qty), 0)
|
|
|
|
|
from IMOS.IMOS_PR_PLAN ipp
|
|
|
|
|
left join (select * from haiwei.BASE_DAY_WBTIME where ROWNUM = 1 order by CREATE_TIME desc) wb on 1=1
|
|
|
|
|
where plan_date is not null
|
|
|
|
|
and process_code = 1002
|
|
|
|
|
and delete_flag = '0'
|
|
|
|
|
and ipp.CREATION_DATE between case when sysdate < = wb.W_END then W_START else W_END end
|
|
|
|
|
and case when sysdate < = 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 >
|
|
|
|
|
-- case
|
|
|
|
|
-- when to_char(sysdate, 'hh24') > 7 and to_char(sysdate, 'hh24') < 20 then to_date(
|
|
|
|
|
-- to_char(SYSDATE, 'yyyy-MM-dd') || '07:30:00',
|
|
|
|
|
-- 'yyyy-MM-dd hh24:mi:ss')
|
|
|
|
|
-- when to_char(sysdate, 'hh24') < 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 <
|
|
|
|
|
-- case
|
|
|
|
|
-- when to_char(sysdate, 'hh24') > 7 and to_char(sysdate, 'hh24') < 20 then to_date(
|
|
|
|
|
-- to_char(SYSDATE, 'yyyy-MM-dd') || '19:30:00',
|
|
|
|
|
-- 'yyyy-MM-dd hh24:mi:ss')
|
|
|
|
|
-- when to_char(sysdate, 'hh24') < 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(QTY, 0) from 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 < = W_END then 0 else 1 end from BASE_DAY_WBTIME where ROWNUM=1 order by CREATE_TIME desc
|
|
|
|
|
</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_selectProductInByTeam" resultType="com.ruoyi.system.domain.BoxOutput">
|
|
|
|
|
select to_char(PRODUCTION_DATE, 'hh24') || ':30' as name, count(1) as qty
|
|
|
|
|
from IMOS_PR_PRODUCT_BARCODE ippb
|
|
|
|
|
left join (select * from haiwei.BASE_DAY_WBTIME where ROWNUM = 1 order by CREATE_TIME desc) wb on 1 = 1
|
|
|
|
|
where ippb.PRODUCTION_DATE between case when sysdate < = wb.W_END then W_START else W_END end
|
|
|
|
|
and case when sysdate < = wb.W_END then W_END else B_END end
|
|
|
|
|
and DETIAL_TYPE_CODE = '1004'
|
|
|
|
|
group by to_char(PRODUCTION_DATE, 'hh24')
|
|
|
|
|
order by to_char(PRODUCTION_DATE, 'hh24')
|
|
|
|
|
</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 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 haiwei.BASE_DAY_WBTIME where ROWNUM = 1 order by CREATE_TIME desc) wb
|
|
|
|
|
on 1 = 1
|
|
|
|
|
where ippb.PRODUCTION_DATE between case when sysdate < = wb.W_END then W_START else W_END end
|
|
|
|
|
and case when sysdate < = wb.W_END then W_END else 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
|
|
|
|
|
order by name
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|