Browse Source

委外出入库为空死循环bug调整

fenghaifu 2 years ago
parent
commit
cfa6da0a9d

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/controller/FabricLossController.java

@@ -72,6 +72,7 @@ public class FabricLossController {
 	public Result<FabricLoss> getFabricLossDatas(@RequestParam(name="csocode",required=true) String csocode,
 	                                             @RequestParam(name="update",required=true) int update) {
 		SyFabricLossReport syFabricLossReport = null;
+		csocode = csocode.trim();
 
 		QueryWrapper<SyFabricLossReport> queryWrapper = new QueryWrapper<>();
 		queryWrapper.eq("plan_code", csocode);

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

@@ -34,20 +34,20 @@ public interface FabricLossMapper extends BaseMapper<FabricLoss> {
 	List<String>getPlanner(@Param("code")String code);
 
 	//查询103的委外发票制单人=制单人
-	@DS("multi-three")
-	List<String>getMakingPeople(@Param("code")String code);
+//	@DS("multi-three")
+//	List<String>getMakingPeople(@Param("code")String code);
 
 	//查询103委外订单数量=排单量
 	@DS("multi-three")
 	String getNumber(@Param("code")String code);
 
 	//查询103委外订单 单价成本
-	@DS("multi-three")
-	String getPrice(@Param("code")String code);
+//	@DS("multi-three")
+//	String getPrice(@Param("code")String code);
 
 	//查询102采购订单号(只获取供应商为马菲羊的)
-	@DS("multi-two")
-	String getOrderCode(@Param("code")String code);
+//	@DS("multi-two")
+//	String getOrderCode(@Param("code")String code);
 
 	//查询销售出库数量
 	@DS("multi-three")
@@ -71,11 +71,11 @@ public interface FabricLossMapper extends BaseMapper<FabricLoss> {
 	@DS("multi-three")
 	List<String> getOmOrderListGw(@Param("code")String code);
 	// 获取委外材料出库单,已核销的取核销数量
-	@DS("multi-three")
-	List<Map<String,Object>> getOmOutList(@Param("code")String code);
+//	@DS("multi-three")
+//	List<Map<String,Object>> getOmOutList(@Param("code")String code);
 	// 获取本次采购入库的形态转换
-	@DS("multi-three")
-	List<Map<String,Object>> getAssemVouchList(@Param("code")String code);
+//	@DS("multi-three")
+//	List<Map<String,Object>> getAssemVouchList(@Param("code")String code);
 	// 获取本次采购入库单,含发票和结算数据
 	@DS("multi-three")
 	List<FabricPoOrderIn> getPurchaseInList(@Param("code")String code);
@@ -101,8 +101,8 @@ public interface FabricLossMapper extends BaseMapper<FabricLoss> {
 	@DS("multi-three")
 	List<FabricCostCloth> getCostClothList(@Param("code")String code);
 	//获取委外入库物料被其他委外订单使用的金额
-	@DS("multi-three")
-	String getOmInToOtherMoney(@Param("code")String code);
+//	@DS("multi-three")
+//	String getOmInToOtherMoney(@Param("code")String code);
 	//获取使用其他委外入库物料的金额
 	//@DS("multi-three")
 	//String getOmOtherToCurMoney(@Param("code")String code);
@@ -116,23 +116,23 @@ public interface FabricLossMapper extends BaseMapper<FabricLoss> {
 	@DS("multi-three")
 	List<FabricMoOrderRK> getOmInDetailList(@Param("code")String code);
 	// 获取委外订单行id,入库物料编号+颜色,处理费用,入库数量
-	@DS("multi-three")
-	List<Map<String,Object>> getOmRowInfoList(@Param("code")String code);
+//	@DS("multi-three")
+//	List<Map<String,Object>> getOmRowInfoList(@Param("code")String code);
 	// 获取委外订单行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>> getOmRowInList(@Param("code")String code);
 	// 获取委外订单出库物料的入库物料信息:包含其他入库
-	@DS("multi-three")
-	List<Map<String,Object>> getOmRowInList2(@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>> getOmRowInListWithAV(@Param("code")String code);
 	// 根据形态转换物料获取其他入库信息
-	@DS("multi-three")
-	List<Map<String,Object>> getOmRowInListWithAV2(@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 - 20
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/mapper/xml/FabricLossMapper.xml

@@ -15,9 +15,9 @@
 		and
 		exists (select x.cVenCode from Vendor x where x.cVenCode=om_momain.cVenCode and x.cVCCode='0105')
 		and cCode like CONCAT(#{code},'%')
-		and (cCloser is null or cCloser='asuser')
 	</select>
 	<!-- 制单人 103的委外发票制单人 -->
+	<!--
 	<select id="getMakingPeople" resultType="java.lang.String">
 		select distinct cpbvmaker From PurBillVouch where cInCode in (
 		select cCode From  RdRecord01 where cOrderCode in (
@@ -29,7 +29,7 @@
 			and (cCloser is null or cCloser='asuser')
 		)
 		)
-	</select>
+	</select>-->
 	<!-- 排单数量 -->
 	<select id="getNumber" resultType="java.lang.String">
 		select sum(isnull(iQuantity,0))as 'iQuantity'  from VIEW_OM_MOMain_ALL_Clothes
@@ -40,6 +40,7 @@
 		select isnull(sum(iQuantity),0) as 'iQuantity' from VIEW_FabricLoss_Head_Clothes_SaleOut_Sum where
 		cCode like CONCAT(#{code},'%')
 	</select>
+	<!--
 	<select id="getPrice" resultType="java.lang.String">
 		select isnull(sum(a.count)/sum(b.iquantity),0) as 'price' from (
 		select sum((isnull(c.iQuantity,0)*isnull(b.iunitcost,0))+(isnull(c.iQuantity,0)*isnull(b.iprocesscost,0))) as 'count' ,a.cordercode as 'cordercode'     from rdrecord01 a left join rdrecords01 b on a.id=b.id
@@ -53,14 +54,15 @@
 		and	b.csoordercode=#{code}
 		</if>
 		GROUP BY b.csoordercode
-	</select>
+	</select>-->
+	<!--
 	<select id="getOrderCode" resultType="java.lang.String">
 		select distinct a.cpoid as 'cpoid' from PO_Pomain a left join PO_Podetails b on a.POID=b.POID
 		where a.cVenCode='T020001'
 		<if test="code!=null and ''!=code">
 			and b.csoordercode=#{code}
 		</if>
-	</select>
+	</select>-->
 
 	<!--获取采购订单,物料名为物料名+颜色-->
 	<select id="getPurchaseList" resultType="org.jeecg.modules.report.entity.FabricPoOrder">
@@ -287,7 +289,7 @@
 	</select>-->
 	<!--获取所有委外订单 cComUnitCode : 计量单位,02(PCS)根,04(M)米-->
 	<select id="getOmOrderListAll" resultType="org.jeecg.modules.report.entity.FabricOMOrder">
-
+		select * from (
 			SELECT b.MODetailsID,e.cVCName,d.cVenName ,d.cVenAbbName ,a.cVenCode ,c.cInvCode,c.cInvName,c.cComUnitCode,
 				isnull(b.cFree1,'') as cColor,
 				isnull((select sum(iQuantity) from rdrecords11 x where x.iOMoDID=b.MODetailsID),0) as iQuantityOut,
@@ -302,7 +304,8 @@
 			WHERE
 				c.cInvCCode NOT LIKE '19%'
 				AND a.cCode LIKE CONCAT(#{code},'%')
-			order by e.cVCName,d.cVenName,c.cInvCode,c.cInvName,c.cComUnitCode,b.cFree1,b.cdefine30
+		) as t1 where (iQuantityOut>0 or iQuantityIn>0)
+		order by cVCName,cVenName,cInvCode,cInvName,cComUnitCode,cColor,cColorNumber
 
 	</select>
 	<!--获取销售出库委外订单行id-->
@@ -324,6 +327,7 @@
 
 	</select>
 	<!--获取本次采购入库的委外材料出库单,已核销的取核销数量-->
+	<!--
 	<select id="getOmOutList" resultType="map">
 		SELECT
 			g.cVenName,
@@ -364,8 +368,9 @@
 				)
 			)
 
-	</select>
+	</select>-->
 	<!--获取本次采购入库的形态转换-->
+	<!--
 	<select id="getAssemVouchList" resultType="map">
 
 		select * from VIEW_FabricLoss_AssemVouchs where
@@ -376,7 +381,7 @@
 			and a.cPOID like CONCAT(#{code},'%')
 			)
 		)
-	</select>
+	</select>-->
 	<!--获取本次采购入库单,含发票和结算数据-->
 	<select id="getPurchaseInList" resultType="org.jeecg.modules.report.entity.FabricPoOrderIn">
 		select a.cCode,a.cBusType,b.cInvCode,isnull(b.cFree1,'') as cColor,isnull(b.cBatch,'') as cBatch,b.iQuantity,e.cInvName,
@@ -474,7 +479,7 @@
 		order by cVenName,cSBVCode,cInvName
 	</select>
 	<!--获取委外入库物料被其他委外订单使用的金额 -->
-
+	<!--
 	<select id="getOmInToOtherMoney" resultType="java.lang.String">
 		select isnull(sum(b.iprice),0) as iPrice from rdrecords11 b
 		inner join OM_MODetails c on b.iOMoDID=c.MODetailsID
@@ -498,7 +503,7 @@
 		)
 		)
 		and d.ccode not like CONCAT(#{code},'%')
-	</select>
+	</select>-->
 	<!--获取使用其他委外入库物料的金额 -->
 	<!--
 	<select id="getOmOtherToCurMoney" resultType="java.lang.String">
@@ -643,6 +648,7 @@
 
 	</select>-->
 	<!-- 获取委外订单行id,入库物料编号+颜色,处理费用,入库数量 -->
+	<!--
 	<select id="getOmRowInfoList" resultType="map">
 		select b.MODetailsID,
 			 b.cinvcode+isnull(b.cfree1,'') as cInvCodeColorIn,
@@ -656,8 +662,7 @@
 		WHERE
 		c.cInvCCode NOT LIKE '19%'
 		AND a.cCode LIKE CONCAT(#{code},'%')
-		<!--and exists (select * from  rdrecords01 x where x.iOMoDID=b.MODetailsID)-->
-	</select>
+	</select>-->
 	<!-- 获取委外订单行id,出库物料信息,出库数量 -->
 	<select id="getOmRowOutList" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
 		select b.MODetailsID,
@@ -680,6 +685,7 @@
 			 having sum(d.iQuantity)>0
 	</select>
 	<!-- 获取委外订单出库物料的入库物料信息:包含采购入库、委外入库 -->
+	<!--
 	<select id="getOmRowInList" resultType="map">
 
 			select f.cBusType,f.cCode,g.cVenName,g.cVenAbbName,
@@ -708,8 +714,9 @@
 					AND a.cCode like CONCAT(#{code},'%')
 
 				) and e.iQuantity>0
-	</select>
+	</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,
@@ -734,8 +741,9 @@
 
 
 		)  and e.iQuantity>0 order by e.autoid desc
-	</select>
+	</select>-->
 	<!-- 根据形态转换物料获取采购入库 -->
+	<!--
 	<select id="getOmRowInListWithAV" resultType="map">
 
 	select e.autoid,f.cBusType,f.cCode,g.cVenName,g.cVenAbbName,
@@ -782,8 +790,9 @@
 
 		)
 		and e.iQuantity>0
-	</select>
+	</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,
@@ -823,7 +832,7 @@
 
 		)
 		and e.iQuantity>0 and f.cbustype in ('其他入库','转换入库') order by e.autoid desc
-	</select>
+	</select>-->
 	<!-- 获取销售订单附件 -->
 	<select id="getSoAccList" resultType="org.jeecg.modules.report.entity.AccessorItem">
 		select distinct cFileId,Filename from VIEW_ACC_LIST_SO where cSoCode=#{cSoCode}
@@ -1017,7 +1026,7 @@
 		select b.cinvcode+isnull(b.cfree1,'')+isnull(b.cbatch,'') from RdRecords01 b
 		INNER JOIN OM_MODetails e on b.iOMoDID=e.MODetailsID
 		inner join om_momain f on f.moid = e.moid
-		where f.cCode like CONCAT(#{code},'%') and (f.cCloser is null or f.cCloser='asuser')
+		where f.cCode like CONCAT(#{code},'%')
 		)
 		or cInvCode+isnull(cFree1,'')+isnull(cbatch,'') in (
 		select cInvCode2+isnull(cColor2,'')+isnull(cAVBatch2,'') from VIEW_FabricLoss_AssemVouchs where
@@ -1025,7 +1034,7 @@
 		select b.cinvcode+isnull(b.cfree1,'')+isnull(b.cbatch,'') from RdRecords01 b
 		INNER JOIN OM_MODetails e on b.iOMoDID=e.MODetailsID
 		inner join om_momain f on f.moid = e.moid
-		where f.cCode like CONCAT(#{code},'%') and (f.cCloser is null or f.cCloser='asuser')
+		where f.cCode like CONCAT(#{code},'%')
 		)
 		)
 		)
@@ -1044,7 +1053,7 @@
 				inner join OM_MODetails p on o.moid  =p.moid
 				inner join Inventory q on p.cInvCode=q.cInvCode
 				inner join RdRecords01 r on r.iOMoDID=p.MODetailsID
-				where o.cCode like CONCAT(#{code},'%') and (o.cCloser is null or o.cCloser='asuser')
+				where o.cCode like CONCAT(#{code},'%')
 		)
 	</select>
 	<!--获取本次委外入库的形态转换-->
@@ -1055,7 +1064,7 @@
 			select cInvCode+isnull(cBatch,'')+isnull(cFree1,'')  from RdRecords01
 			where iOMoDID in (
 			select b.MODetailsID from om_momain a inner join OM_MODetails b on a.moid  =b.moid
-			and a.cCode like CONCAT(#{code},'%') and (a.cCloser is null or a.cCloser='asuser')
+			and a.cCode like CONCAT(#{code},'%')
 			)
 		)
 	</select>

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

@@ -1968,7 +1968,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 					omOrder.setFabricMoOrderCKList(new ArrayList<>());
 				}
 				// 已经设置过的忽略
-				if (oConvertUtils.listIsNotEmpty(omOrder.getFabricMoOrderCKList())){
+				if (omOrder.getFabricMoOrderCKList() != null){
 					break;
 				}
 				// 不存在未算成本的出库单
@@ -2014,6 +2014,15 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 
 		}while(bFind);
 
+		for (FabricOMOrder omOrder : omOrderList){
+			if (omOrder.getFabricMoOrderCKList() == null){
+				omOrder.setFabricMoOrderCKList(new ArrayList<>());
+			}
+			if (omOrder.getFabricMoOrderRKList() == null){
+				omOrder.setFabricMoOrderRKList(new ArrayList<>());
+			}
+		}
+
 	}
 
 	/**