Commit 07ae7764 by 宋祥

Merge branch 'dev-sx' of http://git.pseer.com:8800/platform/hg-smart into dev

 Conflicts:
	src/main/java/com/baosight/hggp/hg/sc/sql/HGSC007.xml
	src/main/java/com/baosight/hggp/hg/sc/sql/HGSC008.xml
	src/main/resources/application.properties
	src/main/resources/quartz.properties
parents 923be607 87e9ad73
...@@ -142,15 +142,36 @@ public class UserSessionUtils extends UserSession { ...@@ -142,15 +142,36 @@ public class UserSessionUtils extends UserSession {
if (CollectionUtils.isEmpty(orgs)) { if (CollectionUtils.isEmpty(orgs)) {
return new ArrayList<>(); return new ArrayList<>();
} }
List<String> prodGroupCodes = new ArrayList<>(); List<String> allGroupCodes = new ArrayList<>();
for (Org org : orgs) { for (Org org : orgs) {
if (OrgTypeEnum.PROD_GROUP.getCode().equals(org.getOrgType()) if (OrgTypeEnum.PROD_GROUP.getCode().equals(org.getOrgType())
|| OrgTypeEnum.CUT_GROUP.getCode().equals(org.getOrgType()) || OrgTypeEnum.CUT_GROUP.getCode().equals(org.getOrgType())
|| OrgTypeEnum.SYN_GROUP.getCode().equals(org.getOrgType())) { || OrgTypeEnum.SYN_GROUP.getCode().equals(org.getOrgType())) {
prodGroupCodes.add(org.getOrgId()); allGroupCodes.add(org.getOrgId());
} }
} }
return prodGroupCodes; return allGroupCodes;
}
/**
* 获取登录用户的所有组名称
*
* @return
*/
public static List<String> getAllGroupName() {
List<Org> orgs = HGXSTools.XsOrg.queryByUser();
if (CollectionUtils.isEmpty(orgs)) {
return new ArrayList<>();
}
List<String> allGroupNames = new ArrayList<>();
for (Org org : orgs) {
if (OrgTypeEnum.PROD_GROUP.getCode().equals(org.getOrgType())
|| OrgTypeEnum.CUT_GROUP.getCode().equals(org.getOrgType())
|| OrgTypeEnum.SYN_GROUP.getCode().equals(org.getOrgType())) {
allGroupNames.add(org.getOrgCname());
}
}
return allGroupNames.stream().distinct().collect(Collectors.toList());
} }
/** /**
......
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.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
...@@ -11,6 +12,7 @@ import com.baosight.hggp.hg.xs.domain.Company; ...@@ -11,6 +12,7 @@ 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;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtil; import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
...@@ -22,10 +24,12 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -22,10 +24,12 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -66,9 +70,16 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -66,9 +70,16 @@ public class ServiceHGSC007 extends ServiceEPBase {
return list; return list;
} }
/**
* 初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产任务", operType = "查询", operDesc = "初始化页面") @OperationLogAnnotation(operModul = "生产任务", operType = "查询", operDesc = "初始化页面")
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROCESS_CODE_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC007().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC007().eiMetadata);
// inInfo = super.query(inInfo, HGSC007.QUERY, new HGSC007()); // inInfo = super.query(inInfo, HGSC007.QUERY, new HGSC007());
} catch (PlatException e) { } catch (PlatException e) {
...@@ -91,8 +102,8 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -91,8 +102,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));
} }
// 仅查询自己所在组的任务 // 设置组过滤条件
queryMap.put("groupCodes", UserSessionUtils.getAllGroupCode()); this.setGroupCondition(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, "查询失败");
...@@ -100,18 +111,24 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -100,18 +111,24 @@ public class ServiceHGSC007 extends ServiceEPBase {
return inInfo; return inInfo;
} }
/**
* 统计
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产任务", operType = "查询", operDesc = "APP查询数量") @OperationLogAnnotation(operModul = "生产任务", operType = "查询", operDesc = "APP查询数量")
public Integer count(EiInfo inInfo) { public Integer count(EiInfo inInfo) {
Integer count = null; Integer count = null;
try { try {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String creatTime = block.getCellStr(ACConstants.ROW_CODE_0, HGSC007.FIELD_created_time); String creatTime = MapUtils.getString(queryMap, HGSC007.FIELD_created_time);
if (StringUtils.isNotBlank(creatTime)) { if (StringUtils.isNotBlank(creatTime)) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSC007.FIELD_created_time, queryMap.put(HGSC007.FIELD_created_time, StringUtil.removeHorizontalLine(creatTime));
StringUtil.removeHorizontalLine(creatTime));
} }
Map paramMap = EiInfoUtils.getFirstRow(inInfo); // 设置组过滤条件
count = super.count(HGSC007.COUNT, paramMap); this.setGroupCondition(queryMap);
count = super.count(HGSC007.COUNT, queryMap);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
...@@ -119,6 +136,23 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -119,6 +136,23 @@ public class ServiceHGSC007 extends ServiceEPBase {
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();
...@@ -256,5 +290,3 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -256,5 +290,3 @@ public class ServiceHGSC007 extends ServiceEPBase {
} }
} }
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.dao.DaoUtils; 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.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;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -12,11 +13,9 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -12,11 +13,9 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @author wwl * @author wwl
* @version 1.0 2024/5/24 * @version 1.0 2024/5/24
...@@ -39,7 +38,13 @@ public class ServiceHGSC008 extends ServiceEPBase { ...@@ -39,7 +38,13 @@ public class ServiceHGSC008 extends ServiceEPBase {
@OperationLogAnnotation(operModul = "生产报工单", operType = "查询", operDesc = "查询") @OperationLogAnnotation(operModul = "生产报工单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo,HGSC008.QUERY,new HGSC008() ); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 仅查询自己所在组的任务 added by songx at 20240820
List<String> allGroupNames = UserSessionUtils.getAllGroupName();
// 当用户无组的时候,集合中添加一个不存在的组用于查询,如果不加会查询出所有的数据
allGroupNames.add(" ");
queryMap.put("groupNames", allGroupNames);
inInfo = super.query(inInfo, HGSC008.QUERY, new HGSC008());
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
......
...@@ -144,6 +144,9 @@ ...@@ -144,6 +144,9 @@
<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>
<isNotEmpty prepend=" AND " property="groupNames">
GROUP_NAME IN <iterate close=")" open="(" conjunction="," property="groupNames">#groupNames[]#</iterate>
</isNotEmpty>
</sql> </sql>
<sql id="appCondition"> <sql id="appCondition">
...@@ -247,134 +250,9 @@ ...@@ -247,134 +250,9 @@
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007 WHERE 1=1 SELECT COUNT(*) FROM ${hggpSchema}.HGSC007 WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<include refid="customCondition"/>
</select> </select>
<!--
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
mat_id = #matId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderId">
order_id = #orderId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderDetailId">
order_detail_id = #orderDetailId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowId">
tech_flow_id = #techFlowId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowName">
tech_flow_name = #techFlowName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventProcessId">
invent_process_id = #inventProcessId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processCode">
process_code = #processCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processName">
process_name = #processName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processOrder">
process_order = #processOrder#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="taskCode">
task_code = #taskCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productType">
product_type = #productType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productCode">
product_code = #productCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productName">
product_name = #productName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planStartDate">
plan_start_date = #planStartDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planEndDate">
plan_end_date = #planEndDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
factory_name = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
group_code = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
group_name = #groupName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="completeDate">
complete_date = #completeDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="quantity">
quantity = #quantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="finishQuantity">
finish_quantity = #finishQuantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unfinishQuantity">
unfinish_quantity = #unfinishQuantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="singleWeight">
single_weight = #singleWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="totalWeight">
total_weight = #totalWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="finishWeight">
finish_weight = #finishWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unfinishWeight">
unfinish_weight = #unfinishWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
created_by = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
created_name = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
created_time = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
-->
<insert id="insert"> <insert id="insert">
INSERT INTO ${hggpSchema}.HGSC007 (id, INSERT INTO ${hggpSchema}.HGSC007 (id,
mat_id, <!-- 物料清单ID --> mat_id, <!-- 物料清单ID -->
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
Generate time : 2024-05-28 16:11:25
Version : 1.0
schema : hggp
tableName : HGSC008
id BIGINT NOT NULL primarykey,
mat_id BIGINT NOT NULL,
task_id BIGINT NOT NULL,
tech_flow_id BIGINT,
tech_flow_name BIGINT,
invent_process_id BIGINT,
process_code VARCHAR,
process_name VARCHAR,
process_order BIGINT,
company_code VARCHAR NOT NULL,
company_name VARCHAR NOT NULL,
dep_code VARCHAR,
dep_name VARCHAR,
proj_code VARCHAR,
proj_name VARCHAR,
work_code VARCHAR,
product_type TINYINT,
product_code VARCHAR,
product_name VARCHAR,
plan_start_date VARCHAR,
plan_end_date VARCHAR,
factory_code VARCHAR,
factory_name VARCHAR,
group_code VARCHAR,
group_name VARCHAR,
register_date VARCHAR,
quantity TINYINT,
single_weight DECIMAL,
total_weight DECIMAL,
account_code VARCHAR NOT NULL,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
updated_time VARCHAR
-->
<sqlMap namespace="HGSC008"> <sqlMap namespace="HGSC008">
<sql id="condition"> <sql id="condition">
...@@ -156,8 +115,16 @@ ...@@ -156,8 +115,16 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <sql id="customCondition">
resultClass="com.baosight.hggp.hg.sc.domain.HGSC008"> <isNotEmpty prepend=" AND " property="groupCodes">
GROUP_CODE IN <iterate close=")" open="(" conjunction="," property="groupCodes">#groupCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupNames">
GROUP_NAME IN <iterate close=")" open="(" conjunction="," property="groupNames">#groupNames[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC008">
SELECT SELECT
id as "id", id as "id",
mat_id as "matId", <!-- 物料清单ID --> mat_id as "matId", <!-- 物料清单ID -->
...@@ -201,6 +168,7 @@ ...@@ -201,6 +168,7 @@
FROM ${hggpSchema}.HGSC008 FROM ${hggpSchema}.HGSC008
WHERE 1=1 WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<include refid="customCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -209,125 +177,14 @@ ...@@ -209,125 +177,14 @@
register_date desc, id desc register_date desc, id desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</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 WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<include refid="customCondition"/>
</select> </select>
<!--
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
mat_id = #matId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="taskId">
task_id = #taskId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowId">
tech_flow_id = #techFlowId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowName">
tech_flow_name = #techFlowName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventProcessId">
invent_process_id = #inventProcessId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processCode">
process_code = #processCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processName">
process_name = #processName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processOrder">
process_order = #processOrder#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="workCode">
work_code = #workCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productType">
product_type = #productType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productCode">
product_code = #productCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productName">
product_name = #productName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planStartDate">
plan_start_date = #planStartDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planEndDate">
plan_end_date = #planEndDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
factory_name = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
group_code = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
group_name = #groupName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="registerDate">
register_date = #registerDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="quantity">
quantity = #quantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="singleWeight">
single_weight = #singleWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="totalWeight">
total_weight = #totalWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
created_by = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
created_name = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
created_time = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
-->
<insert id="insert"> <insert id="insert">
INSERT INTO ${hggpSchema}.HGSC008 (id, INSERT INTO ${hggpSchema}.HGSC008 (id,
mat_id, <!-- 物料清单ID --> mat_id, <!-- 物料清单ID -->
......
...@@ -109,29 +109,64 @@ public class ServiceXSOG0801A extends ServiceEPBase { ...@@ -109,29 +109,64 @@ public class ServiceXSOG0801A extends ServiceEPBase {
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String parentOrgId = queryRow.get("parentOrgId").toString();
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 非管理员组织机构编码前缀增加企业编码 added by songx at 2024-01-15 // 非管理员组织机构编码前缀增加企业编码 added by songx at 2024-01-15
String accountCode = UserSessionUtils.getAccountCode(); String accountCode = UserSessionUtils.getAccountCode();
List<Map> newRows = new ArrayList<>(); List<Map> addRows = new ArrayList<>();
List<Map> modifyRows = new ArrayList<>();
for (Map row : resultRows) { for (Map row : resultRows) {
// 已存在的数据跳过 // 已存在的数据跳过
String orgId = MapUtils.getString(row, "orgId"); String orgId = MapUtils.getString(row, "orgId");
if (StringUtils.isNotBlank(orgId)) { if (StringUtils.isNotBlank(orgId)) {
continue; buildModifyData(row);
modifyRows.add(row);
} else {
buildAddData(row, parentOrgId, accountCode);
addRows.add(row);
}
}
if (CollectionUtils.isNotEmpty(addRows)) {
EiInfo call = new EiInfo();
call.set("list", addRows);
call.set(EiConstant.serviceId, "S_XS_87");
XServiceManager.call(call);
}
if (CollectionUtils.isNotEmpty(modifyRows)) {
EiInfo call = new EiInfo();
call.set("list", modifyRows);
call.set(EiConstant.serviceId, "S_XS_89");
XServiceManager.call(call);
}
inInfo = this.query(inInfo);
inInfo.setMsg("保存成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存组织机构失败");
} }
orgId = SequenceGenerator.getNextSequence(HGConstant.SequenceId.ORG_CODE); return inInfo;
}
/**
* 构建添加数据
*
* @param row
* @param parentOrgId
* @param accountCode
*/
private void buildAddData(Map row, String parentOrgId, String accountCode) {
String orgId = SequenceGenerator.getNextSequence(HGConstant.SequenceId.ORG_CODE);
row.put("orgId", orgId); row.put("orgId", orgId);
row.put("orgEname", orgId); row.put("orgEname", orgId);
row.put("accountCode", accountCode); row.put("accountCode", accountCode);
row.put("establishDate", DateUtils.formatShort(MapUtils.getString(row, "establishDate"))); row.put("establishDate", DateUtils.formatShort(MapUtils.getString(row, "establishDate")));
row.put("parentOrgId", queryRow.get("parentOrgId")); row.put("parentOrgId", parentOrgId);
row.put("recCreator", UserSession.getLoginName()); row.put("recCreator", UserSession.getLoginName());
// 厂区代码 // 厂区代码
if (OrgTypeEnum.FACTORY.getCode().equals(row.get("orgType"))) { if (OrgTypeEnum.FACTORY.getCode().equals(row.get("orgType"))) {
row.put("factoryCode", orgId); row.put("factoryCode", orgId);
row.put("factoryName", row.get("orgCname")); row.put("factoryName", row.get("orgCname"));
} else { } else {
Org factoryOrg = HGXSTools.XsOrg.queryFactory(queryRow.get("parentOrgId").toString()); Org factoryOrg = HGXSTools.XsOrg.queryFactory(parentOrgId);
row.put("factoryCode", factoryOrg == null ? "" : factoryOrg.getOrgId()); row.put("factoryCode", factoryOrg == null ? "" : factoryOrg.getOrgId());
row.put("factoryName", factoryOrg == null ? "" : factoryOrg.getOrgCname()); row.put("factoryName", factoryOrg == null ? "" : factoryOrg.getOrgCname());
} }
...@@ -140,27 +175,20 @@ public class ServiceXSOG0801A extends ServiceEPBase { ...@@ -140,27 +175,20 @@ public class ServiceXSOG0801A extends ServiceEPBase {
row.put("companyCode", orgId); row.put("companyCode", orgId);
row.put("companyName", row.get("orgCname")); row.put("companyName", row.get("orgCname"));
} else { } else {
Org companyOrg = HGXSTools.XsOrg.queryCompany(queryRow.get("parentOrgId").toString()); Org companyOrg = HGXSTools.XsOrg.queryCompany(parentOrgId);
row.put("companyCode", companyOrg == null ? "" : companyOrg.getOrgId()); row.put("companyCode", companyOrg == null ? "" : companyOrg.getOrgId());
row.put("companyName", companyOrg == null ? "" : companyOrg.getOrgCname()); row.put("companyName", companyOrg == null ? "" : companyOrg.getOrgCname());
} }
newRows.add(row);
}
if (CollectionUtils.isEmpty(newRows)) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("请新增一行输入需要新增的数据");
return inInfo;
} }
EiInfo call = new EiInfo();
call.set("list", newRows); /**
call.set(EiConstant.serviceId, "S_XS_87"); * 构建修改数据
XServiceManager.call(call); *
inInfo = this.query(inInfo); * @param row
inInfo.setMsg("新增成功"); */
} catch (Exception e) { private void buildModifyData(Map row) {
LogUtils.setDetailMsg(inInfo, e, "新增组织机构失败"); row.put("establishDate", DateUtils.formatShort(row.get("establishDate")));
} row.put("recRevisor", UserSession.getLoginName());
return inInfo;
} }
} }
<%--
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" %>
...@@ -22,7 +15,6 @@ ...@@ -22,7 +15,6 @@
<EF:EFInput ename="inqu_status-0-orderDetailId" cname="订单详情ID" type="hidden"/> <EF:EFInput ename="inqu_status-0-orderDetailId" cname="订单详情ID" type="hidden"/>
<EF:EFInput ename="inqu_status-0-productCode" cname="产品编码" placeholder="模糊查询" colWidth="3"/> <EF:EFInput ename="inqu_status-0-productCode" cname="产品编码" placeholder="模糊查询" colWidth="3"/>
<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:EFInput blockId="inqu_status" row="0" ename="groupName" 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" <%--<EF:EFDatePicker blockId="inqu_status" row="0" ename="complete_date" cname="生产完工日期" role="date"
...@@ -30,6 +22,13 @@ ...@@ -30,6 +22,13 @@
<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>
<div class="row">
<EF:EFInput blockId="inqu_status" row="0" ename="groupName" cname="班组名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFSelect cname="工序" ename="processCode" blockId="inqu_status" row="0" colWidth="3" optionLabel="全部"
filter="contains">
<EF:EFOptions blockId="processCode_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
...@@ -37,22 +36,22 @@ ...@@ -37,22 +36,22 @@
<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"--%> <%--blockName="factoryCodeBox_block_id"--%>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="220" 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="120" 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="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="100" 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="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"/>
<EF:EFColumn ename="groupName" cname="生产班组" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="groupName" cname="生产班组" width="100" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="spec" cname="规格" width="100" align="right" format="{0:N2}" maxLength="10" enable="false"/> <EF:EFColumn ename="spec" cname="规格" width="100" align="right" format="{0:N2}" maxLength="10" enable="false"/>
<EF:EFColumn ename="length" cname="长(MM)" width="100" align="right" format="{0:N2}" maxLength="10" enable="false"/> <EF:EFColumn ename="length" cname="长(MM)" width="100" align="right" format="{0:N2}" maxLength="10" enable="false"/>
<EF:EFColumn ename="singleWeight" cname="单重(KG)" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="singleWeight" cname="单重(KG)" width="100" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="totalWeight" cname="任务总重(KG)" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="totalWeight" cname="任务总重(KG)" width="110" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="finishWeight" cname="完工总重(KG)" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="finishWeight" cname="完工总重(KG)" width="110" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="unfinishWeight" cname="未完工总重(KG)" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="unfinishWeight" cname="未完工总重(KG)" width="120" enable="false" readonly="true" align="center"/>
<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"/>
......
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="子组织机构"> <EF:EFRegion id="result" title="子组织机构">
<EF:EFGrid blockId="result" autoBind="false" autoDraw="false" checkMode="multiple,row" readonly="true"> <EF:EFGrid blockId="result" autoBind="false" autoDraw="false" checkMode="multiple,row">
<EF:EFColumn ename="orgId" cname="组织ID" hidden="true"/> <EF:EFColumn ename="orgId" cname="组织ID" hidden="true"/>
<EF:EFColumn ename="orgEname" cname="组织编码" readonly="true" hidden="true"/> <EF:EFColumn ename="orgEname" cname="组织编码" readonly="true" hidden="true"/>
<EF:EFColumn ename="orgCname" cname="组织名称" required="true" locked="true"/> <EF:EFColumn ename="orgCname" cname="组织名称" required="true" locked="true"/>
<EF:EFColumn ename="orgBriefName" cname="组织别名" hidden="true"/> <EF:EFColumn ename="orgBriefName" cname="组织别名" hidden="true"/>
<EF:EFComboColumn ename="orgType" cname="组织类型" align="center" required="true" > <EF:EFComboColumn ename="orgType" cname="组织类型" align="center" required="true" readonly="true">
<EF:EFOptions blockId="orgTypeBlock" textField="label" valueField="value"/> <EF:EFOptions blockId="orgTypeBlock" textField="label" valueField="value"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="orgNodeType" cname="节点类型" hidden="true" defaultValue="2"/> <%--隐藏 默认值为2--%> <EF:EFColumn ename="orgNodeType" cname="节点类型" hidden="true" defaultValue="2"/> <%--隐藏 默认值为2--%>
......
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