Browse Source

成本报表 事故单

liuchaohui 2 years ago
parent
commit
750926e445

+ 37 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java

@@ -763,7 +763,43 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         if(syCostAllocation.getActualShipquantity()!=null && syCostAllocation.getPlanQuantity()!=null){
             syCostAllocation.setShortseveral(syCostAllocation.getPlanQuantity().subtract(syCostAllocation.getActualShipquantity()));
         }
-
+        
+        //事故单
+        String sqlAccidentSheet = 
+                "SELECT ah.cPBVCode as accidentNum,VEN.cVenAbbName as accidentUndertaker,sum(A.iOriSum) as amount " +
+                        "  from UFDATA_901_2021.dbo.PurBillVouchs a " +
+                        "  left join UFDATA_901_2021.dbo.PurBillVouch ah on ah.pbvid=a.pbvid " +
+                        "  left join UFDATA_901_2021.dbo.Inventory inv on inv.cInvCode=a.cInvCode " +
+                        "  left join UFDATA_901_2021.dbo.Vendor ven on ven.cVenCode=ah.cvencode " +
+                        "  where cPBVBillType='03' " +
+                        "   and inv.cInvName='事故单'  and ah.cDefine2 like CONCAT('"+plannum+"','%') " +
+                        "  group by ah.cPBVCode,VEN.cVenAbbName,ah.cDefine2 " +
+                        "  union all " +
+                "SELECT ah.cPBVCode as accidentNum,VEN.cVenAbbName as accidentUndertaker,sum(A.iOriSum) as amount " +
+                        "  from UFDATA_902_2021.dbo.PurBillVouchs a " +
+                        "  left join UFDATA_902_2021.dbo.PurBillVouch ah on ah.pbvid=a.pbvid " +
+                        "  left join UFDATA_902_2021.dbo.Inventory inv on inv.cInvCode=a.cInvCode " +
+                        "  left join UFDATA_902_2021.dbo.Vendor ven on ven.cVenCode=ah.cvencode " +
+                        "  where cPBVBillType='03' " +
+                        "   and inv.cInvName='事故单'  and ah.cDefine2 like CONCAT('"+plannum+"','%') " +
+                        "  group by ah.cPBVCode,VEN.cVenAbbName,ah.cDefine2 " +
+                        "  union all " +
+                "SELECT ah.cPBVCode as accidentNum,VEN.cVenAbbName as accidentUndertaker,sum(A.iOriSum) as amount " +
+                        "  from UFDATA_903_2021.dbo.PurBillVouchs a " +
+                        "  left join UFDATA_903_2021.dbo.PurBillVouch ah on ah.pbvid=a.pbvid " +
+                        "  left join UFDATA_903_2021.dbo.Inventory inv on inv.cInvCode=a.cInvCode " +
+                        "  left join UFDATA_903_2021.dbo.Vendor ven on ven.cVenCode=ah.cvencode " +
+                        "  where cPBVBillType='03' " +
+                        "   and inv.cInvName='事故单'  and ah.cDefine2 like CONCAT('"+plannum+"','%') " +
+                        "  group by ah.cPBVCode,VEN.cVenAbbName,ah.cDefine2";
+        List<Map<String, Object>> accidentSheetList  = senYuDataSourceOne.queryForList(sqlAccidentSheet);
+        List<JSONObject> accidentSheet = JsonChangeUtils.toJSONObject(accidentSheetList);
+        List<SyCostAllocationAccident> syCostAllocationAccident = new ArrayList<>();
+        for (int i=0;i<accidentSheet.size();i++) {
+            SyCostAllocationAccident syCostAllocationCostpay = JSONObject.toJavaObject(accidentSheet.get(i), SyCostAllocationAccident.class);
+            syCostAllocationAccident.add(syCostAllocationCostpay);
+        }
+        syCostAllocation.setSyCostAllocationAccidentList(syCostAllocationAccident);
 
         //费用支出
         String sqlCostpay = "SELECT 901 as setNo, " +