Commit c9e3a442 authored by dahai's avatar dahai

添加分拣查询任务单详情

parent a33c8021
...@@ -21,13 +21,10 @@ public class SpecialCardApi { ...@@ -21,13 +21,10 @@ public class SpecialCardApi {
/** /**
* 查询特殊证件详情 * 查询特殊证件详情
* (打印转出) * @param groupNo 组号
* taskId 任务单ID
* name 打印转出人姓名
* process 打印转出人所在工序
* printer 打印机编号
* @return * @return
*/ */
@RequestMapping("selectSpecialCard") @RequestMapping("selectSpecialCard")
public List<Map> updateState2(@RequestParam("groupNo") String groupNo) { public List<Map> updateState2(@RequestParam("groupNo") String groupNo) {
......
...@@ -191,15 +191,15 @@ public class TaskListApi { ...@@ -191,15 +191,15 @@ public class TaskListApi {
/** /**
* 查询任务单详情 * 查询任务单详情
* (辅助库) * (辅助库、制证库)
* *(分拣)
* @param process 工序 * @param process 工序
* @param resp * @param resp
* @return * @return
*/ */
@RequestMapping("queryByCountyAtAuxiliaryState2") @RequestMapping("queryByCountyAtAuxiliaryState3")
public List<Object> queryByCountyAtAuxiliaryState2(@RequestParam("process") String process, HttpServletResponse resp) { public List<Object> queryByCountyAtAuxiliaryState3(@RequestParam("process") String process, HttpServletResponse resp) {
List<Object> objects = taskListService.selectByCountyAtAuxiliary(Long.valueOf(process) - 1); List<Object> objects = taskListService.selectByCountyAtAuxiliary3(Long.valueOf(process) - 1);
return objects; return objects;
} }
......
...@@ -155,6 +155,28 @@ public interface TaskListMapper { ...@@ -155,6 +155,28 @@ public interface TaskListMapper {
"where task.TASK_STATE_ID = #{process} order by group_no.GROUP_NO") "where task.TASK_STATE_ID = #{process} order by group_no.GROUP_NO")
public List<Map<String,Object>> selectByCountyAtAuxiliary_common(@Param("process") long process); public List<Map<String,Object>> selectByCountyAtAuxiliary_common(@Param("process") long process);
/**
* 循环单查询
* 辅助库、制证库 大批证
* @param process 工序
* @return
*/
@Select("select DISTINCT sum(decode(prod_trace_t.ELECTRIC_WRITER_NO,null,0,1)) e_writer_count, task.submit_date, task.task_id,CARD_TYPE_DIC.CARD_TYPE,\n" +
"CARD_TYPE_DIC.CARD_TYPE_ID,COUNTY_DIC.COUNTY_CODE,\n" +
"COUNTY_DIC.COUNTYNAME, group_no.VALID_COUNT,group_no.INVALID_COUNT,\n" +
"group_no.SPECIAL_CARD_COUNT,group_no.GROUP_NO, nvl(fc.faileCount,0) faileCount\n" +
"from group_no left join task on group_no.task_id= task.TASK_ID\n" +
"left join CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = task.CARD_TYPE\n" +
"left join COUNTY_DIC on COUNTY_DIC.COUNTY_CODE = task.COUNTY_CODE\n" +
"left join (select task_id, nvl(count(*),0) faileCount from FAILED_CARD group by task_id ) fc \n" +
"on fc.TASK_ID = task.TASK_ID\n" +
"left join prod_trace_t@PROD_LINK on SUBSTR(prod_trace_t.ACCEPT_NO,0,8) = group_no.GROUP_NO\n" +
"where task.TASK_STATE_ID = #{process} \n" +
"and prod_trace_t.ACCEPT_NO NOT IN (select SPECIAL_CARD.ACCEPT_NO from SPECIAL_CARD) group by task.submit_date, task.task_id, CARD_TYPE_DIC.CARD_TYPE, CARD_TYPE_DIC.CARD_TYPE_ID, COUNTY_DIC.COUNTY_CODE, \n" +
"COUNTY_DIC.COUNTYNAME, group_no.VALID_COUNT, group_no.INVALID_COUNT, group_no.SPECIAL_CARD_COUNT, group_no.GROUP_NO, \n" +
"nvl(fc.faileCount,0) order by group_no.GROUP_NO")
public List<Map<String,Object>> selectByCountyAtAuxiliary_common2(@Param("process") long process);
/** /**
* 循环单查询 * 循环单查询
* 辅助库 快证 * 辅助库 快证
...@@ -170,6 +192,27 @@ public interface TaskListMapper { ...@@ -170,6 +192,27 @@ public interface TaskListMapper {
"where SPECIAL_CARD.SPECIAL_TYPE =2 and task.TASK_STATE_ID = #{process} order by SPECIAL_CARD.ACCEPT_NO") "where SPECIAL_CARD.SPECIAL_TYPE =2 and task.TASK_STATE_ID = #{process} order by SPECIAL_CARD.ACCEPT_NO")
public List<Map<String,Object>> selectByCountyAtAuxiliary_fast(@Param("process") long process); public List<Map<String,Object>> selectByCountyAtAuxiliary_fast(@Param("process") long process);
/**
* 循环单查询
* 辅助库、制证库 快证
* @param process 工序
* @return
*/
@Select("select DISTINCT sum(decode(prod_trace_t.ELECTRIC_WRITER_NO,null,0,1)) e_writer_count,task.submit_date, SPECIAL_CARD.task_id,'快证' CARD_TYPE,'1' CARD_TYPE_ID,COUNTY_DIC.COUNTY_CODE,\n" +
"COUNTY_DIC.COUNTYNAME, 1 VALID_COUNT, 0 INVALID_COUNT,0 SPECIAL_CARD_COUNT,\n" +
"SPECIAL_CARD.ACCEPT_NO group_No, nvl(fc.faileCount,0) faileCount\n" +
"from SPECIAL_CARD left join task on SPECIAL_CARD.task_id= task.TASK_ID\n" +
"left join CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = task.CARD_TYPE\n" +
"left join COUNTY_DIC on COUNTY_DIC.COUNTY_CODE = task.COUNTY_CODE\n" +
"left join prod_trace_t@PROD_LINK on prod_trace_t.ACCEPT_NO = SPECIAL_CARD.ACCEPT_NO\n" +
"left join (select task_id,nvl(count(*),0) faileCount from FAILED_CARD \n" +
"group by task_id ) fc on fc.TASK_ID = task.TASK_ID\n" +
"where SPECIAL_CARD.SPECIAL_TYPE =2 and task.TASK_STATE_ID =#{process}\n" +
"group by task.submit_date, SPECIAL_CARD.task_id, '快证', '1', COUNTY_DIC.COUNTY_CODE, \n" +
"COUNTY_DIC.COUNTYNAME, 1, 0, 0, SPECIAL_CARD.ACCEPT_NO, \n" +
"nvl(fc.faileCount,0) order by SPECIAL_CARD.ACCEPT_NO")
public List<Map<String,Object>> selectByCountyAtAuxiliary_fast2(@Param("process") long process);
/** /**
* 循环单查询 * 循环单查询
* 辅助库 余证 * 辅助库 余证
...@@ -185,6 +228,27 @@ public interface TaskListMapper { ...@@ -185,6 +228,27 @@ public interface TaskListMapper {
"where SPECIAL_CARD.SPECIAL_TYPE =1 and task.TASK_STATE_ID = #{process} order by SPECIAL_CARD.ACCEPT_NO") "where SPECIAL_CARD.SPECIAL_TYPE =1 and task.TASK_STATE_ID = #{process} order by SPECIAL_CARD.ACCEPT_NO")
public List<Map<String,Object>> selectByCountyAtAuxiliary_remaind(@Param("process") long process); public List<Map<String,Object>> selectByCountyAtAuxiliary_remaind(@Param("process") long process);
/**
* 循环单查询
* 辅助库、制证库 余证
* @param process 工序
* @return
*/
@Select("select DISTINCT sum(decode(prod_trace_t.ELECTRIC_WRITER_NO,null,0,1)) e_writer_count,task.submit_date, SPECIAL_CARD.task_id,'余证' CARD_TYPE,'1' CARD_TYPE_ID,COUNTY_DIC.COUNTY_CODE,\n" +
"COUNTY_DIC.COUNTYNAME, 1 VALID_COUNT, 0 INVALID_COUNT,0 SPECIAL_CARD_COUNT,\n" +
"SPECIAL_CARD.ACCEPT_NO group_No, nvl(fc.faileCount,0) faileCount\n" +
"from SPECIAL_CARD left join task on SPECIAL_CARD.task_id= task.TASK_ID\n" +
"left join CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = task.CARD_TYPE\n" +
"left join COUNTY_DIC on COUNTY_DIC.COUNTY_CODE = task.COUNTY_CODE\n" +
"left join prod_trace_t@PROD_LINK on prod_trace_t.ACCEPT_NO = SPECIAL_CARD.ACCEPT_NO\n" +
"left join (select task_id,nvl(count(*),0) faileCount from FAILED_CARD \n" +
"group by task_id ) fc on fc.TASK_ID = task.TASK_ID\n" +
"where SPECIAL_CARD.SPECIAL_TYPE =2 and task.TASK_STATE_ID =#{process} " +
"group by task.submit_date, SPECIAL_CARD.task_id, '余证', '1', COUNTY_DIC.COUNTY_CODE, \n" +
"COUNTY_DIC.COUNTYNAME, 1, 0, 0, SPECIAL_CARD.ACCEPT_NO, \n" +
"nvl(fc.faileCount,0) order by SPECIAL_CARD.ACCEPT_NO")
public List<Map<String,Object>> selectByCountyAtAuxiliary_remaind2(@Param("process") long process);
/** /**
......
...@@ -31,6 +31,8 @@ public interface TaskListService { ...@@ -31,6 +31,8 @@ public interface TaskListService {
public Map selectByCountyAtAuxiliary2(long process); public Map selectByCountyAtAuxiliary2(long process);
public List<Object> selectByCountyAtAuxiliary3(long process);
public List<Object> selectGroupAtACCU(String date,String typeCode,String countyCode); public List<Object> selectGroupAtACCU(String date,String typeCode,String countyCode);
public List<Object> selectGroupAtACCU(String groupNo); public List<Object> selectGroupAtACCU(String groupNo);
......
...@@ -268,6 +268,30 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -268,6 +268,30 @@ public class TaskListServiceImpl implements TaskListService {
return map; return map;
} }
/**
* 查询任务单详情
* 辅助库、制证库
* (分拣)
* @param process 查询工序
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public List selectByCountyAtAuxiliary3(long process) {
//查询普通组号列表 在辅助库、制证库中
List<Map<String, Object>> mapList_common = taskListMapper.selectByCountyAtAuxiliary_common2(process);
//查询快证组号列表 在辅助库、制证库中
List<Map<String, Object>> mapList_fast = taskListMapper.selectByCountyAtAuxiliary_fast2(process);
//查询余证组号列表 在辅助库、制证库中
List<Map<String, Object>> mapList_remaind = taskListMapper.selectByCountyAtAuxiliary_remaind2(process);
List<Map<String,Object>> list = new ArrayList<>();
list = formateMap2(mapList_common);
list.addAll(formateMap2(mapList_fast));
list.addAll(formateMap2(mapList_remaind));
return list;
}
/** /**
* 查询组号信息 * 查询组号信息
* 受理库 * 受理库
...@@ -544,4 +568,109 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -544,4 +568,109 @@ public class TaskListServiceImpl implements TaskListService {
} }
return typeList; return typeList;
} }
private List<Map<String,Object>> formateMap2(List<Map<String, Object>> maplist){
Map<String,Object> typeMap = new LinkedHashMap<>();
for (Map o :maplist){
// 组合JSON
if (typeMap!=null&typeMap.containsKey(o.get("CARD_TYPE")+"")){
List<Map<String,Object>> mapList= (List<Map<String,Object>>)typeMap.get(o.get("CARD_TYPE"));
mapList.add(o);
typeMap.put(o.get("CARD_TYPE")+"",mapList);
}else {
List<Map<String,Object>> mapList = new ArrayList<>();
mapList.add(o);
typeMap.put(o.get("CARD_TYPE")+"",mapList);
}
}
//将已按制证分好的Map 再次细化分为任务单Map
for (String type:typeMap.keySet()){
List<Map<String,Object>> mapList = (List<Map<String,Object>>)typeMap.get(type);
Map<String,Object> typemap = new LinkedHashMap<>();
for (Map<String,Object> o:mapList){
if (typemap!=null&&typemap.containsKey(o.get("TASK_ID")+"")){
List<Map<String,Object>> maplist_county= (List<Map<String,Object>>)typemap.get(o.get("TASK_ID")+"");
maplist_county.add(o);
typemap.put(o.get("TASK_ID")+"",maplist_county);
}else {
List<Map<String,Object>> maplist_county = new ArrayList<>();
maplist_county.add(o);
typemap.put(o.get("TASK_ID")+"",maplist_county);
}
}
typeMap.put(type,typemap);
}
List<Map<String,Object>> typeList = new ArrayList<>();
for (String type:typeMap.keySet()){
Map<String,Object> mapType = new LinkedHashMap<>();
int typeSum =0;
String typeName=null;
List<Map<String,Object>> countyList = new ArrayList<>();
Map<String,List<Map<String, Object>>> mapList = (Map<String,List<Map<String, Object>>>)typeMap.get(type);
for (String taskId:mapList.keySet()){
Map<String,Object> countyMapGroup= new LinkedHashMap<>();
int validCount =0;
int invalidCount =0;
int specialCount=0;
int eWriteCount=0;
int faileCount=0;
String countyName =null;
String countyCode =null;
Object submitDate = null;
List<Map<String, Object>> countyMapList = mapList.get(taskId);
for (Map<String,Object> countyMap:countyMapList){
submitDate = countyMap.get("SUBMIT_DATE");
countyCode = countyMap.get("COUNTY_CODE")+"";
countyName = countyMap.get("COUNTYNAME")+"";
typeName = countyMap.get("CARD_TYPE_ID") + "";
typeSum+=Integer.valueOf(countyMap.get("VALID_COUNT") + "");
typeSum-=Integer.valueOf(countyMap.get("SPECIAL_CARD_COUNT") + "");
validCount+=Integer.valueOf(countyMap.get("VALID_COUNT") + "");
invalidCount+=Integer.valueOf(countyMap.get("INVALID_COUNT") + "");
specialCount+=Integer.valueOf(countyMap.get("SPECIAL_CARD_COUNT") + "");
faileCount+=Integer.valueOf(countyMap.get("FAILECOUNT") + "");
eWriteCount+=Integer.valueOf(countyMap.get("E_WRITER_COUNT") + "");
}
if (countyMapList.size()==1){
countyMapGroup.put("groupNum",countyMapList.get(0).get("GROUP_NO"));
}else {
List<Integer> c = new ArrayList<>();
List<Integer> nsList = new ArrayList<>();
for (int i = 0; i < countyMapList.size(); i++) {
/**
* 判断组号中时候含有历史回迁组
*/
if (((( countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt(((( countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, ((( countyMapList.get(i)).get("GROUP_NO")) + "").length())));
}
} else {
if (((( countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt(((( countyMapList.get(i)).get("GROUP_NO")) + "")));
}
}
}
countyMapGroup.put("groupNum",createGroupNo(c, nsList));
}
countyMapGroup.put("faileCount",faileCount);
countyMapGroup.put("specialCount",specialCount);
countyMapGroup.put("countyCode",countyCode);
countyMapGroup.put("taskId",taskId);
countyMapGroup.put("groupList",countyMapList);
countyMapGroup.put("saveDate",submitDate);
countyMapGroup.put("countyName",countyName);
countyMapGroup.put("eWriteCount",eWriteCount);
countyMapGroup.put("countyValidCount",validCount);
countyMapGroup.put("countyInvalidCount",invalidCount);
countyList.add(countyMapGroup);
}
mapType.put("typeCode",typeName);
mapType.put("typeSum",typeSum );
mapType.put("typeName", type);
mapType.put("countyList",countyList);
typeList.add(mapType);
}
return typeList;
}
} }
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