Commit 4a80baf1 by wancheng

app驾驶舱接口更新,下料附件清单优化

parent 6d288330
package com.baosight.hpjx.hp.mt.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.mt.untils.Base64ToMultipartFile;
import com.baosight.hpjx.hp.mt.untils.UploadUtils2;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.hp.zl.domain.HPZL001A;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.common.ed.domain.TEDCM01;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import net.sf.json.JSONObject;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 鸿鹏机械APP驾驶舱接口调用处
*/
public class ServiceHPMT003 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* APP驾驶舱-日产量
*
* @param inInfo
* @return
*/
public Map queryPmRCLInfo(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String date = inInfo.getString("date").replace("-","");
String factorycode = inInfo.getString("factorycode");
String companyCode = UserSessionUtils.getCompanyCode();
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("date", date);
sqlMap.put("factorycode", factorycode);
List<Map> rows = this.dao.query("HPMT003.queryPmRCLInfo", sqlMap);
List<Map> maps = new ArrayList<>();
resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
/**
* APP驾驶舱-月累计产量
*
* @param inInfo
* @return
*/
public Map queryPmYCLinfo(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String date = inInfo.getString("date").replace("-","");
String factorycode = inInfo.getString("factorycode");
String companyCode = UserSessionUtils.getCompanyCode();
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("date", date);
sqlMap.put("factorycode", factorycode);
List<Map> rows = this.dao.query("HPMT003.queryPmYCLinfo", sqlMap);
List<Map> maps = new ArrayList<>();
resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
/**
* APP驾驶舱-年累计产量
*
* @param inInfo
* @return
*/
public Map queryPmNCLinfo(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String date = inInfo.getString("date").replace("-","");
String factorycode = inInfo.getString("factorycode");
String companyCode = UserSessionUtils.getCompanyCode();
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("date", date);
sqlMap.put("factorycode", factorycode);
List<Map> rows = this.dao.query("HPMT003.queryPmNCLinfo", sqlMap);
List<Map> maps = new ArrayList<>();
resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
/**
* APP驾驶舱-组拼加焊综合总产量
*
* @param inInfo
* @return
*/
public Map queryPmZCLinfo(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String date = inInfo.getString("date").replace("-","");
String factorycode = inInfo.getString("factorycode");
String companyCode = UserSessionUtils.getCompanyCode();
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("date", date);
sqlMap.put("factorycode", factorycode);
List<Map> rows = this.dao.query("HPMT003.queryPmZCLinfo", sqlMap);
List<Map> maps = new ArrayList<>();
resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
/**
* APP驾驶舱-各组组拼加焊综合产量
*
* @param inInfo
* @return
*/
public Map queryPmGroupCLnfo(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String date = inInfo.getString("date").replace("-","");
String factorycode = inInfo.getString("factorycode");
String companyCode = UserSessionUtils.getCompanyCode();
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("date", date);
sqlMap.put("factorycode", factorycode);
List<Map> rows = this.dao.query("HPMT003.queryPmGroupCLnfo", sqlMap);
List<Map> maps = new ArrayList<>();
resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
/**
* APP驾驶舱-生产项
*
* @param inInfo
* @return
*/
public Map queryPmSCXInfo(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String date = inInfo.getString("date").replace("-","");
String factorycode = inInfo.getString("factorycode");
String companyCode = UserSessionUtils.getCompanyCode();
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("date", date);
sqlMap.put("factorycode", factorycode);
List<Map> rows = this.dao.query("HPMT003.queryPmSCXInfo", sqlMap);
List<Map> maps = new ArrayList<>();
resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
/**
* APP驾驶舱-近5日综合产量
*
* @param inInfo
* @return
*/
public Map queryPmZHCLInfo(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String date = inInfo.getString("date").replace("-","");
String factorycode = inInfo.getString("factorycode");
String companyCode = UserSessionUtils.getCompanyCode();
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("date", date);
sqlMap.put("factorycode", factorycode);
List<Map> rows = this.dao.query("HPMT003.queryPmZHCLInfo", sqlMap);
List<Map> maps = new ArrayList<>();
resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
/**
* APP驾驶舱-主要项目进度
*
* @param inInfo
* @return
*/
public Map queryPmXMinfo(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String date = inInfo.getString("date").replace("-","");
String factorycode = inInfo.getString("factorycode");
String companyCode = UserSessionUtils.getCompanyCode();
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("date", date);
sqlMap.put("factorycode", factorycode);
List<Map> rows = this.dao.query("HPMT003.queryPmXMinfo", sqlMap);
List<Map> maps = new ArrayList<>();
resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
/**
* APP驾驶舱-厂区
*
* @param inInfo
* @return
*/
public Map queryPmCompanyInfo(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String date = inInfo.getString("date").replace("-","");
String factorycode = inInfo.getString("factorycode");
String companyCode = UserSessionUtils.getCompanyCode();
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("date", date);
sqlMap.put("factorycode", factorycode);
List<Map> rows = this.dao.query("HPMT003.queryPmCompanyInfo", sqlMap);
List<Map> maps = new ArrayList<>();
resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPMT003">
<select id="queryPmRCLInfo" resultClass="java.util.HashMap">
select
concat(ifnull(YGL,0),'工') as YGL,
concat(format(ifnull(JHCL,0),2),'T') as JHCL,
concat(format(ifnull(SJCL,0),2),'T') as SJCL,
case when ifnull(YGL,0) = 0 then '0.00T'
else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as RJCL
from (select
(select count(*) FROM hpjx.T_HPPZ014
where COMPANY_CODE = #companyCode# and REG_DATE = #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE) as YGL,
0 as JHCL,
(select sum(WEIGHT) FROM hpjx.T_HPXS001
where COMPANY_CODE = #companyCode# and REGISTER_DATE = #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE) as SJCL
from dual) a
</select>
<select id="queryPmYCLinfo" resultClass="java.util.HashMap">
select
concat(ifnull(YGL,0),'工') as LJYGL,
concat(format(ifnull(JHCL,0),2),'T') as LJJHCL,
concat(format(ifnull(SJCL,0),2),'T') as LJSJCL,
case when ifnull(YGL,0) = 0 then '0.00T'
else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as LJRJCL
from (select
(select count(*) FROM hpjx.T_HPPZ014
where COMPANY_CODE = #companyCode# and left(REG_DATE,6) = left(#date#,6) and REG_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE,left(REG_DATE,6)) as YGL,
0 as JHCL,
(select sum(WEIGHT) FROM hpjx.T_HPXS001
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,6) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE,left(REGISTER_DATE,6)) as SJCL
from dual) a
</select>
<select id="queryPmNCLinfo" resultClass="java.util.HashMap">
select
concat(ifnull(YGL,0),'工') as NLJYG,
concat(format(ifnull(JHCL,0),2),'T') as NLJJHCL,
concat(format(ifnull(SJCL,0),2),'T') as NLJSJCL,
case when ifnull(YGL,0) = 0 then '0.00T'
else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as NLJRJCL
from (select
(select count(*) FROM hpjx.T_HPPZ014
where COMPANY_CODE = #companyCode# and left(REG_DATE,4) = left(#date#,4) and REG_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE,left(REG_DATE,4)) as YGL,
0 as JHCL,
(select sum(WEIGHT) FROM hpjx.T_HPXS001
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,4) = left(#date#,4) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE,left(REGISTER_DATE,4)) as SJCL
from dual) a
</select>
<select id="queryPmZCLinfo" resultClass="java.util.HashMap">
select
concat(format(ifnull(ZP,0),2),'T') as ZP,
concat(format(ifnull(JH,0),2),'T') as JH,
concat(format(ifnull(ZH,0),2),'T') as ZH
from (select
(select sum(WEIGHT) FROM hpjx.T_HPXS001
where GROUP_TYPE = '2' and COMPANY_CODE = #companyCode# and REGISTER_DATE = #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE) as ZP,
(select sum(WEIGHT) FROM hpjx.T_HPXS001
where GROUP_TYPE = '1' and COMPANY_CODE = #companyCode# and REGISTER_DATE = #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE) as JH,
(select sum(WEIGHT)/2 FROM hpjx.T_HPXS001
where COMPANY_CODE = #companyCode# and REGISTER_DATE = #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE) as ZH
from dual) a
</select>
<select id="queryPmGroupCLnfo" resultClass="java.util.HashMap">
select SERIES,X,VALUE
from (
select
'组拼' as SERIES,
a.GROUP_NAME as X,
ifnull(sum(WEIGHT),0) as VALUE,
case when right(a.GROUP_NAME,2) = '一组' then 1
when right(a.GROUP_NAME,2) = '二组' then 2
when right(a.GROUP_NAME,2) = '三组' then 3
else 4 end as SORT,
1 as SORT1
from (select a.ORG_ID as FACTORY_CODE,c.ORG_ID as GROUP_CODE,c.ORG_CNAME as GROUP_NAME,a.COMPANY_CODE
from iplat.TXSOG01 a
join iplat.TXSOG01 b on a.ORG_ID = b.PARENT_ORG_ID
join iplat.TXSOG01 c on b.ORG_ID = c.PARENT_ORG_ID
where a.ORG_TYPE = 'factory' and b.ORG_TYPE = 'dept' and c.ORG_TYPE = 'prodGroup' and a.IS_DELETED = 0 and b.IS_DELETED =0 and c.IS_DELETED = 0) a
left join hpjx.T_HPXS001 b on b.FACTORY_CODE = a.FACTORY_CODE and b.GROUP_CODE = a.GROUP_CODE and b.COMPANY_CODE = #companyCode# and b.REGISTER_DATE = #date# and b.FACTORY_CODE = #factorycode# and b.GROUP_TYPE = '2'
group by a.GROUP_NAME,b.GROUP_TYPE
union all
select
'加焊' as SERIES,
a.GROUP_NAME as X,
ifnull(sum(WEIGHT),0) as VALUE,
case when right(a.GROUP_NAME,2) = '一组' then 1
when right(a.GROUP_NAME,2) = '二组' then 2
when right(a.GROUP_NAME,2) = '三组' then 3
else 4 end as SORT,
2 as SORT1
from (select a.ORG_ID as FACTORY_CODE,c.ORG_ID as GROUP_CODE,c.ORG_CNAME as GROUP_NAME,a.COMPANY_CODE
from iplat.TXSOG01 a
join iplat.TXSOG01 b on a.ORG_ID = b.PARENT_ORG_ID
join iplat.TXSOG01 c on b.ORG_ID = c.PARENT_ORG_ID
where a.ORG_TYPE = 'factory' and b.ORG_TYPE = 'dept' and c.ORG_TYPE = 'prodGroup' and a.IS_DELETED = 0 and b.IS_DELETED =0 and c.IS_DELETED = 0) a
left join hpjx.T_HPXS001 b on b.FACTORY_CODE = a.FACTORY_CODE and b.GROUP_CODE = a.GROUP_CODE and b.COMPANY_CODE = #companyCode# and b.REGISTER_DATE = #date# and b.FACTORY_CODE = #factorycode# and b.GROUP_TYPE = '1'
group by a.GROUP_NAME,b.GROUP_TYPE
union all
select
'综合' as SERIES,
a.GROUP_NAME as X,
ifnull(sum(WEIGHT),0)/2 as VALUE,
case when right(a.GROUP_NAME,2) = '一组' then 1
when right(a.GROUP_NAME,2) = '二组' then 2
when right(a.GROUP_NAME,2) = '三组' then 3
else 4 end as SORT,
3 as SORT1
from (select a.ORG_ID as FACTORY_CODE,c.ORG_ID as GROUP_CODE,c.ORG_CNAME as GROUP_NAME,a.COMPANY_CODE
from iplat.TXSOG01 a
join iplat.TXSOG01 b on a.ORG_ID = b.PARENT_ORG_ID
join iplat.TXSOG01 c on b.ORG_ID = c.PARENT_ORG_ID
where a.ORG_TYPE = 'factory' and b.ORG_TYPE = 'dept' and c.ORG_TYPE = 'prodGroup' and a.IS_DELETED = 0 and b.IS_DELETED =0 and c.IS_DELETED = 0) a
left join hpjx.T_HPXS001 b on b.FACTORY_CODE = a.FACTORY_CODE and b.GROUP_CODE = a.GROUP_CODE and b.COMPANY_CODE = #companyCode# and b.REGISTER_DATE = #date# and b.FACTORY_CODE = #factorycode#
group by a.GROUP_NAME) a
order by SORT,SORT1 asc
</select>
<select id="queryPmSCXInfo" resultClass="java.util.HashMap">
select a.GROUP_NAME,ifnull(GROUP_CONCAT(distinct PRDT_NAME SEPARATOR ','),'') as PART_NAME
from (
select a.ORG_ID as FACTORY_CODE,c.ORG_ID as GROUP_CODE,c.ORG_CNAME as GROUP_NAME,a.COMPANY_CODE
from iplat.TXSOG01 a
join iplat.TXSOG01 b on a.ORG_ID = b.PARENT_ORG_ID
join iplat.TXSOG01 c on b.ORG_ID = c.PARENT_ORG_ID
where a.ORG_TYPE = 'factory' and b.ORG_TYPE = 'dept' and c.ORG_TYPE = 'prodGroup' and a.IS_DELETED = 0 and b.IS_DELETED =0 and c.IS_DELETED = 0) a
left join hpjx.T_HPXS001 b on a.GROUP_CODE = b.GROUP_CODE and b.REGISTER_DATE = #date#
where a.COMPANY_CODE = #companyCode# and a.FACTORY_CODE = #factorycode#
group by a.GROUP_NAME,a.GROUP_CODE
order by a.GROUP_CODE
</select>
<select id="queryPmZHCLInfo" resultClass="java.util.HashMap">
select SERIES,X,VALUE
from (
select
a.GROUP_NAME as SERIES,
concat(substring(replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 4 day),'-',''),5,2),'/',substring(replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 4 day),'-',''),7,2)) as X,
ifnull(sum(WEIGHT),0) as VALUE
,replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 4 day),'-','') as date,
case when right(a.GROUP_NAME,2) = '一组' then 1
when right(a.GROUP_NAME,2) = '二组' then 2
when right(a.GROUP_NAME,2) = '三组' then 3
else 4 end as SORT
from (select a.ORG_ID as FACTORY_CODE,c.ORG_ID as GROUP_CODE,c.ORG_CNAME as GROUP_NAME,a.COMPANY_CODE
from iplat.TXSOG01 a
join iplat.TXSOG01 b on a.ORG_ID = b.PARENT_ORG_ID
join iplat.TXSOG01 c on b.ORG_ID = c.PARENT_ORG_ID
where a.ORG_TYPE = 'factory' and b.ORG_TYPE = 'dept' and c.ORG_TYPE = 'prodGroup' and a.IS_DELETED = 0 and b.IS_DELETED =0 and c.IS_DELETED = 0) a
left join hpjx.T_HPXS001 b on b.FACTORY_CODE = a.FACTORY_CODE and b.GROUP_CODE = a.GROUP_CODE and b.COMPANY_CODE = #companyCode#
and b.REGISTER_DATE = replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 4 day),'-','') and b.FACTORY_CODE = #factorycode#
group by a.GROUP_NAME,b.REGISTER_DATE
union all
select
a.GROUP_NAME as SERIES,
concat(substring(replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 3 day),'-',''),5,2),'/',substring(replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 3 day),'-',''),7,2)) as X,
ifnull(sum(WEIGHT),0) as VALUE
,replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 3 day),'-','') as date,
case when right(a.GROUP_NAME,2) = '一组' then 1
when right(a.GROUP_NAME,2) = '二组' then 2
when right(a.GROUP_NAME,2) = '三组' then 3
else 4 end as SORT
from (select a.ORG_ID as FACTORY_CODE,c.ORG_ID as GROUP_CODE,c.ORG_CNAME as GROUP_NAME,a.COMPANY_CODE
from iplat.TXSOG01 a
join iplat.TXSOG01 b on a.ORG_ID = b.PARENT_ORG_ID
join iplat.TXSOG01 c on b.ORG_ID = c.PARENT_ORG_ID
where a.ORG_TYPE = 'factory' and b.ORG_TYPE = 'dept' and c.ORG_TYPE = 'prodGroup' and a.IS_DELETED = 0 and b.IS_DELETED =0 and c.IS_DELETED = 0) a
left join hpjx.T_HPXS001 b on b.FACTORY_CODE = a.FACTORY_CODE and b.GROUP_CODE = a.GROUP_CODE and b.COMPANY_CODE = #companyCode#
and b.REGISTER_DATE = replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 3 day),'-','') and b.FACTORY_CODE = #factorycode#
group by a.GROUP_NAME,b.REGISTER_DATE
union all
select
a.GROUP_NAME as SERIES,
concat(substring(replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 2 day),'-',''),5,2),'/',substring(replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 2 day),'-',''),7,2)) as X,
ifnull(sum(WEIGHT),0) as VALUE
,replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 2 day),'-','') as date,
case when right(a.GROUP_NAME,2) = '一组' then 1
when right(a.GROUP_NAME,2) = '二组' then 2
when right(a.GROUP_NAME,2) = '三组' then 3
else 4 end as SORT
from (select a.ORG_ID as FACTORY_CODE,c.ORG_ID as GROUP_CODE,c.ORG_CNAME as GROUP_NAME,a.COMPANY_CODE
from iplat.TXSOG01 a
join iplat.TXSOG01 b on a.ORG_ID = b.PARENT_ORG_ID
join iplat.TXSOG01 c on b.ORG_ID = c.PARENT_ORG_ID
where a.ORG_TYPE = 'factory' and b.ORG_TYPE = 'dept' and c.ORG_TYPE = 'prodGroup' and a.IS_DELETED = 0 and b.IS_DELETED =0 and c.IS_DELETED = 0) a
left join hpjx.T_HPXS001 b on b.FACTORY_CODE = a.FACTORY_CODE and b.GROUP_CODE = a.GROUP_CODE and b.COMPANY_CODE = #companyCode#
and b.REGISTER_DATE = replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 2 day),'-','') and b.FACTORY_CODE = #factorycode#
group by a.GROUP_NAME,b.REGISTER_DATE
union all
select
a.GROUP_NAME as SERIES,
concat(substring(replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 1 day),'-',''),5,2),'/',substring(replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 1 day),'-',''),7,2)) as X,
ifnull(sum(WEIGHT),0) as VALUE
,replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 1 day),'-','') as date,
case when right(a.GROUP_NAME,2) = '一组' then 1
when right(a.GROUP_NAME,2) = '二组' then 2
when right(a.GROUP_NAME,2) = '三组' then 3
else 4 end as SORT
from (select a.ORG_ID as FACTORY_CODE,c.ORG_ID as GROUP_CODE,c.ORG_CNAME as GROUP_NAME,a.COMPANY_CODE
from iplat.TXSOG01 a
join iplat.TXSOG01 b on a.ORG_ID = b.PARENT_ORG_ID
join iplat.TXSOG01 c on b.ORG_ID = c.PARENT_ORG_ID
where a.ORG_TYPE = 'factory' and b.ORG_TYPE = 'dept' and c.ORG_TYPE = 'prodGroup' and a.IS_DELETED = 0 and b.IS_DELETED =0 and c.IS_DELETED = 0) a
left join hpjx.T_HPXS001 b on b.FACTORY_CODE = a.FACTORY_CODE and b.GROUP_CODE = a.GROUP_CODE and b.COMPANY_CODE = #companyCode#
and b.REGISTER_DATE = replace(date_sub(str_to_date(#date#,'%Y%m%d'), INTERVAL 1 day),'-','') and b.FACTORY_CODE = #factorycode#
group by a.GROUP_NAME,b.REGISTER_DATE
union all
select
a.GROUP_NAME as SERIES,
concat(substring(#date#,5,2),'/',substring(#date#,7,2)) as X,
ifnull(sum(WEIGHT),0) as VALUE
,#date# as date,
case when right(a.GROUP_NAME,2) = '一组' then 1
when right(a.GROUP_NAME,2) = '二组' then 2
when right(a.GROUP_NAME,2) = '三组' then 3
else 4 end as SORT
from (select a.ORG_ID as FACTORY_CODE,c.ORG_ID as GROUP_CODE,c.ORG_CNAME as GROUP_NAME,a.COMPANY_CODE
from iplat.TXSOG01 a
join iplat.TXSOG01 b on a.ORG_ID = b.PARENT_ORG_ID
join iplat.TXSOG01 c on b.ORG_ID = c.PARENT_ORG_ID
where a.ORG_TYPE = 'factory' and b.ORG_TYPE = 'dept' and c.ORG_TYPE = 'prodGroup' and a.IS_DELETED = 0 and b.IS_DELETED =0 and c.IS_DELETED = 0) a
left join hpjx.T_HPXS001 b on b.FACTORY_CODE = a.FACTORY_CODE and b.GROUP_CODE = a.GROUP_CODE and b.COMPANY_CODE = #companyCode#
and b.REGISTER_DATE = #date# and b.FACTORY_CODE = #factorycode#
group by a.GROUP_NAME
) a
order by date,SORT asc
</select>
<select id="queryPmXMinfo" resultClass="java.util.HashMap">
select PROJ_NAME,JHDATE,JHCL,SJCL,JD from (select
a.PROJ_NAME ,
concat(left(max(a.PLAN_COMPLETION_DATE),4),'年',substring(max(a.PLAN_COMPLETION_DATE),5,2),'月',right(max(a.PLAN_COMPLETION_DATE),2),'日') as JHDATE,
concat(format(ifnull(sum(b.TOTAL_WT ),0),2),'吨') as JHCL,
concat(format(ifnull(sum(ACTUAL_COMPLETION_UNIT_WT),0),2),'吨') as SJCL,
concat(format((ifnull( sum( ACTUAL_COMPLETION_NUM ), 0 ) / ifnull( sum( b.NUM ), 0 ) * 100),2),'%') as JD
from hpjx.T_HPSC003 a
join hpjx.T_HPSC004 b on b.PARENT_ID = a.PLAN_INFO_NO
join hpjx.T_HPSC005A c on c.PROD_ORDER_NO = b.PROD_ORDER_NO
where a.COMPANY_CODE = #companyCode# and c.FACTORY_CODE = #factorycode#
group by a.PROJ_NAME) a
where JD <![CDATA[<>]]> 100
</select>
<select id="queryPmCompanyInfo" resultClass="java.util.HashMap">
select ORG_ID,ORG_CNAME
from iplat.TXSOG01
where ORG_TYPE = 'factory' and COMPANY_CODE = #companyCode# and IS_DELETED = 0
</select>
</sqlMap>
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