Commit f2148a0d by liuyang

2024-05-09 设备台账

parent 8093bed5
package com.baosight.hggp.common; package com.baosight.hggp.common;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sb.domain.HGSB001;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -156,7 +159,19 @@ public enum DdynamicEnum { ...@@ -156,7 +159,19 @@ public enum DdynamicEnum {
* 用途:工序编码下拉框 * 用途:工序编码下拉框
* 编写:ly * 编写:ly
*/ */
PROCESS_CODE_BLOCK_ID("processCode_block_id","processCode","processName","factoryCode","factoryName","unit","HGSJ001.queryProcessCode") PROCESS_CODE_BLOCK_ID("processCode_block_id","processCode","processName","factoryCode","factoryName","unit","HGSJ001.queryProcessCode"),
/**
* 模块:工序编码
* 用途:工序编码下拉框
* 编写:ly
*/
GROUP_CODE_BOX_BLOCK_ID("groupCodeBox_block_id","orgEname","orgCname","factoryCode","factoryName","companyCode","companyName","HGSB001.queryGroupCodeBox",
new HashMap<String,Object>(){{
put(HGSB001.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
put(HGSB001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
put("orgTypes",new String[]{OrgTypeEnum.COMPANY.getCode(),OrgTypeEnum.FACTORY.getCode()});
}}
),
; ;
......
...@@ -81,6 +81,10 @@ public class HGConstant { ...@@ -81,6 +81,10 @@ public class HGConstant {
public static final String PROCESS_CODE = "PROCESS_CODE"; public static final String PROCESS_CODE = "PROCESS_CODE";
//工艺流程编码 //工艺流程编码
public static final String FLOW_CODE = "FLOW_CODE"; public static final String FLOW_CODE = "FLOW_CODE";
//设备编码
public static final String DEVICE_CODE = "DEVICE_CODE";
//计划单号
public static final String PLAN_CODE = "PLAN_CODE";
} }
/** /**
......
package com.baosight.hggp.hg.sb.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* Project: <br>
* Title:Hgsb001.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-05-09 13:47:25 create
*/
public class HGSB001 extends DaoEPBase {
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_COMPANY_CODE = "companyCode"; /* 公司编码*/
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/
public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 工厂代码*/
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 工厂名称*/
public static final String FIELD_GROUP_CODE = "groupCode"; /* 设备区域编码*/
public static final String FIELD_GROUP_NAME = "groupName"; /* 设备区域名称*/
public static final String FIELD_DEVICE_TYPE = "deviceType"; /* 设备类型*/
public static final String FIELD_DEVICE_CODE = "deviceCode"; /* 设备编码*/
public static final String FIELD_DEVICE_NAME = "deviceName"; /* 设备名称*/
public static final String FIELD_DEVICE_MODEL = "deviceModel"; /* 设备型号*/
public static final String FIELD_PURCHASE_DATE = "purchaseDate"; /* 购置日期*/
public static final String FIELD_MAINTAIN_DATE = "maintainDate"; /* 保养日期*/
public static final String FIELD_DEVICE_USER_ID = "deviceUserId"; /* 设备负责人*/
public static final String FIELD_DEVICE_STATUS = "deviceStatus"; /* 设备状态 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_COMPANY_CODE = "COMPANY_CODE"; /* 公司编码*/
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 公司名称*/
public static final String COL_FACTORY_CODE = "FACTORY_CODE"; /* 工厂代码*/
public static final String COL_FACTORY_NAME = "FACTORY_NAME"; /* 工厂名称*/
public static final String COL_GROUP_CODE = "GROUP_CODE"; /* 设备区域编码*/
public static final String COL_GROUP_NAME = "GROUP_NAME"; /* 设备区域名称*/
public static final String COL_DEVICE_TYPE = "DEVICE_TYPE"; /* 设备类型*/
public static final String COL_DEVICE_CODE = "DEVICE_CODE"; /* 设备编码*/
public static final String COL_DEVICE_NAME = "DEVICE_NAME"; /* 设备名称*/
public static final String COL_DEVICE_MODEL = "DEVICE_MODEL"; /* 设备型号*/
public static final String COL_PURCHASE_DATE = "PURCHASE_DATE"; /* 购置日期*/
public static final String COL_MAINTAIN_DATE = "MAINTAIN_DATE"; /* 保养日期*/
public static final String COL_DEVICE_USER_ID = "DEVICE_USER_ID"; /* 设备负责人*/
public static final String COL_DEVICE_STATUS = "DEVICE_STATUS"; /* 设备状态 0-停止 1-启用*/
public static final String QUERY = "HGSB001.query";
public static final String COUNT = "HGSB001.count";
public static final String INSERT = "HGSB001.insert";
public static final String UPDATE = "HGSB001.update";
public static final String UPDATE_STATUS = "HGSB001.updateStatus";
public static final String DELETE = "HGSB001.delete";
public static final String DELETE_FLAG = "HGSB001.deleteFlag";
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 companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/
private String factoryCode = " "; /* 工厂代码*/
private String factoryName = " "; /* 工厂名称*/
private String groupCode = " "; /* 设备区域编码*/
private String groupName = " "; /* 设备区域名称*/
private String deviceType = " "; /* 设备类型*/
private String deviceCode = " "; /* 设备编码*/
private String deviceName = " "; /* 设备名称*/
private String deviceModel = " "; /* 设备型号*/
private String purchaseDate = " "; /* 购置日期*/
private String maintainDate = " "; /* 保养日期*/
private String deviceUserId = " "; /* 设备负责人*/
private Integer deviceStatus = 1; /* 设备状态 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_COMPANY_CODE);
eiColumn.setDescName("公司编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_NAME);
eiColumn.setDescName("公司名称");
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_GROUP_CODE);
eiColumn.setDescName("设备区域编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_GROUP_NAME);
eiColumn.setDescName("设备区域名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEVICE_TYPE);
eiColumn.setDescName("设备类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEVICE_CODE);
eiColumn.setDescName("设备编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEVICE_NAME);
eiColumn.setDescName("设备名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEVICE_MODEL);
eiColumn.setDescName("设备型号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PURCHASE_DATE);
eiColumn.setDescName("购置日期");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_MAINTAIN_DATE);
eiColumn.setDescName("保养日期");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEVICE_USER_ID);
eiColumn.setDescName("设备负责人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEVICE_STATUS);
eiColumn.setDescName("设备状态 0-停止 1-启用");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGSB001() {
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 accountCode - 账套.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 账套.
*
* @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 companyCode - 公司编码.
* @return the companyCode
*/
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode - 公司编码.
*
* @param companyCode - 公司编码
*/
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* get the companyName - 公司名称.
* @return the companyName
*/
public String getCompanyName() {
return this.companyName;
}
/**
* set the companyName - 公司名称.
*
* @param companyName - 公司名称
*/
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
/**
* 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 groupCode - 设备区域编码.
* @return the groupCode
*/
public String getGroupCode() {
return this.groupCode;
}
/**
* set the groupCode - 设备区域编码.
*
* @param groupCode - 设备区域编码
*/
public void setGroupCode(String groupCode) {
this.groupCode = groupCode;
}
/**
* get the groupName - 设备区域名称.
* @return the groupName
*/
public String getGroupName() {
return this.groupName;
}
/**
* set the groupName - 设备区域名称.
*
* @param groupName - 设备区域名称
*/
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
* get the deviceType - 设备类型.
* @return the deviceType
*/
public String getDeviceType() {
return this.deviceType;
}
/**
* set the deviceType - 设备类型.
*
* @param deviceType - 设备类型
*/
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
/**
* get the deviceCode - 设备编码.
* @return the deviceCode
*/
public String getDeviceCode() {
return this.deviceCode;
}
/**
* set the deviceCode - 设备编码.
*
* @param deviceCode - 设备编码
*/
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
/**
* get the deviceName - 设备名称.
* @return the deviceName
*/
public String getDeviceName() {
return this.deviceName;
}
/**
* set the deviceName - 设备名称.
*
* @param deviceName - 设备名称
*/
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
/**
* get the deviceModel - 设备型号.
* @return the deviceModel
*/
public String getDeviceModel() {
return this.deviceModel;
}
/**
* set the deviceModel - 设备型号.
*
* @param deviceModel - 设备型号
*/
public void setDeviceModel(String deviceModel) {
this.deviceModel = deviceModel;
}
/**
* get the purchaseDate - 购置日期.
* @return the purchaseDate
*/
public String getPurchaseDate() {
return this.purchaseDate;
}
/**
* set the purchaseDate - 购置日期.
*
* @param purchaseDate - 购置日期
*/
public void setPurchaseDate(String purchaseDate) {
this.purchaseDate = purchaseDate;
}
/**
* get the maintainDate - 保养日期.
* @return the maintainDate
*/
public String getMaintainDate() {
return this.maintainDate;
}
/**
* set the maintainDate - 保养日期.
*
* @param maintainDate - 保养日期
*/
public void setMaintainDate(String maintainDate) {
this.maintainDate = maintainDate;
}
/**
* get the deviceUserId - 设备负责人.
* @return the deviceUserId
*/
public String getDeviceUserId() {
return this.deviceUserId;
}
/**
* set the deviceUserId - 设备负责人.
*
* @param deviceUserId - 设备负责人
*/
public void setDeviceUserId(String deviceUserId) {
this.deviceUserId = deviceUserId;
}
/**
* get the deviceStatus - 设备状态 0-停止 1-启用.
* @return the deviceStatus
*/
public Integer getDeviceStatus() {
return this.deviceStatus;
}
/**
* set the deviceStatus - 设备状态 0-停止 1-启用.
*
* @param deviceStatus - 设备状态 0-停止 1-启用
*/
public void setDeviceStatus(Integer deviceStatus) {
this.deviceStatus = deviceStatus;
}
/**
* 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));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName));
setGroupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_GROUP_CODE)), groupCode));
setGroupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_GROUP_NAME)), groupName));
setDeviceType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEVICE_TYPE)), deviceType));
setDeviceCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEVICE_CODE)), deviceCode));
setDeviceName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEVICE_NAME)), deviceName));
setDeviceModel(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEVICE_MODEL)), deviceModel));
setPurchaseDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PURCHASE_DATE)), purchaseDate));
setMaintainDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_MAINTAIN_DATE)), maintainDate));
setDeviceUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEVICE_USER_ID)), deviceUserId));
setDeviceStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DEVICE_STATUS)), deviceStatus));
}
/**
* 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_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
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_GROUP_CODE, StringUtils.toString(groupCode, eiMetadata.getMeta(FIELD_GROUP_CODE)));
map.put(FIELD_GROUP_NAME, StringUtils.toString(groupName, eiMetadata.getMeta(FIELD_GROUP_NAME)));
map.put(FIELD_DEVICE_TYPE, StringUtils.toString(deviceType, eiMetadata.getMeta(FIELD_DEVICE_TYPE)));
map.put(FIELD_DEVICE_CODE, StringUtils.toString(deviceCode, eiMetadata.getMeta(FIELD_DEVICE_CODE)));
map.put(FIELD_DEVICE_NAME, StringUtils.toString(deviceName, eiMetadata.getMeta(FIELD_DEVICE_NAME)));
map.put(FIELD_DEVICE_MODEL, StringUtils.toString(deviceModel, eiMetadata.getMeta(FIELD_DEVICE_MODEL)));
map.put(FIELD_PURCHASE_DATE, StringUtils.toString(purchaseDate, eiMetadata.getMeta(FIELD_PURCHASE_DATE)));
map.put(FIELD_MAINTAIN_DATE, StringUtils.toString(maintainDate, eiMetadata.getMeta(FIELD_MAINTAIN_DATE)));
map.put(FIELD_DEVICE_USER_ID, StringUtils.toString(deviceUserId, eiMetadata.getMeta(FIELD_DEVICE_USER_ID)));
map.put(FIELD_DEVICE_STATUS, StringUtils.toString(deviceStatus, eiMetadata.getMeta(FIELD_DEVICE_STATUS)));
return map;
}
}
package com.baosight.hggp.hg.sb.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.hg.constant.HGConstant;
import com.baosight.hggp.hg.sb.domain.HGSB001;
import com.baosight.hggp.util.*;
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/9
*/
public class ServiceHGSB001 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB001.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HGSB001.QUERY, new HGSB001());
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.USER_BLOCK_ID,DdynamicEnum.GROUP_CODE_BOX_BLOCK_ID),null
);
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.setCell(ACConstants.ROW_CODE_0, HGSB001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String purchaseDate = block.getCellStr(ACConstants.ROW_CODE_0,HGSB001.FIELD_PURCHASE_DATE);
if (!purchaseDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB001.FIELD_PURCHASE_DATE,StringUtil.removeHorizontalLine(purchaseDate));
}
return super.query(inInfo,HGSB001.QUERY,new HGSB001());
}
@OperationLogAnnotation(operModul = "设备台账",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HGSB001 hgsb001 = new HGSB001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb001.fromMap(map);
hgsb001.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSB001.DELETE_FLAG, hgsb001.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++) {
HGSB001 hgsb001 = new HGSB001();
hgsb001.fromMap(resultRows.get(i));
if (hgsb001.getId() == null || hgsb001.getId() == 0) {
this.add(hgsb001);
} else {
this.modify(hgsb001);
}
}
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(HGSB001 hgsb001) {
queryDeviceCode(hgsb001);
//生成工序编码
//hgsb001.setDeviceCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.DEVICE_CODE));
DaoUtils.insert(HGSB001.INSERT, hgsb001);
}
/**
* 修改操作
*/
public void modify(HGSB001 hgsb001) {
DaoUtils.update(HGSB001.UPDATE, hgsb001);
}
@OperationLogAnnotation(operModul = "设备台账",operType = "修改",operDesc = "修改状态操作")
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
HGSB001 hgsb001 = new HGSB001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb001.fromMap(map);
DaoUtils.update(HGSB001.UPDATE_STATUS, hgsb001);
}
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;
}
public void queryDeviceCode(HGSB001 hgsb001){
Map<String,Object> map = new HashMap<>();
//map.put(HPSB003.FIELD_FACTORY_CODE,hpsb001.getFactoryCode());
map.put("deviceCodeStr",hgsb001.getDeviceCode());
map.put(HGSB001.FIELD_DELETE_FLAG,hgsb001.getDeleteFlag());
List<HGSB001> hpsb003List = this.dao.query(HGSB001.QUERY,map);
AssertUtils.isNotEmpty(hpsb003List, String.format("设备编码[%s]已存在,添加失败!", hgsb001.getDeviceCode()));
}
}
<?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-09 14:10:11
Version : 1.0
schema : hggp
tableName : HGSB001
ID BIGINT NOT NULL primarykey,
ACCOUNT_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,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
FACTORY_CODE VARCHAR,
FACTORY_NAME VARCHAR,
GROUP_CODE VARCHAR,
GROUP_NAME VARCHAR,
DEVICE_TYPE VARCHAR,
DEVICE_CODE VARCHAR,
DEVICE_NAME VARCHAR,
DEVICE_MODEL VARCHAR,
PURCHASE_DATE VARCHAR,
MAINTAIN_DATE VARCHAR,
DEVICE_USER_ID VARCHAR,
DEVICE_STATUS TINYINT
-->
<sqlMap namespace="HGSB001">
<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-是 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
FACTORY_CODE as "factoryCode", <!-- 工厂代码 -->
FACTORY_NAME as "factoryName", <!-- 工厂名称 -->
GROUP_CODE as "groupCode", <!-- 设备区域编码 -->
GROUP_NAME as "groupName", <!-- 设备区域名称 -->
DEVICE_TYPE as "deviceType", <!-- 设备类型 -->
DEVICE_CODE as "deviceCode", <!-- 设备编码 -->
DEVICE_NAME as "deviceName", <!-- 设备名称 -->
DEVICE_MODEL as "deviceModel", <!-- 设备型号 -->
PURCHASE_DATE as "purchaseDate", <!-- 购置日期 -->
MAINTAIN_DATE as "maintainDate", <!-- 保养日期 -->
DEVICE_USER_ID as "deviceUserId", <!-- 设备负责人 -->
DEVICE_STATUS as "deviceStatus" <!-- 设备状态 0-停止 1-启用 -->
</sql>
<sql id="authCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(CREATED_BY = #authOnlyPeople# OR DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<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="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME LIKE CONCAT('%', #companyName#, '%')
</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="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
GROUP_NAME LIKE CONCAT('%', #groupName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceType">
DEVICE_TYPE = #deviceType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCode">
DEVICE_CODE LIKE CONCAT('%', #deviceCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCodeStr">
DEVICE_CODE = #deviceCodeStr#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceName">
DEVICE_NAME LIKE CONCAT('%', #deviceName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceModel">
DEVICE_MODEL = #deviceModel#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purchaseDate">
PURCHASE_DATE = #purchaseDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="maintainDate">
MAINTAIN_DATE = #maintainDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceUserId">
DEVICE_USER_ID = #deviceUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceStatus">
DEVICE_STATUS = #deviceStatus#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sb.domain.HGSB001">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSB001 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
PURCHASE_DATE desc,MAINTAIN_DATE desc,ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSB001 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="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
GROUP_NAME = #groupName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceType">
DEVICE_TYPE = #deviceType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCode">
DEVICE_CODE = #deviceCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceName">
DEVICE_NAME = #deviceName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceModel">
DEVICE_MODEL = #deviceModel#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purchaseDate">
PURCHASE_DATE = #purchaseDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="maintainDate">
MAINTAIN_DATE = #maintainDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceUserId">
DEVICE_USER_ID = #deviceUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceStatus">
DEVICE_STATUS = #deviceStatus#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSB001 (ID, <!-- ID -->
ACCOUNT_CODE, <!-- 账套 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
FACTORY_CODE, <!-- 工厂代码 -->
FACTORY_NAME, <!-- 工厂名称 -->
GROUP_CODE, <!-- 设备区域编码 -->
GROUP_NAME, <!-- 设备区域名称 -->
DEVICE_TYPE, <!-- 设备类型 -->
DEVICE_CODE, <!-- 设备编码 -->
DEVICE_NAME, <!-- 设备名称 -->
DEVICE_MODEL, <!-- 设备型号 -->
PURCHASE_DATE, <!-- 购置日期 -->
MAINTAIN_DATE, <!-- 保养日期 -->
DEVICE_USER_ID, <!-- 设备负责人 -->
DEVICE_STATUS <!-- 设备状态 0-停止 1-启用 -->
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #factoryCode#, #factoryName#, #groupCode#, #groupName#, #deviceType#, #deviceCode#, #deviceName#, #deviceModel#, #purchaseDate#, #maintainDate#, #deviceUserId#, #deviceStatus#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGSB001 WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hggpSchema}.HGSB001
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hggpSchema}.HGSB001
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-是 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
FACTORY_CODE = #factoryCode#, <!-- 工厂代码 -->
FACTORY_NAME = #factoryName#, <!-- 工厂名称 -->
GROUP_CODE = #groupCode#, <!-- 设备区域编码 -->
GROUP_NAME = #groupName#, <!-- 设备区域名称 -->
DEVICE_TYPE = #deviceType#, <!-- 设备类型 -->
DEVICE_CODE = #deviceCode#, <!-- 设备编码 -->
DEVICE_NAME = #deviceName#, <!-- 设备名称 -->
DEVICE_MODEL = #deviceModel#, <!-- 设备型号 -->
PURCHASE_DATE = #purchaseDate#, <!-- 购置日期 -->
MAINTAIN_DATE = #maintainDate#, <!-- 保养日期 -->
DEVICE_USER_ID = #deviceUserId#, <!-- 设备负责人 -->
DEVICE_STATUS = #deviceStatus# <!-- 设备状态 0-停止 1-启用 -->
WHERE
ID = #id#
</update>
<update id="updateStatus">
UPDATE ${hggpSchema}.HGSB001
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DEVICE_STATUS = #deviceStatus# <!-- 状态0.启用1.停止 -->
WHERE
ID = #id#
</update>
<select id="queryGroupCodeBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT distinct
ORG_ENAME AS "orgEname",
CONCAT('[',COMPANY_NAME,']',ORG_CNAME) AS "orgCname",
FACTORY_CODE AS "factoryCode",
FACTORY_NAME as "factoryName",
COMPANY_CODE AS "companyCode",
COMPANY_NAME AS "companyName"
FROM
${platSchema}.TXSOG01
WHERE 1=1
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="type">
ORG_TYPE = #type#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgTypes">
ORG_TYPE not in <iterate close=")" open="(" conjunction="," property="orgTypes">#orgTypes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend="AND" property="deleteFlag">
IS_DELETED = #deleteFlag#
</isNotEmpty>
</select>
</sqlMap>
$(function () {
var companyCodeBox = __eiInfo.getBlock("companyBox_block_id").getMappedRows();
var groupCodeBox = __eiInfo.getBlock("groupCodeBox_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
IPLATUI.EFAutoComplete = {
"inqu_status-0-deviceName": {
minLength: 1,
dataSource: {
pageSize: 10,
serverPaging: true,
serverFiltering: true
}
}
};
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let auditStatus = item.deviceStatus;
let template = '';
if (item.companyCode && item.groupCode) {
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="updateStatus(' + item.id + ',1)" >启用</a>';
} else if (auditStatus == 1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',0)" >停止</a>';
}
}
return template;
}
},{
field: "purchaseDate",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return currShortDate();
}
}, {
field: "maintainDate",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return currShortDate();
}
}, {
field: "companyCode",
title: "公司名称",
template: function (dataItem) {
for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['valueField'] === dataItem['companyCode']){
dataItem['companyName'] = companyCodeBox[i]['textField']
return companyCodeBox[i]['textField'];
}
}
return dataItem["companyCode"];
}
},{
field: "groupCode",
title: "设备区域",
filter: function (options) {
var companyCode = options.model['companyCode'];
if(companyCode) {
// 返回我们过滤后的数据集
return _.filter(groupCodeBox, function (item) {
return item["param3Field"] === companyCode;
})
}
return groupCodeBox;
},
template: function (dataItem) {
for (let i = 0; i < groupCodeBox.length; i++) {
if (groupCodeBox[i]['valueField'] === dataItem['groupCode']) {
dataItem['groupName'] = groupCodeBox[i]['textField'].split("]")[1]
dataItem['factoryCode'] = groupCodeBox[i]['param1Field']
dataItem['factoryName'] = groupCodeBox[i]['param2Field']
return groupCodeBox[i]['textField'].split("]")[1];
}
}
return dataItem["groupCode"]
}
},{
field: "deviceCode",
title: "设备编码",
}
],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "companyCode") {
loadChange(grid,e,"groupCode");
}else if (e.field === "groupCode") {
if (e.items[0].companyCode.length===0){
loadChange(grid,e,"companyCode");
}
//loadChange(grid,e,"userId");
}
});
},
afterEdit:function (e) {
if (e.field === "groupCode" && e.model["companyCode"].length === 0){
for (let i = 0; i < groupCodeBox.length; i++) {
if (e.model[e.field] === groupCodeBox[i]["valueField"]){
e.model["companyCode"]=groupCodeBox[i]["param3Field"]
break;
}
}
}/*else if (e.field === "userId" && e.model["groupCode"].length === 0){
for (let i = 0; i < userName.length; i++) {
if (e.model[e.field] === userName[i]["valueField"]){
//e.model["factoryCode"]=userName[i]["param1Field"]
e.model["groupCode"]=userName[i]["param2Field"]
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) {
}
}
}
//工厂类型下拉联动
/*$('input[name="inqu_status-0-companyCode"]').change(function () {
var companyCode=$("#inqu_status-0-companyCode").val();
$("#inqu_status-0-groupCode").kendoDropDownList({
dataSource: _.filter(groupCodeBox, function (item) {
return item["param3Field"] === companyCode;
}),
dataTextField: "textField",
dataValueField: "valueField",
required: "true",
optionLabelTemplate: "#:textField#",
valueTemplate: "#:textField#",
template: "#:textField#",
filter: "contains"
});
});*/
//生产组下拉联动
/*$('input[name="inqu_status-0-groupCode"]').change(function () {
var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val();
inInfo.set("factoryCode",factoryCode);
var groupCode=$("#inqu_status-0-groupCode").val();
inInfo.set("groupCode",groupCode);
inInfo.set("groupType","prodGroup");
EiCommunicator.send("HPSC008", "queryGroupCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-userId");
let dataEdition=ei.getBlock("user_id_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataEdition,
template: "#=textField#"
});
}, onFail: function (ei) {
}
}, {async: false});
});*/
downKeyUp();
});
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 companyCode= item.get("companyCode");
let groupCode= item.get("groupCode");
let deviceType= item.get("deviceType");
let deviceCode= item.get("deviceCode");
let deviceName= item.get("deviceName");
let deviceModel= item.get("deviceModel");
let purchaseDate= item.get("purchaseDate");
let deviceUserId= item.get("deviceUserId");
if(isBlank(companyCode)){
message("选中的第"+(index+1)+"行\"公司\",不能为空!");
flag = false;
return false;
}
if(isBlank(groupCode)){
message("选中的第"+(index+1)+"行\"设备区域\",不能为空!");
flag = false;
return false;
}
if(isBlank(deviceType)){
message("选中的第"+(index+1)+"行\"设备类型\",不能为空!");
flag = false;
return false;
}
if(isBlank(deviceCode)){
message("选中的第"+(index+1)+"行\"设备编码\",不能为空!");
flag = false;
return false;
}
if(isBlank(deviceName)){
message("选中的第"+(index+1)+"行\"设备名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(deviceModel)){
message("选中的第"+(index+1)+"行\"设备型号\",不能为空!");
flag = false;
return false;
}
if(isBlank(purchaseDate)){
message("选中的第"+(index+1)+"行\"购置日期\",不能为空!");
flag = false;
return false;
}
if(isBlank(deviceUserId)){
message("选中的第"+(index+1)+"行\"设备负责人\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSB001", "save", true);
btnNode.attr("disabled", false);
}
});
}
}
function updateStatus(id,deviceStatus) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-deviceStatus", deviceStatus);
EiCommunicator.send('HGSB001', '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/9
Time: 15:01
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="companyCode" 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="groupName" cname="设备区域" colWidth="3"/>
<%--<EF:EFSelect blockId="inqu_status" row="0" ename="groupCode" cname="设备区域" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="groupCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>--%>
<EF:EFSelect blockId="inqu_status" row="0" ename="deviceType" cname="设备类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType"/>
</EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="purchaseDate" cname="购置日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceCode" cname="设备编码" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceName" cname="设备名称" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="账套" hidden="true"/>
<%--blockName="factoryCodeBox_block_id"--%>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupCode" cname="设备区域"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="groupCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="deviceType" cname="设备类型"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="80" readonly="true" required="true"
align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType" />
</EF:EFComboColumn>
<EF:EFColumn ename="deviceCode" cname="设备编码" width="100" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="deviceName" cname="设备名称" width="160" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="deviceModel" cname="设备型号" width="120" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="purchaseDate" cname="购置日期" width="120" enable="true" readonly="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="maintainDate" cname="保养日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
<EF:EFComboColumn ename="deviceUserId" cname="设备负责人"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="100" readonly="false" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="deviceStatus" cname="设备状态" width="80" align="center" readonly="false" 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>
...@@ -447,6 +447,31 @@ function downKeyUp() { ...@@ -447,6 +447,31 @@ function downKeyUp() {
} }
const grush = { const grush = {
initDropDownBox(carrierId, initBlockId, template) {
if (!($ || jQuery)) {
throw new Error('jQuery引入失败...找不到对外暴露的$和jQuery');
}
if (!$(carrierId).get(0)) {
throw new Error(
`装载数据的载体元素不存在, 找不到元素ID为{${carrierId}}的元素, 请去前端页面查看...`);
}
if (!__eiInfo.getBlock(initBlockId)) {
throw new Error(
`名称为{${initBlockId}的块不存在, 请查看后端初始化方法或前端页面EF:EFComboColumn标签的blockName属性...`);
}
$(carrierId).kendoAutoComplete({
dataSource: __eiInfo.getBlock(initBlockId).getMappedRows(),
dataTextField: "textField",
dataValueField: "valueField",
required: "true",
optionLabelTemplate: "#:valueField#-#:textField#",
valueTemplate: "#:valueField#-#:textField#",
template: "#:textField#",
filter: "contains"
});
},
openImportBox(importBoxDomId) { openImportBox(importBoxDomId) {
if (!($ || jQuery)) { if (!($ || jQuery)) {
throw new Error('jQuery引入失败...找不到对外暴露的$和jQuery'); throw new Error('jQuery引入失败...找不到对外暴露的$和jQuery');
......
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