Commit bd6f3e10 by 宋祥

1.管理员看所有数据,新增工序查询条件,组织机构支持修改

parent cd364bb0
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,11 +102,8 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -91,11 +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));
} }
// 仅查询自己所在组的任务 added by songx at 20240820 // 设置组过滤条件
List<String> allGroupNames = UserSessionUtils.getAllGroupName(); this.setGroupCondition(queryMap);
// 当用户无组的时候,集合中添加空字符串用于查询,如果不加会查询出所有的数据
allGroupNames.add(" ");
queryMap.put("groupNames", allGroupNames);
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, "查询失败");
...@@ -103,18 +111,24 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -103,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, "查询失败");
...@@ -122,6 +136,23 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -122,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();
...@@ -259,5 +290,3 @@ public class ServiceHGSC007 extends ServiceEPBase { ...@@ -259,5 +290,3 @@ public class ServiceHGSC007 extends ServiceEPBase {
} }
} }
...@@ -110,29 +110,64 @@ public class ServiceXSOG0801A extends ServiceEPBase { ...@@ -110,29 +110,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());
} }
...@@ -141,27 +176,20 @@ public class ServiceXSOG0801A extends ServiceEPBase { ...@@ -141,27 +176,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="明细信息">
......
...@@ -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