修改 loss 分钟数判断

master
wangh 3 years ago
parent b8a4d061cd
commit 87861068bc

@ -58,6 +58,7 @@ public class ZZJXBroadController {
@PostMapping("/selectLossInfo") @PostMapping("/selectLossInfo")
@ApiOperation("查询Loss和分布") @ApiOperation("查询Loss和分布")
private String selectLossInfo() { private String selectLossInfo() {
// 统计19.30之后还有没有入库的条码
int tag = service.zz_countNightProductIn(); int tag = service.zz_countNightProductIn();
if (tag > 0) { if (tag > 0) {
return JSONArray.toJSONString(service.zz_selectLossInfo(2)); return JSONArray.toJSONString(service.zz_selectLossInfo(2));

@ -1013,57 +1013,58 @@
</insert> </insert>
<select id="zz_selectLossInfo" resultType="com.ruoyi.system.domain.BoxOutput"> <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) - select case when q1 &lt; q2 then q1 else q1 - 12 end as qty, name
nvl(case from (
when sysdate &gt; to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '09:30:00', 'yyyy-MM-dd hh24:mi:ss') select ROUND(sum(ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - t3.RHYTHM) / 60, 2) q1,
then nvl(case
case when sysdate > to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '09:30:00', 'yyyy-MM-dd hh24:mi:ss')
when sysdate &gt; then
to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '14:30:00', 'yyyy-MM-dd hh24:mi:ss') case
then 60 when sysdate >
else 30 end to_date(to_char(SYSDATE, 'yyyy-MM-dd') || '14:30:00', 'yyyy-MM-dd hh24:mi:ss')
end then 60
, 0) as qty, else 30 end
1 as name end
, 0) as q2,
1 as name
from (select row_number() over (order by PRODUCTION_DATE) as row_number, from (select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day PRODUCTION_DATE as day
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select * left join (select *
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1) wb where ROWNUM = 1) wb
on 1 = 1 on 1 = 1
where ippb.PRODUCTION_DATE between where ippb.PRODUCTION_DATE between
case case
when #{state} = 1 then W_START when 1 = 1 then W_START
when #{state} = 2 then W_END end when 1 = 2 then W_END end
and and
case case
when #{state} = 1 then W_END when 1 = 1 then W_END
when #{state} = 2 then B_END end when 1 = 2 then B_END end
and DETIAL_TYPE_CODE = '1004') t1 and DETIAL_TYPE_CODE = '1004') t1
left join left join
(select row_number() over (order by PRODUCTION_DATE) as row_number, (select row_number() over (order by PRODUCTION_DATE) as row_number,
PRODUCTION_DATE as day PRODUCTION_DATE as day
from IMOS.IMOS_PR_PRODUCT_BARCODE ippb from IMOS.IMOS_PR_PRODUCT_BARCODE ippb
left join (select * left join (select *
from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc) from (select * from haiwei.BASE_DAY_WBTIME order by CREATE_TIME desc)
where ROWNUM = 1) wb where ROWNUM = 1) wb
on 1 = 1 on 1 = 1
where ippb.PRODUCTION_DATE between where ippb.PRODUCTION_DATE between
case case
when #{state} = 1 then W_START when 1 = 1 then W_START
when #{state} = 2 then W_END end when 1 = 2 then W_END end
and and
case case
when #{state} = 1 then W_END when 1 = 1 then W_END
when #{state} = 2 then B_END end when 1 = 2 then B_END end
and DETIAL_TYPE_CODE = '1004') t2 on t1.row_number = t2.row_number + 1 and DETIAL_TYPE_CODE = '1004') t2 on t1.row_number = t2.row_number + 1
left join left join
(select * from (select RHYTHM from haiwei.BASE_RHYTHM order by ID desc) where ROWNUM = 1) t3 on 1 = 1 (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 where 0 &lt; ROUND(TO_NUMBER(t1.day - t2.day) * 24 * 60 * 60) - t3.RHYTHM
)
union union
select count(1) as qty, select count(1) as qty,
2 as name 2 as name

Loading…
Cancel
Save