Commit e5812eac by liuyang

2024-06-13 app查询产量接口

parent dea53870
......@@ -114,6 +114,9 @@ public class HGSC007 extends DaoEPBase {
public static final String INSERT = "HGSC007.insert";
public static final String UPDATE = "HGSC007.update";
public static final String DELETE = "HGSC007.delete";
public static final String QUERY_SUM_WT = "HGSC007.querySumWt"; /*查询累计产量*/
public static final String QUERY_DAY_WT = "HGSC007.queryDayWt"; /*查询工序产量*/
public static final String QUERY_PROJ_CODE_WT = "HGSC007.queryProjCodeWt"; /*查询项目产量*/
private Long id = new Long(0);
private Long matId = new Long(0); /* 物料清单ID*/
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.StringUtil;
......@@ -15,6 +20,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.lang.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -79,6 +85,50 @@ import java.util.Map;
return companyList;
}
/**
* app查询工序产量
*/
@OperationLogAnnotation(operModul = "生产任务", operType = "APP查询产量", operDesc = "APP查询产量")
public Map<String,List> getWt(EiInfo inInfo) {
Map<String,List> map = new HashMap<>();
try {
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
if (StringUtils.isEmpty(queryRow.get(HGSC007.FIELD_company_code).toString())) {
queryRow.put(HGSC007.FIELD_company_code,userVO.getUsercode());
queryRow.put(HGSC007.FIELD_company_name,userVO.getUsername());
}
List sumList = DaoBase.getInstance().query(HGSC007.QUERY_SUM_WT, queryRow);
List dayList = DaoBase.getInstance().query(HGSC007.QUERY_DAY_WT, queryRow);
map.put("sumList",sumList);
map.put("dayList",dayList);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return map;
}
/**
* app查询工序产量
*/
@OperationLogAnnotation(operModul = "生产任务", operType = "APP查询项目产量", operDesc = "APP查询项目产量")
public List getProjCodeWt(EiInfo inInfo) {
List sumList = null;
try {
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
if (StringUtils.isEmpty(queryRow.get(HGSC007.FIELD_company_code).toString())) {
queryRow.put(HGSC007.FIELD_company_code,userVO.getUsercode());
queryRow.put(HGSC007.FIELD_company_name,userVO.getUsername());
}
sumList = DaoBase.getInstance().query(HGSC007.QUERY_PROJ_CODE_WT, queryRow);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return sumList;
}
}
......@@ -487,4 +487,169 @@
</isNotEmpty>
</update>
<!--查询累计完成重量-->
<select id="querySumWt" parameterClass="java.lang.String" resultClass="java.util.Map">
select
a.factoryCode ,
a.factoryName ,
sum(a.dayWt) as dayWt,
sum(a.monthWt) as monthWt,
sum(a.yearWt) as yearWt
from (
select
factory_code as factoryCode ,
factory_name as factoryName ,
0 as dayWt,
0 as monthWt,
sum(finish_weight) as yearWt
from hggp.hgsc007 where 1 = 1 and left(created_time,4) = LEFT(#createdTime#,4)
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
factory_name = #factoryName#
</isNotEmpty>
group by factory_code , factory_name
union all
select
factory_code as factoryCode ,
factory_name as factoryName ,
0 as dayWt,
sum(finish_weight) as monthWt,
0 as yearWt
from hggp.hgsc007 where 1 = 1 and left(created_time,6) = LEFT(#createdTime#,6)
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
factory_name = #factoryName#
</isNotEmpty>
group by factory_code , factory_name
union all
select
factory_code as factoryCode ,
factory_name as factoryName ,
sum(finish_weight) as dayWt,
0 as monthWt,
0 as yearWt
from hggp.hgsc007 where 1 = 1 and left(created_time,8) = LEFT(#createdTime#,8)
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
factory_name = #factoryName#
</isNotEmpty>
group by factory_code , factory_name
) a
group by a.factoryCode , a.factoryName
</select>
<!--查询工序日产量-->
<select id="queryDayWt" parameterClass="java.lang.String" resultClass="java.util.Map">
select
factory_code as factoryCode ,
factory_name as factoryName ,
process_code as processCode ,
process_name as processName ,
sum(finish_weight) finishWeight
from hggp.HGSC007
where 1 = 1 and left(created_time,8) = #createdTime#
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
factory_name = #factoryName#
</isNotEmpty>
group by factory_code , factory_name , process_code , process_name;
</select>
<select id="queryProjCodeWt" parameterClass="java.lang.String" resultClass="java.util.Map">
select
b.factory_code as factoryCode ,
b.factory_name as factoryName ,
a.proj_code as projCode,
a.proj_name as projName,
a.plan_end_date as planEndDate,
sum(a.total_weight) as totalWeight,
sum(a.finish_weight) as finishWeight
from hggp.HGSC005a a inner join hggp.HGSC007 b on a.id = b.order_detail_id
where 1 = 1
<isNotEmpty prepend=" AND " property="accountCode">
a.account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
a.company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
a.company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
a.factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
a.factory_name = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planEndDate">
a.plan_end_date = #planEndDate#
</isNotEmpty>
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
a.DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(a.CREATED_BY = #authOnlyPeople# OR a.DEP_CODE IN <iterate close=")" open="(" conjunction=","
property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
a.CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
a.DEP_CODE IN
<iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
group by b.factory_code , b.factory_name , a.proj_code , a.proj_name, a.plan_end_date;
</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