|
@@ -62,18 +62,20 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
|
|
(
|
|
(
|
|
select i.cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords01 rs
|
|
select i.cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords01 rs
|
|
join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
|
|
join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
|
|
|
|
+ join UFDATA_101_2021.dbo.rdrecord01 r on rs.ID = r.ID
|
|
where cPOID in (
|
|
where cPOID in (
|
|
select distinct om.cPOID
|
|
select distinct om.cPOID
|
|
from UFDATA_101_2021.dbo.PO_POmain om
|
|
from UFDATA_101_2021.dbo.PO_POmain om
|
|
join UFDATA_101_2021.dbo.PO_PODetails od on om.poid=od.poid
|
|
join UFDATA_101_2021.dbo.PO_PODetails od on om.poid=od.poid
|
|
join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
|
|
join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
|
|
- WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser')
|
|
|
|
|
|
+ WHERE om.cVerifier is not null
|
|
and om.cPOID like CONCAT(#{code},'%')
|
|
and om.cPOID like CONCAT(#{code},'%')
|
|
- )
|
|
|
|
|
|
+ ) and r.cBusType = '普通采购'
|
|
GROUP BY i.cInvCode
|
|
GROUP BY i.cInvCode
|
|
union all
|
|
union all
|
|
select i.cInvCode as cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords01 rs
|
|
select i.cInvCode as cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords01 rs
|
|
join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
|
|
join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
|
|
|
|
+ join UFDATA_101_2021.dbo.rdrecord01 r on rs.ID = r.ID
|
|
where cPOID in (
|
|
where cPOID in (
|
|
select distinct om.cCode
|
|
select distinct om.cCode
|
|
from UFDATA_101_2021.dbo.om_momain om
|
|
from UFDATA_101_2021.dbo.om_momain om
|
|
@@ -81,7 +83,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
|
|
join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
|
|
join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
|
|
WHERE om.cVerifier is not null
|
|
WHERE om.cVerifier is not null
|
|
and om.cCode like CONCAT(#{code},'%')
|
|
and om.cCode like CONCAT(#{code},'%')
|
|
- )
|
|
|
|
|
|
+ ) and r.cBusType = '委外加工'
|
|
GROUP BY i.cInvCode
|
|
GROUP BY i.cInvCode
|
|
)tab1
|
|
)tab1
|
|
right join
|
|
right join
|
|
@@ -143,18 +145,20 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
|
|
(
|
|
(
|
|
select i.cInvCode as cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords01 rs
|
|
select i.cInvCode as cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords01 rs
|
|
join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
|
|
join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
|
|
|
|
+ join UFDATA_103_2021.dbo.rdrecord01 r on rs.ID = r.ID
|
|
where cPOID in (
|
|
where cPOID in (
|
|
select distinct om.cPOID
|
|
select distinct om.cPOID
|
|
from UFDATA_103_2021.dbo.PO_POmain om
|
|
from UFDATA_103_2021.dbo.PO_POmain om
|
|
join UFDATA_103_2021.dbo.PO_PODetails od on om.poid=od.poid
|
|
join UFDATA_103_2021.dbo.PO_PODetails od on om.poid=od.poid
|
|
join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
|
|
join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
|
|
- WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser')
|
|
|
|
|
|
+ WHERE om.cVerifier is not null
|
|
and om.cPOID like CONCAT(#{code},'%')
|
|
and om.cPOID like CONCAT(#{code},'%')
|
|
- )
|
|
|
|
|
|
+ ) and r.cBusType = '普通采购'
|
|
GROUP BY i.cInvCode
|
|
GROUP BY i.cInvCode
|
|
union all
|
|
union all
|
|
select i.cInvCode as cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords01 rs
|
|
select i.cInvCode as cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords01 rs
|
|
join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
|
|
join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
|
|
|
|
+ join UFDATA_103_2021.dbo.rdrecord01 r on rs.ID = r.ID
|
|
where cPOID in (
|
|
where cPOID in (
|
|
select distinct om.cCode
|
|
select distinct om.cCode
|
|
from UFDATA_103_2021.dbo.om_momain om
|
|
from UFDATA_103_2021.dbo.om_momain om
|
|
@@ -162,7 +166,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
|
|
join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
|
|
join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
|
|
WHERE om.cVerifier is not null
|
|
WHERE om.cVerifier is not null
|
|
and om.cCode like CONCAT(#{code},'%')
|
|
and om.cCode like CONCAT(#{code},'%')
|
|
- )
|
|
|
|
|
|
+ ) and r.cBusType = '委外加工'
|
|
GROUP BY i.cInvCode
|
|
GROUP BY i.cInvCode
|
|
)tab1
|
|
)tab1
|
|
right join
|
|
right join
|