Commit c6307d6c by wancheng

生产任务保存优化

parent 2bf6133c
...@@ -18,16 +18,24 @@ ...@@ -18,16 +18,24 @@
<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 A.COMPANY_CODE, B.FACTORY_CODE, FROM (
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 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 FROM hpjx.t_hpsc005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
JOIN (SELECT A.FACTORY_CODE, COUNT(*) AS NUM JOIN (
FROM hpjx.T_HPPZ011 A SELECT
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID FROM iplat.TXSOG01 A
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID WHERE A.DELETE_FLAG = 0 GROUP BY A.FACTORY_CODE JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE 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.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE AND C.GROUP_ID = B.ORG_NO
JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> '' WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
...@@ -45,17 +53,25 @@ ...@@ -45,17 +53,25 @@
UNION ALL UNION ALL
SELECT '生产项目' AS SERIES,PROJ_NAME AS VALUE,PROJ_CODE, 2 AS SORT FROM ( SELECT '生产项目' AS SERIES,PROJ_NAME AS VALUE,PROJ_CODE, 2 AS SORT
SELECT A.COMPANY_CODE, B.FACTORY_CODE, FROM (
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 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 FROM hpjx.t_hpsc005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
JOIN (SELECT A.FACTORY_CODE, COUNT(*) AS NUM JOIN (
FROM hpjx.T_HPPZ011 A SELECT
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID FROM iplat.TXSOG01 A
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID WHERE A.DELETE_FLAG = 0 GROUP BY A.FACTORY_CODE JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE 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.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE AND C.GROUP_ID = B.ORG_NO
JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> '' WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
...@@ -78,16 +94,24 @@ ...@@ -78,16 +94,24 @@
'生产产量' 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 A.COMPANY_CODE, B.FACTORY_CODE, FROM (
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 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 FROM hpjx.t_hpsc005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
JOIN (SELECT A.FACTORY_CODE, COUNT(*) AS NUM JOIN (
FROM hpjx.T_HPPZ011 A SELECT
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID FROM iplat.TXSOG01 A
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID WHERE A.DELETE_FLAG = 0 GROUP BY A.FACTORY_CODE JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE 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.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE AND C.GROUP_ID = B.ORG_NO
JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> '' WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
...@@ -110,16 +134,24 @@ ...@@ -110,16 +134,24 @@
'生产人数' AS SERIES, '生产人数' AS SERIES,
concat(NUM,'人') as VALUE, concat(NUM,'人') as VALUE,
PROJ_CODE, 4 AS SORT PROJ_CODE, 4 AS SORT
FROM ( SELECT A.COMPANY_CODE, B.FACTORY_CODE, FROM (
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 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 FROM hpjx.t_hpsc005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
JOIN (SELECT A.FACTORY_CODE, COUNT(*) AS NUM JOIN (
FROM hpjx.T_HPPZ011 A SELECT
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID FROM iplat.TXSOG01 A
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID WHERE A.DELETE_FLAG = 0 GROUP BY A.FACTORY_CODE JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE 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.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE AND C.GROUP_ID = B.ORG_NO
JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> '' WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
...@@ -131,8 +163,8 @@ ...@@ -131,8 +163,8 @@
<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, GROUP BY A.COMPANY_CODE,A.FACTORY_CODE,A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME, A.PROJ_NAME, A.FACTORY_CODE, A.PROJ_CODE B.FACTORY_NAME,A.PROJ_NAME,A.FACTORY_CODE,A.PROJ_CODE
LIMIT 1 LIMIT 1
) A ) A
...@@ -143,16 +175,24 @@ ...@@ -143,16 +175,24 @@
'人均日产' 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 A.COMPANY_CODE, B.FACTORY_CODE, FROM (
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 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 FROM hpjx.t_hpsc005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
JOIN (SELECT A.FACTORY_CODE, COUNT(*) AS NUM JOIN (
FROM hpjx.T_HPPZ011 A SELECT
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID FROM iplat.TXSOG01 A
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID WHERE A.DELETE_FLAG = 0 GROUP BY A.FACTORY_CODE JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE 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.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE AND C.GROUP_ID = B.ORG_NO
JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> '' WHERE ifnull(D.DOCUMENT_DATE,'') <![CDATA[<>]]> ''
<isNotEmpty prepend=" AND " property="date"> <isNotEmpty prepend=" AND " property="date">
...@@ -164,8 +204,8 @@ ...@@ -164,8 +204,8 @@
<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, GROUP BY A.COMPANY_CODE,A.FACTORY_CODE,A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME, A.PROJ_NAME, A.FACTORY_CODE, A.PROJ_CODE 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">
...@@ -181,7 +221,7 @@ ...@@ -181,7 +221,7 @@
'生产人数(人)' AS indNmae, '生产人数(人)' AS indNmae,
(select (select
NUM as VALUE NUM as VALUE
FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -198,21 +238,21 @@ ...@@ -198,21 +238,21 @@
<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,C.FACTORY_CODE) A GROUP BY DOCUMENT_DATE,C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS dayValue, ) AS dayValue,
(select (select
NUM as VALUE NUM as VALUE
FROM (select C.FACTORY_CODE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -230,21 +270,21 @@ ...@@ -230,21 +270,21 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS monValue, ) AS monValue,
(select (select
NUM as VALUE NUM as VALUE
FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -262,17 +302,17 @@ ...@@ -262,17 +302,17 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS yearValue, ) AS yearValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '01' THEN NUM ELSE 0 END) as janValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '01' THEN NUM ELSE 0 END) as janValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '02' THEN NUM ELSE 0 END) as febValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '02' THEN NUM ELSE 0 END) as febValue,
...@@ -286,7 +326,7 @@ ...@@ -286,7 +326,7 @@
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 C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -304,17 +344,17 @@ ...@@ -304,17 +344,17 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
UNION ALL UNION ALL
...@@ -323,7 +363,7 @@ ...@@ -323,7 +363,7 @@
'生产产量(吨)' AS indNmae, '生产产量(吨)' AS indNmae,
(select (select
VALUE VALUE
FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -340,21 +380,21 @@ ...@@ -340,21 +380,21 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS dayValue, ) AS dayValue,
(select (select
VALUE VALUE
FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -372,21 +412,21 @@ ...@@ -372,21 +412,21 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS monValue, ) AS monValue,
(select (select
VALUE VALUE
FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -404,17 +444,17 @@ ...@@ -404,17 +444,17 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS yearValue, ) AS yearValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '01' THEN VALUE ELSE 0 END) as janValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '01' THEN VALUE ELSE 0 END) as janValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '02' THEN VALUE ELSE 0 END) as febValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '02' THEN VALUE ELSE 0 END) as febValue,
...@@ -428,7 +468,7 @@ ...@@ -428,7 +468,7 @@
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 C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -446,17 +486,17 @@ ...@@ -446,17 +486,17 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
UNION ALL UNION ALL
...@@ -465,7 +505,7 @@ ...@@ -465,7 +505,7 @@
'人均产量(kg)' AS indNmae, '人均产量(kg)' AS indNmae,
(select (select
VALUE/NUM AS VALUE VALUE/NUM AS VALUE
FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -482,21 +522,21 @@ ...@@ -482,21 +522,21 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS dayValue, ) AS dayValue,
(select (select
VALUE/NUM AS VALUE VALUE/NUM AS VALUE
FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -514,21 +554,21 @@ ...@@ -514,21 +554,21 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS monValue, ) AS monValue,
(select (select
VALUE/NUM AS VALUE VALUE/NUM AS VALUE
FROM (select C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -546,17 +586,17 @@ ...@@ -546,17 +586,17 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS yearValue, ) AS yearValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '01' THEN VALUE/NUM ELSE 0 END) as janValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '01' THEN VALUE/NUM ELSE 0 END) as janValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '02' THEN VALUE/NUM ELSE 0 END) as febValue, MAX(case when substring(DOCUMENT_DATE,5,2) = '02' THEN VALUE/NUM ELSE 0 END) as febValue,
...@@ -570,7 +610,7 @@ ...@@ -570,7 +610,7 @@
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 C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -588,17 +628,17 @@ ...@@ -588,17 +628,17 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isEmpty property="orderBy"> <isEmpty property="orderBy">
indNmae desc indNmae desc
...@@ -618,7 +658,7 @@ ...@@ -618,7 +658,7 @@
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 C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -635,17 +675,17 @@ ...@@ -635,17 +675,17 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
UNION ALL UNION ALL
...@@ -657,7 +697,7 @@ ...@@ -657,7 +697,7 @@
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 C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -674,17 +714,17 @@ ...@@ -674,17 +714,17 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
UNION ALL UNION ALL
...@@ -696,7 +736,7 @@ ...@@ -696,7 +736,7 @@
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 C.FACTORY_CODE,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE FROM (select C.FACTORY_CODE,C.ORG_NO,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 INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
...@@ -713,17 +753,17 @@ ...@@ -713,17 +753,17 @@
<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),C.FACTORY_CODE) A GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
join (SELECT JOIN (
A.FACTORY_CODE, SELECT
COUNT(*) AS NUM A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM hpjx.T_HPPZ011 A FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.GROUP_CODE = B.ORG_ID JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_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 WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.FACTORY_CODE GROUP BY A.ORG_ID ,C.ORG_ID
) B ON A.FACTORY_CODE=B.FACTORY_CODE ) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isEmpty property="orderBy"> <isEmpty property="orderBy">
......
...@@ -265,7 +265,8 @@ public class ServiceHPSC005A extends ServiceBase { ...@@ -265,7 +265,8 @@ public class ServiceHPSC005A extends ServiceBase {
*/ */
private void setBaseInfo(HPSC005A fSc005a) { private void setBaseInfo(HPSC005A fSc005a) {
// 厂区名称 // 厂区名称
fSc005a.setFactoryName(HPPZTools.HpPz011.getFactoryName(fSc005a.getFactoryCode())); //fSc005a.setFactoryName(HPPZTools.HpPz011.getFactoryName(fSc005a.getFactoryCode()));
fSc005a.setFactoryName(HPXSTools.XsOrg.get(fSc005a.getFactoryCode()).getOrgCname());
// 生产组名称 // 生产组名称
fSc005a.setOrgName(HPXSTools.XsOrg.get(fSc005a.getOrgNo()).getOrgCname()); fSc005a.setOrgName(HPXSTools.XsOrg.get(fSc005a.getOrgNo()).getOrgCname());
} }
......
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