|
@@ -115,6 +115,7 @@
|
|
isnull(b.iSumBillQuantity,0) as iQuantityInvoice,
|
|
isnull(b.iSumBillQuantity,0) as iQuantityInvoice,
|
|
isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum/b.iQuantity),0) as iPrice,
|
|
isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum/b.iQuantity),0) as iPrice,
|
|
isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum ),0) as iPurchuseMoney,
|
|
isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum ),0) as iPurchuseMoney,
|
|
|
|
+ isnull((select sum(x.iMoney)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),0) as iNoTaxPrice,
|
|
isnull(b.iSQuantity,0) as iQuantitySettle,
|
|
isnull(b.iSQuantity,0) as iQuantitySettle,
|
|
g.cVCName,f.cVenName ,f.cVenAbbName,isnull(d.cPOID,'') as cPlanCode,e.cInvCCode
|
|
g.cVCName,f.cVenName ,f.cVenAbbName,isnull(d.cPOID,'') as cPlanCode,e.cInvCCode
|
|
from RdRecord01 a inner join RdRecords01 b on a.id=b.id
|
|
from RdRecord01 a inner join RdRecords01 b on a.id=b.id
|
|
@@ -203,7 +204,7 @@
|
|
<!--委外订单-采购入库详情-->
|
|
<!--委外订单-采购入库详情-->
|
|
<select id="getOmInDetailList" resultType="org.jeecg.modules.report.entity.FabricMoOrderRK">
|
|
<select id="getOmInDetailList" resultType="org.jeecg.modules.report.entity.FabricMoOrderRK">
|
|
select cPlanCode,cCode,MODetailsID,cVCName,cVenName,cVenAbbName,cInvCCode,cInvCode,cInvName,cColor,cBatch,
|
|
select cPlanCode,cCode,MODetailsID,cVCName,cVenName,cVenAbbName,cInvCCode,cInvCode,cInvName,cColor,cBatch,
|
|
- sum(iQuantityIn) as iQuantityIn,sum(iProcessFee) as iProcessFee,sum(iSQuantity) as iSQuantity,
|
|
|
|
|
|
+ sum(iQuantityIn) as iQuantityIn,sum(iProcessFee) as iProcessFee, sum(iNoTaxProcessFee) as iNoTaxProcessFee, sum(iSQuantity) as iSQuantity,
|
|
sum(iQuantityOut) as iQuantityOut,sum(iSumBillQuantity) as iSumBillQuantity
|
|
sum(iQuantityOut) as iQuantityOut,sum(iSumBillQuantity) as iSumBillQuantity
|
|
from (
|
|
from (
|
|
select isnull(a.cCode,'') as cPlanCode,z.cCode,b.MODetailsID,
|
|
select isnull(a.cCode,'') as cPlanCode,z.cCode,b.MODetailsID,
|
|
@@ -211,6 +212,7 @@
|
|
x.cInvCode as cInvCode,y.cInvName as cInvName,isnull(x.cFree1,'') as cColor,isnull(x.cBatch,'') as cBatch,
|
|
x.cInvCode as cInvCode,y.cInvName as cInvName,isnull(x.cFree1,'') as cColor,isnull(x.cBatch,'') as cBatch,
|
|
isnull(x.iQuantity,0) as iQuantityIn,
|
|
isnull(x.iQuantity,0) as iQuantityIn,
|
|
isnull(isnull((select sum(case when m.cexch_name='美元' then convert(decimal(18,4),isnull(n.cdefine27,'0'))*n.iPBVQuantity else n.iSum end) from PurBillVouchs n inner join purbillvouch m on m.PBVID =n.PBVID where n.RdsId =x.autoid),0),0) as iProcessFee,
|
|
isnull(isnull((select sum(case when m.cexch_name='美元' then convert(decimal(18,4),isnull(n.cdefine27,'0'))*n.iPBVQuantity else n.iSum end) from PurBillVouchs n inner join purbillvouch m on m.PBVID =n.PBVID where n.RdsId =x.autoid),0),0) as iProcessFee,
|
|
|
|
+ isnull((select sum(n.iMoney ) from PurBillVouchs n inner join purbillvouch m on m.PBVID =n.PBVID where n.RdsId =x.autoid),0) as iNoTaxProcessFee,
|
|
isnull(x.iSumBillQuantity,0) as iSumBillQuantity,isnull(x.iSQuantity,0) as iSQuantity,
|
|
isnull(x.iSumBillQuantity,0) as iSumBillQuantity,isnull(x.iSQuantity,0) as iSQuantity,
|
|
isnull((select sum(isnull(iquantity,0)) as iQuantityOut from rdrecords11 d where d.iOMoDID=b.MODetailsID),0) as iQuantityOut,
|
|
isnull((select sum(isnull(iquantity,0)) as iQuantityOut from rdrecords11 d where d.iOMoDID=b.MODetailsID),0) as iQuantityOut,
|
|
y.cInvCCode
|
|
y.cInvCCode
|
|
@@ -331,7 +333,7 @@
|
|
(
|
|
(
|
|
select 'rdrecords01' as cTableName,b.AutoId,a.cBusType,
|
|
select 'rdrecords01' as cTableName,b.AutoId,a.cBusType,
|
|
b.cInvCode+isnull(b.cFree1,'')+isnull(b.cBatch,'') as cInvIdBefore,
|
|
b.cInvCode+isnull(b.cFree1,'')+isnull(b.cBatch,'') as cInvIdBefore,
|
|
- c.cInvCode2+c.cColor2+c.cAVBatch2 as cInvIdAfter
|
|
|
|
|
|
+ c.cInvCode2+c.cColor2+c.cAVBatch2 as cInvIdAfter,c.iAVQuantity/c.iAVQuantity2 as iRate
|
|
from VIEW_FabricLoss_AssemVouchs c,rdrecords01 b,rdrecord01 a,Vendor d, VendorClass e
|
|
from VIEW_FabricLoss_AssemVouchs c,rdrecords01 b,rdrecord01 a,Vendor d, VendorClass e
|
|
where a.id=b.id and d.cVenCode=a.cVenCode and d.cVCCode =e.cVCCode
|
|
where a.id=b.id and d.cVenCode=a.cVenCode and d.cVCCode =e.cVCCode
|
|
and c.cinvcode+ccolor+cavbatch=b.cinvcode +isnull(b.cFree1,'')+isnull(b.cBatch,'') and b.iQuantity <> 0
|
|
and c.cinvcode+ccolor+cavbatch=b.cinvcode +isnull(b.cFree1,'')+isnull(b.cBatch,'') and b.iQuantity <> 0
|
|
@@ -342,7 +344,7 @@
|
|
) union all (
|
|
) union all (
|
|
select 'rdrecords08' as cTableName,b.AutoId,a.cBusType,
|
|
select 'rdrecords08' as cTableName,b.AutoId,a.cBusType,
|
|
b.cInvCode+isnull(b.cFree1,'')+isnull(b.cBatch,'') as cInvIdBefore,
|
|
b.cInvCode+isnull(b.cFree1,'')+isnull(b.cBatch,'') as cInvIdBefore,
|
|
- c.cInvCode2+c.cColor2+c.cAVBatch2 as cInvIdAfter
|
|
|
|
|
|
+ c.cInvCode2+c.cColor2+c.cAVBatch2 as cInvIdAfter,c.iAVQuantity/c.iAVQuantity2 as iRate
|
|
from VIEW_FabricLoss_AssemVouchs c,rdrecords08 b,rdrecord08 a
|
|
from VIEW_FabricLoss_AssemVouchs c,rdrecords08 b,rdrecord08 a
|
|
where a.id=b.id
|
|
where a.id=b.id
|
|
and c.cinvcode+ccolor+cavbatch=b.cinvcode +isnull(b.cFree1,'')+isnull(b.cBatch,'') and a.cbustype= '其他入库'
|
|
and c.cinvcode+ccolor+cavbatch=b.cinvcode +isnull(b.cFree1,'')+isnull(b.cBatch,'') and a.cbustype= '其他入库'
|
|
@@ -354,7 +356,7 @@
|
|
) union all (
|
|
) union all (
|
|
select 'rdrecords08' as cTableName,b.AutoId,a.cBusType,
|
|
select 'rdrecords08' as cTableName,b.AutoId,a.cBusType,
|
|
b.cInvCode+isnull(b.cFree1,'')+isnull(b.cBatch,'') as cInvIdBefore,
|
|
b.cInvCode+isnull(b.cFree1,'')+isnull(b.cBatch,'') as cInvIdBefore,
|
|
- c.cInvCode2+c.cColor2+c.cAVBatch2 as cInvIdAfter
|
|
|
|
|
|
+ c.cInvCode2+c.cColor2+c.cAVBatch2 as cInvIdAfter,c.iAVQuantity/c.iAVQuantity2 as iRate
|
|
from VIEW_FabricLoss_AssemVouchs c,rdrecords08 b,rdrecord08 a
|
|
from VIEW_FabricLoss_AssemVouchs c,rdrecords08 b,rdrecord08 a
|
|
where a.id=b.id
|
|
where a.id=b.id
|
|
and c.cinvcode+ccolor+cavbatch=b.cinvcode +isnull(b.cFree1,'')+isnull(b.cBatch,'') and a.cbustype = '转换入库'
|
|
and c.cinvcode+ccolor+cavbatch=b.cinvcode +isnull(b.cFree1,'')+isnull(b.cBatch,'') and a.cbustype = '转换入库'
|
|
@@ -369,9 +371,15 @@
|
|
</select>
|
|
</select>
|
|
<!-- 根据入库单子表id获取采购入库价格 -->
|
|
<!-- 根据入库单子表id获取采购入库价格 -->
|
|
<select id="getPoInPriceList" resultType="org.jeecg.modules.report.entity.FabricInPrice">
|
|
<select id="getPoInPriceList" resultType="org.jeecg.modules.report.entity.FabricInPrice">
|
|
- select b.AutoId,
|
|
|
|
|
|
+ select isnull(d.cPOID,'') as cPlanCode, a.cBusType,a.cCode,g.cVCName,f.cVenName ,f.cVenAbbName,
|
|
|
|
+ b.AutoId,
|
|
isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum/b.iQuantity),0) as iPrice
|
|
isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum/b.iQuantity),0) as iPrice
|
|
from rdrecords01 b
|
|
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 d.poid=c.poid
|
|
|
|
+ inner join Vendor f on f.cVenCode=a.cVenCode
|
|
|
|
+ inner join VendorClass g on g.cVCCode =f.cVCCode
|
|
where b.autoId in
|
|
where b.autoId in
|
|
<foreach item="item" collection="autoIdList" index="index" open="(" separator="," close=")">
|
|
<foreach item="item" collection="autoIdList" index="index" open="(" separator="," close=")">
|
|
#{item}
|
|
#{item}
|
|
@@ -508,7 +516,7 @@
|
|
case when a.cbustype='委外加工' then 0 else
|
|
case when a.cbustype='委外加工' then 0 else
|
|
isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum/b.iQuantity),0) end
|
|
isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum/b.iQuantity),0) end
|
|
as iPrice,
|
|
as iPrice,
|
|
- isnull(b.iOMoDID,0) as MODetailsID,isnull(b.iPOsID,0) as PoDetailsID,f.cInvCCode
|
|
|
|
|
|
+ isnull(b.iOMoDID,0) as MODetailsID,isnull(b.iPOsID,0) as PoDetailsID,f.cInvCCode,1.0 as iRate
|
|
|
|
|
|
from rdrecords01 b
|
|
from rdrecords01 b
|
|
inner join rdrecord01 a on a.id=b.id
|
|
inner join rdrecord01 a on a.id=b.id
|
|
@@ -523,7 +531,7 @@
|
|
select b.AutoId,a.cCode, isnull(a.cdefine9,'') as cPlanCode,a.cBusType,'' as cVCName,'' as cVenName,'' as cVenAbbName,
|
|
select b.AutoId,a.cCode, isnull(a.cdefine9,'') as cPlanCode,a.cBusType,'' as cVCName,'' as cVenName,'' as cVenAbbName,
|
|
b.cInvCode,isnull(b.cFree1,'') as cColor,isnull(b.cBatch,'') as cBatch,f.cInvname,b.iQuantity,
|
|
b.cInvCode,isnull(b.cFree1,'') as cColor,isnull(b.cBatch,'') as cBatch,f.cInvname,b.iQuantity,
|
|
isnull(case when a.cMaker='王行乔' then b.iPrice/b.iQuantity else b.iPrice*1.13/b.iQuantity end,0) as iPrice,
|
|
isnull(case when a.cMaker='王行乔' then b.iPrice/b.iQuantity else b.iPrice*1.13/b.iQuantity end,0) as iPrice,
|
|
- 0 as MODetailsID, 0 as PoDetailsID,f.cInvCCode
|
|
|
|
|
|
+ 0 as MODetailsID, 0 as PoDetailsID,f.cInvCCode,1.0 as iRate
|
|
from rdrecords08 b
|
|
from rdrecords08 b
|
|
inner join rdrecord08 a on a.id=b.id
|
|
inner join rdrecord08 a on a.id=b.id
|
|
inner join Inventory f ON b.cinvcode = f.cinvcode
|
|
inner join Inventory f ON b.cinvcode = f.cinvcode
|
|
@@ -570,6 +578,24 @@
|
|
</select>
|
|
</select>
|
|
<!-- 获取销售出库数量 -->
|
|
<!-- 获取销售出库数量 -->
|
|
<select id="getSaleOutList" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
|
|
<select id="getSaleOutList" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
|
|
|
|
+
|
|
|
|
+ select distinct c.autoid,'' as cOmCode,c.cInvCode as cInvCodeOut,b.cInvName as cInvNameOut,
|
|
|
|
+ isnull(c.cFree1,'') as cColorOut,isnull(c.cBatch,'') as cBatchOut,c.iQuantity as iQuantityOut,
|
|
|
|
+ isnull(c.cbatchproperty9,'') as cVenAbbName
|
|
|
|
+ from rdrecords32 c inner join SO_SODetails d on c.iorderdid=d.iSOsID
|
|
|
|
+ inner join so_somain e on e.id=d.id
|
|
|
|
+ INNER JOIN Inventory b ON c.cinvcode = b.cinvcode
|
|
|
|
+ where d.id in (
|
|
|
|
+ select distinct e.id
|
|
|
|
+ from om_momain a
|
|
|
|
+ inner join OM_MODetails b on a.moid=b.moid
|
|
|
|
+ inner join rdrecords32 c on c.iorderdid =b.isosid and b.cinvcode=c.cinvcode
|
|
|
|
+ INNER JOIN Inventory d ON c.cinvcode = d.cinvcode
|
|
|
|
+ inner join SO_SODetails e on e.iSOsID=c.isodid
|
|
|
|
+ where a.ccode like CONCAT(#{code},'%') and a.ccode not like '%样%' and
|
|
|
|
+ (d.cInvCCode like '01%' or d.cInvCCode like '02%' or d.cInvCCode like '03%' or d.cInvCCode like '04%')
|
|
|
|
+ )
|
|
|
|
+<!--
|
|
select distinct c.autoid,a.ccode as cOmCode,c.cInvCode as cInvCodeOut,d.cInvName as cInvNameOut,
|
|
select distinct c.autoid,a.ccode as cOmCode,c.cInvCode as cInvCodeOut,d.cInvName as cInvNameOut,
|
|
isnull(c.cFree1,'') as cColorOut,isnull(c.cBatch,'') as cBatchOut,c.iQuantity as iQuantityOut,
|
|
isnull(c.cFree1,'') as cColorOut,isnull(c.cBatch,'') as cBatchOut,c.iQuantity as iQuantityOut,
|
|
isnull(c.cbatchproperty9,'') as cVenAbbName
|
|
isnull(c.cbatchproperty9,'') as cVenAbbName
|
|
@@ -579,7 +605,7 @@
|
|
INNER JOIN Inventory d ON c.cinvcode = d.cinvcode
|
|
INNER JOIN Inventory d ON c.cinvcode = d.cinvcode
|
|
where a.ccode like CONCAT(#{code},'%') and a.ccode not like '%样%' and
|
|
where a.ccode like CONCAT(#{code},'%') and a.ccode not like '%样%' and
|
|
(d.cInvCCode like '01%' or d.cInvCCode like '02%' or d.cInvCCode like '03%' or d.cInvCCode like '04%')
|
|
(d.cInvCCode like '01%' or d.cInvCCode like '02%' or d.cInvCCode like '03%' or d.cInvCCode like '04%')
|
|
-
|
|
|
|
|
|
+-->
|
|
</select>
|
|
</select>
|
|
<!--获取本次采购入库的形态转换-->
|
|
<!--获取本次采购入库的形态转换-->
|
|
<select id="getPoAssemVouchList" resultType="map">
|
|
<select id="getPoAssemVouchList" resultType="map">
|