Commit ca6aab8a by liuyang

2024-04-12 设备管理功能开发

parent 2f3af722
...@@ -351,11 +351,11 @@ public enum DdynamicEnum { ...@@ -351,11 +351,11 @@ public enum DdynamicEnum {
*/ */
GROUP_RECORD1_BLOCK_ID("group_record_block_id","orgId","orgCname","HPSC010.queryGroupComboBox"), GROUP_RECORD1_BLOCK_ID("group_record_block_id","orgId","orgCname","HPSC010.queryGroupComboBox"),
FACTORY_CODE_BOX_BLOCK_ID("factoryCodeBox_block_id","factoryCode","factoryName","HPSB001.queryFactoryCodeBox"), FACTORY_CODE_BOX_BLOCK_ID("factoryCodeBox_block_id","factoryCode","factoryName","HPSB003.queryFactoryCodeBox"),
GROUP_CODE_BOX_BLOCK_ID("groupCodeBox_block_id","groupCode","groupName","factoryCode","factoryName","HPSB001.queryGroupCodeBox"), GROUP_CODE_BOX_BLOCK_ID("groupCodeBox_block_id","groupCode","groupName","factoryCode","factoryName","HPSB003.queryGroupCodeBox"),
USER_ID_BOX_BLOCK_ID("userIdBox_block_id","userId","userName","HPSB001.queryUserIdBox"), USER_ID_BOX_BLOCK_ID("userIdBox_block_id","userId","userName","HPSB003.queryUserIdBox"),
/** /**
* 模块:工人管理 * 模块:工人管理
......
package com.baosight.hpjx.hp.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:THpsb003.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-04-02 10:36:28 create
*/
public class HPSB003 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id"; /* ID*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 公司编码*/
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_GROUP_CODE = "groupCode"; /* 生产组代码(设备区域)*/
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_COMPANY_CODE = "COMPANY_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_GROUP_CODE = "GROUP_CODE"; /* 生产组代码(设备区域)*/
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 = "HPSB003.query";
public static final String COUNT = "HPSB003.count";
public static final String INSERT = "HPSB003.insert";
public static final String UPDATE = "HPSB003.update";
public static final String DELETE = "HPSB003.delete";
public static final String DELETE_FLAG = "HPSB003.deleteFlag";
public static final String UPDATE_DEVICE_STATUS = "HPSB003.updateDeviceStatus";
private Long id; /* ID*/
private String companyCode = " "; /* 公司编码*/
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 groupCode = " "; /* 生产组代码(设备区域)*/
private String deviceType = " "; /* 设备类型*/
private String deviceCode = " "; /* 设备编码*/
private String deviceName = " "; /* 设备名称*/
private String deviceModel = " "; /* 设备型号*/
private String purchaseDate = " "; /* 购置日期*/
private String maintainDate = " "; /* 保养日期*/
private String deviceUserId = " "; /* 设备负责人*/
private Integer deviceStatus = 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_COMPANY_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_GROUP_CODE);
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 HPSB003() {
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 getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode - 公司编码.
*
* @param companyCode - 公司编码
*/
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* 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 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 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) {
//TODO id cannot generate automatically ,BigInteger dont support
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
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));
setGroupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_GROUP_CODE)), groupCode));
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_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_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_GROUP_CODE, StringUtils.toString(groupCode, eiMetadata.getMeta(FIELD_GROUP_CODE)));
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.hpjx.hp.sb.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.sb.domain.HPSB003;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.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 java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/4/8
*/
public class ServiceHPSB003 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
final EiInfo outEiInfo = super.query(inInfo, HPSB003.QUERY, new HPSB003());
//拼接名称 包含逻辑删除数据
CommonMethod.initBlock(outEiInfo,
Arrays.asList(DdynamicEnum.FACTORY_CODE_BOX_BLOCK_ID,DdynamicEnum.GROUP_CODE_BOX_BLOCK_ID,DdynamicEnum.USER_ID_BOX_BLOCK_ID),
new HashMap<String,Object>(){}
);
return outEiInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
String purchaseDate = block.getCellStr(ACConstants.ROW_CODE_0,HPSB003.FIELD_PURCHASE_DATE);
if (!purchaseDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB003.FIELD_PURCHASE_DATE, StringUtil.removeHorizontalLine(purchaseDate));
}
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0, HPSB003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPSB003.QUERY,new HPSB003());
}
@OperationLogAnnotation(operModul = "设备管理",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPSB003 hpsb001 = new HPSB003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsb001.fromMap(map);
hpsb001.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPSB003.DELETE_FLAG, hpsb001);
}
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 = "修改操作")
@Override
public EiInfo update(EiInfo inInfo) {
int i = 0;
try {
HPSB003 hpsb001 = new HPSB003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsb001.fromMap(map);
hpsb001.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.update(HPSB003.UPDATE, hpsb001);
}
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;
}
@OperationLogAnnotation(operModul = "设备管理",operType = "修改",operDesc = "修改设备状态操作")
public EiInfo updateDeviceStatus(EiInfo inInfo) {
int i = 0;
try {
HPSB003 hpsb001 = new HPSB003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsb001.fromMap(map);
DaoUtils.update(HPSB003.UPDATE_DEVICE_STATUS, hpsb001);
}
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;
}
@OperationLogAnnotation(operModul = "设备管理",operType = "新增",operDesc = "新增操作")
@Override
public EiInfo insert(EiInfo inInfo) {
int i = 0;
try {
HPSB003 hpsb001 = new HPSB003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsb001.fromMap(map);
hpsb001.setDeleteFlag(CommonConstant.YesNo.NO_0);
Map<String,Object> queryMap = new HashMap<>();
queryDeviceCode(hpsb001);
DaoUtils.insert(HPSB003.INSERT, hpsb001);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.insert", "新增")});
} catch (PlatException e) {
e.printStackTrace();
ErrorCodeUtils.handleInsertException(inInfo,i,e);
logError("新增失败", e.getMessage());
return inInfo;
}
return inInfo;
}
public EiInfo queryFactoryCode(EiInfo inInfo) {
final String companyCode = UserSessionUtils.getCompanyCode();
String factoryCode = inInfo.getString(HPSB003.FIELD_FACTORY_CODE);
//String groupType = inInfo.getString(HPSC008.FIELD_GROUP_TYPE);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.GROUP_CODE_BOX_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSB003.FIELD_COMPANY_CODE,companyCode);
put(HPSB003.FIELD_FACTORY_CODE,factoryCode);
}});
return inInfo;
}
public void queryDeviceCode(HPSB003 hpsb001){
Map<String,Object> map = new HashMap<>();
map.put(HPSB003.FIELD_FACTORY_CODE,hpsb001.getFactoryCode());
map.put(HPSB003.FIELD_DEVICE_CODE,hpsb001.getDeviceCode());
map.put(HPSB003.FIELD_DELETE_FLAG,hpsb001.getDeleteFlag());
List<HPSB003> hpsb003List = this.dao.query(HPSB003.QUERY,map);
AssertUtils.isNotEmpty(hpsb003List, String.format("设备编码[%s]在当前工厂已存在,添加失败", map.get(HPSB003.FIELD_DEVICE_CODE)));
}
}
<?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">
<sqlMap namespace="HPSB003">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</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="groupCode">
GROUP_CODE = #groupCode#
</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="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>
<!--根据companyCode获取用户绑定的组织的工厂编码-->
<sql id="queryFactoryCodeBase">
SELECT DISTINCT FACTORY_CODE
FROM ${platSchema}.txsog01
WHERE IS_DELETED = '0'
and COMPANY_CODE = #companyCode#
and ORG_ID in (<include refid="queryLoginNameBase"/>)
</sql>
<!--根据companyCode获取用户绑定的组织机构ID-->
<sql id="queryLoginNameBase">
select ORG_ID from ${platSchema}.txsog02 T2 inner join ${platSchema}.xs_user xu on t2.USER_ID = xu.USER_ID
where xu.COMPANY_CODE = #companyCode#
order by T2.REC_CREATE_TIME desc
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sb.domain.HPSB003">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
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", <!-- 工厂代码(公司名称) -->
GROUP_CODE as "groupCode", <!-- 生产组代码(设备区域) -->
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-启用 -->
FROM ${hpjxSchema}.T_HPSB003 WHERE 1=1
<include refid="authCondition"/>
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPSB003 WHERE 1=1
<include refid="authCondition"/>
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</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="groupCode">
GROUP_CODE = #groupCode#
</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 ${hpjxSchema}.T_HPSB003 (ID, <!-- ID -->
COMPANY_CODE, <!-- 公司编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
FACTORY_CODE, <!-- 工厂代码(公司名称) -->
GROUP_CODE, <!-- 生产组代码(设备区域) -->
DEVICE_TYPE, <!-- 设备类型 -->
DEVICE_CODE, <!-- 设备编码 -->
DEVICE_NAME, <!-- 设备名称 -->
DEVICE_MODEL, <!-- 设备型号 -->
PURCHASE_DATE, <!-- 购置日期 -->
MAINTAIN_DATE, <!-- 保养日期 -->
DEVICE_USER_ID, <!-- 设备负责人 -->
DEVICE_STATUS <!-- 设备状态 0-停止 1-启用 -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #factoryCode#, #groupCode#, #deviceType#, #deviceCode#, #deviceName#, #deviceModel#, #purchaseDate#, #maintainDate#, #deviceUserId#, #deviceStatus#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPSB003 WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPSB003
SET
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0:否1.是 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_TIME = #updatedTime#, <!-- 修改人名称 -->
UPDATED_NAME = #updatedName# <!-- 修改时间 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPSB003
SET
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
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#, <!-- 工厂代码(公司名称) -->
GROUP_CODE = #groupCode#, <!-- 生产组代码(设备区域) -->
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="updateDeviceStatus">
UPDATE ${hpjxSchema}.T_HPSB003
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DEVICE_STATUS = #deviceStatus# <!-- 设备状态 0-停止 1-启用 -->
WHERE
ID = #id#
</update>
<select id="queryFactoryCodeBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT distinct
FACTORY_CODE as "factoryCode",
FACTORY_NAME as "factoryName"
FROM ${platSchema}.txsog01
WHERE IS_DELETED = '0'
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
<!--and ORG_ID IN (<include refid="queryLoginNameBase"/>)-->
</isNotEmpty>
ORDER BY FACTORY_CODE,REC_CREATE_TIME desc
</select>
<select id="queryGroupCodeBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
T2.LEVEL AS "level",
T3.ORG_ID AS "groupCode",
CONCAT('[',T5.FACTORY_NAME,']',T3.ORG_CNAME) AS "groupName",
T3.FACTORY_CODE AS "factoryCode",
T5.FACTORY_NAME AS "factoryName"
FROM (
SELECT
@CODES AS CODES,
(SELECT @CODES:=GROUP_CONCAT(ORG_ID)
FROM ${platSchema}.TXSOG01
WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES)
AND COMPANY_CODE = #companyCode#
AND IS_DELETED = 0
) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL
FROM ${platSchema}.TXSOG01,
<isNotEmpty property="parentOrgId">
(SELECT @CODES:=#parentOrgId#, @LEVEL:= 0) T4
</isNotEmpty>
<isEmpty property="parentOrgId">
(SELECT @CODES:='root', @LEVEL:= 0) T4
</isEmpty>
WHERE @CODES IS NOT NULL
) T2,
${platSchema}.TXSOG01 T3
LEFT JOIN ${platSchema}.TXSOG01 T5 ON T3.FACTORY_CODE = T5.ORG_ID
WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES)
AND T3.IS_DELETED = '0'
and T3.ORG_ID != 'root'
<isNotEmpty prepend=" AND " property="orgType">
T3.ORG_TYPE = #orgType#
</isNotEmpty>
<isNotEmpty property="AND" prepend="orgTypes">
ORG_TYPE NOT IN <iterate close=")" open="(" conjunction="," property="depCodes">#orgTypes[]#</iterate>
</isNotEmpty>
<isEmpty prepend="AND" property="orgType">
T3.ORG_TYPE NOT IN ('factory','dept')
</isEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
T3.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
T3.FACTORY_CODE,T2.LEVEL, T3.ORG_ID
</isEmpty>
</dynamic>
</select>
<select id="queryUserIdBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
select distinct
LOGIN_NAME as "userId",
USER_NAME as "userName"
from ${platSchema}.xs_user T1
inner join ${platSchema}.txsog02 T2 ON t2.USER_ID = T1.USER_ID
where 1=1
<isNotEmpty prepend=" AND " property="companyCode">
T1.COMPANY_CODE = #companyCode#
</isNotEmpty>
<!--<isNotEmpty prepend="AND" property="companyCode">
T2.ORG_ID IN (<include refid="queryLoginNameBase"/>)
</isNotEmpty>-->
<!--<isNotEmpty prepend="and" property="companyCode">
ORG_ID in (
select ORG_ID FROM iplat.txsog01
WHERE IS_DELETED = '0'
and COMPANY_CODE = #companyCode#
<isNotEmpty prepend="and" property="orgEname">
ORG_ENAME = #orgEname#
</isNotEmpty>
AND ORG_TYPE NOT IN ('factory','dept')
and FACTORY_CODE IN (
SELECT FACTORY_CODE FROM iplat.txsog01
WHERE IS_DELETED = '0' and COMPANY_CODE = #companyCode#
and ORG_ID IN (
SELECT ORG_ID FROM iplat.txsog02 T2
INNER JOIN iplat.xs_user xu ON t2.USER_ID = xu.USER_ID
WHERE xu.COMPANY_CODE = #companyCode#
ORDER BY T2.REC_CREATE_TIME desc
)
)
)
</isNotEmpty>-->
</select>
</sqlMap>
$(function () {
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.factoryCode && 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: "factoryCode",
title: "公司名称",
/*filter: function (options) {
return factoryCode;
},*/
/*template: function (dataItem) {
return dataItem["factoryCode"].split(']')[1];
}*/
},{
field: "groupCode",
title: "设备区域",
filter: function (options) {
var province = options.model['factoryCode'];
if(province) {
// 返回我们过滤后的数据集
return _.filter(groupCodeBox, function (item) {
return item["param1Field"]==province;
})
}
return groupCodeBox;
},
template: function (dataItem) {
for (let i = 0; i < groupCodeBox.length; i++) {
if (groupCodeBox[i]['valueField'] === dataItem['groupCode']) {
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 == "factoryCode") {
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;
}
}
}/*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();
//saveFunc();
},
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-factoryCode"]').change(function () {
var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val();
inInfo.set("factoryCode",factoryCode);
inInfo.set("groupType","prodGroup");
EiCommunicator.send("HPSB003", "queryFactoryCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
let dataEdition=ei.getBlock("groupCodeBox_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataEdition,
template: "#=textField#"
});
}, onFail: function (ei) {
}
}, {async: false});
});
//生产组下拉联动
/*$('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);
}
function updateStatus(id,deviceStatus) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-deviceStatus", deviceStatus);
EiCommunicator.send('HPSB003', 'updateDeviceStatus', 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");
}
var rowsBlock = function (grid_id,field) {
var resultGrid = window[grid_id + 'Grid'];
var columns = resultGrid.columns;
var dateColumns = _.filter(columns,
function (column) {
return column.editType === "date"
|| column.editType === "datetime";
}
);
var eiblock = new EiBlock(grid_id);
var rowsDate = resultGrid.getDataItems();
if (field!==undefined){
rowsDate = _.filter(resultGrid.getDataItems(), function (item) {
return item["id"]==field;
});
}
for (var int = 0; int < rowsDate.length; int++) {
if (int == 0) {
for (var key in rowsDate[0].toJSON()) {
var eColumn = new EiColumn(key);
eiblock.getBlockMeta().addMeta(eColumn);
}
}
var model = rowsDate[int];
$.each(dateColumns, function (index, dateColumn) {
var field = dateColumn.field, dateFormat = dateColumn.dateFormat;
model[field] = kendo.toString(model[field],
dateFormat
);// 日期转String
});
if (isBlank(model.prdtName)){
continue;
}else {
eiblock.addRow(eiblock.getMappedArray(model, true));
}
}
var showCount = eiblock.get(EiConstant.SHOW_COUNT) || "true";
eiblock.set(EiConstant.SHOW_COUNT, showCount);
eiblock.set(EiConstant.LIMIT, resultGrid.dataSource['_pageSize']);
// eiblock.set(EiConstant.OFFSET, resultGrid.dataSource['_skip']);
// 默认查询第一页
eiblock.set(EiConstant.OFFSET, 0);
return eiblock;
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/4/13
Time: 10:29
To change this template use File | Settings | File Templates.
--%>
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/4/9
Time: 8:51
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="factoryCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<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">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<%--blockName="factoryCodeBox_block_id"--%>
<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" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="factoryCodeBox_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" hidden="true"
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="userIdBox_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>
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