|
@@ -37,6 +37,10 @@
|
|
|
<select id="getSaleOutSum" resultType="java.lang.String">
|
|
|
select sum(isnull(iQuantity,0)) as 'iQuantity' from VIEW_FabricLoss_Head_Clothes_SaleOut_Sum where csocode in (
|
|
|
select cSoOrdercode from VIEW_OM_MOMain_ALL_Clothes where ccode like CONCAT(#{code},'%')
|
|
|
+ ) and cinvcode in (
|
|
|
+ select cinvcode from VIEW_OM_MOMain_ALL_Clothes where ccode like CONCAT(#{code},'%')
|
|
|
+ ) and cfree1 in (
|
|
|
+ select cfree1 from VIEW_OM_MOMain_ALL_Clothes where ccode like CONCAT(#{code},'%')
|
|
|
)
|
|
|
</select>
|
|
|
<select id="getPrice" resultType="java.lang.String">
|
|
@@ -63,12 +67,12 @@
|
|
|
|
|
|
<!--获取采购订单,物料名为物料名+颜色-->
|
|
|
<select id="getPurchaseList" resultType="org.jeecg.modules.report.entity.FabricPoOrder">
|
|
|
- select cVenName,cVenAbbName,cInvCode,cInvName,cColor,cBatch,sum(iQuantity) as iQuantity,
|
|
|
+ select cVenName,cVenAbbName,cPOID,cInvCode,cInvName,cColor,<!--isnull(cBatch,'') as cBatch,-->sum(iQuantity) as iQuantity,
|
|
|
isnull(sum(iQuantityIn),0) as iQuantityIn
|
|
|
from (
|
|
|
select a.cPOID ,d.cVenName,d.cVenAbbName ,c.cInvCode,c.cInvName + ' ' + isnull(b.cFree1,'') as cInvName,isnull(b.cFree1,'') as cColor,b.iQuantity,
|
|
|
- (select sum(iquantity) from RdRecords01 x where x.iposid=b.id) as iQuantityIn,
|
|
|
- stuff((SELECT ',' + cbatch FROM RdRecords01 x where x.iposid=b.id FOR XML path('') ), 1, 1, '') as cBatch
|
|
|
+ (select sum(iquantity) from RdRecords01 x where x.iposid=b.id) as iQuantityIn<!--,
|
|
|
+ stuff((SELECT ',' + cbatch FROM RdRecords01 x where x.iposid=b.id FOR XML path('') ), 1, 1, '') as cBatch-->
|
|
|
from PO_Pomain a
|
|
|
inner join PO_Podetails b on a.POID =b.POID
|
|
|
inner join Inventory c on b.cInvCode=c.cInvCode
|
|
@@ -78,7 +82,7 @@
|
|
|
or c.cInvCCode LIKE '02%'
|
|
|
or c.cInvCCode LIKE '03%'
|
|
|
or c.cInvCCode LIKE '04%')
|
|
|
- ) as t1 group by cVenName,cVenAbbName,cInvCode,cInvName,cColor,cBatch
|
|
|
+ ) as t1 group by cVenName,cVenAbbName,cPOID,cInvCode,cInvName,cColor<!--,cBatch-->
|
|
|
</select>
|
|
|
<!-- 其他入库纱,找委外订单的材料出库单,获取物料号+批号,物料号+批号再其他入库单 -->
|
|
|
<select id="getPurchaseListOtherInList" resultType="org.jeecg.modules.report.entity.FabricPoOrderOut">
|
|
@@ -90,7 +94,7 @@
|
|
|
rdrecords11 a
|
|
|
INNER JOIN Inventory d ON a.cinvcode = d.cinvcode
|
|
|
WHERE
|
|
|
- a.cbatch is not null and a.cbatch <>'期初' and
|
|
|
+ (a.cbatch is null or a.cbatch='' or a.cbatch <> '期初') and
|
|
|
(d.cInvCCode LIKE '01%'
|
|
|
or d.cInvCCode LIKE '02%'
|
|
|
or d.cInvCCode LIKE '03%'
|
|
@@ -114,7 +118,7 @@
|
|
|
WHERE
|
|
|
a.cbustype = '其他入库'
|
|
|
)
|
|
|
- )
|
|
|
+ ) or d.cinvname='杂纱'
|
|
|
)
|
|
|
) as t1 group by cCode
|
|
|
</select>
|
|
@@ -221,7 +225,7 @@
|
|
|
order by cVCName,cVenName,cInvCode,cInvName,cComUnitCode,cColor
|
|
|
|
|
|
</select>
|
|
|
- <!--获取委外材料出库单,已核销的取核销数量-->
|
|
|
+ <!--获取本次采购入库的委外材料出库单,已核销的取核销数量-->
|
|
|
<select id="getOmOutList" resultType="map">
|
|
|
SELECT
|
|
|
g.cVenName,
|
|
@@ -277,7 +281,7 @@
|
|
|
</select>
|
|
|
<!--获取本次采购入库单,含发票和结算数据-->
|
|
|
<select id="getPurchaseInList" resultType="org.jeecg.modules.report.entity.FabricPoOrderIn">
|
|
|
- select a.cCode,a.cBusType,b.cInvCode,b.cFree1 as cColor,b.iQuantity,
|
|
|
+ select a.cCode,a.cBusType,b.cInvCode,b.cFree1 as cColor,b.cBatch,b.iQuantity,
|
|
|
isnull((select sum(iPBVQuantity ) from PurBillVouchs x where x.RdsId =b.autoid),0) as iQuantityInvoice,
|
|
|
isnull((select sum(iSum)/sum(iPBVQuantity ) from PurBillVouchs x where x.RdsId =b.autoid),0) as iPrice,
|
|
|
isnull((select sum(iSVQuantity) from PurSettleVouchs x where x.iRdsID=b.autoid),0) as iQuantitySettle
|
|
@@ -415,7 +419,9 @@
|
|
|
</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 cCode,cInvCode,cColor,
|
|
|
+ case when sum( iQuantity ) = 0 then 0 else sum(iQuantity*iPrice)/sum(iQuantity) end 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
|
|
@@ -482,4 +488,25 @@
|
|
|
AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
|
|
|
</select>
|
|
|
+ <!-- 获取委外出库的纱数量 -->
|
|
|
+ <select id="getOmOutList01" resultType="org.jeecg.modules.report.entity.FabricInventoryOut">
|
|
|
+ SELECT
|
|
|
+ b.cInvName,
|
|
|
+ isnull( a.cFree1, '' ) AS cColor,
|
|
|
+ b.cInvCode,
|
|
|
+ sum(isnull( a.iSQuantity, a.iQuantity )) AS iQuantity,
|
|
|
+ a.cBatch
|
|
|
+ FROM
|
|
|
+ rdrecords11 a
|
|
|
+ INNER JOIN Inventory b ON a.cInvCode = b.cInvCode
|
|
|
+ INNER JOIN OM_MODetails d ON d.MODetailsID = a.iOMoDID
|
|
|
+ INNER JOIN om_momain e ON e.moid = d.moid
|
|
|
+ WHERE
|
|
|
+ b.cInvCCode NOT LIKE '19%'
|
|
|
+ AND e.cCode LIKE CONCAT(#{code},'%')
|
|
|
+ and b.cInvCCode like '01%'
|
|
|
+ group by b.cinvname,a.cFree1,b.cinvcode,a.cbatch
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|