Commit 354074dd by yukang

Merge remote-tracking branch 'origin/dev' into dev

parents cb45a13b 0b386492
......@@ -235,42 +235,42 @@ public enum DdynamicEnum {
* 用途:用户查询
* 编写:ly
*/
USER_ID_BLOCK_ID("user_id_block_id","userId","userName","factoryCode","groupCode", "deleteFlag","HPSC008.queryUserId"),
USER_ID_BLOCK_ID("user_id_block_id","userId","userName","factoryCode","groupCode", "HPSC008.queryUserId"),
/**
* 模块:系统管理
* 用途:生产组查询
* 编写:ly
*/
GROUP_CODE_BLOCK_ID("group_code_block_id","groupCode","groupName","factoryCode", "deleteFlag","HPSC008.queryGroupCode"),
GROUP_CODE_BLOCK_ID("group_code_block_id","groupCode","groupName","factoryCode", "HPSC008.queryGroupCode"),
/**
* 模块:系统管理
* 用途:厂区查询
* 编写:ly
*/
FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName", "deleteFlag","HPSC008.queryFactoryCode"),
FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName","HPSC008.queryFactoryCode"),
/**
* 模块:系统管理
* 用途:用户查询
* 编写:ly
*/
USER_ID1_BLOCK_ID("user_id1_block_id","userId","userName","factoryCode","groupCode", "deleteFlag","HPSC008.queryUserId"),
USER_ID1_BLOCK_ID("user_id1_block_id","userId","userName","factoryCode","groupCode", "HPSC008.queryUserId"),
/**
* 模块:系统管理
* 用途:生产组查询
* 编写:ly
*/
GROUP_CODE1_BLOCK_ID("group_code1_block_id","groupCode","groupName","factoryCode", "deleteFlag","HPSC008.queryGroupCode"),
GROUP_CODE1_BLOCK_ID("group_code1_block_id","groupCode","groupName","factoryCode", "HPSC008.queryGroupCode"),
/**
* 模块:系统管理
* 用途:厂区查询
* 编写:ly
*/
FACTORY_CODE1_BLOCK_ID("factory_code1_block_id","factoryCode","factoryName", "deleteFlag","HPSC008.queryFactoryCode"),
FACTORY_CODE1_BLOCK_ID("factory_code1_block_id","factoryCode","factoryName", "HPSC008.queryFactoryCode"),
/**
......
......@@ -30,8 +30,6 @@ public class ConfigurationBean {
@Bean(name = "fileUpLoadManager")
public PlatFileUploadManagerByAmazonS3 newPlatFileUploadManagerByAmazonS3() {
String str = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.switch");
log.warn("str -> {}", str);
return new PlatFileUploadManagerByAmazonS3();
}
......
......@@ -278,8 +278,14 @@ public class HPSqlConstant {
*/
public class HPPZ013 {
// 查询
// 修改
public static final String UPDATE = "HPPZ013.update";
// 修改状态
public static final String UPDATE_STATUS = "HPPZ013.updateStatus";
// 清空生产部门
public static final String CLEAR_GROUP = "HPPZ013.clearGroup";
// 清空生产厂区
public static final String CLEAR_FACTORY = "HPPZ013.clearFactory";
}
/**
......
......@@ -15,6 +15,8 @@ import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -22,7 +24,9 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
......@@ -84,10 +88,15 @@ public class ServiceHPPZ013 extends ServiceBase {
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 数据校验
this.checkSaveData(resultRows);
// 查询数据
List<HPPZ013> dbPz023s = HPPZTools.HpPz013.list(ids);
// 写入数据
this.saveData(resultRows);
List<HPPZ01301> fPz013s = this.saveData(resultRows);
// 清理和新增关系
this.delAndAddMember(dbPz023s, fPz013s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
......@@ -106,7 +115,7 @@ public class ServiceHPPZ013 extends ServiceBase {
for (Map resultRow : resultRows) {
HPPZ01301 fPz01301 = new HPPZ01301();
fPz01301.fromMap(resultRow);
AssertUtils.isEmpty(fPz01301.getFactoryCode(), "请选择工厂");
AssertUtils.isEmpty(fPz01301.getFactoryCode(), "请选择厂区");
AssertUtils.isEmpty(fPz01301.getGroupType(), "请选择生产组类型");
AssertUtils.isEmpty(fPz01301.getGroupCode(), "请选择生产组");
AssertUtils.isEmpty(fPz01301.getUserName(), "请输入姓名");
......@@ -120,7 +129,8 @@ public class ServiceHPPZ013 extends ServiceBase {
*
* @param resultRows
*/
private void saveData(List<Map> resultRows) throws Exception {
private List<HPPZ01301> saveData(List<Map> resultRows) throws Exception {
List<HPPZ01301> fPz01301s = new ArrayList<>();
for (Map resultRow : resultRows) {
HPPZ01301 fPz01301 = new HPPZ01301();
fPz01301.fromMap(resultRow);
......@@ -131,7 +141,9 @@ public class ServiceHPPZ013 extends ServiceBase {
} else {
this.modify(fPz01301);
}
fPz01301s.add(fPz01301);
}
return fPz01301s;
}
/**
......@@ -165,28 +177,6 @@ public class ServiceHPPZ013 extends ServiceBase {
fPz01301.setUserId(userId);
fPz01301.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ013.INSERT, fPz01301);
// 添加到组织机构
this.insertOrgMember(fPz01301);
}
/**
* 用户关联组织
*
* @param fPz01301
*/
private void insertOrgMember(HPPZ01301 fPz01301) {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("loginName", fPz01301.getUserId());
inInfoRowMap.put("userId", fPz01301.getUserId());
inInfoRowMap.put("orgId", fPz01301.getGroupCode());
EiInfo inInfo = new EiInfo();
inInfo.addBlock(EiConstant.resultBlock).addRow(inInfoRowMap);
inInfo.set(EiConstant.serviceName, "XSOG0801");
inInfo.set(EiConstant.methodName, "insertUserByOrgId");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
......@@ -195,7 +185,7 @@ public class ServiceHPPZ013 extends ServiceBase {
* @param fPz01301
*/
private void modify(HPPZ01301 fPz01301) {
DaoUtils.update(HPSqlConstant.HPPZ013.UPDATE_STATUS, fPz01301);
DaoUtils.update(HPSqlConstant.HPPZ013.UPDATE, fPz01301);
}
/**
......@@ -208,14 +198,17 @@ public class ServiceHPPZ013 extends ServiceBase {
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HPPZ013> fPz013s = new ArrayList<>();
for (Map resultRow : resultRows) {
HPPZ013 fPz013 = new HPPZ013();
HPPZ01301 fPz013 = new HPPZ01301();
fPz013.fromMap(resultRow);
fPz013.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPPZ013.DELETE, fPz013);
// 从组织机构删除
this.deleteOrgMember(fPz013);
fPz013s.add(fPz013);
}
// 从组织机构删除
this.deleteOrgMember(fPz013s);
// 刷新数据
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
......@@ -226,23 +219,77 @@ public class ServiceHPPZ013 extends ServiceBase {
}
/**
* 用户删除组织
* 删除和新增组织机构关系
*
* @param delPz013s
* @param addPz01301s
*/
private void delAndAddMember(List<HPPZ013> delPz013s, List<HPPZ01301> addPz01301s) {
// 删除用工关系
this.deleteOrgMember(delPz013s);
// 重新添加组织机构关系
this.insertOrgMember(addPz01301s);
}
/**
* 用户关联组织
*
* @param fPz013
* @param addPz01301s
*/
private void deleteOrgMember(HPPZ013 fPz013) {
private void insertOrgMember(List<HPPZ01301> addPz01301s) {
if (CollectionUtils.isEmpty(addPz01301s)) {
return;
}
List<Map> addRelations = new ArrayList<>();
for (HPPZ01301 addPz01301 : addPz01301s) {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("loginName", addPz01301.getUserId());
inInfoRowMap.put("userId", addPz01301.getUserId());
inInfoRowMap.put("orgId", addPz01301.getGroupCode());
addRelations.add(inInfoRowMap);
}
EiInfo inInfo = new EiInfo();
inInfo.set("inqu_status-0-parentOrgId", fPz013.getGroupCode());
inInfo.set("result-0-userId", fPz013.getUserId());
inInfo.set("result-0-loginName", fPz013.getUserId());
inInfo.set("result-0-orgId", fPz013.getGroupCode());
inInfo.set("result-0-orgEname", fPz013.getGroupCode());
// serviceName:XSOrgManage,methodName:deleteRelationBetweenUserAndOrg
inInfo.addBlock(EiConstant.resultBlock).setRows(addRelations);
inInfo.set(EiConstant.serviceName, "XSOG0801");
inInfo.set(EiConstant.methodName, "deleteUserByOrgId");
inInfo.set(EiConstant.methodName, "insertUserByOrgId");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
* 用户删除组织
*
* @param delPz013s
*/
private void deleteOrgMember(List<HPPZ013> delPz013s) {
if (CollectionUtils.isEmpty(delPz013s)) {
return;
}
List<Map> delRelations = new ArrayList<>();
for (HPPZ013 delPz013 : delPz013s) {
String groupCode = delPz013.getGroupCode();
if (StringUtils.isBlank(groupCode)) {
continue;
}
Map deleteMap = new HashMap();
deleteMap.put("userId", delPz013.getUserId());
deleteMap.put("loginName", delPz013.getUserId());
deleteMap.put("orgId", delPz013.getGroupCode());
deleteMap.put("orgEname", delPz013.getGroupCode());
delRelations.add(deleteMap);
}
if (CollectionUtils.isEmpty(delRelations)) {
return;
}
EiInfo inInfo = new EiInfo();
inInfo.set("list", delRelations);
// serviceName:XSOrgManage,methodName:deleteRelationBetweenUserAndOrg
inInfo.set(EiConstant.serviceId, "S_XS_91");
EiInfo outInfo = XServiceManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
}
......@@ -91,6 +91,8 @@ public class ServiceHPPZ014 extends ServiceBase {
Map queryMap = EiInfoUtils.getFirstRow(inInfo, "main");
String regDate = DateUtils.formatShort(queryMap.get("regDate"));
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkData(resultRows, regDate);
// 写入数据
this.saveData(resultRows, regDate);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -102,6 +104,24 @@ public class ServiceHPPZ014 extends ServiceBase {
}
/**
* 校验数据
*
* @param resultRows
* @param regDate
*/
private void checkData(List<Map> resultRows, String regDate) {
AssertUtils.isEmpty(regDate, "登记时间不能为空");
for (Map resultRow : resultRows) {
HPPZ013 fPz013 = new HPPZ013();
fPz013.fromMap(resultRow);
AssertUtils.isEmpty(fPz013.getFactoryCode(), "请选择厂区");
AssertUtils.isEmpty(fPz013.getGroupType(), "请选择生产组类型");
AssertUtils.isEmpty(fPz013.getGroupCode(), "请选择生产组");
}
}
/**
* 保存数据
*
* @param resultRows
......
......@@ -84,6 +84,9 @@
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="gender">
USER_ID IN (SELECT LOGIN_NAME FROM ${platSchema}.XS_USER WHERE COMPANY_CODE = #companyCode# AND GENDER = #gender# )
</isNotEmpty>
......@@ -159,6 +162,21 @@
</delete>
<!-- 修改状态 -->
<update id="update">
UPDATE ${hpjxSchema}.T_HPPZ013
SET
STATUS = #status#, <!-- 状态:1-在职,2-离职 -->
FACTORY_CODE = #factoryCode#, <!-- 工厂编码 -->
FACTORY_NAME = #factoryName#, <!-- 工厂名称 -->
GROUP_TYPE = #groupType#, <!-- 部门类型 -->
GROUP_CODE = #groupCode#, <!-- 生产组编码 -->
GROUP_NAME = #groupName#, <!-- 生产组名称 -->
REMARK = #remark#, <!-- 备注 -->
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
<!-- 修改状态 -->
<update id="updateStatus">
UPDATE ${hpjxSchema}.T_HPPZ013
SET
......@@ -168,6 +186,38 @@
WHERE ID = #id#
</update>
<!-- 清空生产部门 -->
<update id="clearGroup">
UPDATE ${hpjxSchema}.T_HPPZ013
SET
FACTORY_CODE = '',
FACTORY_NAME = '',
GROUP_TYPE = '',
GROUP_CODE = '',
GROUP_NAME = '',
<include refid="updateRevise"/>
WHERE GROUP_CODE = #groupCode#
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
</update>
<!-- 清空生产厂区 -->
<update id="clearFactory">
UPDATE ${hpjxSchema}.T_HPPZ013
SET
FACTORY_CODE = '',
FACTORY_NAME = '',
GROUP_TYPE = '',
GROUP_CODE = '',
GROUP_NAME = '',
<include refid="updateRevise"/>
WHERE FACTORY_CODE = #factoryCode#
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
</update>
<select id="queryComboBox" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT DISTINCT
......
......@@ -6,11 +6,17 @@ import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.*;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.domain.HPPZ013;
import com.baosight.hpjx.hp.pz.domain.HPPZ015;
import com.baosight.hpjx.hp.pz.domain.HPPZ015A;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.pz.domain.*;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
......@@ -537,8 +543,12 @@ public class HPPZTools {
}
}
/**
* @author:songx
* @date:2024/3/14,20:59
*/
public static class HpPz013 {
public static HPPZ013 get(String userId) {
AssertUtils.isNull(userId, "工人ID不能为空");
Map queryMap = new HashMap();
......@@ -547,6 +557,50 @@ public class HPPZTools {
AssertUtils.isEmpty(results, String.format("工人ID[%s]不存在", userId));
return results.get(0);
}
/**
* @param ids
* @return
*/
public static List<HPPZ013> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPPZ013.QUERY, queryMap);
}
/**
* 清空生产部门关系
*
* @param orgId
* @param userId
* @return
*/
public static void clearGroup(String orgId, String userId) {
AssertUtils.isNull(orgId, "组织机构ID不能为空");
Map queryMap = new HashMap();
queryMap.put("groupCode", orgId);
queryMap.put("userId", userId);
DaoUtils.update(HPSqlConstant.HPPZ013.CLEAR_GROUP, queryMap);
}
/**
* 清空厂区关系
*
* @param orgId
* @param userId
* @return
*/
public static void clearFactory(String orgId, String userId) {
AssertUtils.isNull(orgId, "组织机构ID不能为空");
Map queryMap = new HashMap();
queryMap.put("factoryCode", orgId);
queryMap.put("userId", userId);
DaoUtils.update(HPSqlConstant.HPPZ013.CLEAR_FACTORY, queryMap);
}
}
/**
......
......@@ -787,8 +787,16 @@ public class ServiceHPSC002 extends ServiceBase {
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo queryInfo = new EiInfo();
queryInfo.set(HPSC002A.FIELD_DOC_ID,hpds002.getDocId());
//获取文档信息
queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",realPath+"-"+0);
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
......@@ -797,6 +805,7 @@ public class ServiceHPSC002 extends ServiceBase {
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}
}else {
FileUtils.deleteFile(realPath);
}
......
......@@ -150,8 +150,16 @@ public class ServiceHPSC002A extends ServiceEPBase {
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo queryInfo = new EiInfo();
queryInfo.set(HPSC002A.FIELD_DOC_ID,list.get(0).getDocId());
//获取文档信息
queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",realPath+"-"+0);
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
......@@ -160,6 +168,7 @@ public class ServiceHPSC002A extends ServiceEPBase {
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}
}else {
FileUtils.deleteFile(realPath);
}
......
......@@ -331,8 +331,16 @@ public class ServiceHPSC006 extends ServiceBase {
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo queryInfo = new EiInfo();
queryInfo.set(HPSC002A.FIELD_DOC_ID,hpds002.getDocId());
//获取文档信息
queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",realPath+"-"+0);
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
......@@ -341,6 +349,7 @@ public class ServiceHPSC006 extends ServiceBase {
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}
}else {
FileUtils.deleteFile(realPath);
}
......
......@@ -35,13 +35,13 @@ public class ServiceHPSC008 extends ServiceEPBase {
Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID,DdynamicEnum.GROUP_CODE_BLOCK_ID,DdynamicEnum.FACTORY_CODE_BLOCK_ID),
new HashMap<String,Object>(){{put(HPSC008.FIELD_COMPANY_CODE,companyCode);}}
);
/*CommonMethod.initBlock(outEiInfo,
CommonMethod.initBlock(outEiInfo,
Arrays.asList(DdynamicEnum.USER_ID1_BLOCK_ID,DdynamicEnum.GROUP_CODE1_BLOCK_ID,DdynamicEnum.FACTORY_CODE1_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
}}
);*/
);
//outEiInfo.getBlock(EiConstant.resultBlock).getRows().clear();
return outEiInfo;
}
......@@ -104,17 +104,24 @@ public class ServiceHPSC008 extends ServiceEPBase {
String factoryCode = inInfo.getString(HPPZ013.FIELD_FACTORY_CODE);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.GROUP_CODE_BLOCK_ID),
new HashMap<String,Object>(){{put(HPSC008.FIELD_COMPANY_CODE,companyCode);put(HPPZ013.FIELD_FACTORY_CODE,factoryCode);}});
new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_FACTORY_CODE,factoryCode);
}});
return inInfo;
}
public EiInfo queryGroupCode(EiInfo inInfo) {
final String companyCode = UserSessionUtils.getCompanyCode();
String factoryCode = inInfo.getString(HPPZ013.FIELD_FACTORY_CODE);
String groupCode = inInfo.getString(HPPZ013.FIELD_GROUP_CODE);
String groupCode = inInfo.getString(HPSC008.FIELD_GROUP_CODE);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID),
new HashMap<String,Object>(){{put(HPSC008.FIELD_COMPANY_CODE,companyCode);put(HPPZ013.FIELD_FACTORY_CODE,factoryCode);put(HPPZ013.FIELD_GROUP_CODE,groupCode);}});
new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_FACTORY_CODE,factoryCode);
put(HPSC008.FIELD_GROUP_CODE,groupCode);
}});
return inInfo;
}
}
......@@ -99,6 +99,9 @@
<isEqual prepend=" AND " property="isComplete" compareValue="0">
B.NUM - B.COMPLETE_NUM &gt; 0
</isEqual>
<isEqual prepend=" AND " property="isComplete" compareValue="1">
B.NUM - B.COMPLETE_NUM = 0
</isEqual>
</sql>
<sql id="order">
......
......@@ -260,12 +260,14 @@
<select id="queryFactoryCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT
FACTORY_CODE as "factoryCode",
FACTORY_NAME as "factoryName",
DELETE_FLAG as "deleteFlag"
FACTORY_NAME as "factoryName"
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
......@@ -281,15 +283,23 @@
SELECT DISTINCT
GROUP_CODE as "groupCode",
GROUP_NAME as "groupName",
FACTORY_CODE AS factoryCode,
DELETE_FLAG as "deleteFlag"
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 and GROUP_TYPE = 'prodGroup'
FACTORY_CODE AS factoryCode
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isEmpty prepend=" AND " property="groupType">
GROUP_TYPE = 'prodGroup'
</isEmpty>
<isNotEmpty prepend=" AND " property="groupType">
GROUP_TYPE = #groupType#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
......@@ -306,9 +316,8 @@
USER_ID as "userId",
USER_NAME as "userName",
FACTORY_CODE AS factoryCode,
GROUP_CODE as "groupCode",
DELETE_FLAG as "deleteFlag"
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 and GROUP_TYPE = 'prodGroup' and STATUS = '1'
GROUP_CODE as "groupCode"
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 and STATUS = '1'
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -318,6 +327,15 @@
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isEmpty prepend=" AND " property="groupType">
GROUP_TYPE = 'prodGroup'
</isEmpty>
<isNotEmpty prepend=" AND " property="groupType">
GROUP_TYPE = #groupType#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
......
......@@ -10,7 +10,7 @@
FACTORY_CODE AS "factoryCode",
FACTORY_NAME AS "factoryName"
FROM iplat.TXSOG01
WHERE 1 = 1
WHERE 1 = 1 AND IS_DELETED = 0
AND FACTORY_CODE IN (
SELECT ORG_ENAME FROM iplat.TXSOG01
WHERE COMPANY_CODE = #companyCode# AND ORG_TYPE = 'factory'
......
......@@ -21,6 +21,7 @@ import com.baosight.iplat4j.core.util.NumberUtils;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -863,6 +864,39 @@ public class HPSCTools {
return results.stream().collect(Collectors.toMap(HPSC005B::getProdTaskNo, item -> item));
}
/**
* 查询信息
*
* @param factoryCode
* @param isComplete 是否完工
* @return
*/
public static List<HPSC005B> listByFactory(String factoryCode, Integer isComplete) {
if (StringUtils.isEmpty(factoryCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("factoryCode", factoryCode);
queryMap.put("isComplete", isComplete);
return DaoBase.getInstance().query(HPSC005B.QUERY, queryMap);
}
/**
* 查询信息
*
* @param orgNo 生产组
* @param isComplete
* @return
*/
public static List<HPSC005B> listByGroup(String orgNo, Integer isComplete) {
if (StringUtils.isEmpty(orgNo)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("orgNo", orgNo);
queryMap.put("isComplete", isComplete);
return DaoBase.getInstance().query(HPSC005B.QUERY, queryMap);
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="XSOG01">
<!--组织机构所有子节点树查询-->
<select id="queryOrgChild" resultClass="java.util.HashMap">
SELECT PARENT_ORG_ID, ORG_ID,ORG_ENAME,ORG_CNAME,ORG_TYPE FROM ${platSchema}.TXSOG01 WHERE FIND_IN_SET(ORG_ID,${platSchema}.getChildrenOrg(#orgId#)) AND IS_DELETED = '0';
</select>
<!--根据组织机构编码 获取所有父节点的组织机构信息。包括本身-->
<select id="queryOrgByOrgEnameAndLevel" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT org_id as "orgId",
org_ename as "orgEname",
org_cname as "orgCname",
org_type as "orgType",
sort_index as "sortIndex",
parent_org_id as "parentOrgId"
from ${platSchema}.txsog01
where FIND_IN_SET(org_id,${platSchema}.queryParentOrgs(#orgId#)) AND IS_DELETED = '0';
</select>
<!--根据组织机构编码向上递归组织机构 返回组织结构Id、父组织机构Id、由下向上的层级数-->
<sql id="getRecursiveUpOrg">
SELECT
@a as orgId,
(SELECT org_ename FROM ${platSchema}.TXSOG01 where org_id = @a) as orgEname,
(SELECT org_Cname FROM ${platSchema}.TXSOG01 where org_id = @a) as orgCname,
(SELECT org_type FROM ${platSchema}.TXSOG01 where org_id = @a) as orgType,
(SELECT @a:=parent_org_id from ${platSchema}.txsog01 where org_id = @a limit 0,1) as parentOrgId,
@b := @b+1 as lv
FROM (SELECT @a:= (SELECT ORG_ID FROM ${platSchema}.txsog01 WHERE 1=1
<isNotEmpty prepend=" AND " property="orgId">
ORG_ID = #orgId#
</isNotEmpty>
<isEmpty prepend=" " property="orgId">
<isNotEmpty prepend=" AND " property="orgEname">
ORG_ENAME = #orgEname#
</isNotEmpty>
</isEmpty>
AND IS_DELETED = '0' limit 0,1),@b:=0) vars,txsog01 t
where @a <![CDATA[<>]]> ''
</sql>
<!--根据组织机构代码获取匹配特定类型的父组织机构-->
<select id="getParentOrgByOrgEnameAndOrgType" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
select * FROM (<include refid="getRecursiveUpOrg"/>) a Where a.orgEname <![CDATA[<>]]> #orgEname# AND a.orgType = #orgType#
</select>
<!--向上递归查询 到组织机构类型不等于company-->
<select id="queryOneLevelOrgByOrgId" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT org_id as "orgId",org_ename as "orgEname",org_cname as "orgCname" from ${platSchema}.txsog01
where FIND_IN_SET(org_id,${platSchema}.queryParentOrg(#orgId#,'company')) AND org_Id != 'root';
</select>
</sqlMap>
\ No newline at end of file
......@@ -264,10 +264,12 @@
<!--组织机构所有子节点树查询-->
<select id="queryOrgChild" resultClass="java.util.HashMap">
WITH report(PARENT_ORG_ID, ORG_ID,ORG_ENAME,ORG_CNAME) AS (
SELECT PARENT_ORG_ID, ORG_ID,ORG_ENAME,ORG_CNAME FROM ${platSchema}.TXSOG01 WHERE ORG_ID = #orgId# and is_deleted = '0'
WITH report(PARENT_ORG_ID, ORG_ID,ORG_ENAME,ORG_CNAME, ORG_TYPE) AS (
SELECT PARENT_ORG_ID, ORG_ID,ORG_ENAME,ORG_CNAME,ORG_TYPE FROM ${platSchema}.TXSOG01
WHERE ORG_ID = #orgId# and is_deleted = '0'
UNION ALL
SELECT b.PARENT_ORG_ID, b.ORG_ID,b.ORG_ENAME,b.ORG_CNAME FROM report a, ${platSchema}.TXSOG01 b WHERE b.PARENT_ORG_ID = a.ORG_ID and b.is_deleted = '0'
SELECT b.PARENT_ORG_ID, b.ORG_ID,b.ORG_ENAME,b.ORG_CNAME,b.ORG_TYPE FROM report a, ${platSchema}.TXSOG01 b
WHERE b.PARENT_ORG_ID = a.ORG_ID and b.is_deleted = '0'
)
SELECT * FROM report
</select>
......
......@@ -97,7 +97,7 @@ let save = function () {
for (let i = 0; i < rows.length; i++) {
let item = rows[i];
if (isBlank(item['factoryCode'])) {
message("选中的第" + (i + 1) + "行\"工厂\",不能为空!");
message("选中的第" + (i + 1) + "行\"厂区\",不能为空!");
return;
}
if (isBlank(item['groupType'])) {
......@@ -153,6 +153,21 @@ let checkIn = function () {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
let item = rows[i];
if (isBlank(item['factoryCode'])) {
message("选中的第" + (i + 1) + "行\"厂区\",不能为空!");
return;
}
if (isBlank(item['groupType'])) {
message("选中的第" + (i + 1) + "行\"部门类型\",不能为空!");
return;
}
if (isBlank(item['groupCode'])) {
message("选中的第" + (i + 1) + "行\"生产部门\",不能为空!");
return;
}
}
JSColorbox.open({
href: "HPPZ013A?methodName=initLoad",
title: "<div style='text-align: center;'>用工登记</div>",
......
......@@ -42,14 +42,13 @@
<EF:EFColumn ename="userId" cname="工号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userName" cname="姓名" width="120" align="center" required="true" readonly="true"/>
<EF:EFComboColumn ename="factoryCode" cname="厂区" width="110" align="center" defaultValue="" required="true"
filter="contains" readonly="true">
filter="contains">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupType" cname="部门类型" width="80" align="center" required="true"
readonly="true">
<EF:EFComboColumn ename="groupType" cname="部门类型" width="80" align="center" required="true">
<EF:EFCodeOption codeName="xs.og.orgType" condition="ITEM_CODE IN ('prodGroup', 'cutGroup')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="groupCode" cname="生产部门" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="groupCode" cname="生产部门" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="gender" cname="性别" width="80" align="center" required="true" readonly="true"
valueField="valueField" textField="textField">
<EF:EFCodeOption codeName="xservices.xs.sex"/>
......
......@@ -42,13 +42,15 @@
<EF:EFColumn ename="regDate" cname="登记日期" enable="false" width="100" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="userId" cname="工号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂" enable="false" width="110" align="center">
<EF:EFColumn ename="factoryName" cname="厂区" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="factoryCode" cname="厂区" enable="false" width="110" align="center" hidden="true">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupType" cname="部门类型" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="xs.og.orgType" condition="ITEM_CODE IN ('prodGroup', 'cutGroup')"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupCode" cname="生产部门" enable="false" width="110" align="center">
<EF:EFColumn ename="groupName" cname="生产部门" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="groupCode" cname="生产部门" enable="false" width="110" align="center" hidden="true">
<EF:EFOptions blockId="group_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="userName" cname="姓名" enable="false" width="120" align="center"/>
......
......@@ -17,6 +17,17 @@ $(function () {
}
let flag = true;
$.each(rows, function(index, item) {
let id = item.get("id");
if (isBlank(id)) {
IPLAT.alert({
message: "选中的第" + (index + 1) + "行数据未保存,不能批量派工!",
okFn: function (e) {
},
title: '错误'
});
flag = false;
return false;
}
let status = item.get("status");
if (status === "1") {
IPLAT.alert({
......
......@@ -2,15 +2,6 @@ $(function () {
var factoryCodes = __eiInfo.getBlock("factory_code_block_id").getMappedRows();
var groupCodes = __eiInfo.getBlock("group_code_block_id").getMappedRows();
var userIds = __eiInfo.getBlock("user_id_block_id").getMappedRows();
var factoryCode = _.filter(__eiInfo.getBlock("factory_code_block_id").getMappedRows(), function (item) {
return item["param1Field"]=="false";
});
var groupCode = _.filter(__eiInfo.getBlock("group_code_block_id").getMappedRows(), function (item) {
return item["param2Field"]=="false";
});
var userId = _.filter(__eiInfo.getBlock("user_id_block_id").getMappedRows(), function (item) {
return item["param3Field"]=="false";
});
$(".row").children().attr("class", "col-md-3");
......@@ -52,6 +43,17 @@ $(function () {
return currShortDate();
}
},{
field: "factoryCode",
title: "工厂",
template: function (dataItem) {
for (let i = 0; i < factoryCodes.length; i++) {
if (factoryCodes[i]['valueField'] === dataItem['factoryCode']) {
return factoryCodes[i]['textField'];
}
}
return dataItem["factoryCode"];
}
},{
field: "groupCode",
title: "生产组",
filter: function (options) {
......@@ -65,6 +67,14 @@ $(function () {
} else {
return [];
}
},
template: function (dataItem) {
for (let i = 0; i < groupCodes.length; i++) {
if (groupCodes[i]['valueField'] === dataItem['groupCode']) {
return groupCodes[i]['textField'];
}
}
return dataItem["groupCode"];
}
},{
field: "userId",
......@@ -81,6 +91,14 @@ $(function () {
} else {
return [];
}
},
template: function (dataItem) {
for (let i = 0; i < userIds.length; i++) {
if (userIds[i]['valueField'] === dataItem['userId']) {
return userIds[i]['textField'];
}
}
return dataItem["userId"];
}
}],
loadComplete: function(grid) {
......@@ -101,10 +119,10 @@ $(function () {
//e.sender.dataSource.options.fields[5].values = groupCode
//e.sender.dataSource.options.fields[6].values = userId;
// 动态设置默认邮箱
$.each(e.items, function(index, item){
/*$.each(e.items, function(index, item){
item['prdtName'] = "demo"+ index + "@baosight.com";
});
});*/
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
......@@ -148,7 +166,7 @@ $(function () {
EiCommunicator.send("HPSC008", "queryFactoryCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
dataEdition=ei.getBlock("group_code_block_id").getMappedRows();
let dataEdition=ei.getBlock("group_code_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
......@@ -171,7 +189,7 @@ $(function () {
EiCommunicator.send("HPSC008", "queryGroupCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-userId");
dataEdition=ei.getBlock("user_id_block_id").getMappedRows();
let dataEdition=ei.getBlock("user_id_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
......
......@@ -48,19 +48,19 @@
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="registerDate" cname="登记日期" width="160" align="center" editType="date" readonly="true"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="factory_code_block_id"
<EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="factory_code1_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupCode" cname="生产组" blockName="group_code_block_id"
<EF:EFComboColumn ename="groupCode" cname="生产组" blockName="group_code1_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFComboColumn ename="userId" cname="员工" blockName="user_id_block_id"
<EF:EFComboColumn ename="userId" cname="员工" blockName="user_id1_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="100" required="true"
......
......@@ -43,10 +43,10 @@ $(function () {
field: "docName",
title: "文件名称",
template: function (item) {
let docId = item.docId;
let docName = item.docName
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + IPLATUI.CONTEXT_PATH + '/EU/DM/EUDM06.jsp?docId=' + item.docId
+ '" >'+docName+'</a>';
+ 'href="' + downloadHref(docId) + '" target="_blank">'+docName+'</a>';
return template;
}
}],
......@@ -119,11 +119,14 @@ $(function () {
NotificationUtil("请至少选中一条数据", "info");
} else {
for (let i = 0, length = checkedRows.length; i < length; i++) {
docId += checkedRows[i]["docId"];
docId += ","
window.location.href = downloadHref(checkedRows[i]["docId"])
//docId += checkedRows[i]["docId"];
//docId += ","
}
docId = docId.substr(0, docId.lastIndexOf(','));
window.location.href = IPLATUI.CONTEXT_PATH + '/EU/DM/EUDM14.jsp?docIds=' + docId
//docId = docId.substr(0, docId.lastIndexOf(','));
//window.location.href = IPLATUI.CONTEXT_PATH + '/EU/DM/EUDM14.jsp?docIds=' + docId
}
})
......
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