Commit 3e2be62d by 宋祥
parents 8f5e564b e1bb9ffa
...@@ -80,7 +80,8 @@ public class UserSessionUtils extends UserSession { ...@@ -80,7 +80,8 @@ public class UserSessionUtils extends UserSession {
} }
/** /**
获取用户所属公司 * * 获取用户所属公司
*
* @return * @return
*/ */
public static UserVO getUserCompany() { public static UserVO getUserCompany() {
...@@ -89,7 +90,7 @@ public class UserSessionUtils extends UserSession { ...@@ -89,7 +90,7 @@ public class UserSessionUtils extends UserSession {
if (CollectionUtils.isNotEmpty(orgList)) { if (CollectionUtils.isNotEmpty(orgList)) {
Org org = orgList.get(0); Org org = orgList.get(0);
if (!org.getOrgType().equals("company")) { if (!org.getOrgType().equals("company")) {
//如果不是公司公司,则找到上一级 // 如果不是公司公司,则找到上一级
Org org1 = HGXSTools.XsOrg.queryCompany(org.getOrgId()); Org org1 = HGXSTools.XsOrg.queryCompany(org.getOrgId());
userVO.setUsercode(org1.getOrgId()); userVO.setUsercode(org1.getOrgId());
userVO.setUsername(org1.getOrgCname()); userVO.setUsername(org1.getOrgCname());
...@@ -100,6 +101,7 @@ public class UserSessionUtils extends UserSession { ...@@ -100,6 +101,7 @@ public class UserSessionUtils extends UserSession {
} }
return userVO; return userVO;
} }
/** /**
* 获取登录用户的组织机构 * 获取登录用户的组织机构
* *
...@@ -114,6 +116,25 @@ public class UserSessionUtils extends UserSession { ...@@ -114,6 +116,25 @@ public class UserSessionUtils extends UserSession {
} }
/** /**
* 获取登录用户的公司编码
*
* @return
*/
public static List<String> getCompanyCode() {
List<Org> orgs = HGXSTools.XsOrg.queryByUser();
if (CollectionUtils.isEmpty(orgs)) {
return new ArrayList<>();
}
List<String> orgIds = new ArrayList<>();
for (Org org : orgs) {
if (OrgTypeEnum.COMPANY.getCode().equals(org.getOrgType())) {
orgIds.add(org.getOrgId());
}
}
return orgIds;
}
/**
* 获取登录用户的厂区编码 * 获取登录用户的厂区编码
* *
* @return * @return
...@@ -133,6 +154,25 @@ public class UserSessionUtils extends UserSession { ...@@ -133,6 +154,25 @@ public class UserSessionUtils extends UserSession {
} }
/** /**
* 获取登录用户的厂区名称
*
* @return
*/
public static List<String> getFactoryName() {
List<Org> orgs = HGXSTools.XsOrg.queryByUser();
if (CollectionUtils.isEmpty(orgs)) {
return new ArrayList<>();
}
List<String> factoryNames = new ArrayList<>();
for (Org org : orgs) {
if (OrgTypeEnum.FACTORY.getCode().equals(org.getOrgType())) {
factoryNames.add(org.getOrgCname());
}
}
return factoryNames;
}
/**
* 获取登录用户的所有组 * 获取登录用户的所有组
* *
* @return * @return
......
...@@ -8,6 +8,7 @@ import com.baosight.hggp.core.security.UserSessionUtils; ...@@ -8,6 +8,7 @@ import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.sb.tools.HGSBTools; import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.sc.domain.HGSC007; import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Factory; import com.baosight.hggp.hg.xs.domain.Factory;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
...@@ -102,8 +103,8 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -102,8 +103,8 @@ public class ServiceHGSC007 extends ServiceEPBase {
if (StringUtils.isNotBlank(creatTime)) { if (StringUtils.isNotBlank(creatTime)) {
queryMap.put(HGSC007.FIELD_created_time, StringUtil.removeHorizontalLine(creatTime)); queryMap.put(HGSC007.FIELD_created_time, StringUtil.removeHorizontalLine(creatTime));
} }
// 设置组过滤条件 // 仅查询自己所在组的任务 added by songx at 20240820
this.setGroupCondition(queryMap); HgScUtils.HgSc007.setOrgCondition(queryMap);
inInfo = super.query(inInfo, HGSC007.QUERY, new HGSC007()); inInfo = super.query(inInfo, HGSC007.QUERY, new HGSC007());
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
...@@ -126,33 +127,15 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -126,33 +127,15 @@ public class ServiceHGSC007 extends ServiceEPBase {
if (StringUtils.isNotBlank(creatTime)) { if (StringUtils.isNotBlank(creatTime)) {
queryMap.put(HGSC007.FIELD_created_time, StringUtil.removeHorizontalLine(creatTime)); queryMap.put(HGSC007.FIELD_created_time, StringUtil.removeHorizontalLine(creatTime));
} }
// 设置组过滤条件 // 仅查询自己所在组的任务 added by songx at 20240820
this.setGroupCondition(queryMap); HgScUtils.HgSc007.setOrgCondition(queryMap);
count = super.count(HGSC007.COUNT, queryMap); count = super.count(HGSC007.COUNT, queryMap);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
return count; return count;
} }
/**
* 设置组过滤条件
*
* @param queryMap
*/
private void setGroupCondition(Map queryMap) {
// 超级管理员看所有数据
if (LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
return;
}
// 仅查询自己所在组的任务 added by songx at 20240820
List<String> allGroupNames = UserSessionUtils.getAllGroupName();
// 当用户无组的时候,集合中添加空字符串用于查询,如果不加会查询出所有的数据
allGroupNames.add(" ");
queryMap.put("groupNames", allGroupNames);
}
@OperationLogAnnotation(operModul = "生产任务", operType = "APP查询公司", operDesc = "APP查询当前登陆用户角色所属公司") @OperationLogAnnotation(operModul = "生产任务", operType = "APP查询公司", operDesc = "APP查询当前登陆用户角色所属公司")
public List<Company> getRoleCompany(EiInfo inInfo) { public List<Company> getRoleCompany(EiInfo inInfo) {
List<Company> companyList = UserSessionUtils.getRoleCompany(); List<Company> companyList = UserSessionUtils.getRoleCompany();
......
package com.baosight.hggp.hg.sc.service; package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.domain.HGSC002; import com.baosight.hggp.hg.sc.domain.HGSC002;
import com.baosight.hggp.hg.sc.domain.HGSC008; import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
...@@ -22,28 +22,34 @@ import java.util.Map; ...@@ -22,28 +22,34 @@ import java.util.Map;
*/ */
public class ServiceHGSC008 extends ServiceEPBase { public class ServiceHGSC008 extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工单", operType = "查询", operDesc = "初始化页面") @OperationLogAnnotation(operModul = "生产报工单", operType = "查询", operDesc = "初始化页面")
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC008().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC008().eiMetadata);
inInfo = super.query(inInfo, HGSC008.QUERY, new HGSC008());
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} }
return inInfo; return inInfo;
} }
/* /**
* 查询*/ * 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工单", operType = "查询", operDesc = "查询") @OperationLogAnnotation(operModul = "生产报工单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 仅查询自己所在组的任务 added by songx at 20240820 // 仅查询自己所在组的任务 added by songx at 20240820
List<String> allGroupNames = UserSessionUtils.getAllGroupName(); HgScUtils.HgSc007.setOrgCondition(queryMap);
// 当用户无组的时候,集合中添加一个不存在的组用于查询,如果不加会查询出所有的数据
allGroupNames.add(" ");
queryMap.put("groupNames", allGroupNames);
inInfo = super.query(inInfo, HGSC008.QUERY, new HGSC008()); inInfo = super.query(inInfo, HGSC008.QUERY, new HGSC008());
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
...@@ -2,9 +2,54 @@ ...@@ -2,9 +2,54 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC007"> <sqlMap namespace="HGSC007">
<sql id="column">
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
order_id as "orderId", <!-- 生产计划ID -->
order_detail_id as "orderDetailId", <!-- 生产计划明细ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
task_code as "taskCode", <!-- 任务编码 -->
product_type as "productType", <!-- 产品类型 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
complete_date as "completeDate", <!-- 完工日期 -->
quantity as "quantity", <!-- 数量 -->
finish_quantity as "finishQuantity", <!-- 完工数量 -->
unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
single_weight as "singleWeight", <!-- 单重 -->
total_weight as "totalWeight", <!-- 总重 -->
finish_weight as "finishWeight", <!-- 完工重量 -->
unfinish_weight as "unfinishWeight", <!-- 未完工重量 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime", <!-- 更新时间 -->
LENGTH as "length", <!-- 长 -->
SPEC as "spec" <!-- 规格 -->
</sql>
<sql id="condition"> <sql id="condition">
<include refid="HGXSDataAuth.authCondition"/> <include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
id = #id# id = #id#
</isNotEmpty> </isNotEmpty>
...@@ -141,6 +186,15 @@ ...@@ -141,6 +186,15 @@
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
<isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCodes">
FACTORY_CODE IN <iterate close=")" open="(" conjunction="," property="factoryCodes">#factoryCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryNames">
FACTORY_NAME IN <iterate close=")" open="(" conjunction="," property="factoryNames">#factoryNames[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCodes"> <isNotEmpty prepend=" AND " property="groupCodes">
GROUP_CODE IN <iterate close=")" open="(" conjunction="," property="groupCodes">#groupCodes[]#</iterate> GROUP_CODE IN <iterate close=")" open="(" conjunction="," property="groupCodes">#groupCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
...@@ -168,6 +222,7 @@ ...@@ -168,6 +222,7 @@
</isNotEmpty> </isNotEmpty>
</isNotEqual> </isNotEqual>
</sql> </sql>
<sql id="appOrderCondition"> <sql id="appOrderCondition">
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEmpty prepend=" AND " property="accountCode">
h.account_code = #accountCode# h.account_code = #accountCode#
...@@ -186,56 +241,7 @@ ...@@ -186,56 +241,7 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <sql id="orderBy">
resultClass="com.baosight.hggp.hg.sc.domain.HGSC007">
SELECT
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
order_id as "orderId", <!-- 生产计划ID -->
order_detail_id as "orderDetailId", <!-- 生产计划明细ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
task_code as "taskCode", <!-- 任务编码 -->
product_type as "productType", <!-- 产品类型 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
complete_date as "completeDate", <!-- 完工日期 -->
quantity as "quantity", <!-- 数量 -->
finish_quantity as "finishQuantity", <!-- 完工数量 -->
unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
single_weight as "singleWeight", <!-- 单重 -->
total_weight as "totalWeight", <!-- 总重 -->
finish_weight as "finishWeight", <!-- 完工重量 -->
unfinish_weight as "unfinishWeight", <!-- 未完工重量 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime", <!-- 更新时间 -->
LENGTH as "length", <!-- 长 -->
SPEC as "spec" <!-- 规格 -->
FROM ${hggpSchema}.HGSC007
WHERE 1=1
<include refid="condition" />
<include refid="customCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -244,12 +250,22 @@ ...@@ -244,12 +250,22 @@
id desc, product_type asc, product_name, process_order desc id desc, product_type asc, product_name, process_order desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSC007
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="orderBy"/>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007 WHERE 1=1 SELECT COUNT(*) FROM ${hggpSchema}.HGSC007
<include refid="condition" /> WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/> <include refid="customCondition"/>
</select> </select>
...@@ -307,8 +323,7 @@ ...@@ -307,8 +323,7 @@
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM ${hggpSchema}.HGSC007 WHERE DELETE FROM ${hggpSchema}.HGSC007 WHERE id = #id#
id = #id#
</delete> </delete>
<update id="update"> <update id="update">
...@@ -360,7 +375,6 @@ ...@@ -360,7 +375,6 @@
id = #id# id = #id#
</update> </update>
<!-- 行锁 --> <!-- 行锁 -->
<update id="lock"> <update id="lock">
UPDATE ${hggpSchema}.HGSC007 UPDATE ${hggpSchema}.HGSC007
...@@ -430,6 +444,7 @@ ...@@ -430,6 +444,7 @@
) a ) a
group by a.factoryCode, a.factoryName group by a.factoryCode, a.factoryName
</select> </select>
<!--查询工序日产量--> <!--查询工序日产量-->
<select id="queryWt" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryWt" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
select select
...@@ -449,6 +464,7 @@ ...@@ -449,6 +464,7 @@
group by h.DEPOSIT_DATE, h2.factory_code, h2.factory_name, h2.process_code, h2.process_name group by h.DEPOSIT_DATE, h2.factory_code, h2.factory_name, h2.process_code, h2.process_name
order by h.DEPOSIT_DATE asc order by h.DEPOSIT_DATE asc
</select> </select>
<!--查询工序日产量--> <!--查询工序日产量-->
<select id="queryDayWt" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryDayWt" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
select select
...@@ -468,6 +484,7 @@ ...@@ -468,6 +484,7 @@
group by h.DEPOSIT_DATE, h2.factory_code, h2.factory_name, h2.process_code, h2.process_name group by h.DEPOSIT_DATE, h2.factory_code, h2.factory_name, h2.process_code, h2.process_name
order by h.DEPOSIT_DATE asc order by h.DEPOSIT_DATE asc
</select> </select>
<!--查询工序月产量--> <!--查询工序月产量-->
<select id="queryMonthWt" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryMonthWt" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
select select
...@@ -487,6 +504,7 @@ ...@@ -487,6 +504,7 @@
group by h.DEPOSIT_DATE, h2.factory_code, h2.factory_name, h2.process_code, h2.process_name group by h.DEPOSIT_DATE, h2.factory_code, h2.factory_name, h2.process_code, h2.process_name
order by h.DEPOSIT_DATE asc order by h.DEPOSIT_DATE asc
</select> </select>
<!--项目产量--> <!--项目产量-->
<select id="queryProjCodeWt" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryProjCodeWt" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
select select
......
...@@ -2,9 +2,50 @@ ...@@ -2,9 +2,50 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC008"> <sqlMap namespace="HGSC008">
<sql id="column">
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
task_id as "taskId", <!-- 生产任务ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
work_code as "workCode", <!-- 报工编码 -->
product_type as "productType", <!-- 产品类型 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
register_date as "registerDate", <!-- 报工日期 -->
quantity as "quantity", <!-- 数量 -->
single_weight as "singleWeight", <!-- 单重 -->
total_weight as "totalWeight", <!-- 总重 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime", <!-- 更新时间 -->
length as "length", <!-- 长 -->
spec as "spec", <!-- 规格 -->
exceed_reason as "exceedReason"
</sql>
<sql id="condition"> <sql id="condition">
<include refid="HGXSDataAuth.authCondition"/> <include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
id = #id# id = #id#
</isNotEmpty> </isNotEmpty>
...@@ -116,6 +157,15 @@ ...@@ -116,6 +157,15 @@
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
<isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCodes">
FACTORY_CODE IN <iterate close=")" open="(" conjunction="," property="factoryCodes">#factoryCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryNames">
FACTORY_NAME IN <iterate close=")" open="(" conjunction="," property="factoryNames">#factoryNames[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCodes"> <isNotEmpty prepend=" AND " property="groupCodes">
GROUP_CODE IN <iterate close=")" open="(" conjunction="," property="groupCodes">#groupCodes[]#</iterate> GROUP_CODE IN <iterate close=")" open="(" conjunction="," property="groupCodes">#groupCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
...@@ -124,51 +174,7 @@ ...@@ -124,51 +174,7 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC008"> <sql id="orderBy">
SELECT
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
task_id as "taskId", <!-- 生产任务ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
work_code as "workCode", <!-- 报工编码 -->
product_type as "productType", <!-- 产品类型 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
register_date as "registerDate", <!-- 报工日期 -->
quantity as "quantity", <!-- 数量 -->
single_weight as "singleWeight", <!-- 单重 -->
total_weight as "totalWeight", <!-- 总重 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime", <!-- 更新时间 -->
length as "length", <!-- 长 -->
spec as "spec", <!-- 规格 -->
exceed_reason as "exceedReason"
FROM ${hggpSchema}.HGSC008
WHERE 1=1
<include refid="condition" />
<include refid="customCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -177,11 +183,22 @@ ...@@ -177,11 +183,22 @@
register_date desc, id desc register_date desc, id desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC008">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSC008
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="orderBy"/>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC008 WHERE 1=1 SELECT COUNT(*) FROM ${hggpSchema}.HGSC008
<include refid="condition" /> WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/> <include refid="customCondition"/>
</select> </select>
...@@ -237,8 +254,7 @@ ...@@ -237,8 +254,7 @@
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM ${hggpSchema}.HGSC008 WHERE DELETE FROM ${hggpSchema}.HGSC008 WHERE id = #id#
id = #id#
</delete> </delete>
<update id="update"> <update id="update">
...@@ -290,4 +306,5 @@ ...@@ -290,4 +306,5 @@
DELETE FROM ${hggpSchema}.HGSC008 WHERE DELETE FROM ${hggpSchema}.HGSC008 WHERE
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate> id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</delete> </delete>
</sqlMap> </sqlMap>
package com.baosight.hggp.hg.sc.util;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/8/22,16:15
*/
public class HgScUtils {
/**
*
* @author:songx
* @date:2024/8/22,16:17
*/
public static class HgSc007 {
/**
* 设置组织机构查询条件
*
* @param queryMap
*/
public static void setOrgCondition(Map queryMap) {
// 超级管理员看所有数据
if (LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
return;
}
// 仅查询自己所在组的任务 added by songx at 20240820
List<String> allGroupNames = UserSessionUtils.getAllGroupName();
if (CollectionUtils.isNotEmpty(allGroupNames)) {
queryMap.put("groupNames", allGroupNames);
return;
}
// 如果没有组,则查看所在厂区的任务
List<String> factoryNames = UserSessionUtils.getFactoryName();
if (CollectionUtils.isNotEmpty(factoryNames)) {
queryMap.put("factoryNames", factoryNames);
return;
}
// 如果没有厂区,则查看所在公司的任务
List<String> companyCodes = UserSessionUtils.getCompanyCode();
if (CollectionUtils.isNotEmpty(companyCodes)) {
queryMap.put("companyCodes", companyCodes);
return;
}
// 当用户无组织机构时,抛出异常
throw new PlatException("当前用户未绑定组织机构,无法操作数据,请联系管理员!");
}
}
}
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
<EF:EFInput blockId="inqu_status" row="0" ename="productName" cname="产品名称" placeholder="模糊查询" colWidth="3"/> <EF:EFInput blockId="inqu_status" row="0" ename="productName" cname="产品名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="createdTime" cname="生产任务日期" role="date" <EF:EFDatePicker blockId="inqu_status" row="0" ename="createdTime" cname="生产任务日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/> format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<%--<EF:EFDatePicker blockId="inqu_status" row="0" ename="complete_date" cname="生产完工日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>--%>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="completeDate" cname="生产完工日期" role="date" <EF:EFDatePicker blockId="inqu_status" row="0" ename="completeDate" cname="生产完工日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/> format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
</div> </div>
...@@ -35,13 +33,12 @@ ...@@ -35,13 +33,12 @@
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="账套" hidden="true"/> <EF:EFColumn ename="accountCode" cname="账套" hidden="true"/>
<%--blockName="factoryCodeBox_block_id"--%>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="180" align="center" readOnly="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="true" width="140" align="center" readOnly="true"/> <EF:EFColumn ename="projName" cname="项目名称" enable="true" width="140" align="center" readOnly="true"/>
<EF:EFColumn ename="createdTime" cname="生产任务日期" width="120" enable="true" readonly="false" align="center" editType="date" <EF:EFColumn ename="createdTime" cname="生产任务日期" width="120" enable="true" readonly="false" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="taskCode" cname="生产任务单号" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="taskCode" cname="生产任务单号" width="130" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="productCode" cname="产品编码" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="productCode" cname="产品编码" width="100" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="productName" cname="产品名称" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="productName" cname="产品名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="processName" cname="工序" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="processName" cname="工序" width="100" enable="false" readonly="true" align="center"/>
...@@ -55,7 +52,6 @@ ...@@ -55,7 +52,6 @@
<EF:EFColumn ename="quantity" cname="任务数量" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="quantity" cname="任务数量" width="100" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="finishQuantity" cname="完工数量" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="finishQuantity" cname="完工数量" width="100" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="unfinishQuantity" cname="未完工数量" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="unfinishQuantity" cname="未完工数量" width="100" enable="false" readonly="true" align="center"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </EF:EFPage>
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/10
Time: 15:29
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html> <!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
...@@ -30,9 +23,9 @@ ...@@ -30,9 +23,9 @@
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="账套" hidden="true"/> <EF:EFColumn ename="accountCode" cname="账套" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="180" align="center" readOnly="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="projName" cname="项目名称" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFColumn ename="workCode" cname="报工单号" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="workCode" cname="报工单号" width="130" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="productCode" cname="产品编码" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="productCode" cname="产品编码" width="100" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="productName" cname="产品名称" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="productName" cname="产品名称" width="100" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="processName" cname="工序" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="processName" cname="工序" width="100" enable="false" readonly="true" align="center"/>
......
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