| 
					
				 | 
			
			
				@@ -124,6 +124,14 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				dOutSum = ret.getNumber(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			ret.setOutboundNumber(dOutSum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			// 销售订单附件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<AccessorItem> accessorItemList = fabricLossMapper.getSoAccList(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			accessorItemList.forEach(e->e.setFileurl("/report/FabricLoss/getFile?fileId="+e.getCFileId()+"&filename="+e.getFilename())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			ret.setAccessorItemList(accessorItemList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			// 委外订单附件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<AccessorItem> omAccList = fabricLossMapper.getOmAccList(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			omAccList.forEach(e->e.setFileurl("/report/FabricLoss/getFile?fileId="+e.getCFileId()+"&filename="+e.getFilename())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// 采购入库数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			List<FabricPoOrder> fabricPoOrderListTmp = fabricLossMapper.getPurchaseList(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//采购数据把不同订单合并 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -314,6 +322,11 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// 设置详情及成本 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			fabricOMOrderList1 = setFabricOMOrderOutDetail(fabricOMOrderList1, code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			fabricOMOrderList1 = setFabricOMOrderInDetail(fabricOMOrderList1, code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			// 设置附件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fabricOMOrderList1.forEach(e->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				List<AccessorItem> accessorItemList1 = omAccList.stream().filter(a->a.getCInvId().equals(e.getCInvCode()+e.getCColor())).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				e.setAccessorItemList(accessorItemList1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// 委外订单国内 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			for (FabricOMOrder fabricOMOrder : fabricOMOrderList1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				double dLoss = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -365,15 +378,26 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					newItem.setCVenName(fabricCostInvoice.getCVenName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					newItem.setCVenAbbName(fabricCostInvoice.getCVenAbbName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					newItem.setIUnitCost(fabricCostInvoice.getIUnitCost()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					fabricCostInvoiceList.add(newItem); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				Double money = newItem.getIMoney(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				for (FabricOMOrder omOrder : fabricOMOrderList1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					List<FabricMoOrderCK> ckList = omOrder.getFabricMoOrderCKList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if (ckList != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						List<FabricMoOrderCK> findList1 = ckList.stream().filter(e-> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+								e.getCInvCodeOut().equals(fabricCostInvoice.getCInvCode()) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+										e.getCColorOut().equals(fabricCostInvoice.getCColor())).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						for (FabricMoOrderCK ckItem : findList1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+							money+=ckItem.getIMoney(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				double outSum = fabricOMOrderList1.stream().filter(e-> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-						e.getCVCName().equals(fabricCostInvoice.getCVCName()) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-						e.getCVenAbbName().equals(fabricCostInvoice.getCVenAbbName()) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-						e.getCInvCode().equals(fabricCostInvoice.getCInvCode())).mapToDouble(FabricOMOrder::getIQuantityOut).sum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				outSum *=newItem.getIUnitCost(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				outSum += newItem.getIMoney(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				BigDecimal bdValue = new BigDecimal(money); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				newItem.setIMoney(bdValue.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				newItem.setIMoney(outSum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//获取委外订单发票金额 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -393,8 +417,10 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if (fabricCostInvoiceListTmp.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				fabricCostInvoiceListOrder.addAll(fabricCostInvoiceListTmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			fabricCostInvoiceListTmp = fabricCostInvoiceList.stream().filter(e->e.getCVCName().indexOf("织")!=0&&e.getCVCName().indexOf("染")!=0&&e.getCVCName().indexOf("印")!=0).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if (fabricOMOrderListTmp.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fabricCostInvoiceListTmp = fabricCostInvoiceList.stream().filter(e-> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				return fabricCostInvoiceListOrder.stream().filter(x->x.getCVCName().equals(e.getCVCName())).count()==0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (fabricCostInvoiceListTmp.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				fabricCostInvoiceListOrder.addAll(fabricCostInvoiceListTmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			fabricCostInvoiceList = fabricCostInvoiceListOrder; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -699,7 +725,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// 根据委外订单子表id,找到入库物料 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			findInCanSetList = findInCanSetList.stream().filter(in->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				return findOutCanSetList.stream().filter(out-> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-						oConvertUtils.getInt(in.get("MODetailsID")).equals(out.getMODetailsID())).count()>0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						out.getMODetailsID() == oConvertUtils.getInt(in.get("MODetailsID"),0)).count()>0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// 设置入库单金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			for (Map<String,Object> item : findInCanSetList){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -897,4 +923,14 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return ret; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	// 根据文件id,获取文件内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public byte[] getFileContent(String fileId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<Map<String,Object>> fileContentList = fabricLossMapper.getAccDetail(fileId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (fileContentList.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return (byte[])fileContentList.get(0).get("FileContent"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |