Commit 39dbf6f4 by liuyang

2024-05-08 新增工序设置

parent bf921dc4
...@@ -62,7 +62,7 @@ public enum DdynamicEnum { ...@@ -62,7 +62,7 @@ public enum DdynamicEnum {
* 用途:用户下拉框 * 用途:用户下拉框
* 编写:yk * 编写:yk
*/ */
USER_BLOCK_ID("user_block_id","loginName","userName","HPXSUser.queryComboBox"), USER_BLOCK_ID("user_block_id","loginName","userName","HGXSUser.queryComboBox"),
/** /**
* 模块:系统管理 * 模块:系统管理
...@@ -70,7 +70,21 @@ public enum DdynamicEnum { ...@@ -70,7 +70,21 @@ public enum DdynamicEnum {
* 编写:ly * 编写:ly
*/ */
DEPT_CODE_BLOCK_ID("dept_code_block_id", "orgId", "orgCname", "factoryCode", "factoryName", "companyCode", DEPT_CODE_BLOCK_ID("dept_code_block_id", "orgId", "orgCname", "factoryCode", "factoryName", "companyCode",
"companyName", "HGXSOrg.queryAll"); "companyName", "HGXSOrg.queryAll"),
/**
* 模块:公司名称
* 用途:工序设计下拉框
* 编写:ly
*/
COMPANY_BOX_BLOCK_ID("companyBox_block_id","orgEname","orgCname","HGSJ001.queryCompany"),
/**
* 模块:工序编码
* 用途:工序编码下拉框
* 编写:ly
*/
PROCESS_CODE_BLOCK_ID("processCode_block_id","processCode","processName","HGSJ001.queryProcessCode")
;
......
...@@ -64,6 +64,10 @@ public class HGConstant { ...@@ -64,6 +64,10 @@ public class HGConstant {
public static final String HPPZ017_SALES_CODE = "HPPZ017_SALES_CODE"; public static final String HPPZ017_SALES_CODE = "HPPZ017_SALES_CODE";
//销售计划单号 //销售计划单号
public static final String PLAN_SALES_CODE = "PLAN_SALES_CODE"; public static final String PLAN_SALES_CODE = "PLAN_SALES_CODE";
//工序编码
public static final String PROCESS_CODE = "PROCESS_CODE";
//工艺流程编码
public static final String FLOW_CODE = "FLOW_CODE";
} }
/** /**
......
package com.baosight.hggp.hg.sj.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:THpsc010.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-05-05 21:45:00 create
*/
public class HGSJ001 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id"; /* 主键id*/
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 账套*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 更新人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0.否1.是*/
public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 厂区编码*/
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 厂区名称*/
public static final String FIELD_PROCESS_CODE = "processCode"; /* 工序编码*/
public static final String FIELD_PROCESS_NAME = "processName"; /* 工序名称*/
public static final String FIELD_UNIT = "unit"; /* 单位*/
public static final String FIELD_STANDARD_JOB = "standardJob"; /* 标准作业*/
public static final String FIELD_STANDARD_DAYS = "standardDays"; /* 标准人天*/
public static final String FIELD_STANDARD_NUM = "standardNum"; /* 标准工序人数*/
public static final String FIELD_PRINC = "princ"; /* 负责人*/
public static final String FIELD_STATUS = "status"; /* 状态0.启用1.停止*/
public static final String COL_ID = "ID"; /* 主键id*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码 预留*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 更新人*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除0.否1.是*/
public static final String COL_FACTORY_CODE = "FACTORY_CODE"; /* 厂区编码*/
public static final String COL_FACTORY_NAME = "FACTORY_NAME"; /* 厂区名称*/
public static final String COL_PROCESS_CODE = "PROCESS_CODE"; /* 工序编码*/
public static final String COL_PROCESS_NAME = "PROCESS_NAME"; /* 工序名称*/
public static final String COL_UNIT = "UNIT"; /* 单位*/
public static final String COL_STANDARD_JOB = "STANDARD_JOB"; /* 标准作业*/
public static final String COL_STANDARD_DAYS = "STANDARD_DAYS"; /* 标准人天*/
public static final String COL_STANDARD_NUM = "STANDARD_NUM"; /* 标准工序人数*/
public static final String COL_PRINC = "PRINC"; /* 负责人*/
public static final String COL_STATUS = "STATUS"; /* 状态0.启用1.停止*/
public static final String QUERY = "HGSJ001.query";
public static final String COUNT = "HGSJ001.count";
public static final String INSERT = "HGSJ001.insert";
public static final String UPDATE = "HGSJ001.update";
public static final String DELETE = "HGSJ001.delete";
public static final String DELETE_FLAG = "HGSJ001.deleteFlag";
public static final String UPDATE_STATUS = "HGSJ001.updateStatus";
private Long id = new Long(0); /* 主键id*/
private String accountCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag = 0; /* 是否删除0.否1.是*/
private String factoryCode = " "; /* 厂区编码*/
private String factoryName = " "; /* 厂区名称*/
private String processCode = " "; /* 工序编码*/
private String processName = " "; /* 工序名称*/
private String unit = " "; /* 单位*/
private BigDecimal standardJob = new BigDecimal("0"); /* 标准作业*/
private BigDecimal standardDays = new BigDecimal("0"); /* 标准人天*/
private BigDecimal standardNum = new BigDecimal("0"); /* 标准工序人数*/
private String princ = " "; /* 负责人*/
private Integer status = 0; /* 状态0.启用1.停止*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName("主键id");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("创建人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("更新人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("更新人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除0.否1.是");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_CODE);
eiColumn.setDescName("厂区编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_NAME);
eiColumn.setDescName("厂区名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROCESS_CODE);
eiColumn.setDescName("工序编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROCESS_NAME);
eiColumn.setDescName("工序名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UNIT);
eiColumn.setDescName("单位");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_STANDARD_JOB);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(15);
eiColumn.setDescName("标准作业");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_STANDARD_DAYS);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(15);
eiColumn.setDescName("标准人天");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_STANDARD_NUM);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(15);
eiColumn.setDescName("标准工序人数");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PRINC);
eiColumn.setDescName("负责人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_STATUS);
eiColumn.setDescName("状态0.启用1.停止");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGSJ001() {
initMetaData();
}
/**
* get the id - 主键id.
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id - 主键id.
*
* @param id - 主键id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the companyCode - 企业编码 预留.
* @return the companyCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the companyCode - 企业编码 预留.
*
* @param accountCode - 企业编码 预留
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the depCode - 部门编码.
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码.
*
* @param depCode - 部门编码
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
* @param createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 创建人名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
* @param createdName - 创建人名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
* @param createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人.
*
* @param updatedBy - 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 更新人名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 更新人名称.
*
* @param updatedName - 更新人名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 更新时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间.
*
* @param updatedTime - 更新时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 是否删除0.否1.是.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 是否删除0.否1.是.
*
* @param deleteFlag - 是否删除0.否1.是
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the factoryCode - 厂区编码.
* @return the factoryCode
*/
public String getFactoryCode() {
return this.factoryCode;
}
/**
* set the factoryCode - 厂区编码.
*
* @param factoryCode - 厂区编码
*/
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
/**
* get the factoryName - 厂区名称.
* @return the factoryName
*/
public String getFactoryName() {
return this.factoryName;
}
/**
* set the factoryName - 厂区名称.
*
* @param factoryName - 厂区名称
*/
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
/**
* get the processCode - 工序编码.
* @return the processCode
*/
public String getProcessCode() {
return this.processCode;
}
/**
* set the processCode - 工序编码.
*
* @param processCode - 工序编码
*/
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
/**
* get the processName - 工序名称.
* @return the processName
*/
public String getProcessName() {
return this.processName;
}
/**
* set the processName - 工序名称.
*
* @param processName - 工序名称
*/
public void setProcessName(String processName) {
this.processName = processName;
}
/**
* get the unit - 单位.
* @return the unit
*/
public String getUnit() {
return this.unit;
}
/**
* set the unit - 单位.
*
* @param unit - 单位
*/
public void setUnit(String unit) {
this.unit = unit;
}
/**
* get the standardJob - 标准作业.
* @return the standardJob
*/
public BigDecimal getStandardJob() {
return this.standardJob;
}
/**
* set the standardJob - 标准作业.
*
* @param standardJob - 标准作业
*/
public void setStandardJob(BigDecimal standardJob) {
this.standardJob = standardJob;
}
/**
* get the standardDays - 标准人天.
* @return the standardDays
*/
public BigDecimal getStandardDays() {
return this.standardDays;
}
/**
* set the standardDays - 标准人天.
*
* @param standardDays - 标准人天
*/
public void setStandardDays(BigDecimal standardDays) {
this.standardDays = standardDays;
}
/**
* get the standardNum - 标准工序人数.
* @return the standardNum
*/
public BigDecimal getStandardNum() {
return this.standardNum;
}
/**
* set the standardNum - 标准工序人数.
*
* @param standardNum - 标准工序人数
*/
public void setStandardNum(BigDecimal standardNum) {
this.standardNum = standardNum;
}
/**
* get the princ - 负责人.
* @return the princ
*/
public String getPrinc() {
return this.princ;
}
/**
* set the princ - 负责人.
*
* @param princ - 负责人
*/
public void setPrinc(String princ) {
this.princ = princ;
}
/**
* get the status - 状态0.启用1.停止.
* @return the status
*/
public Integer getStatus() {
return this.status;
}
/**
* set the status - 状态0.启用1.停止.
*
* @param status - 状态0.启用1.停止
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName));
setProcessCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROCESS_CODE)), processCode));
setProcessName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROCESS_NAME)), processName));
setUnit(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UNIT)), unit));
setStandardJob(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_STANDARD_JOB)), standardJob));
setStandardDays(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_STANDARD_DAYS)), standardDays));
setStandardNum(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_STANDARD_NUM)), standardNum));
setPrinc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRINC)), princ));
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_FACTORY_CODE, StringUtils.toString(factoryCode, eiMetadata.getMeta(FIELD_FACTORY_CODE)));
map.put(FIELD_FACTORY_NAME, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_FACTORY_NAME)));
map.put(FIELD_PROCESS_CODE, StringUtils.toString(processCode, eiMetadata.getMeta(FIELD_PROCESS_CODE)));
map.put(FIELD_PROCESS_NAME, StringUtils.toString(processName, eiMetadata.getMeta(FIELD_PROCESS_NAME)));
map.put(FIELD_UNIT, StringUtils.toString(unit, eiMetadata.getMeta(FIELD_UNIT)));
map.put(FIELD_STANDARD_JOB, StringUtils.toString(standardJob, eiMetadata.getMeta(FIELD_STANDARD_JOB)));
map.put(FIELD_STANDARD_DAYS, StringUtils.toString(standardDays, eiMetadata.getMeta(FIELD_STANDARD_DAYS)));
map.put(FIELD_STANDARD_NUM, StringUtils.toString(standardNum, eiMetadata.getMeta(FIELD_STANDARD_NUM)));
map.put(FIELD_PRINC, StringUtils.toString(princ, eiMetadata.getMeta(FIELD_PRINC)));
map.put(FIELD_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS)));
return map;
}
}
package com.baosight.hggp.hg.sj.service;
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.enums.OrgTypeEnum;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sj.domain.HGSJ001;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.ErrorCodeUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
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.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/5/6
*/
public class ServiceHGSJ001 extends ServiceEPBase {
@Override
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),
new HashMap<String,Object>(){{put("orgType", OrgTypeEnum.COMPANY.getCode());}}
);
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSJ001.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
return super.query(inInfo, HGSJ001.QUERY);
}
@OperationLogAnnotation(operModul = "工序设置",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HGSJ001 hpsc012 = new HGSJ001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc012.fromMap(map);
hpsc012.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSJ001.DELETE_FLAG, hpsc012.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
}
return inInfo;
}
/**
* 保存操作
*/
@OperationLogAnnotation(operModul = "工序设置",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGSJ001 hpsc012 = new HGSJ001();
hpsc012.fromMap(resultRows.get(i));
if (hpsc012.getId() == null || hpsc012.getId() == 0) {
this.add(hpsc012);
} else {
this.modify(hpsc012);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HGSJ001 hpsc012) {
//生成工序编码
hpsc012.setProcessCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PROCESS_CODE));
DaoUtils.insert(HGSJ001.INSERT, hpsc012);
}
/**
* 修改操作
*/
public void modify(HGSJ001 hpsc012) {
DaoUtils.update(HGSJ001.UPDATE, hpsc012);
}
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
HGSJ001 hpsc012 = new HGSJ001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc012.fromMap(map);
DaoUtils.update(HGSJ001.UPDATE_STATUS, hpsc012);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
}
return inInfo;
}
}
<?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
Generate time : 2024-05-05 21:45:00
Version : 1.0
schema : hpjx
tableName : HGPZ001
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
FACTORY_CODE VARCHAR,
FACTORY_NAME VARCHAR,
PROCESS_CODE VARCHAR,
PROCESS_NAME VARCHAR,
UNIT VARCHAR,
STANDARD_JOB DECIMAL,
STANDARD_DAYS DECIMAL,
STANDARD_NUM DECIMAL,
PRINC VARCHAR,
STATUS TINYINT
-->
<sqlMap namespace="HGSJ001">
<sql id="column">
ID as "id", <!-- 主键id -->
ACCOUNT_CODE as "accountCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0.否1.是 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
PROCESS_CODE as "processCode", <!-- 工序编码 -->
PROCESS_NAME as "processName", <!-- 工序名称 -->
UNIT as "unit", <!-- 单位 -->
STANDARD_JOB as "standardJob", <!-- 标准作业 -->
STANDARD_DAYS as "standardDays", <!-- 标准人天 -->
STANDARD_NUM as "standardNum", <!-- 标准工序人数 -->
PRINC as "princ", <!-- 负责人 -->
STATUS as "status" <!-- 状态0.启用1.停止 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</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>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME LIKE CONCAT('%', #factoryName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processCode">
PROCESS_CODE = #processCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processName">
PROCESS_NAME LIKE CONCAT('%', #processName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="standardJob">
STANDARD_JOB = #standardJob#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="standardDays">
STANDARD_DAYS = #standardDays#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="standardNum">
STANDARD_NUM = #standardNum#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="princ">
PRINC LIKE CONCAT('%', #princ#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sj.domain.HGSJ001">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGGY001 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc,ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGGY001 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</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>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processCode">
PROCESS_CODE = #processCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processName">
PROCESS_NAME = #processName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="standardJob">
STANDARD_JOB = #standardJob#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="standardDays">
STANDARD_DAYS = #standardDays#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="standardNum">
STANDARD_NUM = #standardNum#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="princ">
PRINC = #princ#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGGY001 (ID, <!-- 主键id -->
ACCOUNT_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人名称 -->
UPDATED_TIME, <!-- 更新时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
FACTORY_CODE, <!-- 厂区编码 -->
FACTORY_NAME, <!-- 厂区名称 -->
PROCESS_CODE, <!-- 工序编码 -->
PROCESS_NAME, <!-- 工序名称 -->
UNIT, <!-- 单位 -->
STANDARD_JOB, <!-- 标准作业 -->
STANDARD_DAYS, <!-- 标准人天 -->
STANDARD_NUM, <!-- 标准工序人数 -->
PRINC, <!-- 负责人 -->
STATUS <!-- 状态0.启用1.停止 -->
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #factoryCode#, #factoryName#, #processCode#, #processName#, #unit#, #standardJob#, #standardDays#, #standardNum#, #princ#, #status#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGGY001 WHERE
ID = #id#
</delete>
<!--逻辑删除-->
<update id="deleteFlag">
UPDATE ${hggpSchema}.HGGY001
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hggpSchema}.HGGY001
SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 预留 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
FACTORY_CODE = #factoryCode#, <!-- 厂区编码 -->
FACTORY_NAME = #factoryName#, <!-- 厂区名称 -->
PROCESS_CODE = #processCode#, <!-- 工序编码 -->
PROCESS_NAME = #processName#, <!-- 工序名称 -->
UNIT = #unit#, <!-- 单位 -->
STANDARD_JOB = #standardJob#, <!-- 标准作业 -->
STANDARD_DAYS = #standardDays#, <!-- 标准人天 -->
STANDARD_NUM = #standardNum#, <!-- 标准工序人数 -->
PRINC = #princ#, <!-- 负责人 -->
STATUS = #status# <!-- 状态0.启用1.停止 -->
WHERE
ID = #id#
</update>
<update id="updateStatus">
UPDATE ${hggpSchema}.HGGY001
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
STATUS = #status# <!-- 状态0.启用1.停止 -->
WHERE
ID = #id#
</update>
<select id="queryProcessCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
PROCESS_CODE as "processCode", <!-- 工序编码 -->
PROCESS_NAME as "processName" <!-- 工序名称 -->
FROM ${hggpSchema}.HGGY001 WHERE 1=1
<include refid="condition" />
group by PROCESS_CODE,PROCESS_NAME
</select>
<select id="queryCompany" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
select distinct
ORG_ENAME as "orgEname",
ORG_CNAME as "orgCname"
from iplat_hggp.txsog01
where ACCOUNT_CODE = #accountCode# and ORG_TYPE in (#orgType#)
</select>
</sqlMap>
package com.baosight.hggp.hg.sj.tools;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sj.domain.HGSJ003;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.iplat4j.common.ed.domain.TEDCM01;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/5/7
*/
public class HGSJTools {
/**
* Hgsj003公共DAO方法定义
*
*/
public static class Hgsj003 {
/**
* 查询
*
* @param id
* @return
*/
public static HGSJ003 get(Long id) {
AssertUtils.isNull(id, "规格ID不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HGSJ003> results = DaoBase.getInstance().query(HGSJ003.QUERY, queryMap);
AssertUtils.isEmpty(results, String.format("规格[%s]不存在", id));
return results.get(0);
}
/**
* 查询
*
* @param ids
* @return
*/
public static List<HGSJ003> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HGSJ003.QUERY, queryMap);
}
/**
* 查询
*
* @param ids
* @return
*/
public static Map<Long, HGSJ003> map(List<Long> ids) {
List<HGSJ003> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HGSJ003::getId, item -> item));
}
/**
* 拼接规格
*
* @param hgsj003
*/
public static void jointSpec(HGSJ003 hgsj003) {
if (StringUtils.isNotBlank(hgsj003.getSpec())) {
return;
}
hgsj003.setSpec(jointSpec(hgsj003.getLength(), hgsj003.getWidth(), hgsj003.getThick()));
}
/**
* 拼接规格
*
* @param length
* @param width
* @param thick
* @return
*/
public static String jointSpec(BigDecimal length, BigDecimal width, BigDecimal thick) {
StringBuffer sb = new StringBuffer();
if (length != null && length.compareTo(BigDecimal.ZERO) != 0) {
sb.append(length.stripTrailingZeros().toPlainString());
}
if (width != null && width.compareTo(BigDecimal.ZERO) != 0) {
if (StringUtils.isNotBlank(sb)) {
sb.append("*");
}
sb.append(width.stripTrailingZeros().toPlainString());
}
if (thick != null && thick.compareTo(BigDecimal.ZERO) != 0) {
if (StringUtils.isNotBlank(sb)) {
sb.append("*");
}
sb.append(thick.stripTrailingZeros().toPlainString());
}
return sb.toString();
}
public static Map getCompany(String loginName,String orgType){
AssertUtils.isEmpty(loginName, "用户不能为空");
Map queryMap = new HashMap();
queryMap.put("loginName", loginName);
queryMap.put("orgType", orgType);
queryMap.put(HGSJ003.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
List<Map<String,Object>> results = DaoBase.getInstance().query("HGSJ003.queryCompanyCode", queryMap);
if(results.size()==0){
results = null;
}
AssertUtils.isEmpty(results, String.format("用户[%s]没有绑定公司", loginName));
return results.get(0);
}
public static Map getSmallCode(String codesetCode){
AssertUtils.isEmpty(codesetCode, "代码分类不能为空");
return getSmallCode(codesetCode,null);
}
public static Map<String,Object> getSmallCode(String codesetCode,String itemCode){
Map param = new HashMap();
param.put("codesetCode",codesetCode);
param.put("itemCode",itemCode);
List<TEDCM01> results = listSmall(codesetCode,itemCode);
return results.stream().collect(Collectors.toMap(TEDCM01::getItemCname, TEDCM01::getItemCode));
}
public static List<TEDCM01> listSmall(String codesetCode, String itemCode){
AssertUtils.isEmpty(codesetCode, "代码分类不能为空");
Map param = new HashMap();
param.put("codesetCode",codesetCode);
param.put("itemCode",itemCode);
return DaoBase.getInstance().query("EDCM01.queryByCodesetCode", param);
}
}
}
...@@ -2,16 +2,23 @@ package com.baosight.hggp.util; ...@@ -2,16 +2,23 @@ package com.baosight.hggp.util;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sj.domain.HGSJ003;
import com.baosight.hggp.hg.sj.tools.HGSJTools;
import com.baosight.hggp.util.importer.Importer; import com.baosight.hggp.util.importer.Importer;
import com.baosight.hggp.util.importer.impl.XlsImporter; import com.baosight.hggp.util.importer.impl.XlsImporter;
import com.baosight.iplat4j.common.ed.domain.TEDCM01;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.data.ibatis.SqlMapClientTemplate; import com.baosight.iplat4j.core.data.ibatis.SqlMapClientTemplate;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant; 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.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
...@@ -22,9 +29,7 @@ import java.io.OutputStream; ...@@ -22,9 +29,7 @@ import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* @author:songx * @author:songx
...@@ -32,6 +37,17 @@ import java.util.Map; ...@@ -32,6 +37,17 @@ import java.util.Map;
*/ */
public class ExcelUtils { public class ExcelUtils {
private static Dao dao = (Dao) PlatApplicationContext.getBean("dao");
private static final int QUERY_LIMIT = 1_000_000;
/**
* 导出最大值50*1000
*/
private static final int MAX_PAGE_NUMBER = 100;
private static final String COUNT_METHOD_NAME = "count";
private static final String QUERY_METHOD_NAME = "query";
public static final String SQL_OK_BLOCK = "sql_ok_block"; public static final String SQL_OK_BLOCK = "sql_ok_block";
public static final String CHECK_OK_BLOCK = "check_ok_block"; public static final String CHECK_OK_BLOCK = "check_ok_block";
/** /**
...@@ -59,7 +75,8 @@ public class ExcelUtils { ...@@ -59,7 +75,8 @@ public class ExcelUtils {
*/ */
public static final String FLAG_ONLY_NOT_NULL = "onlyNotNull"; public static final String FLAG_ONLY_NOT_NULL = "onlyNotNull";
public static final String SQL_OK_LINE = "sql_ok_line"; public static final String SQL_OK_LINE = "sql_ok_line";
private static SqlMapClientTemplate sqlMapClientTemplate = new SqlMapClientTemplate(); //private static SqlMapClientTemplate sqlMapClientTemplate = new SqlMapClientTemplate();
private static SqlMapClientTemplate sqlMapClientTemplate = (SqlMapClientTemplate) PlatApplicationContext.getBean("sqlMapClientTemplate");
protected static Logger logger = LogManager.getLogger(ExcelUtils.class); protected static Logger logger = LogManager.getLogger(ExcelUtils.class);
...@@ -154,7 +171,7 @@ public class ExcelUtils { ...@@ -154,7 +171,7 @@ public class ExcelUtils {
} }
String className = insertSql.substring(0,7); String className = insertSql.substring(0,7);
List arrayList = inInfo.getBlock(SQL_OK_BLOCK).getRows(); List<Map> arrayList = inInfo.getBlock(SQL_OK_BLOCK).getRows();
// 数据校验 // 数据校验
switch (className){ switch (className){
/** /**
...@@ -199,6 +216,28 @@ public class ExcelUtils { ...@@ -199,6 +216,28 @@ public class ExcelUtils {
} else { } else {
inInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_FAILURE);
} }
break;
case "HGSJ003":
HGSJ003 hgsj003 = new HGSJ003();
Map<String, String> mapSmall = HGSJTools.Hgsj003.getSmallCode("hggp.hgsj.processClass");
for (Map<?, ?> map : arrayList) {
String processClass = MapUtils.getString(mapSmall,map.get(HGSJ003.FIELD_PROCESS_CLASS_NAME));
AssertUtils.isEmpty(processClass,String.format("工序分类[%s]代码不存在,添加失败!",map.get(HGSJ003.FIELD_PROCESS_CLASS_NAME)));
hgsj003.fromMap(map);
// 设置规格
if (org.apache.commons.lang3.StringUtils.isBlank(hgsj003.getSpec())) {
hgsj003.setSpec(HGSJTools.Hgsj003.jointSpec(hgsj003.getLength(), hgsj003.getWidth(), hgsj003.getThick()));
}
// 去除空格
hgsj003.setSpec(StringUtils.trimToEmpty(hgsj003.getSpec()));
hgsj003.setProcessClass(Integer.valueOf(processClass));
//校验
checkAddData(hgsj003);
DaoUtils.insert(HGSJ003.INSERT, hgsj003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("导入成功"+arrayList.size()+"条");
default:
} }
return inInfo; return inInfo;
...@@ -234,6 +273,117 @@ public class ExcelUtils { ...@@ -234,6 +273,117 @@ public class ExcelUtils {
return inInfo; return inInfo;
} }
/**
* Excel导出功能
*
* @param param 查询参数
* @param columnList 导出时显示的列名
* @param bean 对应的对象
* @return
*/
public static EiInfo exportToExcel(Map param, List columnList, DaoEPBase bean) {
return exportToExcel(COUNT_METHOD_NAME, QUERY_METHOD_NAME, param, columnList, bean);
}
/**
* Excel导出功能
*
* @param queryMethodName 查询方法名
* @param param 查询参数
* @param bean 对应的对象
* @return
*/
public static EiInfo exportToExcel(String queryMethodName, Map param, DaoEPBase bean) {
return exportToExcel(COUNT_METHOD_NAME, queryMethodName, param, null, bean);
}
/**
* Excel导出功能
*
* @param param 查询参数
* @param bean 对应的对象
* @return
*/
public static EiInfo exportToExcel(Map param, DaoEPBase bean) {
return exportToExcel(COUNT_METHOD_NAME, QUERY_METHOD_NAME, param, null, bean);
}
/**
* Excel导出功能
*
* @param countMethodName 总和方法名
* @param queryMethodName 查询方法名
* @param param 查询参数
* @param columnList 导出时显示的列名
* @param bean 对应的对象
*/
public static EiInfo exportToExcel(String countMethodName, String queryMethodName, Map param, List columnList, DaoEPBase bean) {
String className = bean.getClass().getSimpleName();
EiInfo outInfo = new EiInfo();
int offset = 0;
List queryList;
//2019年6月17日 防止jdbc内存溢出处理
try {
queryList = dao.query(className + "." + countMethodName, param, offset, 1);
int count = ((Integer) queryList.get(0)).intValue();
//跳过平台的查询限制
queryList = sqlMapClientTemplate.queryForList(className + "." + queryMethodName, param, offset, QUERY_LIMIT);
for (int i = 1; i < (count / QUERY_LIMIT); i++) {
int start = Double.valueOf(Math.ceil(i * QUERY_LIMIT) + 1).intValue();
queryList.addAll(sqlMapClientTemplate.queryForList(className + "." + queryMethodName, param, start, QUERY_LIMIT));
}
} catch (RuntimeException e1) {
queryList = dao.query(className + "." + queryMethodName, param, offset, -999999);
}
outInfo.addBlock(EiConstant.resultBlock).setRows(queryList);
outInfo.getBlocks().put("detail", outInfo.getBlock(EiConstant.resultBlock)); // 增加block:detail
outInfo.getBlocks().remove(EiConstant.resultBlock); // 移除block:result
EiBlock transformBlock = outInfo.addBlock(EiConstant.resultBlock);
//自定义行
List list;
if (!(columnList == null || columnList.isEmpty())) {
list = columnList;
} else {
Map metas = bean.eiMetadata.getMetas();
list = new LinkedList();
Iterator keySet = metas.keySet().iterator();
while (keySet.hasNext()) {
list.add(((EiColumn) metas.get(keySet.next())).getName());
}
}
List list2 = new LinkedList();
Map map = new LinkedHashMap();
for (int i = 0; i < list.size(); i++) {
map.put(list.get(i), i);
list2.add(map);
}
for (int i = 0; i < list2.size(); i++) {
HashMap<String, String> newMap = (HashMap) list2.get(i);
for (Map.Entry<String, String> entry : newMap.entrySet()) {
EiColumn eiColumn = bean.eiMetadata.getMeta(entry.getKey());
transformBlock.addMeta(eiColumn);
}
}
//将查询结果放入块中
transformBlock.addRows(queryList);
//防止平台空指针异常报错
transformBlock.set("groupColumns", new HashMap<>(2));
transformBlock.set("groupColumnsCname", new HashMap<>(2));
transformBlock.set("groupedColumns", new ArrayList<>(2));
return outInfo;
}
public static void checkTreeNodeLeaf(String id) { public static void checkTreeNodeLeaf(String id) {
//1 获取参数 //1 获取参数
Map queryMap = new HashMap(); Map queryMap = new HashMap();
...@@ -327,4 +477,30 @@ public class ExcelUtils { ...@@ -327,4 +477,30 @@ public class ExcelUtils {
inInfo.set("checkStatus",checkStatus); inInfo.set("checkStatus",checkStatus);
return inInfo; return inInfo;
} }
/**
* 校验规格
* @param hgsj003
*/
private static void checkAddData(HGSJ003 hgsj003) {
AssertUtils.isNull(hgsj003.getProcessCode(), "工序名称不能为空");
AssertUtils.isNull(hgsj003.getProcessClass(), "工序分类不能为空");
// 重复校验
String msg;
Map queryParam = new HashMap();
queryParam.put(HGSJ003.FIELD_ACCOUNT_CODE,hgsj003.getAccountCode());
queryParam.put(HGSJ003.FIELD_FACTORY_CODE,hgsj003.getFactoryCode());
queryParam.put(HGSJ003.FIELD_PROCESS_CODE, hgsj003.getProcessCode());
queryParam.put(HGSJ003.FIELD_PROCESS_CLASS,hgsj003.getProcessClass());
queryParam.put(HGSJ003.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
if (StringUtils.isBlank(hgsj003.getSpec())) {
queryParam.put("notSpec", CommonConstant.YesNo.YES);
msg = String.format("工序编码[%s]已存在无规格,请勿重复添加!", hgsj003.getProcessCode());
} else {
queryParam.put("spec", hgsj003.getSpec());
msg = String.format("工厂[%s]工序编码[%s]已存在规格[%s],请勿重复添加!", hgsj003.getFactoryCode(), hgsj003.getProcessCode(), hgsj003.getSpec());
}
List<HGSJ003> hgsj003List = dao.query(HGSJ003.QUERY, queryParam);
AssertUtils.isNotEmpty(hgsj003List, msg);
}
} }
...@@ -12,6 +12,21 @@ public class ACConstants { ...@@ -12,6 +12,21 @@ public class ACConstants {
public static final char ROW_CODE_0 = 0; public static final char ROW_CODE_0 = 0;
/** /**
* sql 条件统计数目方法
*/
public static final String SQL_COUNT = "count";
/**
* sql 条件模板查询方法
*/
public static final String SQL_TEMPLATE = "template";
/**
* sql 条件导出方法
*/
public static final String SQL_EXPORT = "export";
/**
* 模块:仓库档案 * 模块:仓库档案
* 用途:前后台交互下拉框字段 * 用途:前后台交互下拉框字段
* 编写:yk * 编写:yk
......
$(function (){
var factoryCodes = __eiInfo.getBlock("companyBox_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
/* 页面查询框的尺寸设置 */
$.extend(true, IPLATUI.Config, {
EFGrid: {
height: $(document).height() - $("#inqu").height() - $("#ef_form_head").height() - 100,
}
});
IPLATUI.EFGrid = {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let status = item.status;
let template = '';
if (item.id){
if (status == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="updateStatus(' + item.id + ',1)" >启用</a>';
} else if (status == 1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',0)" >停止</a>';
}
}
return template;
}
},{
field: "factoryCode",
template: function (dataItem) {
for (let i = 0; i < factoryCodes.length; i++) {
if (factoryCodes[i]['valueField'] === dataItem['factoryCode']) {
dataItem['factoryName'] = factoryCodes[i]['textField'];
return factoryCodes[i]['textField'];
}
}
return dataItem['factoryCode'];
},
},{
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}
],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
/*grid.dataSource.bind("change", function(e) {
let items = e.items
// 判断父级节点是否发生变化
if (e.field == "factoryCode") {
for (let i = 0; i <items.length ; i++) {
if (items[i]["factoryCode"].length > 0 && items[i]["factoryName"].length <= 0){
}
}
//loadChange(grid,e,"groupCode");
}else if (e.field == "groupCode") {
if (e.items[0].factoryCode.length===0){
loadChange(grid,e,"factoryCode");
}
loadChange(grid,e,"userId");
}else if (e.field == "deviceCode"){
}
});*/
},
afterEdit:function (e) {
//下拉框选中回写
/*if (e.field === "groupCode" && e.model["factoryCode"].length === 0){
for (let i = 0; i < groupCodeBox.length; i++) {
if (e.model[e.field] === groupCodeBox[i]["valueField"]){
e.model["factoryCode"]=groupCodeBox[i]["param1Field"]
break;
}
}
}*/
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onRowClick: function (e) {
},
exportGrid : {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "工序设置_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls",
exportBlockId: "result",
}
}
}
})
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let factoryCode= item.get("factoryCode");
let processName= item.get("processName");
let standardJob= item.get("standardJob");
let standardDays= item.get("standardDays");
let standardNum= item.get("standardNum");
let princ= item.get("princ");
if(isBlank(factoryCode)){
message("选中的第"+(index+1)+"行\"工厂\",不能为空!");
flag = false;
return false;
}
if(isBlank(processName)){
message("选中的第"+(index+1)+"行\"工序名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(standardJob)){
message("选中的第"+(index+1)+"行\"标准作业\",不能为空!");
flag = false;
return false;
}
if(isBlank(standardDays)){
message("选中的第"+(index+1)+"行\"标准人天\",不能为空!");
flag = false;
return false;
}
if(isBlank(standardNum)){
message("选中的第"+(index+1)+"行\"标准工序人数\",不能为空!");
flag = false;
return false;
}
if(isBlank(princ)){
message("选中的第"+(index+1)+"行\"负责人\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSJ001", "save", true,
function (e) {
query();
});
btnNode.attr("disabled", false);
}
});
}
}
function updateStatus(id,status) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-status", status);
EiCommunicator.send('HGSJ001', 'updateStatus', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
}
function loadChange(grid,e,field) {
var cell_label = field,that = grid;
// locked 表示是否为固定列
var locked = that.isCellLocked(cell_label);
// tr 表示 locked 和非 locked 的行,index 表示此行的第几列
var tr,index;
// 获取此 model 元素信息
var item = e.items[0];
var _uid = item.uid;
if (locked) {
tr = $(".k-grid-content-locked tr[data-uid="+ _uid +"]");
index = $("th[data-field='"+cell_label+"']").data("index");
} else {
tr = $(".k-grid-content tr[data-uid="+ _uid +"]");
index = parseInt($("th[data-field='"+cell_label+"']").data("index")) - that.lockedHeader.find("th").length;
}
// 获取子 cell(td)
var td = tr.children("td:eq("+index+")");
// 触发 td.click 事件,
td.trigger("click");
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/6
Time: 9:39
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" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="工序设置">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="factoryCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="processName" cname="工序名称" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="princ" cname="负责人" colWidth="3"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="状态" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</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="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFComboColumn ename="factoryCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="factoryName" cname="公司名称" hidden="true"/>
<EF:EFColumn ename="processCode" cname="工序编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="processName" cname="工序名称" width="120" enable="true" readonly="false" align="center" required="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" enable="true" readonly="false" align="center"/>
<EF:EFColumn ename="standardJob" cname="标准作业" width="120" enable="true" format="{0:N0}" editType="number"
displayType="0" sort="true" align="right" required="true"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="15"
data-errorprompt="请输入数字,该值最大可设置15位整数!"
/>
<EF:EFColumn ename="standardDays" cname="标准人天" width="120" enable="true" format="{0:N0}" editType="number"
displayType="0" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数!"
/>
<EF:EFColumn ename="standardNum" cname="标准工序人数" width="120" enable="true" format="{0:N0}" editType="number"
displayType="0" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数!"
/>
<EF:EFComboColumn ename="princ" cname="负责人"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<%--<EF:EFColumn ename="princ" cname="负责人" width="120" enable="true" readonly="false" align="center" required="true"/>--%>
<EF:EFComboColumn ename="status" cname="状态" width="80" enable="true" readonly="false" align="center" required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</EF:EFComboColumn>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="100" readonly="true" required="false"
enable="false"/>
<EF:EFColumn cname="创建时间" ename="createdTime" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="120" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
...@@ -445,3 +445,79 @@ function downKeyUp() { ...@@ -445,3 +445,79 @@ function downKeyUp() {
} }
}) })
} }
const grush = {
openImportBox(importBoxDomId) {
if (!($ || jQuery)) {
throw new Error('jQuery引入失败...找不到对外暴露的$和jQuery');
}
importBoxDomId = importBoxDomId || '#IMPORT';
if (!importBoxDomId) {
throw new Error(
`ID为{${importBoxDomId}的导入框元素找不到, 请查看是否在平台上注册或是其它问题导致`);
}
$(importBoxDomId).on("click", function (e) {
openFileWindow.open();
});
},
downloadFile(fileUrl, downloadDomId) {
if (!($ || jQuery)) {
throw new Error('jQuery引入失败...找不到对外暴露的$和jQuery');
}
downloadDomId = downloadDomId || '#DOWNLOAD';
if (!downloadDomId) {
throw new Error(
`ID为{${downloadDomId}的导入框元素找不到, 请查看是否在平台上注册或是其它问题导致`);
}
$(downloadDomId).on("click", function (e) {
window.location.href = fileUrl;
});
},
IExport(validatorDom, exportEiInfo, exportDomId, eventName) {
if (!($ || jQuery)) {
throw new Error('jQuery引入失败...找不到对外暴露的$和jQuery');
}
exportDomId = exportDomId || '#EXPORT';
if (!exportDomId) {
throw new Error(
`ID为{${exportDomId}的导出元素找不到, 请查看是否在平台上注册或是其它问题导致`);
}
eventName = eventName || 'click';
$(exportDomId).on(eventName, function (e) {
if (!validatorDom.val()) {
return settingValidator();
}
exportEiInfo['queryInfo'] = resultGrid.getQueryInfo().toJSONString();
IPLAT.Util.exportGrid(exportEiInfo);
});
},
settingValidator(validatorDomId) {
validatorDomId = validatorDomId || 'inqu';
const validator = IPLAT.Validator({
id: validatorDomId
});
if (!validator.validate()) {
const errorMessage = validator.errors().toString().split(',');
IPLAT.alert(
{
title: '错误',
message: '<b>错误:<br>' + errorMessage.join('<br>') + '</b>',
okFn(e) {
}
}
);
return false;
}
return true;
},
}
function isExcelFile(uploadFileUrl) {
return uploadFileUrl.indexOf("xls") === -1
&& uploadFileUrl.indexOf("xlsx") === -1
&& uploadFileUrl.indexOf("XLS") === -1
&& uploadFileUrl.indexOf("XLSX") === -1;
}
\ No newline at end of file
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