浏览代码

面料损耗委外出库按照物料数量排序,扣减的入库按照金额排序

fenghaifu 9 月之前
父节点
当前提交
0a0218a3b5

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

@@ -947,6 +947,8 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 			poOrderInList.addAll(order.getFabricPoOrderInList());
 		}
 		poOrderInList.forEach(e->e.setITempUseSum(0.0));
+
+
 		// 获取材料出库
 		// 获取委外订单行id,出库物料信息,出库数量
 		List<FabricMoOrderCK> rowOutList = fabricLossMapper.getOmRowOutList(code);
@@ -1052,12 +1054,16 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 		otherInList1.addAll(otherInList.stream().filter(e->oConvertUtils.getString(e.getCPlanCode()).indexOf(code)==-1).collect(Collectors.toList()));
 		otherInList = otherInList1;
 
+
 		// 设置非本次委外加工出入库成本
 		List<FabricMoOrderCK> findOutList = rowOutList.stream().filter(e->e.getIQuantityOut()!=0).collect(Collectors.toList());
+		findOutList.sort(Comparator.comparing(FabricMoOrderCK::getCInvCCodeOut).thenComparing(FabricMoOrderCK::getIQuantityOut));
 		List<FabricMoOrderCK> calCkList = new ArrayList<>();
 		for (FabricMoOrderCK outItem : findOutList){
 			// 先设置本次采购入库的
 			List<FabricPoOrderIn> findPoInList = poOrderInList.stream().filter(e->e.getInvId().equalsIgnoreCase(outItem.getInvOutId())&&DoubleOperation.sub(e.getIQuantity(),e.getITempUseSum())>0).collect(Collectors.toList());
+			findPoInList.sort(Comparator.comparing(FabricPoOrderIn::getIPrice));
+
 			for (FabricPoOrderIn inItem : findPoInList){
 				FabricMoOrderCK calItem = outItem.getByPoIn(editOmList, inItem);
 				calCkList.add(calItem);
@@ -1070,6 +1076,8 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 			}
 			// 设置非本次委外和其他入库的
 			List<FabricCommonIn> findOtherInList = otherInList.stream().filter(e->e.getInvId().equalsIgnoreCase(outItem.getInvOutId())&&DoubleOperation.sub(e.getIQuantity(),e.getITempUseSum())>0).collect(Collectors.toList());
+			findOtherInList.sort(Comparator.comparing(FabricCommonIn::getIPrice));
+
 			for (FabricCommonIn inItem : findOtherInList){
 				FabricMoOrderCK calItem = outItem.getByCommonIn(editOmList, inItem);
 				calCkList.add(calItem);