|
@@ -81,11 +81,11 @@
|
|
|
) as t1 group by cVenName,cVenAbbName,cInvCode,cInvName,cColor,cBatch
|
|
|
</select>
|
|
|
|
|
|
- <select id="getPurchaseListOtherInList" resultType="org.jeecg.modules.report.entity.FabricPoOrder">
|
|
|
-
|
|
|
+ <select id="getPurchaseListOtherInList" resultType="org.jeecg.modules.report.entity.FabricPoOrderOut">
|
|
|
+ select cCode,sum(iQuantity*iPrice)/sum(iQuantity) as iPrice, sum(iQuantity) as iQuantity from
|
|
|
+ (
|
|
|
SELECT
|
|
|
- '其他入库的纱' as cInvName,
|
|
|
- isnull(sum(a.iQuantity),0) as iQuantityOut
|
|
|
+ a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,a.iUnitCost as iPrice
|
|
|
FROM
|
|
|
rdrecords11 a
|
|
|
INNER JOIN OM_MODetails b ON a.iOMoDID = b.MODetailsID
|
|
@@ -98,77 +98,50 @@
|
|
|
or d.cInvCCode LIKE '04%')
|
|
|
AND c.cCode LIKE CONCAT(#{code},'%')
|
|
|
AND a.cInvCode + isnull( a.cFree1, '' ) + isnull( a.cBatch, '' ) 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 = '其他入库'
|
|
|
+ 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.FabricPoOrder">
|
|
|
+ <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
|
|
|
- '来源余纱' as cInvName,isnull(sum(h.iQuantity),0) as iQuantityOut
|
|
|
+ a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,a.iUnitCost as iPrice
|
|
|
FROM
|
|
|
- rdrecords11 h
|
|
|
- WHERE
|
|
|
- comcode IN (
|
|
|
- SELECT DISTINCT
|
|
|
- a.cCode
|
|
|
- FROM
|
|
|
- om_momain a
|
|
|
- INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
|
- INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
+ rdrecords11 a
|
|
|
+ INNER JOIN Inventory d ON a.cinvcode = d.cinvcode
|
|
|
WHERE
|
|
|
- (c.cInvCCode LIKE '01%'
|
|
|
- or c.cInvCCode LIKE '02%'
|
|
|
- or c.cInvCCode LIKE '03%'
|
|
|
- or c.cInvCCode LIKE '04%')
|
|
|
- AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
- )
|
|
|
- AND cInvCode + isnull( cBatch, '' ) IN ( SELECT cinvcode + isnull( cavbatch, '' ) FROM AssemVouchs WHERE bavtype = '转换后' )
|
|
|
- and cInvCode + isnull( cBatch, '' ) IN (
|
|
|
- select u.cInvCode+ isnull( u.cBatch, '' ) from rdrecords01 u inner join PO_Podetails v on u.iposid=v.id
|
|
|
- inner join PO_Pomain w on w.POID =v.POID where w.cPOID not like CONCAT(#{code},'%')
|
|
|
- and u.cInvCode + isnull( u.cBatch, '' ) in (
|
|
|
- select m.cInvCode + isnull( m.cavbatch, '' ) from AssemVouchs m where m.cavcode + CONVERT ( VARCHAR ( 10 ), m.igroupno ) in (
|
|
|
- select cavcode + CONVERT ( VARCHAR ( 10 ), igroupno )
|
|
|
- FROM
|
|
|
- AssemVouchs where cinvcode + isnull( cavbatch, '' )=h.cInvCode + isnull( h.cBatch, '' ) and bavtype = '转换后'
|
|
|
- ) and bavtype = '转换前'
|
|
|
- )
|
|
|
- )
|
|
|
- ) union all
|
|
|
- (
|
|
|
- SELECT
|
|
|
- '来源余纱' as cInvName,isnull(sum(iQuantity),0) as iQuantityIn
|
|
|
- FROM
|
|
|
- rdrecords11
|
|
|
- WHERE
|
|
|
- comcode IN (
|
|
|
- SELECT DISTINCT
|
|
|
- a.cCode
|
|
|
- FROM
|
|
|
- om_momain a
|
|
|
- INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
|
- INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
- WHERE
|
|
|
- (c.cInvCCode LIKE '01%'
|
|
|
- or c.cInvCCode LIKE '02%'
|
|
|
- or c.cInvCCode LIKE '03%'
|
|
|
- or c.cInvCCode LIKE '04%')
|
|
|
- AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
+ (d.cInvCCode LIKE '01%'
|
|
|
+ or d.cInvCCode LIKE '02%'
|
|
|
+ or d.cInvCCode LIKE '03%'
|
|
|
+ or d.cInvCCode LIKE '04%')
|
|
|
+ and a.comcode 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 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='普通采购'
|
|
|
)
|
|
|
- AND cInvCode + isnull( cBatch, '' ) NOT IN ( SELECT cinvcode + isnull( cavbatch, '' ) FROM AssemVouchs WHERE bavtype = '转换后' )
|
|
|
- and cInvCode + isnull( cBatch, '' ) in (
|
|
|
- select u.cInvCode + isnull( u.cBatch, '' ) from rdrecords01 u inner join PO_Podetails v on u.iposid=v.id
|
|
|
- inner join PO_Pomain w on w.POID =v.POID where w.cPOID not like CONCAT(#{code},'%')
|
|
|
+ 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='普通采购')
|
|
|
)
|
|
|
- )
|
|
|
+ )
|
|
|
+ ) as t1 group by cCode
|
|
|
</select>
|
|
|
|
|
|
<select id="getOmOrderListAll" resultType="org.jeecg.modules.report.entity.FabricOMOrder">
|
|
@@ -396,4 +369,30 @@
|
|
|
)
|
|
|
)
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getPoOrderInToOther" resultType="org.jeecg.modules.report.entity.FabricPoOrderOut">
|
|
|
+ select cCode,cInvCode,cColor,sum(iQuantity*iPrice)/sum(iQuantity) as iPrice, sum(iQuantity) as iQuantity from
|
|
|
+ (
|
|
|
+ select cInvCode,isnull(cFree1,'') as cColor,comcode as cCode,isnull(iSQuantity,iquantity) as iQuantity,iUnitCost as iPrice
|
|
|
+ from rdrecords11 where
|
|
|
+ comcode not like CONCAT(#{code},'%')
|
|
|
+ and (cInvCode+isnull(cFree1,'')+isnull(cbatch,'') in (
|
|
|
+ select b.cinvcode+isnull(b.cfree1,'')+isnull(b.cbatch,'') from RdRecords01 b
|
|
|
+ inner join OM_MODetails c on b.iOMoDID=c.MODetailsID
|
|
|
+ inner join om_momain d on c.MOID =d.MOID
|
|
|
+ where d.ccode like CONCAT(#{code},'%')
|
|
|
+ )
|
|
|
+ or cInvCode+isnull(cFree1,'')+isnull(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 OM_MODetails c on b.iOMoDID=c.MODetailsID
|
|
|
+ inner join om_momain d on c.MOID =d.MOID
|
|
|
+ where d.ccode like CONCAT(#{code},'%')
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ) as t1
|
|
|
+ group by cCode,cInvCode,cColor
|
|
|
+ </select>
|
|
|
</mapper>
|