Kaynağa Gözat

面料损耗更新

fenghaifu 2 yıl önce
ebeveyn
işleme
b8c770e28f

+ 7 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/mapper/FabricLossMapper.java

@@ -118,12 +118,18 @@ public interface FabricLossMapper extends BaseMapper<FabricLoss> {
 	// 获取委外订单行id,出库物料信息,出库数量
 	@DS("multi-three")
 	List<FabricMoOrderCK> getOmRowOutList(@Param("code")String code);
-	// 获取委外订单出库物料的入库物料信息:包含采购入库、委外入库、其他入库
+	// 获取委外订单出库物料的入库物料信息:包含采购入库、委外入库
 	@DS("multi-three")
 	List<Map<String,Object>> getOmRowInList(@Param("code")String code);
+	// 获取委外订单出库物料的入库物料信息:包含其他入库
+	@DS("multi-three")
+	List<Map<String,Object>> getOmRowInList2(@Param("code")String code);
 	// 根据形态转换物料获取采购入库信息
 	@DS("multi-three")
 	List<Map<String,Object>> getOmRowInListWithAV(@Param("code")String code);
+	// 根据形态转换物料获取其他入库信息
+	@DS("multi-three")
+	List<Map<String,Object>> getOmRowInListWithAV2(@Param("code")String code);
 	// 销售订单附件
 	@DS("multi-three")
 	List<AccessorItem> getSoAccList(@Param("cSoCode")String cSoCode);

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

@@ -554,7 +554,8 @@
 	<select id="getOmInDetailList" resultType="org.jeecg.modules.report.entity.FabricMoOrderRK">
 		select a.cCode,
 			 x.cInvCode as cInvCode,y.cInvName as cInvName,x.cFree1 as cColor,x.cBatch as cBatch,
-			 isnull(x.iQuantity,0) as iQuantityIn,isnull(x.iProcessFee,0) as iProcessFee,
+			 isnull(x.iQuantity,0) as iQuantityIn,
+			 isnull(isnull((select  sum(n.iSum) from  PurBillVouchs  n where n.RdsId =x.autoid),x.iProcessFee),0) as iProcessFee,
 			 isnull(x.iSumBillQuantity,0) as iSumBillQuantity,isnull(x.iSQuantity,0) as iSQuantity,
 			 (select sum(isnull(iquantity,0)) as iQuantityOut from rdrecords11 d where d.iOMoDID=b.MODetailsID) as iQuantityOut
 		FROM
@@ -623,12 +624,10 @@
 		group by b.MODetailsID,
 			 d.cInvCode,z.cInvName,d.cFree1,d.cBatch
 	</select>
-	<!-- 获取委外订单出库物料的入库物料信息:包含采购入库、委外入库、其他入库 -->
+	<!-- 获取委外订单出库物料的入库物料信息:包含采购入库、委外入库 -->
 	<select id="getOmRowInList" resultType="map">
-		select * from (
-			(
 
-			select e.autoid,f.cBusType,f.cCode,g.cVenName,g.cVenAbbName,
+			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,
@@ -650,38 +649,36 @@
 					AND a.cCode like CONCAT(#{code},'%')
 
 				) and e.iQuantity>0
-
-		) union all(
-			select e.autoid,f.cBusType,f.cCode,'' as cVenName,'' as cVenAbbName,
+	</select>
+	<!-- 获取委外订单出库物料的入库物料信息:包含其他入库 -->
+	<select id="getOmRowInList2" resultType="map">
+		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
-			from rdrecords08 e
+		from rdrecords08 e
 				inner join rdrecord08 f on e.id=f.id
-				where e.cinvcode+isnull(e.cfree1,'')+isnull(cbatch,'') in (
+		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},'%')
+			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
-			)
-		) as t1 order by autoid desc
+		)  and e.iQuantity>0 order by e.autoid desc
 	</select>
-	<!-- 根据形态转换物料获取采购入库、其他入库信息 -->
+	<!-- 根据形态转换物料获取采购入库 -->
 	<select id="getOmRowInListWithAV" resultType="map">
-	select * from (
-	(
+
 	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,
@@ -722,8 +719,10 @@
 
 		)
 		and e.iQuantity>0
-	) union all(
-		select e.autoid,f.cBusType,f.cCode,'' as cVenName,'' as cVenAbbName,
+	</select>
+	<!-- 根据形态转换物料获取其他入库信息 -->
+	<select id="getOmRowInListWithAV2" resultType="map">
+	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,
@@ -759,8 +758,7 @@
 				)
 
 		)
-		and e.iQuantity>0 and f.cbustype in ('其他入库','转换入库')
-	)) as t1 order by autoid desc
+		and e.iQuantity>0 and f.cbustype in ('其他入库','转换入库') order by e.autoid desc
 	</select>
 	<!-- 获取销售订单附件 -->
 	<select id="getSoAccList" resultType="org.jeecg.modules.report.entity.AccessorItem">

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/service/impl/FabricLossServiceImpl.java

@@ -542,8 +542,12 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 		List<FabricMoOrderCK> rowOutList = fabricLossMapper.getOmRowOutList(code);
 		// 获取委外订单出库物料的入库物料信息:包含采购入库、委外入库、其他入库
 		List<Map<String,Object>> rowInList = fabricLossMapper.getOmRowInList(code);
+		List<Map<String,Object>> rowInList2 = fabricLossMapper.getOmRowInList2(code);
+		rowInList.addAll(rowInList2);
 		// 获取委外订单出库物料的形态转换前入库物料信息:包含采购入库
 		List<Map<String,Object>> rowInListWithAV = fabricLossMapper.getOmRowInListWithAV(code);
+		List<Map<String,Object>> rowInListWithAV2 = fabricLossMapper.getOmRowInListWithAV2(code);
+		rowInListWithAV.addAll(rowInListWithAV2);
 
 		List<FabricMoOrderCK> fabricMoOrderCKList = getFabricMoOrderCKList(rowInfoList, rowOutList, rowInList, rowInListWithAV);