Commit e8631987 authored by dahai's avatar dahai

添加卡机统计报表、膜统计报表

修改耗材统计流程
添加耗材审核工位
parent 083f6f22
......@@ -6,6 +6,7 @@ import com.yxproject.start.service.MaterialManagementService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
......@@ -150,6 +151,67 @@ public class MaterialManagementApi {
}
/**
* 查询卡基报表统计数据
* @param beginDate 开始时间
* @param endDate 结束时间
* @param typeCode 出入库类型
* @param name 操作人
* @param cardBodyType 卡体类型
* @return
*/
@RequestMapping("queryCardBodyReport")
public Map<String,Object> queryCardBodyReport(@Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("typeCode")String typeCode, @Param("name")String name, @Param("cardBodyType")String cardBodyType, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize){
Map<String, Object> map = materialManagementService.selectCardBodyReport(replaceDate(beginDate), replaceDate(endDate), typeCode, name, cardBodyType,(Long.valueOf(currPage)-1)*Long.valueOf(pageSize)+1,Long.valueOf(currPage)*Long.valueOf(pageSize));
return map;
}
/**
* 查询卡基报表统计数量
* @param beginDate 开始时间
* @param endDate 结束时间
* @param typeCode 出入库类型
* @param name 操作人
* @param cardBodyType 卡体类型
* @return
*/
@RequestMapping("queryCardBodyReportCount")
public int queryCardBodyReportCount(@Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("typeCode")String typeCode, @Param("name")String name, @Param("cardBodyType")String cardBodyType){
int i = materialManagementService.selectCardBodyReportCount(replaceDate(beginDate), replaceDate(endDate), typeCode, name, cardBodyType);
return i;
}
/**
* 查询膜报表统计数据
* @param beginDate
* @param endDate
* @return
*/
@RequestMapping("queryPlasticFilmReport")
public Map<String,Object> queryPlasticFilmReport(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize){
Map<String, Object> map = materialManagementService.selectPlasticFilmReport(replaceDate(beginDate), replaceDate(endDate), typeCode, name,(Long.valueOf(currPage)-1)*Long.valueOf(pageSize)+1,Long.valueOf(currPage)*Long.valueOf(pageSize));
return map;
}
/**
* 查询膜报表统计数量
* @param beginDate 开始时间
* @param endDate 结束时间
* @param typeCode 出入库类型
* @param name 操作人
* @return
*/
@RequestMapping("queryPlasticFilmReportCount")
public int queryPlasticFilmReportCount(@Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("typeCode")String typeCode, @Param("name")String name){
int i = materialManagementService.selectPlasticFilmReportCount(replaceDate(beginDate), replaceDate(endDate), typeCode, name);
return i;
}
/**
......
......@@ -5,6 +5,7 @@ import com.yxproject.start.entity.PlasticFilmEntity;
import org.apache.ibatis.annotations.*;
import java.util.List;
import java.util.Map;
@Mapper
public interface MaterialManagementMapper {
......@@ -33,7 +34,7 @@ public interface MaterialManagementMapper {
public List<PlasticFilmEntity> selectFilm(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("typeCode") String typeCode, @Param("name") String name);
@Select("<script>" +
"select sum(TOTAL_COUNT) PLASTIC_FILM_TYPE1 from plastic_film where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and PLASTIC_FILM_TYPE=1 " +
"select sum(TOTAL_COUNT) PLASTIC_FILM_TYPE1 from plastic_film where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and state =1 and PLASTIC_FILM_TYPE=1 " +
"<if test='name != null '>" +
" and name =#{name} " +
"</if>" +
......@@ -44,7 +45,7 @@ public interface MaterialManagementMapper {
public String selectFilmCount1(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("typeCode") String typeCode, @Param("name") String name);
@Select("<script>" +
"select sum(TOTAL_COUNT) PLASTIC_FILM_TYPE1 from plastic_film where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and PLASTIC_FILM_TYPE=2" +
"select sum(TOTAL_COUNT) PLASTIC_FILM_TYPE1 from plastic_film where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and state =1 and PLASTIC_FILM_TYPE=2" +
"<if test='name != null '>" +
" and name =#{name} " +
"</if>" +
......@@ -84,7 +85,7 @@ public interface MaterialManagementMapper {
public List<CardBodyEntity> selectCardBody(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("typeCode") String typeCode, @Param("name") String name, @Param("cardBodyType")String cardBodyType);
@Select("<script>" +
"select sum(TOTAL_COUNT) cardType1 from CARD_BODY where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and CARD_TYPE=1" +
"select sum(TOTAL_COUNT) cardType1 from CARD_BODY where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and state =1 and CARD_TYPE=1" +
"<if test='name != null '>" +
" and name =#{name} " +
"</if>" +
......@@ -95,7 +96,7 @@ public interface MaterialManagementMapper {
public String selectCardCount1(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("typeCode") String typeCode, @Param("name") String name);
@Select("<script>" +
"select sum(TOTAL_COUNT) cardType2 from CARD_BODY where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and CARD_TYPE=2" +
"select sum(TOTAL_COUNT) cardType2 from CARD_BODY where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and state =1 and CARD_TYPE=2" +
"<if test='name != null '>" +
" and name =#{name} " +
"</if>" +
......@@ -116,4 +117,77 @@ public interface MaterialManagementMapper {
@Update("update PLASTIC_FILM set state =1 where PLASTIC_FILM_ID = #{id}")
public boolean updatePlasticFilmState(long id);
@Select("<script>" +
"select * from (select name,save_date,CARD_BODY_TYPE,sum(count1) count1 ,sum(count2) count2,rownum rn\n" +
"from (select name,CARD_TYPE,CARD_BODY_TYPE,to_Char(SAVE_DATE,'yyyyMMdd') save_date, decode(card_type,2,0,total_count) count1 ,decode(card_type,1,0,total_count) count2 from CARD_BODY where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and state =1 " +
"<if test='name != 0 '>" +
" and name =#{name} " +
"</if>" +
"<if test='typeCode != 0 '>" +
" and card_type =#{typeCode} " +
"</if>" +
"<if test='cardBodyType != 0 '>" +
" and card_Body_Type =#{cardBodyType} " +
"</if>" +
") \n" +
" group by name, save_date,CARD_BODY_TYPE,rownum ORDER BY rownum) where rn BETWEEN #{start} and #{end}" +
"</script>")
public List<Map<String,Object>> selectCardBodyReport(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("typeCode") String typeCode, @Param("name") String name, @Param("cardBodyType") long cardBodyType,@Param("start") long start,@Param("end") long end);
@Select("<script>" +
"select * from (select name,save_date,CARD_BODY_TYPE,sum(count1) count1 ,sum(count2) count2,rownum rn\n" +
"from (select name,CARD_TYPE,CARD_BODY_TYPE,to_Char(SAVE_DATE,'yyyyMMdd') save_date, decode(card_type,2,0,total_count) count1 ,decode(card_type,1,0,total_count) count2 from CARD_BODY where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and state =1 " +
"<if test='name != 0 '>" +
" and name =#{name} " +
"</if>" +
"<if test='typeCode != 0 '>" +
" and card_type =#{typeCode} " +
"</if>" +
"<if test='cardBodyType != 0 '>" +
" and card_Body_Type =#{cardBodyType} " +
"</if>" +
") \n" +
" group by name, save_date,CARD_BODY_TYPE,rownum ORDER BY rownum) " +
"</script>")
public List<Map<String,Object>> selectCardBodyReportCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("typeCode") String typeCode, @Param("name") String name, @Param("cardBodyType") long cardBodyType);
@Select("select sum(count1) count1 ,sum(count2) count2\n" +
"from (select name,CARD_TYPE,CARD_BODY_TYPE,to_Char(SAVE_DATE,'yyyyMMdd') save_date, decode(card_type,2,0,total_count) count1 ,decode(card_type,1,0,total_count) count2 from CARD_BODY)")
public List<Map<String,Object>> selectCardBodyReportTotalCount();
@Select("<script>" +
"select * from (select name,save_date,sum(count1) count1 ,sum(count2) count2,rownum rn\n" +
"from (select name,CARD_TYPE,to_Char(SAVE_DATE,'yyyyMMdd') save_date, decode(card_type,2,0,total_count) count1 ,decode(card_type,1,0,total_count) count2 from PLASTIC_FILM where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and state =1 " +
"<if test='name != 0 '>" +
" and name =#{name} " +
"</if>" +
"<if test='typeCode != 0 '>" +
" and card_type =#{typeCode} " +
"</if>" +
") \n" +
" group by name, save_date,rownum ORDER BY rownum) where rn BETWEEN #{start} and #{end}" +
"</script>")
public List<Map<String,Object>> selectPlasticFilmReport(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("typeCode") String typeCode, @Param("name") String name,@Param("start") long start,@Param("end") long end);
@Select("<script>" +
"select * from (select name,save_date,sum(count1) count1 ,sum(count2) count2,rownum rn\n" +
"from (select name,CARD_TYPE,to_Char(SAVE_DATE,'yyyyMMdd') save_date, decode(card_type,2,0,total_count) count1 ,decode(card_type,1,0,total_count) count2 from PLASTIC_FILM where (to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}) and state =1 " +
"<if test='name != 0 '>" +
" and name =#{name} " +
"</if>" +
"<if test='typeCode != 0 '>" +
" and card_type =#{typeCode} " +
"</if>" +
") \n" +
" group by name, save_date,rownum ORDER BY rownum) where rn BETWEEN #{start} and #{end}" +
"</script>")
public List<Map<String,Object>> selectPlasticFilmReportCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("typeCode") String typeCode, @Param("name") String name);
@Select("select sum(count1) count1 ,sum(count2) count2\n" +
"from (select name,CARD_TYPE,to_Char(SAVE_DATE,'yyyyMMdd') save_date, decode(card_type,2,0,total_count) count1 ,decode(card_type,1,0,total_count) count2 from PLASTIC_FILM)")
public List<Map<String,Object>> selectPlasticFilmTotalCount();
}
......@@ -5,6 +5,7 @@ import com.yxproject.start.entity.PlasticFilmEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface MaterialManagementService {
......@@ -32,4 +33,12 @@ public interface MaterialManagementService {
public List<PlasticFilmEntity> selectPlasticFilm();
public Map<String,Object> selectCardBodyReport(String beginDate, String endDate, String typeCode, String name, String cardBodyType,long start,long end);
public int selectCardBodyReportCount(String beginDate, String endDate, String typeCode, String name, String cardBodyType);
public Map<String,Object> selectPlasticFilmReport(String beginDate, String endDate, String typeCode, String name,long start,long end);
public int selectPlasticFilmReportCount(String beginDate, String endDate, String typeCode, String name);
}
......@@ -7,7 +7,9 @@ import com.yxproject.start.service.MaterialManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Service
public class MaterialManagementServiceImpl implements MaterialManagementService {
......@@ -83,4 +85,63 @@ public class MaterialManagementServiceImpl implements MaterialManagementService
return materialManagementMapper.selectPlasticFilmByState();
}
@Override
public Map<String, Object> selectCardBodyReport(String beginDate, String endDate, String typeCode, String name, String cardBodyType,long start,long end) {
List<Map<String, Object>> maps = materialManagementMapper.selectCardBodyReport(beginDate, endDate, typeCode, name, Long.valueOf(cardBodyType),start, end);
Map<String,Object> sumMap = new LinkedHashMap<>();
int count1 = 0;
int count2 = 0;
for (Map<String,Object> map:maps){
count1+= Integer.valueOf(map.get("COUNT1")+"");
count2+= Integer.valueOf(map.get("COUNT2")+"");
}
sumMap.put("NAME","合计");
sumMap.put("COUNT1",count1);
sumMap.put("COUNT2",count2);
maps.add(sumMap);
Map<String,Object> reportMap= new LinkedHashMap<>();
List<Map<String, Object>> maps1 = materialManagementMapper.selectCardBodyReportTotalCount();
reportMap.put("list",maps);
reportMap.put("total1",maps1.get(0).get("COUNT1"));
reportMap.put("total2",maps1.get(0).get("COUNT2"));
return reportMap;
}
@Override
public int selectCardBodyReportCount(String beginDate, String endDate, String typeCode, String name, String cardBodyType) {
List<Map<String, Object>> maps = materialManagementMapper.selectCardBodyReportCount(beginDate, endDate, typeCode, name, Long.valueOf(cardBodyType));
return maps.size();
}
@Override
public Map<String, Object> selectPlasticFilmReport(String beginDate, String endDate, String typeCode, String name,long start,long end) {
List<Map<String, Object>> maps = materialManagementMapper.selectPlasticFilmReport(beginDate, endDate, typeCode, name,start, end);
Map<String,Object> sumMap = new LinkedHashMap<>();
int count1 = 0;
int count2 = 0;
for (Map<String,Object> map:maps){
count1+= Integer.valueOf(map.get("COUNT1")+"");
count2+= Integer.valueOf(map.get("COUNT2")+"");
}
sumMap.put("NAME","合计");
sumMap.put("COUNT1",count1);
sumMap.put("COUNT2",count2);
maps.add(sumMap);
Map<String,Object> reportMap= new LinkedHashMap<>();
List<Map<String, Object>> maps1 = materialManagementMapper.selectPlasticFilmTotalCount();
reportMap.put("list",maps);
reportMap.put("total1",maps1.get(0).get("COUNT1"));
reportMap.put("total2",maps1.get(0).get("COUNT2"));
return reportMap;
}
@Override
public int selectPlasticFilmReportCount(String beginDate, String endDate, String typeCode, String name) {
List<Map<String, Object>> maps = materialManagementMapper.selectPlasticFilmReportCount(beginDate, endDate, typeCode, name);
return maps.size();
}
}
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