Commit 53c1411c authored by wuzhilong's avatar wuzhilong

库房生产量报表

parent d5decbf2
...@@ -1610,21 +1610,54 @@ public interface TaskListMapper { ...@@ -1610,21 +1610,54 @@ public interface TaskListMapper {
@Delete("delete task where task_id = ${taskId}") @Delete("delete task where task_id = ${taskId}")
public boolean deleteTaskByTaskId(@Param("taskId")long taskId); public boolean deleteTaskByTaskId(@Param("taskId")long taskId);
@Select("select a.card_type,a.finish_date,sum(a.valid_count) valid_count,sum(decode(a.failed_count,null,0,a.failed_count)) failed_count from (\n" + @Select("select * from (\n" +
" select task.TASK_ID,card_type,to_char(punching_date,'yyyyMMdd') finish_date ,FAILED_CARD.failed_count,\n" + " select \n" +
" sum(decode(group_no.VALID_COUNT,null,1,group_no.VALID_COUNT-group_no.SPECIAL_CARD_COUNT)) valid_count\n" + " a.finish_date,\n" +
" from task \n" + " sum(decode(card_type,5,a.valid_count)) \"ga\",\n" +
" left join group_no on task.TASK_ID = group_no.TASK_ID\n" + " sum(decode(card_type,7,a.valid_count)) \"tw\",\n" +
" left join SPECIAL_CARD on task.TASK_ID = SPECIAL_CARD.TASK_ID\n" + " sum(decode(card_type,8,a.valid_count)) \"yd\",\n" +
" left join (select TASK_ID,count(FAILED_CARD.accept_no) failed_count \n" + " sum(decode(card_type,9,a.valid_count)) \"yj\"\n" +
" from FAILED_CARD \n" + " from \n" +
" group by TASK_ID\n" + " ( select task.TASK_ID,card_type,to_char(punching_date,'yyyyMMdd') finish_date,\n" +
" ) FAILED_CARD on FAILED_CARD.TASK_ID = task.TASK_ID\n" + " sum(decode(group_no.VALID_COUNT,null,1,group_no.VALID_COUNT-group_no.SPECIAL_CARD_COUNT)) valid_count\n" +
" where to_char(punching_date,'yyyyMMdd') BETWEEN #{startDate} and #{endDate} \n" + " from task \n" +
" group by task.TASK_ID, card_type, to_char(punching_date,'yyyyMMdd'), FAILED_CARD.failed_count\n" + " left join group_no on task.TASK_ID = group_no.TASK_ID\n" +
" ) a group by a.card_type, a.finish_date") " left join SPECIAL_CARD on task.TASK_ID = SPECIAL_CARD.TASK_ID \n" +
" where to_char(punching_date,'yyyyMMdd') BETWEEN #{startDate} and #{endDate}\n" +
" group by task.TASK_ID, card_type, to_char(punching_date,'yyyyMMdd') ) a\n" +
" group by a.finish_date ) a\n" +
" left join (\n" +
" select to_char(punching_date,'yyyyMMdd') finish_date,\n" +
" count(decode(card_type,5,card_type)) \"gaf\",\n" +
" count(decode(card_type,7,card_type)) \"twf\",\n" +
" count(decode(card_type,8,card_type)) \"ydf\",\n" +
" count(decode(card_type,9,card_type)) \"yjf\"\n" +
" from task\n" +
"left join (\n" +
" select TASK_ID,count(FAILED_CARD.accept_no) failed_count\n" +
" from FAILED_CARD group by TASK_ID\n" +
" ) FAILED_CARD on FAILED_CARD.TASK_ID = task.TASK_ID \n" +
" where to_char(punching_date,'yyyyMMdd') BETWEEN #{startDate} and #{endDate}\n" +
" group by to_char(punching_date,'yyyyMMdd')\n" +
" ) b\n" +
" on a.finish_date=b.finish_date\n" +
" left join (\n" +
" select to_char(FINISH_DATE,'yyyyMMdd') finish_date,\n" +
" count(decode(card_type,5,card_type)) \"gab\",\n" +
" count(decode(card_type,7,card_type)) \"twb\",\n" +
" count(decode(card_type,8,card_type)) \"ydb\",\n" +
" count(decode(card_type,9,card_type)) \"yjb\"\n" +
" from FAILED_CARD \n" +
" left join task\n" +
" on task.TASK_ID=FAILED_CARD.TASK_ID\n" +
" where to_char(FINISH_DATE,'yyyyMMdd') \n" +
" BETWEEN #{startDate} and #{endDate} \n" +
" group by to_char(FINISH_DATE,'yyyyMMdd') ) c\n" +
" on a.finish_date=c.finish_date" +
" order by a.finish_date")
public List<Map<String, Object>> selectQualityCheckReport(@Param("startDate")String startDate,@Param("endDate") String endDate); public List<Map<String, Object>> selectQualityCheckReport(@Param("startDate")String startDate,@Param("endDate") String endDate);
@Select("select to_char(FINISH_DATE,'yyyyMMdd')FINISH_DATE,count(FAILED_CARD.accept_no) failed_count \n" + @Select("select to_char(FINISH_DATE,'yyyyMMdd')FINISH_DATE,count(FAILED_CARD.accept_no) failed_count \n" +
"from FAILED_CARD \n" + "from FAILED_CARD \n" +
"where to_char(FINISH_DATE,'yyyyMMdd') BETWEEN #{startDate} and #{endDate} \n" + "where to_char(FINISH_DATE,'yyyyMMdd') BETWEEN #{startDate} and #{endDate} \n" +
......
...@@ -13,10 +13,7 @@ import org.springframework.stereotype.Service; ...@@ -13,10 +13,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Service @Service
public class TaskListServiceImpl implements TaskListService { public class TaskListServiceImpl implements TaskListService {
...@@ -1253,72 +1250,37 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -1253,72 +1250,37 @@ public class TaskListServiceImpl implements TaskListService {
@Override @Override
public List<Map<String, Object>> selectQualityCheckReport(String startDate, String endDate) { public List<Map<String, Object>> selectQualityCheckReport(String startDate, String endDate) {
List<Map<String, Object>> mapList = taskListMapper.selectQualityCheckReport(startDate, endDate); List<Map<String, Object>> mapList = taskListMapper.selectQualityCheckReport(startDate, endDate);
List<Map<String, Object>> maps = taskListMapper.selectQualityCheckReportBu(startDate, endDate); int[] type_count=new int[12];
Map<String,Object> dateMap = new LinkedHashMap<>(); Map<String, Object> countMap = new LinkedHashMap<>();
Map<String,Object> stringObjectMap = new LinkedHashMap<>(); for (Map<String,Object> map :mapList) {
stringObjectMap.put("VALID_COUNT",0); type_count[0] =type_count[0]+(map.get("ga")==null?0:Integer.valueOf(map.get("ga")+""));
stringObjectMap.put("FAILED_COUNT",0); type_count[1] =type_count[1]+(map.get("gaf")==null?0:Integer.valueOf(map.get("gaf")+""));
int count =0; type_count[2] =type_count[2]+(map.get("gab")==null?0:Integer.valueOf(map.get("gab")+""));
int failedCount =0; type_count[3] =type_count[3]+(map.get("tw")==null?0:Integer.valueOf(map.get("tw")+""));
int buCount =0; type_count[4] =type_count[4]+(map.get("twf")==null?0:Integer.valueOf(map.get("twf")+""));
type_count[5] =type_count[5]+(map.get("twb")==null?0:Integer.valueOf(map.get("twb")+""));
for (Map<String,Object> map :mapList){ type_count[6] =type_count[6]+(map.get("yd")==null?0:Integer.valueOf(map.get("yd")+""));;
count+=Integer.valueOf(map.get("VALID_COUNT")+""); type_count[7] =type_count[7]+(map.get("ydf")==null?0:Integer.valueOf(map.get("ydf")+"")); ;
failedCount+=Integer.valueOf(map.get("FAILED_COUNT")+""); type_count[8] =type_count[8]+(map.get("ydb")==null?0:Integer.valueOf(map.get("ydb")+"")); ;
if (dateMap.containsKey(map.get("FINISH_DATE").toString())){ type_count[9] =type_count[9]+(map.get("yj")==null?0:Integer.valueOf(map.get("yj")+""));;
Map<String,Object> objectMap =(Map<String, Object>)dateMap.get(map.get("FINISH_DATE").toString()); type_count[10] =type_count[10]+(map.get("yjf")==null?0:Integer.valueOf(map.get("yjf")+"")); ;
objectMap.put(map.get("CARD_TYPE").toString(),map); type_count[11] =type_count[11]+(map.get("yjb")==null?0:Integer.valueOf(map.get("yjb")+"")); ;
dateMap.put(map.get("FINISH_DATE").toString(),objectMap);
}else {
Map<String,Object> objectMap = new LinkedHashMap<>();
objectMap.put("0",stringObjectMap);
objectMap.put("1",stringObjectMap);
objectMap.put("2",stringObjectMap);
objectMap.put("5",stringObjectMap);
objectMap.put("6",stringObjectMap);
objectMap.put("7",stringObjectMap);
objectMap.put("8",stringObjectMap);
objectMap.put("9",stringObjectMap);
objectMap.put("bu",stringObjectMap);
objectMap.put(map.get("CARD_TYPE").toString(),map);
dateMap.put(map.get("FINISH_DATE").toString(),objectMap);
}
}
for (Map<String,Object> map :maps){
buCount+=Integer.valueOf(map.get("FAILED_COUNT")+"");
} }
for (String date :dateMap.keySet()){ countMap.put("ga",type_count[0]);
countMap.put("gaf",type_count[1]);
for (Map<String,Object> map :maps){ countMap.put("gab",type_count[2]);
if (date.equals(map.get("FINISH_DATE").toString())){ countMap.put("tw",type_count[3]);
Map<String,Object> objectMap =(Map<String, Object>)dateMap.get(date); countMap.put("twf",type_count[4]);
objectMap.put("bu",map); countMap.put("twb",type_count[5]);
dateMap.put(map.get("FINISH_DATE").toString(),objectMap); countMap.put("yd",type_count[6]);
} countMap.put("ydf",type_count[7]);
} countMap.put("ydb",type_count[8]);
} countMap.put("yj",type_count[9]);
for (String date :dateMap.keySet()){ countMap.put("yjf",type_count[10]);
Map<String,Object> objectMap =(Map<String, Object>)dateMap.get(date); countMap.put("yjb",type_count[11]);
List<Map<String,Object>> list = new ArrayList<>(); countMap.put("FINISH_DATE","合计");
for (String cardType:objectMap.keySet()){ mapList.add(countMap);
list.add((Map<String, Object>)objectMap.get(cardType)); return mapList;
}
dateMap.put(date,list);
}
Map<String,Object> objectMap = new LinkedHashMap<>();
objectMap.put("validCount",count);
objectMap.put("failedCount",failedCount);
objectMap.put("buCount",buCount);
dateMap.put("合计",objectMap);
List<Map<String,Object>> list = new ArrayList<>();
for(String date:dateMap.keySet()){
Map<String,Object> map = new LinkedHashMap<>();
map.put("date",date);
map.put("list",dateMap.get(date));
list.add(map);
}
return list;
} }
@Override @Override
......
...@@ -27,48 +27,49 @@ ...@@ -27,48 +27,49 @@
<thead> <thead>
<tr> <tr>
<th style="text-align: center;">日期</th> <th style="text-align: center;">日期</th>
<th style="text-align: center;" colspan="2">快证</th> <th style="text-align: center;" colspan="3">港澳证</th>
<th style="text-align: center;" colspan="2">重做登记</th> <th style="text-align: center;" colspan="3">台湾证</th>
<th style="text-align: center;" colspan="2">港澳证</th> <th style="text-align: center;" colspan="3">异地证</th>
<th style="text-align: center;" colspan="2">台湾证</th> <th style="text-align: center;" colspan="3">异地证邮寄</th>
<th style="text-align: center;" colspan="2">异地证</th>
<th style="text-align: center;" colspan="2">补证</th>
</tr> </tr>
<tr class="tr"> <tr class="tr">
<td></td> <td></td>
<td>成品</td> <td>成品</td>
<td class="text-danger">废品</td> <td class="text-danger">废品</td>
<td class="text-success">补证</td>
<td>成品</td> <td>成品</td>
<td class="text-danger">废品</td> <td class="text-danger">废品</td>
<td class="text-success">补证</td>
<td>成品</td> <td>成品</td>
<td class="text-danger">废品</td> <td class="text-danger">废品</td>
<td class="text-success">补证</td>
<td>成品</td> <td>成品</td>
<td class="text-danger">废品</td> <td class="text-danger">废品</td>
<td>成品</td> <td class="text-success">补证</td>
<td class="text-danger">废品</td>
<td>数量</td>
</tr> </tr>
</thead> </thead>
<tbody ng-repeat="item in qualityCheckReportList | orderBy:date" style="border-top: 1px solid #f4f4f4;"> <tbody ng-repeat="item in qualityCheckReportList" style="border-top: 1px solid #f4f4f4;">
<tr ng-if="item.date!='合计'"> <tr>
<td>{{item.date | myDateFilter}}</td> <td>{{item.FINISH_DATE}}</td>
<td>{{item.list[1].VALID_COUNT}}</td> <td>{{item.ga}}</td>
<td>{{item.list[1].FAILED_COUNT}}</td> <td>{{item.gaf}}</td>
<td>{{item.list[2].VALID_COUNT}}</td> <td>{{item.gab}}</td>
<td>{{item.list[2].FAILED_COUNT}}</td> <td>{{item.tw}}</td>
<td>{{item.list[3].VALID_COUNT}}</td> <td>{{item.twf}}</td>
<td>{{item.list[3].FAILED_COUNT}}</td> <td>{{item.twb}}</td>
<td>{{item.list[5].VALID_COUNT}}</td> <td>{{item.yd}}</td>
<td>{{item.list[5].FAILED_COUNT}}</td> <td>{{item.ydf}}</td>
<td>{{item.list[6].VALID_COUNT}}</td> <td>{{item.ydb}}</td>
<td>{{item.list[6].FAILED_COUNT}}</td> <td>{{item.yj}}</td>
<td>{{item.list[8].FAILED_COUNT}}</td> <td>{{item.yjf}}</td>
<td>{{item.yjb}}</td>
</tr> </tr>
<tr ng-if="item.date=='合计'" class="bg-gray"> <tr ng-if="item.date=='total'" class="bg-gray">
<td>{{item.date}}:</td> <td>合计</td>
<td colspan="4">成品证:{{item.list.validCount}}</td> <td colspan="4">成品证:{{item.list.validCount}}</td>
<td colspan="4">废品证:{{item.list.failedCount}}</td> <td colspan="4">废品证:{{item.list.failedCount}}</td>
<td colspan="3">补证:{{item.list.buCount}}</td> <td colspan="5">补证:{{item.list.buCount}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment