|
@@ -602,13 +602,14 @@
|
|
|
WHERE
|
|
|
c.cInvCCode NOT LIKE '19%'
|
|
|
AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
+ and exists (select * from rdrecords01 x where x.iOMoDID=b.MODetailsID)
|
|
|
</select>
|
|
|
|
|
|
<select id="getOmRowOutList" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
|
|
|
select b.MODetailsID,
|
|
|
d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cFree1,'') as cColorOut,
|
|
|
isnull(d.cBatch,'') as cBatchOut,
|
|
|
- d.iQuantity as iQuantityOut
|
|
|
+ isnull(sum(d.iQuantity),0) as iQuantityOut
|
|
|
FROM
|
|
|
om_momain a
|
|
|
INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
@@ -618,6 +619,8 @@
|
|
|
WHERE
|
|
|
c.cInvCCode NOT LIKE '19%'
|
|
|
AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
+ group by b.MODetailsID,
|
|
|
+ d.cInvCode,z.cInvName,d.cFree1,d.cBatch
|
|
|
</select>
|
|
|
|
|
|
<select id="getOmRowInList" resultType="map">
|
|
@@ -650,7 +653,7 @@
|
|
|
select f.cBusType,f.cCode,'' as cVenName,'' as cVenAbbName,
|
|
|
e.cInvCode,isnull(e.cFree1,'') as cColor,isnull(e.cBatch,'') as cBatch,
|
|
|
e.iQuantity,
|
|
|
- isnull(iPrice,0) as iPurchuseMoney,
|
|
|
+ isnull(e.iPrice,0) as iPurchuseMoney,
|
|
|
null as MODetailsID
|
|
|
from rdrecords08 e
|
|
|
inner join rdrecord08 f on e.id=f.id
|
|
@@ -673,4 +676,87 @@
|
|
|
)
|
|
|
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getOmRowInListWithAV" resultType="map">
|
|
|
+ (
|
|
|
+ select f.cBusType,f.cCode,g.cVenName,g.cVenAbbName,
|
|
|
+ e.cInvCode,isnull(e.cFree1,'') as cColor,isnull(e.cBatch,'') as cBatch,
|
|
|
+ e.iQuantity,
|
|
|
+ isnull((select sum(iSum) from PurBillVouchs x where x.RdsId =e.autoid and f.cbustype='普通采购'),0) as iPurchuseMoney,
|
|
|
+ e.iOMoDID as MODetailsID,
|
|
|
+ (select top 1 x.cInvCode2+isnull(x.cColor2,'')+isnull(x.cAVBatch2,'') from
|
|
|
+ VIEW_FabricLoss_AssemVouchs x where
|
|
|
+ x.cInvCode+isnull(x.cColor,'')+isnull(x.cAVBatch,'')=e.cInvCode+isnull(e.cfree1,'')+isnull(e.cBatch,'')) as cInvIdOut
|
|
|
+ from rdrecords01 e
|
|
|
+ inner join rdrecord01 f on e.id=f.id
|
|
|
+ inner join Vendor g on g.cVenCode=f.cVenCode
|
|
|
+ where
|
|
|
+ e.cinvcode+isnull(e.cfree1,'')+isnull(cbatch,'') in (
|
|
|
+ select x.cInvCode+isnull(x.cColor,'')+isnull(x.cAVBatch,'') from
|
|
|
+ VIEW_FabricLoss_AssemVouchs x
|
|
|
+ where x.cInvCode2+isnull(x.cColor2,'')+isnull(x.cAVBatch2,'') in (
|
|
|
+ select
|
|
|
+ e.cInvCode+isnull(e.cFree1,'')+isnull(e.cBatch,'')
|
|
|
+ from rdrecords08 e
|
|
|
+ inner join rdrecord08 f on e.id=f.id
|
|
|
+ where e.cinvcode+isnull(e.cfree1,'')+isnull(cbatch,'') in (
|
|
|
+
|
|
|
+ select
|
|
|
+ d.cInvCode+isnull(d.cFree1,'')+isnull(d.cBatch,'')
|
|
|
+ FROM
|
|
|
+ om_momain a
|
|
|
+ INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
|
+ INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
+ inner join rdrecords11 d on d.iOMoDID=b.MODetailsID
|
|
|
+ WHERE
|
|
|
+ f.cbustype='转换入库'
|
|
|
+ and c.cInvCCode NOT LIKE '19%'
|
|
|
+ AND a.cCode like CONCAT(#{code},'%')
|
|
|
+
|
|
|
+
|
|
|
+ ) and e.iQuantity>0
|
|
|
+ )
|
|
|
+
|
|
|
+ )
|
|
|
+ and e.iQuantity>0
|
|
|
+ ) union all(
|
|
|
+ select f.cBusType,f.cCode,'' as cVenName,'' as cVenAbbName,
|
|
|
+ e.cInvCode,isnull(e.cFree1,'') as cColor,isnull(e.cBatch,'') as cBatch,
|
|
|
+ e.iQuantity,
|
|
|
+ isnull(e.iPrice,0) as iPurchuseMoney,
|
|
|
+ null as MODetailsID,
|
|
|
+ (select top 1 x.cInvCode2+isnull(x.cColor2,'')+isnull(x.cAVBatch2,'') from
|
|
|
+ VIEW_FabricLoss_AssemVouchs x where
|
|
|
+ x.cInvCode+isnull(x.cColor,'')+isnull(x.cAVBatch,'')=e.cInvCode+isnull(e.cfree1,'')+isnull(e.cBatch,'')) as cInvIdOut
|
|
|
+ from rdrecords08 e
|
|
|
+ inner join rdrecord08 f on e.id=f.id
|
|
|
+ where
|
|
|
+ e.cinvcode+isnull(e.cfree1,'')+isnull(cbatch,'') in (
|
|
|
+ select x.cInvCode+isnull(x.cColor,'')+isnull(x.cAVBatch,'') from
|
|
|
+ VIEW_FabricLoss_AssemVouchs x
|
|
|
+ where x.cInvCode2+isnull(x.cColor2,'')+isnull(x.cAVBatch2,'') in (
|
|
|
+ select
|
|
|
+ e.cInvCode+isnull(e.cFree1,'')+isnull(e.cBatch,'')
|
|
|
+ from rdrecords08 e
|
|
|
+ inner join rdrecord08 f on e.id=f.id
|
|
|
+ where e.cinvcode+isnull(e.cfree1,'')+isnull(cbatch,'') in (
|
|
|
+
|
|
|
+ select
|
|
|
+ d.cInvCode+isnull(d.cFree1,'')+isnull(d.cBatch,'')
|
|
|
+ FROM
|
|
|
+ om_momain a
|
|
|
+ INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
|
+ INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
+ inner join rdrecords11 d on d.iOMoDID=b.MODetailsID
|
|
|
+ WHERE
|
|
|
+ f.cbustype='转换入库'
|
|
|
+ and c.cInvCCode NOT LIKE '19%'
|
|
|
+ AND a.cCode like CONCAT(#{code},'%')
|
|
|
+ ) and e.iQuantity>0
|
|
|
+ )
|
|
|
+
|
|
|
+ )
|
|
|
+ and e.iQuantity>0 and f.cbustype='其他入库'
|
|
|
+ )
|
|
|
+ </select>
|
|
|
</mapper>
|