sql="update equipment_sparepart es , equipment_out eo , equipment_out_child eoc set es.storage_num = (es.storage_num + eoc.out_num) where eo.id = eoc.out_id and es.supplies_id = eoc.sparepart_id and es.supplies_warehouse_id = eo.supplies_warehouse_id";
sql+=" and eo.id = '"+materialIN.getEquipmentOutId()+"'";
sql="update equipment_sparepart es , equipment_in ei , equipment_in_child eic set es.storage_num = (es.storage_num - eic.in_num) where ei.id = eic.in_id and es.supplies_id = eic.sparepart_id and es.supplies_warehouse_id = ei.supplies_warehouse_id";
sql+=" and ei.id = '"+materialIN.getEquipmentInId()+"'";
" left join (select danger_id ,GROUP_CONCAT(inspect_name SEPARATOR '@') 'inspect_content' from danger_inspect_info group by danger_id)aaa on aaa.danger_id = t.id "+
" left join (select danger_id, count(id) 'inspection_num' from danger_inspection_record "+
" where DATE_FORMAT(report_date,'%Y-%m-%d') >= #{startTime} and DATE_FORMAT(report_date,'%Y-%m-%d') <= #{endTime} "+
" group by danger_id)bbb on bbb.danger_id = t.id "+
" left join (select danger_id, count(id) 'rectification_num' from ajh_rectification_info"+
" left join (select eee.danger_id ,count(eee.record_id) 'rectification_num' from ( select DISTINCT t.id 'record_id' ,t1.danger_id from danger_inspection_record t"+
" left join danger_inspection_info t1 on t.id= t1.inspection_record_id left join danger_inspection_item t2 on t1.id = t2.inspection_info_id "+
" where t2.status = 0 and DATE_FORMAT(t.report_date,'%Y-%m-%d') >= #{startTime} and DATE_FORMAT(t.report_date,'%Y-%m-%d') <= #{endTime} "+
" )eee group by eee.danger_id "+
" )bbb on bbb.danger_id = t.id "+
" left join (select danger_id, count(id) 'inspection_num' from ajh_rectification_info"+
" where DATE_FORMAT(rec_ord_report_date,'%Y-%m-%d') >= #{startTime} and DATE_FORMAT(rec_ord_report_date,'%Y-%m-%d') <= #{endTime} "+
" group by danger_id)ccc on ccc.danger_id = t.id ${ew.customSqlSegment}")
@@ -129,17 +129,30 @@ public class EquipmentInfoMonthReportController {
sql="select round(ifnull(sum(total_cost),0)/10000,2) 'repair_cost' from equipment_repair where reality_maintenance_end_time >= '"+startDate+" 00:00:00' and reality_maintenance_end_time <='"+endDate+" 23:59:59'";
sql=" select count(1) 'count' from ( select emp.maintenance_type , emt.results_enforcement from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
sql+=" where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.results_enforcement >2 and aaa.maintenance_type = 'dxjg' ";
sql=" select count(1) 'count' from (select emp.maintenance_type , emt.results_enforcement from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
sql+=" where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.results_enforcement >2 and aaa.maintenance_type = 'dxjg'";
sql+=" WHERE er.del_flag = 1 and er.create_time >= '"+startDate+"' and er.create_time <= '"+endDate+"' group by er.depart_id ) aaa on aaa.depart_id = d.id";
...
...
@@ -166,7 +179,7 @@ public class EquipmentInfoMonthReportController {
Stringsql="select d.id depart_id , d.depart_name , ifnull(aaa.plan_name,'') 'plan_name' , round( ifnull(aaa.plan_cost,0), 2) 'plan_cost', round(ifnull(bbb.maintenance_cost,0),2) 'maintenance_cost' from sys_depart d ";
Stringsql="select d.id depart_id , d.depart_name , ifnull(aaa.plan_name,'') 'plan_name' , round( ifnull(aaa.plan_cost,0), 2) 'plan_cost', round(ifnull(bbb.maintenance_cost,0),2) 'maintenance_cost' ,'' as 'reason' from sys_depart d ";
sql+=" left join (select depart_id, GROUP_CONCAT(plan_name,',') 'plan_name' ,(sum(ifnull(plan_cost,0))/10000) 'plan_cost' from equipment_maintain_plan where maintenance_type = 'dxjg' and release_status='1' and start_time >= '"+startDate+" 00:00:00' and end_time <='"+endDate+" 23:59:59' group by depart_id )aaa on aaa.depart_id = d.id ";
sql+=" left join ( select emt.depart_id, sum(ifnull(maintenance_cost,0)) maintenance_cost from equipment_maintain_task emt ,equipment_maintain_plan emp where emt.plan_id = emp.id and emp.maintenance_type = 'dxjg' and emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' group by emt.depart_id )bbb on bbb.depart_id = d.id ";
sql+=" where d.depart_type = 1 ";
...
...
@@ -177,9 +190,9 @@ public class EquipmentInfoMonthReportController {
sql+=" left join (select er.id 'info_id', er.depart_id , ei.equipment_name , GROUP_CONCAT(er.fault_content) fault_content , GROUP_CONCAT( er.fault_library_id) fault_library_id from equipment_repair er , equipment_info ei ";
sql+=" where er.info_id = ei.id and and ei.equipment_level = '6bf727eb7e7cca6a95c694dab0036b2c' and repair_date >= '"+startDate+" 00:00:00' and repair_date <='"+endDate+" 23:59:59' ";
sql+=" where er.info_id = ei.id and ei.equipment_level = '6bf727eb7e7cca6a95c694dab0036b2c' and repair_date >= '"+startDate+" 00:00:00' and repair_date <='"+endDate+" 23:59:59' ";
sql+=" group by er.depart_id ,er.info_id )aaa on aaa.depart_id = d.id ";