Sfoglia il codice sorgente

面料损耗更新

fenghaifu 2 anni fa
parent
commit
cc4bd9c97d

+ 12 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/mapper/xml/FabricLossMapper.xml

@@ -593,8 +593,8 @@
 	<select id="getOmRowInfoList" resultType="map">
 		select b.MODetailsID,
 			 (select top 1  x.cInvCode+isnull(x.cFree1,'') from  rdrecords01 x where x.iOMoDID=b.MODetailsID) as cInvCodeColorIn,
-			 (select  sum(x.iProcessFee) from  rdrecords01 x where x.iOMoDID=b.MODetailsID) as iProcessFee,
-			 (select  sum(x.iQuantity) from  rdrecords01 x where x.iOMoDID=b.MODetailsID) as iQuantityIn
+			 isnull((select  isnull(sum(y.iSum),sum(x.iProcessFee)) from  rdrecords01 x inner join PurBillVouchs  y on y.RdsId =x.autoid where x.iOMoDID=b.MODetailsID),0) as iProcessFee,
+			 isnull((select  sum(x.iQuantity) from  rdrecords01 x where x.iOMoDID=b.MODetailsID),0) as iQuantityIn
 
 		FROM
 		om_momain a
@@ -625,9 +625,10 @@
 	</select>
 	<!-- 获取委外订单出库物料的入库物料信息:包含采购入库、委外入库、其他入库 -->
 	<select id="getOmRowInList" resultType="map">
-		(
+		select * from (
+			(
 
-			select f.cBusType,f.cCode,g.cVenName,g.cVenAbbName,
+			select e.autoid,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,
@@ -651,7 +652,7 @@
 				) and e.iQuantity>0
 
 		) union all(
-			select f.cBusType,f.cCode,'' as cVenName,'' as cVenAbbName,
+			select e.autoid,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,
@@ -674,13 +675,14 @@
 
 
 				)  and e.iQuantity>0
-		)
-
+			)
+		) as t1 order by autoid desc
 	</select>
 	<!-- 根据形态转换物料获取采购入库、其他入库信息 -->
 	<select id="getOmRowInListWithAV" resultType="map">
+	select * from (
 	(
-	select f.cBusType,f.cCode,g.cVenName,g.cVenAbbName,
+	select e.autoid,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,
@@ -721,7 +723,7 @@
 		)
 		and e.iQuantity>0
 	) union all(
-		select f.cBusType,f.cCode,'' as cVenName,'' as cVenAbbName,
+		select e.autoid,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,
@@ -758,7 +760,7 @@
 
 		)
 		and e.iQuantity>0 and f.cbustype in ('其他入库','转换入库')
-	)
+	)) as t1 order by autoid desc
 	</select>
 	<!-- 获取销售订单附件 -->
 	<select id="getSoAccList" resultType="org.jeecg.modules.report.entity.AccessorItem">