Commit 51b7e3eb by liuyang

2024-05-22

1、更改工序设置,公司只能选择当前用户所在公司,负责人默认选中登录用户,负责人只能选中当前公司用户
2、更改工序单价,公司只能选择当前用户所在公司和工序
3.更改工艺流程,公司只能选择当前用户所在公司和工序
parent 7e4d4252
......@@ -221,6 +221,8 @@ public enum DdynamicEnum {
put("orgType", OrgTypeEnum.COMPANY.getCode());
}}),
USER_ID_BOX_BLOCK_ID("user_block_id","loginName","userName","XSOG0801.queryUserByOrgIdBack"),
/**
* 模块:工序编码
* 用途:工序编码下拉框
......
......@@ -2,14 +2,23 @@ package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sj.domain.HGSJ002;
import com.baosight.hggp.hg.sj.domain.HGSJ002A;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
......@@ -21,8 +30,22 @@ public class ServiceHGPZ005B extends ServiceEPBase {
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSJ002.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSJ002.FIELD_STATUS, CommonConstant.YesNo.YES_1);
List<Org> orgList = HGXSTools.XsOrg.queryByUser();
if (CollectionUtils.isNotEmpty(orgList)){
Org org = orgList.get(0);
if (!org.getOrgType().equals("company")) {
//如果不是公司公司,则找到上一级
Org org1 = HGXSTools.XsOrg.queryCompany(org.getOrgId());
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSJ002.FIELD_FACTORY_CODE, org1.getOrgId());
}else {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSJ002.FIELD_FACTORY_CODE, org.getOrgId());
}
}
String userId = "admin".equals(UserSessionUtils.getUserId())?"":UserSessionUtils.getUserId();
inInfo = super.query(inInfo, HGSJ002.QUERY, new HGSJ002());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID),null);
Map qarma = new HashMap();
qarma.put(User.FIELD_USER_ID,userId);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID),qarma);
return inInfo;
}
......
......@@ -4,8 +4,13 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sj.domain.HGSJ001;
import com.baosight.hggp.hg.sj.domain.HGSJ002A;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -15,11 +20,9 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author LiuYang
......@@ -31,9 +34,14 @@ public class ServiceHGSJ001 extends ServiceEPBase {
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSJ001.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HGSJ001.QUERY, new HGSJ001());
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.USER_BLOCK_ID),null
);
Map qarma = new HashMap();
String userId = "admin".equals(UserSessionUtils.getUserId())?"":UserSessionUtils.getUserId();
qarma.put(User.FIELD_USER_ID,userId);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID),qarma);
qarma.clear();
List orgIds = getOrgId();
qarma.put(Org.FIELD_ORG_ID,orgIds);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
return inInfo;
}
......@@ -139,8 +147,33 @@ public class ServiceHGSJ001 extends ServiceEPBase {
public void queryDeviceCode(HGSJ001 hgsj001){
Map<String,Object> map = new HashMap<>();
map.put(HGSJ001.FIELD_PROCESS_NAME,hgsj001.getProcessName().trim());
map.put(HGSJ001.FIELD_FACTORY_CODE,hgsj001.getFactoryCode());
map.put(HGSJ001.FIELD_DELETE_FLAG,hgsj001.getDeleteFlag());
List<HGSJ001> hgsj001s = this.dao.query(HGSJ001.QUERY,map);
AssertUtils.isNotEmpty(hgsj001s, String.format("工序名称[%s]已存在,添加失败!", hgsj001.getProcessName()));
AssertUtils.isNotEmpty(hgsj001s, String.format("公司名称[%s]-工序名称[%s]已存在,添加失败!", hgsj001.getFactoryName(),hgsj001.getProcessName()));
}
public List<String> getOrgId(){
Map<String, Object> orgMap = new HashMap();
List<Org> orgList = HGXSTools.XsOrg.queryByUser();
if (CollectionUtils.isNotEmpty(orgList)){
Org org = orgList.get(0);
if (!org.getOrgType().equals("company")) {
//如果不是公司公司,则找到上一级
Org org1 = HGXSTools.XsOrg.queryCompany(org.getOrgId());
orgMap.put("orgId",org.getParentOrgId());
}else {
orgMap.put("orgId", org.getParentOrgId());
}
}
List<HashMap<String, Object>> orgIdChildList = this.dao.query("XSOG01.queryOrgChild", orgMap);
List<String> strList = new ArrayList();
Iterator var6 = orgIdChildList.iterator();
while (var6.hasNext()) {
HashMap map = (HashMap) var6.next();
strList.add(map.get("ORG_ID").toString());
}
return strList;
}
}
......@@ -5,8 +5,10 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sj.domain.HGSJ002;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.ErrorCodeUtils;
import com.baosight.hggp.util.LogUtils;
......@@ -34,7 +36,10 @@ public class ServiceHGSJ002 extends ServiceEPBase {
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSJ002.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HGSJ002.QUERY, new HGSJ002());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID),null);
Map qarma = new HashMap();
String userId = "admin".equals(UserSessionUtils.getUserId())?"":UserSessionUtils.getUserId();
qarma.put(User.FIELD_USER_ID,userId);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID),qarma);
return inInfo;
}
......
......@@ -35,7 +35,10 @@ public class ServiceHGSJ002A extends ServiceEPBase {
//inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HGPZ002A.FIELD_FLOW_CODE,inInfo.get("inqu_status-0-flowCode"));
String factoryCode = inInfo.getCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HGSJ002A.FIELD_FACTORY_CODE).toString();
inInfo = super.query(inInfo, HGSJ002A.QUERY, new HGSJ002A());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.PROCESS_CODE_BLOCK_ID),null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.PROCESS_CODE_BLOCK_ID),
new HashMap<String,Object>(){{
put(HGSJ002A.FIELD_FACTORY_CODE,factoryCode);
}});
return inInfo;
}
......
......@@ -7,8 +7,12 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sj.domain.HGSJ002;
import com.baosight.hggp.hg.sj.domain.HGSJ002A;
import com.baosight.hggp.hg.sj.domain.HGSJ003;
import com.baosight.hggp.hg.sj.tools.HGSJTools;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -20,6 +24,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
......@@ -34,7 +39,24 @@ public class ServiceHGSJ003 extends ServiceEPBase {
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSJ003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HGSJ003.QUERY, new HGSJ003());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.PROCESS_CODE_BLOCK_ID),null);
List asList = new ArrayList<>();
Map qarma = new HashMap();
String userId = "admin".equals(UserSessionUtils.getUserId())?"":UserSessionUtils.getUserId();
qarma.put(User.FIELD_USER_ID,userId);
asList.add(DdynamicEnum.COMPANY_BOX_BLOCK_ID);
asList.add(DdynamicEnum.PROCESS_CODE_BLOCK_ID);
List<Org> orgList = HGXSTools.XsOrg.queryByUser();
if (CollectionUtils.isNotEmpty(orgList)){
Org org = orgList.get(0);
if (!org.getOrgType().equals("company")) {
//如果不是公司公司,则找到上一级
Org org1 = HGXSTools.XsOrg.queryCompany(org.getOrgId());
qarma.put(HGSJ002A.FIELD_FACTORY_CODE,org1.getOrgId());
}else {
qarma.put(HGSJ002A.FIELD_FACTORY_CODE,org.getOrgId());
}
}
CommonMethod.initBlock(inInfo, asList, qarma);
return inInfo;
}
......
......@@ -223,7 +223,8 @@
A.ORG_TYPE AS "orgType",
A.ACCOUNT_CODE AS "accounCcode",
A.FACTORY_CODE AS "factoryCode",
A.COMPANY_CODE AS "companyCode"
A.COMPANY_CODE AS "companyCode",
A.PARENT_ORG_ID as "parentOrgId"
FROM ${platSchema}.TXSOG01 A, ${platSchema}.TXSOG02 B, ${platSchema}.XS_USER C
WHERE 1=1
AND A.ORG_ID = B.ORG_ID
......
......@@ -9,8 +9,13 @@
<%@ 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();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<EF:EFPage title="工序设置">
<EF:EFRegion id="inqu" title="查询条件">
......@@ -59,7 +64,7 @@
<EF:EFComboColumn ename="computeType" cname="计算类型" width="80" enable="true" align="center" required="true">
<EF:EFCodeOption codeName="hggp.hgsj.computeType"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="princ" cname="负责人"
<EF:EFComboColumn ename="princ" cname="负责人" defaultValue="${loginName}"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="120" required="true"
......
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