| 
					
				 | 
			
			
				@@ -197,82 +197,9 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /*查询U8数据 面料*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String sqlFabric ="SELECT cInvName as goodsName,sum(yi) as usageQuantity,sum(ying) as planQuantity,sum(gou) as purchaseQuantity," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "processUnit,isnull(sum(gou),0)-isnull(sum(yuu),0) as fabricremainingQuantity,sum(yu) as fabrictransferQuantity FROM (  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                " " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                select sum(r.iQuantity) as yu,r.cBatch ,b.cSource,b.cPOID,sum(b.gou) as gou,sum(b.yi) as yi,sum(b.ying) as ying " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "    ,c.cInvName ,v.cVenName as processUnit ,( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                    SELECT sum(r.iQuantity) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                    FROM UFDATA_903_2021.dbo.rdrecords01 rs1  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          left join UFDATA_903_2021.dbo.rdrecord01 r1 on r1.id=rs1.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          where rs1.cBatch = '"+plannum+"' and rs1.cPOID  like '"+plannum+"%' and " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                     r.cBatch = rs1.cBatch and rs1.cInvCode=r.cInvCode  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "    group by rs1.cInvCode, rs1.cBatch  ) as yuu " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                 FROM UFDATA_903_2021.dbo.rdrecords11  r  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                  JOIN (  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                   SELECT od.MODetailsID,od.cInvCode,om.cVenCode    " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                   FROM UFDATA_903_2021.dbo.OM_MOMain om LEFT JOIN UFDATA_903_2021.dbo.OM_MODetails od ON om.MOID = od.MOID   " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                   WHERE om.iVerifyStateNew = 2 and om.cCode like '"+plannum+"%'  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                   ) o ON r.iOMoDID  = o.MODetailsID   " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                  LEFT JOIN (  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                    SELECT r1.id,r1.cSource,rs1.cBatch,rs1.cInvCode ,rs1.cPOID, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "     rs1.iQuantity as gou,isnull(od.iQuantity,0)+isnull(p.iQuantity,0) as ying,isnull(od.iSendQTY,0)+isnull(p.iQuantity,0) as yi " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                    FROM UFDATA_903_2021.dbo.rdrecords01 rs1  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          left join UFDATA_903_2021.dbo.rdrecord01 r1 on r1.id=rs1.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          left join UFDATA_903_2021.dbo.PO_Podetails p on p.ID=rs1.iPOsID " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          left join UFDATA_903_2021.dbo.OM_MODetails o on o.MODetailsID =rs1.iOMoDID " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          left join UFDATA_903_2021.dbo.OM_MOMaterials od on od.MoDetailsID=o.MODetailsID  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          where rs1.cBatch = '"+plannum+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                    ) b on r.cBatch = b.cBatch and b.cInvCode=r.cInvCode   " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                " " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "      JOIN (SELECT * FROM  UFDATA_903_2021.dbo.Inventory where (cInvCCode like '03%' or cInvCCode like '04%'  )  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "           and cInvCCode != '0399' and cInvCCode != '0499') c on c.cInvCode=r.cInvCode  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                 LEFT JOIN UFDATA_903_2021.dbo.Vendor v ON o.cVenCode= v.cVenCode  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                  GROUP BY c.cInvName,r.cBatch,b.cSource,b.cPOID,v.cVenName ,r.cInvCode " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "         " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "         ) as ta GROUP BY cInvName,processUnit" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                " UNION all " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "SELECT cInvName as goodsName,sum(yi) as usageQuantity,sum(ying) as planQuantity,sum(gou) as purchaseQuantity," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "processUnit,isnull(sum(gou),0)-isnull(sum(yuu),0) as fabricremainingQuantity,sum(yu) as fabrictransferQuantity FROM (  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                " " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                select sum(r.iQuantity) as yu,r.cBatch ,b.cSource,b.cPOID,sum(b.gou) as gou,sum(b.yi) as yi,sum(b.ying) as ying " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "    ,c.cInvName ,v.cVenName as processUnit ,( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                    SELECT sum(r.iQuantity) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                    FROM rdrecords01 rs1  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          left join rdrecord01 r1 on r1.id=rs1.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          where rs1.cBatch = '"+plannum+"' and rs1.cPOID  like '"+plannum+"%' and " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                     r.cBatch = rs1.cBatch and rs1.cInvCode=r.cInvCode  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "    group by rs1.cInvCode, rs1.cBatch  ) as yuu " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                 FROM rdrecords11  r  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                  JOIN (  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                   SELECT od.MODetailsID,od.cInvCode,om.cVenCode    " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                   FROM OM_MOMain om LEFT JOIN OM_MODetails od ON om.MOID = od.MOID   " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                   WHERE om.iVerifyStateNew = 2 and om.cCode like '"+plannum+"%'  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                   ) o ON r.iOMoDID  = o.MODetailsID   " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                  LEFT JOIN (  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                    SELECT r1.id,r1.cSource,rs1.cBatch,rs1.cInvCode ,rs1.cPOID, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "     rs1.iQuantity as gou,isnull(od.iQuantity,0)+isnull(p.iQuantity,0) as ying,isnull(od.iSendQTY,0)+isnull(p.iQuantity,0) as yi " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                    FROM rdrecords01 rs1  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          left join rdrecord01 r1 on r1.id=rs1.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          left join PO_Podetails p on p.ID=rs1.iPOsID " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          left join OM_MODetails o on o.MODetailsID =rs1.iOMoDID " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          left join OM_MOMaterials od on od.MoDetailsID=o.MODetailsID  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "          where rs1.cBatch = '"+plannum+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                    ) b on r.cBatch = b.cBatch and b.cInvCode=r.cInvCode   " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                " " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "      JOIN (SELECT * FROM  Inventory where (cInvCCode like '03%' or cInvCCode like '04%'  )  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "           and cInvCCode != '0399' and cInvCCode != '0499') c on c.cInvCode=r.cInvCode  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                 LEFT JOIN Vendor v ON o.cVenCode= v.cVenCode  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "                  GROUP BY c.cInvName,r.cBatch,b.cSource,b.cPOID,v.cVenName ,r.cInvCode " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "         " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                "         ) as ta GROUP BY cInvName,processUnit" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Map<String, Object>> list1  = senYuDataSourceOne.queryForList(sqlFabric); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<JSONObject> jianSon1 = JsonChangeUtils.toJSONObject(list1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<SyCostAllocationFabric> list3 = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (int i=0;i<jianSon1.size();i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            SyCostAllocationFabric Fabric = JSONObject.toJavaObject(jianSon1.get(i), SyCostAllocationFabric.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<SyCostAllocationFabric> list3 = syCostAllocationFabricMapper.queryByCostFabric(plannum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int i=0;i<list3.size();i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SyCostAllocationFabric Fabric = list3.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             1.转入:从材料出库起手,找到委外订单下使用的出库,然后关联采购排除不是自己买的; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   -- 1.委外订单关联材料出库单,根据计划号查出所有材料出库; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -360,7 +287,6 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Fabric.setFabrictransferQuantity(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Fabric.setTransferCost(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            list3.add(Fabric); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -467,7 +393,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //发运 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<SyCostAllocationShipdetail> Shipdetails = syCostAllocationShipdetailMapper.queryByCostShipdetail(plannum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (int i=0;i<Shipdetails.size();i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             SyCostAllocationShipdetail ship = Shipdetails.get(i); 
			 |