Commit bd6f3e10 by 宋祥

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

parent cd364bb0
package com.baosight.hggp.hg.sc.service;
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.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
......@@ -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.Org;
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.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
......@@ -22,10 +24,12 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
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.lang.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -66,9 +70,16 @@ public class ServiceHGSC007 extends ServiceEPBase {
return list;
}
/**
* 初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产任务", operType = "查询", operDesc = "初始化页面")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROCESS_CODE_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC007().eiMetadata);
// inInfo = super.query(inInfo, HGSC007.QUERY, new HGSC007());
} catch (PlatException e) {
......@@ -91,11 +102,8 @@ public class ServiceHGSC007 extends ServiceEPBase {
if (StringUtils.isNotBlank(creatTime)) {
queryMap.put(HGSC007.FIELD_created_time, StringUtil.removeHorizontalLine(creatTime));
}
// 仅查询自己所在组的任务 added by songx at 20240820
List<String> allGroupNames = UserSessionUtils.getAllGroupName();
// 当用户无组的时候,集合中添加空字符串用于查询,如果不加会查询出所有的数据
allGroupNames.add(" ");
queryMap.put("groupNames", allGroupNames);
// 设置组过滤条件
this.setGroupCondition(queryMap);
inInfo = super.query(inInfo, HGSC007.QUERY, new HGSC007());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -103,18 +111,24 @@ public class ServiceHGSC007 extends ServiceEPBase {
return inInfo;
}
/**
* 统计
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产任务", operType = "查询", operDesc = "APP查询数量")
public Integer count(EiInfo inInfo) {
Integer count = null;
try {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
String creatTime = block.getCellStr(ACConstants.ROW_CODE_0, HGSC007.FIELD_created_time);
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String creatTime = MapUtils.getString(queryMap, HGSC007.FIELD_created_time);
if (StringUtils.isNotBlank(creatTime)) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSC007.FIELD_created_time,
StringUtil.removeHorizontalLine(creatTime));
queryMap.put(HGSC007.FIELD_created_time, 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) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -122,6 +136,23 @@ public class ServiceHGSC007 extends ServiceEPBase {
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查询当前登陆用户角色所属公司")
public List<Company> getRoleCompany(EiInfo inInfo) {
List<Company> companyList = UserSessionUtils.getRoleCompany();
......@@ -259,5 +290,3 @@ public class ServiceHGSC007 extends ServiceEPBase {
}
}
......@@ -110,58 +110,86 @@ public class ServiceXSOG0801A extends ServiceEPBase {
public EiInfo save(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String parentOrgId = queryRow.get("parentOrgId").toString();
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 非管理员组织机构编码前缀增加企业编码 added by songx at 2024-01-15
String accountCode = UserSessionUtils.getAccountCode();
List<Map> newRows = new ArrayList<>();
List<Map> addRows = new ArrayList<>();
List<Map> modifyRows = new ArrayList<>();
for (Map row : resultRows) {
// 已存在的数据跳过
String orgId = MapUtils.getString(row, "orgId");
if (StringUtils.isNotBlank(orgId)) {
continue;
}
orgId = SequenceGenerator.getNextSequence(HGConstant.SequenceId.ORG_CODE);
row.put("orgId", orgId);
row.put("orgEname", orgId);
row.put("accountCode", accountCode);
row.put("establishDate", DateUtils.formatShort(MapUtils.getString(row, "establishDate")));
row.put("parentOrgId", queryRow.get("parentOrgId"));
row.put("recCreator", UserSession.getLoginName());
// 厂区代码
if (OrgTypeEnum.FACTORY.getCode().equals(row.get("orgType"))) {
row.put("factoryCode", orgId);
row.put("factoryName", row.get("orgCname"));
} else {
Org factoryOrg = HGXSTools.XsOrg.queryFactory(queryRow.get("parentOrgId").toString());
row.put("factoryCode", factoryOrg == null ? "" : factoryOrg.getOrgId());
row.put("factoryName", factoryOrg == null ? "" : factoryOrg.getOrgCname());
}
// 公司代码
if (OrgTypeEnum.COMPANY.getCode().equals(row.get("orgType"))) {
row.put("companyCode", orgId);
row.put("companyName", row.get("orgCname"));
buildModifyData(row);
modifyRows.add(row);
} else {
Org companyOrg = HGXSTools.XsOrg.queryCompany(queryRow.get("parentOrgId").toString());
row.put("companyCode", companyOrg == null ? "" : companyOrg.getOrgId());
row.put("companyName", companyOrg == null ? "" : companyOrg.getOrgCname());
buildAddData(row, parentOrgId, accountCode);
addRows.add(row);
}
newRows.add(row);
}
if (CollectionUtils.isEmpty(newRows)) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("请新增一行输入需要新增的数据");
return inInfo;
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);
}
EiInfo call = new EiInfo();
call.set("list", newRows);
call.set(EiConstant.serviceId, "S_XS_87");
XServiceManager.call(call);
inInfo = this.query(inInfo);
inInfo.setMsg("新增成功");
inInfo.setMsg("保存成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增组织机构失败");
LogUtils.setDetailMsg(inInfo, e, "保存组织机构失败");
}
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("orgEname", orgId);
row.put("accountCode", accountCode);
row.put("establishDate", DateUtils.formatShort(MapUtils.getString(row, "establishDate")));
row.put("parentOrgId", parentOrgId);
row.put("recCreator", UserSession.getLoginName());
// 厂区代码
if (OrgTypeEnum.FACTORY.getCode().equals(row.get("orgType"))) {
row.put("factoryCode", orgId);
row.put("factoryName", row.get("orgCname"));
} else {
Org factoryOrg = HGXSTools.XsOrg.queryFactory(parentOrgId);
row.put("factoryCode", factoryOrg == null ? "" : factoryOrg.getOrgId());
row.put("factoryName", factoryOrg == null ? "" : factoryOrg.getOrgCname());
}
// 公司代码
if (OrgTypeEnum.COMPANY.getCode().equals(row.get("orgType"))) {
row.put("companyCode", orgId);
row.put("companyName", row.get("orgCname"));
} else {
Org companyOrg = HGXSTools.XsOrg.queryCompany(parentOrgId);
row.put("companyCode", companyOrg == null ? "" : companyOrg.getOrgId());
row.put("companyName", companyOrg == null ? "" : companyOrg.getOrgCname());
}
}
/**
* 构建修改数据
*
* @param row
*/
private void buildModifyData(Map row) {
row.put("establishDate", DateUtils.formatShort(row.get("establishDate")));
row.put("recRevisor", UserSession.getLoginName());
}
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/10
Time: 15:29
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
String loginName = UserSession.getLoginName();
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<EF:EFPage title="生产任务">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="inqu_status-0-orderDetailId" cname="订单详情ID" type="hidden"/>
<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="groupName" cname="班组名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="createdTime" cname="生产任务日期" role="date"
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"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="inqu_status-0-orderDetailId" cname="订单详情ID" type="hidden"/>
<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:EFDatePicker blockId="inqu_status" row="0" ename="createdTime" cname="生产任务日期" role="date"
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"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
</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 id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" 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="companyName" 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"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<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="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="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="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="totalWeight" cname="任务总重(KG)" width="110" 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="120" 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="unfinishQuantity" cname="未完工数量" width="100" enable="false" readonly="true" align="center"/>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" 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="companyName" 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"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<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="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="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="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="totalWeight" cname="任务总重(KG)" width="110" 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="120" 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="unfinishQuantity" cname="未完工数量" width="100" enable="false" readonly="true" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -18,12 +18,12 @@
</div>
</EF:EFRegion>
<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="orgEname" cname="组织编码" readonly="true" hidden="true"/>
<EF:EFColumn ename="orgCname" cname="组织名称" required="true" locked="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:EFComboColumn>
<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