|  | @@ -81,11 +81,11 @@
 | 
											
												
													
														|  |  		) as t1 group by cVenName,cVenAbbName,cInvCode,cInvName,cColor,cBatch
 |  |  		) as t1 group by cVenName,cVenAbbName,cInvCode,cInvName,cColor,cBatch
 | 
											
												
													
														|  |  	</select>
 |  |  	</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
 |  |  		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
 |  |  		FROM
 | 
											
												
													
														|  |  			rdrecords11 a
 |  |  			rdrecords11 a
 | 
											
												
													
														|  |  			INNER JOIN OM_MODetails b ON a.iOMoDID = b.MODetailsID
 |  |  			INNER JOIN OM_MODetails b ON a.iOMoDID = b.MODetailsID
 | 
											
										
											
												
													
														|  | @@ -98,77 +98,50 @@
 | 
											
												
													
														|  |  			or d.cInvCCode LIKE '04%')
 |  |  			or d.cInvCCode LIKE '04%')
 | 
											
												
													
														|  |  			AND c.cCode LIKE CONCAT(#{code},'%')
 |  |  			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
 |  | 
 | 
											
												
													
														|  | -			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>
 | 
											
												
													
														|  |  	<!-- 来源余纱,找委外订单的材料出库单,获取物料号+批号。如果物料号+批号在形态转换单中,取转换前物料+批号。判断物料+批号,是否在其他采购入库里 -->
 |  |  	<!-- 来源余纱,找委外订单的材料出库单,获取物料号+批号。如果物料号+批号在形态转换单中,取转换前物料+批号。判断物料+批号,是否在其他采购入库里 -->
 | 
											
												
													
														|  | -	<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
 |  |  		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
 |  |  		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
 |  |  		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>
 | 
											
												
													
														|  |  	<!--获取所有委外订单 cComUnitCode : 计量单位,02(PCS)根,04(M)米-->
 |  |  	<!--获取所有委外订单 cComUnitCode : 计量单位,02(PCS)根,04(M)米-->
 | 
											
												
													
														|  |  	<select id="getOmOrderListAll" resultType="org.jeecg.modules.report.entity.FabricOMOrder">
 |  |  	<select id="getOmOrderListAll" resultType="org.jeecg.modules.report.entity.FabricOMOrder">
 | 
											
										
											
												
													
														|  | @@ -396,4 +369,30 @@
 | 
											
												
													
														|  |  				)
 |  |  				)
 | 
											
												
													
														|  |  			)
 |  |  			)
 | 
											
												
													
														|  |  	</select>
 |  |  	</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>
 |  |  </mapper>
 |