Commit ce5a17c4 by wancheng

生产日报更新

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