Commit c4ca7466 by wancheng

报屏获取公司代码优化

parent caaee74d
...@@ -80,23 +80,23 @@ public class ServiceHPBI001 extends ServiceBase { ...@@ -80,23 +80,23 @@ public class ServiceHPBI001 extends ServiceBase {
//汇总数据 //汇总数据
//if(!StringUtils.isEmpty(inInfo.getCellStr(EiConstant.queryBlock, 0, "date"))){ //if(!StringUtils.isEmpty(inInfo.getCellStr(EiConstant.queryBlock, 0, "date"))){
//每日数据 //每日数据
String pro_name = "***"; String pro_code = "***";
List<Map> mrsj= dao.query("HPBI001.queryDay", params); List<Map> mrsj= dao.query("HPBI001.queryDay", params);
if(mrsj!=null){ if(mrsj!=null){
for (Map obj:mrsj) { for (Map obj:mrsj) {
if((Long) obj.get("SORT") == 2){ if((Long) obj.get("SORT") == 2){
pro_name = (String) obj.get("VALUE"); pro_code = (String) obj.get("PROJ_CODE");
} }
} }
} }
params.put("pro_name", pro_name); params.put("pro_name", pro_code);
inInfo.setCell(EiConstant.queryBlock, 0, "pro_name",pro_name); inInfo.setCell(EiConstant.queryBlock, 0, "pro_name",pro_code);
outInfo = super.query(inInfo,"HPBI001.querySum",new HPBI001()); outInfo = super.query(inInfo,"HPBI001.querySum",new HPBI001());
//生产月报 //生产月报
List scyb= dao.query("HPBI001.queryMon", params); List scyb= dao.query("HPBI001.queryMon", params);
outInfo.set("mrsj",mrsj); outInfo.set("mrsj",mrsj);
outInfo.set("scyb",scyb); outInfo.set("scyb",scyb);
// } // }
} catch (Exception e) { } catch (Exception e) {
...@@ -142,12 +142,9 @@ public class ServiceHPBI001 extends ServiceBase { ...@@ -142,12 +142,9 @@ public class ServiceHPBI001 extends ServiceBase {
map.put("offset",0); map.put("offset",0);
map.put("limit",1000); map.put("limit",1000);
//获取公司代码 //获取公司代码
Map user_params =new HashMap();
user_params.put("loginName", UserSession.getUserId());
List<Map> company_codes = super.dao.query("HPBI001.queryCompanyCode",user_params);
String company_code = "%"; String company_code = "%";
if(!StringUtils.isEmpty(company_codes.get(0).get("COMPANY_CODE").toString().trim())){ if(!StringUtils.isEmpty(UserSessionUtils.getCompanyCode().trim())){
company_code = company_codes.get(0).get("COMPANY_CODE").toString(); company_code = UserSessionUtils.getCompanyCode();
} }
//数据集入参 //数据集入参
Map params =new HashMap(); Map params =new HashMap();
...@@ -201,12 +198,16 @@ public class ServiceHPBI001 extends ServiceBase { ...@@ -201,12 +198,16 @@ public class ServiceHPBI001 extends ServiceBase {
map.put("offset",0); map.put("offset",0);
map.put("limit",1000); map.put("limit",1000);
//获取公司代码 //获取公司代码
Map user_params =new HashMap(); /* Map user_params =new HashMap();
user_params.put("loginName", UserSession.getUserId()); user_params.put("loginName", UserSession.getUserId());
List<Map> company_codes = super.dao.query("HPBI001.queryCompanyCode",user_params); List<Map> company_codes = super.dao.query("HPBI001.queryCompanyCode",user_params);
String company_code = "%"; String company_code = "%";
if(!StringUtils.isEmpty(company_codes.get(0).get("COMPANY_CODE").toString().trim())){ if(!StringUtils.isEmpty(company_codes.get(0).get("COMPANY_CODE").toString().trim())){
company_code = company_codes.get(0).get("COMPANY_CODE").toString(); company_code = company_codes.get(0).get("COMPANY_CODE").toString();
}*/
String company_code = "%";
if(!StringUtils.isEmpty(UserSessionUtils.getCompanyCode().trim())){
company_code = UserSessionUtils.getCompanyCode();
} }
//数据集入参 //数据集入参
Map params =new HashMap(); Map params =new HashMap();
...@@ -262,12 +263,9 @@ public class ServiceHPBI001 extends ServiceBase { ...@@ -262,12 +263,9 @@ public class ServiceHPBI001 extends ServiceBase {
map.put("offset",0); map.put("offset",0);
map.put("limit",1000); map.put("limit",1000);
//获取公司代码 //获取公司代码
Map user_params =new HashMap();
user_params.put("loginName", UserSession.getUserId());
List<Map> company_codes = super.dao.query("HPBI001.queryCompanyCode",user_params);
String company_code = "%"; String company_code = "%";
if(!StringUtils.isEmpty(company_codes.get(0).get("COMPANY_CODE").toString().trim())){ if(!StringUtils.isEmpty(UserSessionUtils.getCompanyCode().trim())){
company_code = company_codes.get(0).get("COMPANY_CODE").toString(); company_code = UserSessionUtils.getCompanyCode();
} }
//数据集入参 //数据集入参
Map params =new HashMap(); Map params =new HashMap();
...@@ -321,12 +319,9 @@ public class ServiceHPBI001 extends ServiceBase { ...@@ -321,12 +319,9 @@ public class ServiceHPBI001 extends ServiceBase {
map.put("offset",0); map.put("offset",0);
map.put("limit",1000); map.put("limit",1000);
//获取公司代码 //获取公司代码
Map user_params =new HashMap();
user_params.put("loginName", UserSession.getUserId());
List<Map> company_codes = super.dao.query("HPBI001.queryCompanyCode",user_params);
String company_code = "%"; String company_code = "%";
if(!StringUtils.isEmpty(company_codes.get(0).get("COMPANY_CODE").toString().trim())){ if(!StringUtils.isEmpty(UserSessionUtils.getCompanyCode().trim())){
company_code = company_codes.get(0).get("COMPANY_CODE").toString(); company_code = UserSessionUtils.getCompanyCode();
} }
//数据集入参 //数据集入参
Map params =new HashMap(); Map params =new HashMap();
...@@ -385,12 +380,9 @@ public class ServiceHPBI001 extends ServiceBase { ...@@ -385,12 +380,9 @@ public class ServiceHPBI001 extends ServiceBase {
map.put("offset",0); map.put("offset",0);
map.put("limit",1000); map.put("limit",1000);
//获取公司代码 //获取公司代码
Map user_params =new HashMap();
user_params.put("loginName", UserSession.getUserId());
List<Map> company_codes = super.dao.query("HPBI001.queryCompanyCode",user_params);
String company_code = "%"; String company_code = "%";
if(!StringUtils.isEmpty(company_codes.get(0).get("COMPANY_CODE").toString().trim())){ if(!StringUtils.isEmpty(UserSessionUtils.getCompanyCode().trim())){
company_code = company_codes.get(0).get("COMPANY_CODE").toString(); company_code = UserSessionUtils.getCompanyCode();
} }
//数据集入参 //数据集入参
Map params =new HashMap(); Map params =new HashMap();
...@@ -453,12 +445,9 @@ public class ServiceHPBI001 extends ServiceBase { ...@@ -453,12 +445,9 @@ public class ServiceHPBI001 extends ServiceBase {
map.put("offset",0); map.put("offset",0);
map.put("limit",1000); map.put("limit",1000);
//获取公司代码 //获取公司代码
Map user_params =new HashMap();
user_params.put("loginName", UserSession.getUserId());
List<Map> company_codes = super.dao.query("HPBI001.queryCompanyCode",user_params);
String company_code = "%"; String company_code = "%";
if(!StringUtils.isEmpty(company_codes.get(0).get("COMPANY_CODE").toString().trim())){ if(!StringUtils.isEmpty(UserSessionUtils.getCompanyCode().trim())){
company_code = company_codes.get(0).get("COMPANY_CODE").toString(); company_code = UserSessionUtils.getCompanyCode();
} }
//数据集入参 //数据集入参
Map params =new HashMap(); Map params =new HashMap();
......
...@@ -15,6 +15,210 @@ ...@@ -15,6 +15,210 @@
</isNotEmpty> </isNotEmpty>
</select> </select>
<select id="queryDay" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT '工厂' AS SERIES,FACTORY_NAME AS VALUE,PROJ_CODE, 1 AS SORT
FROM ( SELECT
A.COMPANY_CODE,
A.FACTORY_CODE,
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_NAME,
A.PROJ_CODE,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A
JOIN (SELECT
A.FACTORY_CODE,
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.DELETE_FLAG = 0
GROUP BY A.FACTORY_CODE
) B ON A.FACTORY_CODE=B.FACTORY_CODE
JOIN hpjx.t_hpkc003 C ON A.PRODUCTION_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
LIMIT 1 ) A
UNION ALL
SELECT '生产项目' AS SERIES,PROJ_NAME AS VALUE,PROJ_CODE, 2 AS SORT FROM ( SELECT
A.COMPANY_CODE,
A.FACTORY_CODE,
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_NAME,
A.PROJ_CODE,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A
JOIN (SELECT
A.FACTORY_CODE,
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.DELETE_FLAG = 0
GROUP BY A.FACTORY_CODE
) B ON A.FACTORY_CODE=B.FACTORY_CODE
JOIN hpjx.t_hpkc003 C ON A.PRODUCTION_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
LIMIT 1
) A
UNION ALL
SELECT
'生产产量' AS SERIES,
concat('计划产量:',TOTAL_WT,'吨 , 实际产量',WEIGHT,'吨') as VALUE,
PROJ_CODE, 3 AS SORT
FROM ( SELECT
A.COMPANY_CODE,
A.FACTORY_CODE,
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_NAME,
A.PROJ_CODE,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A
JOIN (SELECT
A.FACTORY_CODE,
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.DELETE_FLAG = 0
GROUP BY A.FACTORY_CODE
) B ON A.FACTORY_CODE=B.FACTORY_CODE
JOIN hpjx.t_hpkc003 C ON A.PRODUCTION_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
LIMIT 1
) A
UNION ALL
SELECT
'生产人数' AS SERIES,
concat(NUM,'人') as VALUE,
PROJ_CODE, 4 AS SORT
FROM ( SELECT
A.COMPANY_CODE,
A.FACTORY_CODE,
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_CODE,
A.PROJ_NAME,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A
JOIN (SELECT
A.FACTORY_CODE,
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.DELETE_FLAG = 0
GROUP BY A.FACTORY_CODE
) B ON A.FACTORY_CODE=B.FACTORY_CODE
JOIN hpjx.t_hpkc003 C ON A.PRODUCTION_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
LIMIT 1
) A
UNION ALL
SELECT
'人均日产' AS SERIES,
concat(ifnull(WEIGHT,0)/NUM,'吨') as VALUE,
PROJ_CODE, 5 AS SORT
FROM ( SELECT
A.COMPANY_CODE,
A.FACTORY_CODE,
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_NAME,
A.PROJ_CODE,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A
JOIN (SELECT
A.FACTORY_CODE,
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.DELETE_FLAG = 0
GROUP BY A.FACTORY_CODE
) B ON A.FACTORY_CODE=B.FACTORY_CODE
JOIN hpjx.t_hpkc003 C ON A.PRODUCTION_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
LIMIT 1
) A
<dynamic prepend="ORDER BY">
<isEmpty property="orderBy">
SORT asc
</isEmpty>
</dynamic>
</select>
<select id="querySum" parameterClass="java.util.HashMap" <select id="querySum" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bi.domain.HPBI001"> resultClass="com.baosight.hpjx.hp.bi.domain.HPBI001">
select select
...@@ -25,8 +229,8 @@ ...@@ -25,8 +229,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
...@@ -55,8 +259,8 @@ ...@@ -55,8 +259,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','') A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','')
...@@ -86,8 +290,8 @@ ...@@ -86,8 +290,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','') A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','')
...@@ -127,8 +331,8 @@ ...@@ -127,8 +331,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','') A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','')
...@@ -163,8 +367,8 @@ ...@@ -163,8 +367,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
...@@ -193,8 +397,8 @@ ...@@ -193,8 +397,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','') A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','')
...@@ -224,8 +428,8 @@ ...@@ -224,8 +428,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','') A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','')
...@@ -265,8 +469,8 @@ ...@@ -265,8 +469,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','') A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','')
...@@ -301,8 +505,8 @@ ...@@ -301,8 +505,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
...@@ -331,8 +535,8 @@ ...@@ -331,8 +535,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','') A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','')
...@@ -362,8 +566,8 @@ ...@@ -362,8 +566,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','') A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','')
...@@ -403,8 +607,8 @@ ...@@ -403,8 +607,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','') A.DOCUMENT_DATE <![CDATA[<=]]> replace(#date#,'-','')
...@@ -434,206 +638,7 @@ ...@@ -434,206 +638,7 @@
</dynamic> </dynamic>
</select> </select>
<select id="queryDay" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT '工厂' AS SERIES,FACTORY_NAME AS VALUE,NULL AS FACTORY,NULL AS DATE, 1 AS SORT
FROM ( SELECT
A.COMPANY_CODE,
A.FACTORY_CODE,
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_NAME,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A
JOIN (SELECT
A.FACTORY_CODE,
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.DELETE_FLAG = 0
GROUP BY A.FACTORY_CODE
) B ON A.FACTORY_CODE=B.FACTORY_CODE
JOIN hpjx.t_hpkc003 C ON A.PRODUCTION_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
LIMIT 1 ) A
UNION ALL
SELECT '生产项目' AS SERIES,PROJ_NAME AS VALUE,NULL AS FACTORY,NULL AS DATE, 2 AS SORT FROM ( SELECT
A.COMPANY_CODE,
A.FACTORY_CODE,
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_NAME,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A
JOIN (SELECT
A.FACTORY_CODE,
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.DELETE_FLAG = 0
GROUP BY A.FACTORY_CODE
) B ON A.FACTORY_CODE=B.FACTORY_CODE
JOIN hpjx.t_hpkc003 C ON A.PRODUCTION_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
LIMIT 1
) A
UNION ALL
SELECT
'生产产量' AS SERIES,
concat('计划产量:',TOTAL_WT,'吨 , 实际产量',WEIGHT,'吨') as VALUE,
NULL AS FACTORY,NULL AS DATE, 3 AS SORT
FROM ( SELECT
A.COMPANY_CODE,
A.FACTORY_CODE,
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_NAME,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A
JOIN (SELECT
A.FACTORY_CODE,
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.DELETE_FLAG = 0
GROUP BY A.FACTORY_CODE
) B ON A.FACTORY_CODE=B.FACTORY_CODE
JOIN hpjx.t_hpkc003 C ON A.PRODUCTION_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
LIMIT 1
) A
UNION ALL
SELECT
'生产人数' AS SERIES,
concat(NUM,'人') as VALUE,
NULL AS FACTORY,NULL AS DATE, 4 AS SORT
FROM ( SELECT
A.COMPANY_CODE,
A.FACTORY_CODE,
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_NAME,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A
JOIN (SELECT
A.FACTORY_CODE,
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.DELETE_FLAG = 0
GROUP BY A.FACTORY_CODE
) B ON A.FACTORY_CODE=B.FACTORY_CODE
JOIN hpjx.t_hpkc003 C ON A.PRODUCTION_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
LIMIT 1
) A
UNION ALL
SELECT
'人均日产' AS SERIES,
concat(ifnull(WEIGHT,0)/NUM,'吨') as VALUE,
NULL AS FACTORY,NULL AS DATE, 5 AS SORT
FROM ( SELECT
A.COMPANY_CODE,
A.FACTORY_CODE,
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_NAME,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A
JOIN (SELECT
A.FACTORY_CODE,
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.DELETE_FLAG = 0
GROUP BY A.FACTORY_CODE
) B ON A.FACTORY_CODE=B.FACTORY_CODE
JOIN hpjx.t_hpkc003 C ON A.PRODUCTION_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
LIMIT 1
) A
<dynamic prepend="ORDER BY">
<isEmpty property="orderBy">
SORT asc
</isEmpty>
</dynamic>
</select>
<select id="queryMon" parameterClass="java.util.HashMap" <select id="queryMon" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap"> resultClass="java.util.HashMap">
...@@ -649,8 +654,8 @@ ...@@ -649,8 +654,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
...@@ -687,8 +692,8 @@ ...@@ -687,8 +692,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
...@@ -725,8 +730,8 @@ ...@@ -725,8 +730,8 @@
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PRODUCTION_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_name"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_NAME = #pro_name# A.PROJ_CODE = #pro_code#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
......
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