Commit ce5a17c4 by wancheng

生产日报更新

parent 71062661
...@@ -18,74 +18,57 @@ ...@@ -18,74 +18,57 @@
<select id="queryDay" parameterClass="java.util.HashMap" <select id="queryDay" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap"> resultClass="java.util.HashMap">
SELECT '工厂' AS SERIES,FACTORY_NAME AS VALUE,PROJ_CODE, 1 AS SORT SELECT '工厂' AS SERIES,FACTORY_NAME AS VALUE,PROJ_CODE, 1 AS SORT
FROM ( SELECT FROM ( SELECT A.COMPANY_CODE, B.FACTORY_CODE,
A.COMPANY_CODE, B.FACTORY_NAME, A.PROJ_NAME, A.PROJ_CODE, MAX(A.TOTAL_WT) AS TOTAL_WT, SUM(WEIGHT) AS WEIGHT, MAX(C.NUM) AS NUM
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 FROM hpjx.t_hpsc005 A
JOIN (SELECT INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
A.FACTORY_CODE, JOIN (SELECT A.FACTORY_CODE, COUNT(*) AS NUM
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.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 JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID WHERE A.DELETE_FLAG = 0 GROUP BY A.FACTORY_CODE
WHERE A.DELETE_FLAG = 0 ) C ON C.FACTORY_CODE=B.FACTORY_CODE
GROUP BY A.FACTORY_CODE JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
) B ON A.FACTORY_CODE=B.FACTORY_CODE WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
JOIN hpjx.t_hpkc003 C ON A.PROD_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','') D.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY A.COMPANY_CODE, A.FACTORY_CODE, A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME, A.PROJ_NAME, A.FACTORY_CODE, A.PROJ_CODE
LIMIT 1 ) A LIMIT 1 ) A
UNION ALL UNION ALL
SELECT '生产项目' AS SERIES,PROJ_NAME AS VALUE,PROJ_CODE, 2 AS SORT FROM ( SELECT SELECT '生产项目' AS SERIES,PROJ_NAME AS VALUE,PROJ_CODE, 2 AS SORT FROM (
A.COMPANY_CODE, SELECT A.COMPANY_CODE, B.FACTORY_CODE,
A.FACTORY_CODE, B.FACTORY_NAME, A.PROJ_NAME, A.PROJ_CODE, MAX(A.TOTAL_WT) AS TOTAL_WT, SUM(WEIGHT) AS WEIGHT, MAX(C.NUM) AS NUM
A.PLAN_COMPLETION_DATE,
A.FACTORY_NAME,
A.PROJ_NAME,
A.PROJ_CODE,
TOTAL_WT,
WEIGHT,
B.NUM
FROM hpjx.t_hpsc005 A FROM hpjx.t_hpsc005 A
JOIN (SELECT INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
A.FACTORY_CODE, JOIN (SELECT A.FACTORY_CODE, COUNT(*) AS NUM
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.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 JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID WHERE A.DELETE_FLAG = 0 GROUP BY A.FACTORY_CODE
WHERE A.DELETE_FLAG = 0 ) C ON C.FACTORY_CODE=B.FACTORY_CODE
GROUP BY A.FACTORY_CODE JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
) B ON A.FACTORY_CODE=B.FACTORY_CODE WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
JOIN hpjx.t_hpkc003 C ON A.PROD_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','') D.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY A.COMPANY_CODE, A.FACTORY_CODE, A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME, A.PROJ_NAME, A.FACTORY_CODE, A.PROJ_CODE
LIMIT 1 LIMIT 1
) A ) A
...@@ -95,38 +78,29 @@ ...@@ -95,38 +78,29 @@
'生产产量' AS SERIES, '生产产量' AS SERIES,
concat('计划产量:',TOTAL_WT,'吨 , 实际产量',WEIGHT,'吨') as VALUE, concat('计划产量:',TOTAL_WT,'吨 , 实际产量',WEIGHT,'吨') as VALUE,
PROJ_CODE, 3 AS SORT PROJ_CODE, 3 AS SORT
FROM ( SELECT FROM ( SELECT A.COMPANY_CODE, B.FACTORY_CODE,
A.COMPANY_CODE, B.FACTORY_NAME, A.PROJ_NAME, A.PROJ_CODE, MAX(A.TOTAL_WT) AS TOTAL_WT, SUM(WEIGHT) AS WEIGHT, MAX(C.NUM) AS NUM
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 FROM hpjx.t_hpsc005 A
JOIN (SELECT INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
A.FACTORY_CODE, JOIN (SELECT A.FACTORY_CODE, COUNT(*) AS NUM
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.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 JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID WHERE A.DELETE_FLAG = 0 GROUP BY A.FACTORY_CODE
WHERE A.DELETE_FLAG = 0 ) C ON C.FACTORY_CODE=B.FACTORY_CODE
GROUP BY A.FACTORY_CODE JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
) B ON A.FACTORY_CODE=B.FACTORY_CODE WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
JOIN hpjx.t_hpkc003 C ON A.PROD_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','') D.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY A.COMPANY_CODE, A.FACTORY_CODE, A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME, A.PROJ_NAME, A.FACTORY_CODE, A.PROJ_CODE
LIMIT 1 LIMIT 1
) A ) A
...@@ -136,38 +110,29 @@ ...@@ -136,38 +110,29 @@
'生产人数' AS SERIES, '生产人数' AS SERIES,
concat(NUM,'人') as VALUE, concat(NUM,'人') as VALUE,
PROJ_CODE, 4 AS SORT PROJ_CODE, 4 AS SORT
FROM ( SELECT FROM ( SELECT A.COMPANY_CODE, B.FACTORY_CODE,
A.COMPANY_CODE, B.FACTORY_NAME, A.PROJ_NAME, A.PROJ_CODE, MAX(A.TOTAL_WT) AS TOTAL_WT, SUM(WEIGHT) AS WEIGHT, MAX(C.NUM) AS NUM
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 FROM hpjx.t_hpsc005 A
JOIN (SELECT INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
A.FACTORY_CODE, JOIN (SELECT A.FACTORY_CODE, COUNT(*) AS NUM
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.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 JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID WHERE A.DELETE_FLAG = 0 GROUP BY A.FACTORY_CODE
WHERE A.DELETE_FLAG = 0 ) C ON C.FACTORY_CODE=B.FACTORY_CODE
GROUP BY A.FACTORY_CODE JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
) B ON A.FACTORY_CODE=B.FACTORY_CODE WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
JOIN hpjx.t_hpkc003 C ON A.PROD_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','') D.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY A.COMPANY_CODE, A.FACTORY_CODE, A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME, A.PROJ_NAME, A.FACTORY_CODE, A.PROJ_CODE
LIMIT 1 LIMIT 1
) A ) A
...@@ -178,38 +143,29 @@ ...@@ -178,38 +143,29 @@
'人均日产' AS SERIES, '人均日产' AS SERIES,
concat(ifnull(WEIGHT,0)/NUM,'吨') as VALUE, concat(ifnull(WEIGHT,0)/NUM,'吨') as VALUE,
PROJ_CODE, 5 AS SORT PROJ_CODE, 5 AS SORT
FROM ( SELECT FROM ( SELECT A.COMPANY_CODE, B.FACTORY_CODE,
A.COMPANY_CODE, B.FACTORY_NAME, A.PROJ_NAME, A.PROJ_CODE, MAX(A.TOTAL_WT) AS TOTAL_WT, SUM(WEIGHT) AS WEIGHT, MAX(C.NUM) AS NUM
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 FROM hpjx.t_hpsc005 A
JOIN (SELECT INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
A.FACTORY_CODE, JOIN (SELECT A.FACTORY_CODE, COUNT(*) AS NUM
COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM hpjx.T_HPPZ011 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.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 JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID WHERE A.DELETE_FLAG = 0 GROUP BY A.FACTORY_CODE
WHERE A.DELETE_FLAG = 0 ) C ON C.FACTORY_CODE=B.FACTORY_CODE
GROUP BY A.FACTORY_CODE JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
) B ON A.FACTORY_CODE=B.FACTORY_CODE WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
JOIN hpjx.t_hpkc003 C ON A.PROD_ORDER_NO = C.PROD_ORDER_NO
WHERE ifnull(C.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
C.DOCUMENT_DATE = replace(#date#,'-','') D.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
A.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY A.COMPANY_CODE, A.FACTORY_CODE, A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME, A.PROJ_NAME, A.FACTORY_CODE, A.PROJ_CODE
LIMIT 1 LIMIT 1
) A ) A
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
...@@ -225,9 +181,10 @@ ...@@ -225,9 +181,10 @@
'生产人数(人)' AS indNmae, '生产人数(人)' AS indNmae,
(select (select
NUM as VALUE NUM as VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -236,12 +193,12 @@ ...@@ -236,12 +193,12 @@
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY DOCUMENT_DATE,FACTORY_CODE) A GROUP BY DOCUMENT_DATE,C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -255,9 +212,10 @@ ...@@ -255,9 +212,10 @@
) AS dayValue, ) AS dayValue,
(select (select
NUM as VALUE NUM as VALUE
FROM (select FACTORY_CODE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -267,12 +225,12 @@ ...@@ -267,12 +225,12 @@
AND left(DOCUMENT_DATE,6) = left(replace(#date#,'-',''),6) AND left(DOCUMENT_DATE,6) = left(replace(#date#,'-',''),6)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -286,9 +244,10 @@ ...@@ -286,9 +244,10 @@
) AS monValue, ) AS monValue,
(select (select
NUM as VALUE NUM as VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -298,12 +257,12 @@ ...@@ -298,12 +257,12 @@
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4) AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -327,9 +286,10 @@ ...@@ -327,9 +286,10 @@
MAX(case when substring(DOCUMENT_DATE,5,2) = '10' THEN NUM ELSE 0 END) as octValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '10' THEN NUM ELSE 0 END) as octValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '11' THEN NUM ELSE 0 END) as novValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '11' THEN NUM ELSE 0 END) as novValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '12' THEN NUM ELSE 0 END) as decValue MAX(case when substring(DOCUMENT_DATE,5,2) = '12' THEN NUM ELSE 0 END) as decValue
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -339,12 +299,12 @@ ...@@ -339,12 +299,12 @@
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4) AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -363,9 +323,10 @@ ...@@ -363,9 +323,10 @@
'生产产量(吨)' AS indNmae, '生产产量(吨)' AS indNmae,
(select (select
VALUE VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -374,12 +335,12 @@ ...@@ -374,12 +335,12 @@
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -393,9 +354,10 @@ ...@@ -393,9 +354,10 @@
) AS dayValue, ) AS dayValue,
(select (select
VALUE VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -405,12 +367,12 @@ ...@@ -405,12 +367,12 @@
AND left(DOCUMENT_DATE,6) = left(replace(#date#,'-',''),6) AND left(DOCUMENT_DATE,6) = left(replace(#date#,'-',''),6)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -424,9 +386,10 @@ ...@@ -424,9 +386,10 @@
) AS monValue, ) AS monValue,
(select (select
VALUE VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -436,12 +399,12 @@ ...@@ -436,12 +399,12 @@
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4) AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -465,9 +428,10 @@ ...@@ -465,9 +428,10 @@
MAX(case when substring(DOCUMENT_DATE,5,2) = '10' THEN VALUE ELSE 0 END) as octValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '10' THEN VALUE ELSE 0 END) as octValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '11' THEN VALUE ELSE 0 END) as novValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '11' THEN VALUE ELSE 0 END) as novValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '12' THEN VALUE ELSE 0 END) as decValue MAX(case when substring(DOCUMENT_DATE,5,2) = '12' THEN VALUE ELSE 0 END) as decValue
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -477,12 +441,12 @@ ...@@ -477,12 +441,12 @@
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4) AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -501,9 +465,10 @@ ...@@ -501,9 +465,10 @@
'人均产量(kg)' AS indNmae, '人均产量(kg)' AS indNmae,
(select (select
VALUE/NUM AS VALUE VALUE/NUM AS VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -512,12 +477,12 @@ ...@@ -512,12 +477,12 @@
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -531,9 +496,10 @@ ...@@ -531,9 +496,10 @@
) AS dayValue, ) AS dayValue,
(select (select
VALUE/NUM AS VALUE VALUE/NUM AS VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -543,12 +509,12 @@ ...@@ -543,12 +509,12 @@
AND left(DOCUMENT_DATE,6) = left(replace(#date#,'-',''),6) AND left(DOCUMENT_DATE,6) = left(replace(#date#,'-',''),6)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -562,9 +528,10 @@ ...@@ -562,9 +528,10 @@
) AS monValue, ) AS monValue,
(select (select
VALUE/NUM AS VALUE VALUE/NUM AS VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -574,12 +541,12 @@ ...@@ -574,12 +541,12 @@
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4) AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -603,9 +570,10 @@ ...@@ -603,9 +570,10 @@
MAX(case when substring(DOCUMENT_DATE,5,2) = '10' THEN VALUE/NUM ELSE 0 END) as octValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '10' THEN VALUE/NUM ELSE 0 END) as octValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '11' THEN VALUE/NUM ELSE 0 END) as novValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '11' THEN VALUE/NUM ELSE 0 END) as novValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '12' THEN VALUE/NUM ELSE 0 END) as decValue MAX(case when substring(DOCUMENT_DATE,5,2) = '12' THEN VALUE/NUM ELSE 0 END) as decValue
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -615,12 +583,12 @@ ...@@ -615,12 +583,12 @@
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4) AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -650,9 +618,10 @@ ...@@ -650,9 +618,10 @@
else concat(substring(DOCUMENT_DATE,5,2),'月') else concat(substring(DOCUMENT_DATE,5,2),'月')
end as X, end as X,
VAULE as VALUE VAULE as VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -661,12 +630,12 @@ ...@@ -661,12 +630,12 @@
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -688,9 +657,10 @@ ...@@ -688,9 +657,10 @@
else concat(substring(DOCUMENT_DATE,5,2),'月') else concat(substring(DOCUMENT_DATE,5,2),'月')
end as X, end as X,
NUM as VALUE NUM as VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -699,12 +669,12 @@ ...@@ -699,12 +669,12 @@
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
...@@ -726,9 +696,10 @@ ...@@ -726,9 +696,10 @@
else concat(substring(DOCUMENT_DATE,5,2),'月') else concat(substring(DOCUMENT_DATE,5,2),'月')
end as X, end as X,
VAULE/NUM as VALUE VAULE/NUM as VALUE
FROM (select FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> '' where ifnull(A.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="pro_code"> <isNotEmpty prepend=" AND " property="pro_code">
A.PROJ_CODE = #pro_code# A.PROJ_CODE = #pro_code#
...@@ -737,12 +708,12 @@ ...@@ -737,12 +708,12 @@
A.DOCUMENT_DATE = replace(#date#,'-','') A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factory"> <isNotEmpty prepend=" AND " property="factory">
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%')) C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="company_code"> <isNotEmpty prepend=" AND " property="company_code">
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%')) B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty> </isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE) A
join (SELECT join (SELECT
A.FACTORY_CODE, A.FACTORY_CODE,
COUNT(*) AS NUM COUNT(*) AS NUM
......
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