批次回盘优化

This commit is contained in:
Alawn
2021-09-02 15:35:27 +08:00
parent b14e549580
commit 2afafe98df
+6 -14
View File
@@ -6,20 +6,12 @@
</Attributes>
<DynSentence name="QryBatLst">
<Sentence>
select dsk_nam from CAPDSKINF where DSK_NAM in
(select dsk_nam from (select A.dsk_nam,B.rank from CAPDSKINF A,CAPCUSINF B
where A.dsk_nam in (select dsk_nam from
(select dsk_nam,sum(unfinished_num) unfinished_num,sum(finish_num) finish_num
from (select dsk_nam,(case when BAT_STS not in ('4','2') then 1 else 0 end)
unfinished_num ,(case when BAT_STS in ('4','2') then 1 else 0 end) finish_num
from CAPBATINF b where b.dsk_nam in
(select DSK_NAM from CAPDSKINF a where a.dsk_sts = '1' and ORD_DT &gt;= ? )) group by dsk_nam) c
where c.unfinished_num = 0 and c.finish_num &gt; 0
union select DSK_NAM from CAPDSKINF a where a.dsk_sts = '9' and ORD_DT &gt;= ?)
AND A.Customer_Id = B.Customer_Id
order by rank )
where ROWNUM &lt;= '1')
FOR UPDATE skip locked
select DSK_NAM from capdskinf where DSK_NAM in
(select DSK_NAM from capdskinf a where dsk_sts = '1' and ord_dt &gt;= ? and (dsk_nam,0) in
(select dsk_nam,sum(case when bat_sts not in ('4', '2') then 1 else 0 end) notfinal from capbatinf
where ord_dt = a.ord_dt and dsk_nam = a.DSK_NAM group by dsk_nam having sum(case when bat_sts not in ('4', '2') then 1 else 0 end) = 0)
union all select DSK_NAM from CAPDSKINF a where a.dsk_sts = '9' and ORD_DT &gt;= ?)
and rownum = 1 for update skip locked
</Sentence>
<Fields>DT_BEFER|DT_BEFER|</Fields>
</DynSentence>