|
@@ -97,7 +97,7 @@
|
|
|
or d.cInvCCode LIKE '03%'
|
|
|
or d.cInvCCode LIKE '04%')
|
|
|
AND c.cCode LIKE CONCAT(#{code},'%')
|
|
|
- AND a.cInvCode + isnull( a.cFree1, '' ) + isnull( a.cBatch, '' ) IN (
|
|
|
+ AND (a.cInvCode + isnull( a.cFree1, '' ) + isnull( a.cBatch, '' ) IN (
|
|
|
SELECT
|
|
|
b.cInvCode + isnull( b.cFree1, '' ) + isnull( b.cBatch, '' )
|
|
|
FROM
|
|
@@ -105,15 +105,27 @@
|
|
|
INNER JOIN rdrecord08 a ON a.id = b.ID
|
|
|
WHERE
|
|
|
a.cbustype = '其他入库'
|
|
|
+ ) or a.cInvCode + isnull( a.cFree1, '' ) + isnull( a.cBatch, '' ) IN (
|
|
|
+ select cInvCode2+isnull(cColor2,'')+isnull(cAVBatch2,'') from VIEW_FabricLoss_AssemVouchs where
|
|
|
+ cInvCode+isnull(cColor,'')+isnull(cAVBatch,'') in (
|
|
|
+ select b.cInvCode + isnull( b.cFree1, '' ) + isnull( b.cBatch, '' )
|
|
|
+ FROM
|
|
|
+ RdRecords08 b
|
|
|
+ INNER JOIN rdrecord08 a ON a.id = b.ID
|
|
|
+ WHERE
|
|
|
+ a.cbustype = '其他入库'
|
|
|
+ )
|
|
|
+ )
|
|
|
)
|
|
|
) as t1 group by cCode
|
|
|
</select>
|
|
|
|
|
|
<select id="getPurchaseListOtherPurInList" resultType="org.jeecg.modules.report.entity.FabricPoOrderOut">
|
|
|
- select cCode,sum(iQuantity*iPrice)/sum(iQuantity) as iPrice, sum(iQuantity) as iQuantity from
|
|
|
+ select cCode,sum(iPrice)/count(iPrice) as iPrice, sum(iQuantity) as iQuantity from
|
|
|
(
|
|
|
SELECT
|
|
|
- a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,a.iUnitCost as iPrice
|
|
|
+ a.comcode as cCode,case when a.iSQuantity is null or a.iSQuantity=0 then a.iquantity else a.iSQuantity end as iQuantity,
|
|
|
+ a.iUnitCost as iPrice
|
|
|
FROM
|
|
|
rdrecords11 a
|
|
|
INNER JOIN Inventory d ON a.cinvcode = d.cinvcode
|
|
@@ -127,18 +139,18 @@
|
|
|
a.cInvCode+isnull(a.cFree1,'')+isnull(a.cbatch,'') in (
|
|
|
select b.cinvcode+isnull(b.cfree1,'')+isnull(b.cbatch,'') from RdRecords01 b
|
|
|
inner join RdRecord01 a on a.id=b.id
|
|
|
- inner join OM_MODetails c on b.iOMoDID=c.MODetailsID
|
|
|
- inner join om_momain d on c.MOID =d.MOID
|
|
|
- where d.ccode not like CONCAT(#{code},'%') and a.cbustype='普通采购'
|
|
|
+ inner join PO_Podetails c on b.iPOsID =c.ID
|
|
|
+ inner join PO_Pomain d on c.POID =d.POID
|
|
|
+ where d.cPOID not like CONCAT(#{code},'%') and a.cbustype='普通采购'
|
|
|
)
|
|
|
or a.cInvCode+isnull(a.cFree1,'')+isnull(a.cbatch,'') in (
|
|
|
select cInvCode2+isnull(cColor2,'')+isnull(cAVBatch2,'') from VIEW_FabricLoss_AssemVouchs where
|
|
|
cInvCode+isnull(cColor,'')+isnull(cAVBatch,'') in (
|
|
|
select b.cinvcode+isnull(b.cfree1,'')+isnull(b.cbatch,'') from RdRecords01 b
|
|
|
inner join RdRecord01 a on a.id=b.id
|
|
|
- inner join OM_MODetails c on b.iOMoDID=c.MODetailsID
|
|
|
- inner join om_momain d on c.MOID =d.MOID
|
|
|
- where d.ccode not like CONCAT(#{code},'%') and a.cbustype='普通采购')
|
|
|
+ inner join PO_Podetails c on b.iPOsID =c.ID
|
|
|
+ inner join PO_Pomain d on c.POID =d.POID
|
|
|
+ where d.cPOID not like CONCAT(#{code},'%') and a.cbustype='普通采购')
|
|
|
)
|
|
|
)
|
|
|
) as t1 group by cCode
|
|
@@ -208,7 +220,8 @@
|
|
|
b.cInvCode,
|
|
|
isnull( a.iSQuantity, a.iQuantity ) AS iQuantity,
|
|
|
a.autoid,
|
|
|
- a.iPrice
|
|
|
+ a.iPrice,
|
|
|
+ a.cBatch
|
|
|
FROM
|
|
|
rdrecords11 a
|
|
|
INNER JOIN Inventory b ON a.cInvCode = b.cInvCode
|
|
@@ -218,6 +231,24 @@
|
|
|
WHERE
|
|
|
b.cInvCCode NOT LIKE '19%'
|
|
|
AND e.cCode LIKE CONCAT(#{code},'%')
|
|
|
+ and (
|
|
|
+ a.cInvCode+isnull(a.cFree1,'')+isnull(a.cbatch,'') in (
|
|
|
+ select b.cinvcode+isnull(b.cfree1,'')+isnull(b.cbatch,'') from RdRecords01 b
|
|
|
+ inner join RdRecord01 a on a.id=b.id
|
|
|
+ inner join PO_Podetails c on b.iPOsID =c.ID
|
|
|
+ inner join PO_Pomain d on c.POID =d.POID
|
|
|
+ where d.cPOID like CONCAT(#{code},'%') and a.cbustype='普通采购'
|
|
|
+ )
|
|
|
+ or a.cInvCode+isnull(a.cFree1,'')+isnull(a.cbatch,'') in (
|
|
|
+ select cInvCode2+isnull(cColor2,'')+isnull(cAVBatch2,'') from VIEW_FabricLoss_AssemVouchs where
|
|
|
+ cInvCode+isnull(cColor,'')+isnull(cAVBatch,'') in (
|
|
|
+ select b.cinvcode+isnull(b.cfree1,'')+isnull(b.cbatch,'') from RdRecords01 b
|
|
|
+ inner join RdRecord01 a on a.id=b.id
|
|
|
+ inner join PO_Podetails c on b.iPOsID =c.ID
|
|
|
+ inner join PO_Pomain d on c.POID =d.POID
|
|
|
+ where d.cPOID like CONCAT(#{code},'%') and a.cbustype='普通采购')
|
|
|
+ )
|
|
|
+ )
|
|
|
|
|
|
</select>
|
|
|
|