Commit b02ad10d by liuyang

2024-08-14 设备管理

parent e2fafc06
......@@ -393,7 +393,7 @@ public enum DdynamicEnum {
*/
DEVICE_CODE_BLOCK_ID("deviceCode_block_id","deviceCode","deviceName","HPSB003.queryDeviceCode"),
DEVICE_CODE_BOX_BLOCK_ID("deviceCodeBox_block_id","deviceCode","deviceName", "deviceType", "companyCode", "factoryCode", "deviceStatus","HPSB003.queryDeviceCodeBox"),
DEVICE_CODE_BOX_BLOCK_ID("deviceCodeBox_block_id","deviceCode","deviceName", "deviceType", "companyCode", "factoryCode", "groupCode","deviceStatus","HPSB003.queryDeviceCodeBox"),
;
......
package com.baosight.hpjx.hp.sb.domain;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
......@@ -42,6 +43,13 @@ public class HPSB003 extends DaoEPBase {
public static final String FIELD_DEVICE_USER_ID = "deviceUserId"; /* 设备负责人*/
public static final String FIELD_DEVICE_STATUS = "deviceStatus"; /* 设备状态 0-停止 1-启用*/
public static final String FIELD_SUP_CODE = "supCode"; /* 供应商编码*/
public static final String FIELD_SUP_NAME = "supName"; /* 供应商名称*/
public static final String FIELD_HEAD_NAME = "headName"; /* 负责人*/
public static final String FIELD_PHONE_NAME = "phoneName"; /* 负责人联系方式*/
public static final String FIELD_ADDRESS = "address"; /* 地址*/
public static final String FIELD_PERIOD_DAYS = "periodDays";
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"; /* 部门编码*/
......@@ -70,6 +78,8 @@ public class HPSB003 extends DaoEPBase {
public static final String DELETE = "HPSB003.delete";
public static final String DELETE_FLAG = "HPSB003.deleteFlag";
public static final String UPDATE_DEVICE_STATUS = "HPSB003.updateDeviceStatus";
public static final String UPDATE_STATUS = "HPSB003.updateStatus";
public static final String UPDATE_MAINTAIN_DATE = "HPSB003.updateMaintainDate";
private Long id; /* ID*/
private String companyCode = " "; /* 公司编码*/
......@@ -91,6 +101,12 @@ public class HPSB003 extends DaoEPBase {
private String maintainDate = " "; /* 保养日期*/
private String deviceUserId = " "; /* 设备负责人*/
private Integer deviceStatus = 0; /* 设备状态 0-停止 1-启用*/
private String supCode = " "; /* 供应商编码*/
private String supName = " "; /* 供应商名称*/
private String headName = " "; /* 联系人*/
private String phoneName = " "; /* 联系电话*/
private String address = " "; /* 地址*/
public Integer periodDays = 0;
/**
* initialize the metadata.
......@@ -179,6 +195,29 @@ public class HPSB003 extends DaoEPBase {
eiColumn.setDescName("设备状态 0-停止 1-启用");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SUP_CODE);
eiColumn.setDescName("供应商编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SUP_NAME);
eiColumn.setDescName("供应商名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_HEAD_NAME);
eiColumn.setDescName("负责人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PHONE_NAME);
eiColumn.setDescName("负责人联系方式");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ADDRESS);
eiColumn.setDescName("地址");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PERIOD_DAYS);
eiColumn.setDescName("保养周期天数");
eiMetadata.addMeta(eiColumn);
}
......@@ -509,6 +548,55 @@ public class HPSB003 extends DaoEPBase {
public void setDeviceStatus(Integer deviceStatus) {
this.deviceStatus = deviceStatus;
}
public String getSupCode() {
return supCode;
}
public void setSupCode(String supCode) {
this.supCode = supCode;
}
public String getSupName() {
return supName;
}
public void setSupName(String supName) {
this.supName = supName;
}
public String getHeadName() {
return headName;
}
public void setHeadName(String headName) {
this.headName = headName;
}
public String getPhoneName() {
return phoneName;
}
public void setPhoneName(String phoneName) {
this.phoneName = phoneName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getPeriodDays() {
return periodDays;
}
public void setPeriodDays(Integer periodDays) {
this.periodDays = periodDays;
}
/**
* get the value from Map.
*
......@@ -534,10 +622,16 @@ public class HPSB003 extends DaoEPBase {
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));
setPurchaseDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_PURCHASE_DATE))), purchaseDate));
setMaintainDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(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));
setSupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUP_CODE)), supCode));
setSupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUP_NAME)), supName));
setHeadName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_HEAD_NAME)), headName));
setPhoneName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PHONE_NAME)), phoneName));
setAddress(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ADDRESS)), address));
setPeriodDays(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_PERIOD_DAYS)), periodDays));
}
/**
......@@ -567,6 +661,12 @@ public class HPSB003 extends DaoEPBase {
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)));
map.put(FIELD_SUP_CODE, StringUtils.toString(supCode, eiMetadata.getMeta(FIELD_SUP_CODE)));
map.put(FIELD_SUP_NAME, StringUtils.toString(supName, eiMetadata.getMeta(FIELD_SUP_NAME)));
map.put(FIELD_HEAD_NAME, StringUtils.toString(headName, eiMetadata.getMeta(FIELD_HEAD_NAME)));
map.put(FIELD_PHONE_NAME, StringUtils.toString(phoneName, eiMetadata.getMeta(FIELD_PHONE_NAME)));
map.put(FIELD_ADDRESS, StringUtils.toString(address, eiMetadata.getMeta(FIELD_ADDRESS)));
map.put(FIELD_PERIOD_DAYS, StringUtils.toString(periodDays, eiMetadata.getMeta(FIELD_PERIOD_DAYS)));
return map;
}
......
......@@ -18,10 +18,7 @@ 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;
import java.util.*;
/**
* @author LiuYang
......@@ -31,23 +28,28 @@ 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());
//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),
CommonMethod.initBlock(inInfo,
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;
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
if (!Objects.isNull(block)) {
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());
}
......@@ -66,14 +68,9 @@ public class ServiceHPSB003 extends ServiceEPBase {
DaoUtils.update(HPSB003.DELETE_FLAG, hpsb001);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
inInfo.setMsg("操作成功!本次对[" + eiBlock.getRowCount() + "]条数据删除成功!");
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
LogUtils.setMsg(inInfo,e, "删除失败");
}
return inInfo;
}
......@@ -92,13 +89,9 @@ public class ServiceHPSB003 extends ServiceEPBase {
DaoUtils.update(HPSB003.UPDATE, hpsb001);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
inInfo.setMsg("操作成功!本次对[" + eiBlock.getRowCount() + "]条数据修改成功!");
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
LogUtils.setMsg(inInfo,e, "修改失败");
}
return inInfo;
}
......@@ -107,21 +100,17 @@ public class ServiceHPSB003 extends ServiceEPBase {
public EiInfo updateDeviceStatus(EiInfo inInfo) {
int i = 0;
try {
HPSB003 hpsb001 = new HPSB003();
HPSB003 hpsb003 = 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);
hpsb003.fromMap(map);
DaoUtils.update(HPSB003.UPDATE_DEVICE_STATUS, hpsb003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
inInfo.setMsg("操作成功!本次对[" + eiBlock.getRowCount() + "]条数据修改成功!");
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
LogUtils.setMsg(inInfo,e, "修改失败");
}
return inInfo;
}
......@@ -131,16 +120,15 @@ public class ServiceHPSB003 extends ServiceEPBase {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
for (Map resultRow : resultRows) {
HPSB003 hpsb003 = new HPSB003();
hpsb003.fromMap(resultRows.get(i));
hpsb003.fromMap(resultRow);
if (hpsb003.getId() == null || hpsb003.getId() == 0) {
this.add(hpsb003);
} else {
this.modify(hpsb003);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
......@@ -169,23 +157,19 @@ public class ServiceHPSB003 extends ServiceEPBase {
public EiInfo insert(EiInfo inInfo) {
int i = 0;
try {
HPSB003 hpsb001 = new HPSB003();
HPSB003 hpsb003 = 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);
hpsb003.fromMap(map);
hpsb003.setDeleteFlag(CommonConstant.YesNo.NO_0);
queryDeviceCode(hpsb003);
DaoUtils.insert(HPSB003.INSERT, hpsb003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.insert", "新增")});
inInfo.setMsg("操作成功!本次对[" + eiBlock.getRowCount() + "]条数据新增成功!");
} catch (PlatException e) {
e.printStackTrace();
ErrorCodeUtils.handleInsertException(inInfo,i,e);
logError("新增失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
......
package com.baosight.hpjx.hp.sb.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.hp.sb.domain.HPSB003;
import com.baosight.hpjx.hp.sb.domain.HPSB003A;
import com.baosight.hpjx.hp.sb.domain.HPSB008;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
/**
* @author LiuYang
* @version 1.0 2024/8/13
* @description 设备台账详情
*/
public class ServiceHPSB003A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
//EiBlock queryBlock = inInfo.getBlock(EiConstant.queryBlock);
//queryBlock.setCell(ACConstants.ROW_CODE_0, HPSB003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
//queryBlock.set(EiConstant.offsetStr,EiConstant.defaultOffset);
//queryBlock.set(EiConstant.limitStr,EiConstant.defaultLimit);
//EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
//resultBlock.set(EiConstant.isCountFlag,true);
//inInfo.setBlock(resultBlock);
//inInfo = super.query(inInfo, HPSB003A.RESULT_QUERY, new HPSB003A(),false, new EiBlockMeta(),EiConstant.queryBlock,EiConstant.resultBlock,EiConstant.resultBlock,"resultCount");
//EiInfo eiInfo = super.query(inInfo, HPSB003A.DETAIL_QUERY, new HPSB003A(), false, new EiBlockMeta(), EiConstant.queryBlock, CommonConstant.Field.DETAIL, CommonConstant.Field.DETAIL, "HPSB003A.detailCount");
//inInfo.setBlock(eiInfo.getBlock(CommonConstant.Field.DETAIL));
CommonMethod.initBlock(inInfo,
Arrays.asList(
DdynamicEnum.FACTORY_CODE_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, HPSB003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HPSB003A.RESULT_QUERY, new HPSB003A(),false, new EiBlockMeta(),EiConstant.queryBlock,EiConstant.resultBlock,EiConstant.resultBlock,HPSB003A.RESULT_COUNT);
//queryDetail(inInfo);
return inInfo;
}
/**
* 设备保养
* @param inInfo 参数对象
*/
public EiInfo queryDetail (EiInfo inInfo){
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.setCell(ACConstants.ROW_CODE_0, HPSB003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPSB003A.DETAIL_QUERY, new HPSB003A(), false, new EiBlockMeta(), EiConstant.queryBlock, CommonConstant.Field.DETAIL, CommonConstant.Field.DETAIL, HPSB003A.DETAIL_COUNT);
}
/**
* 设备保养
* @param inInfo 参数对象
*/
public EiInfo queryDetail1 (EiInfo inInfo){
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.setCell(ACConstants.ROW_CODE_0, HPSB003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPSB003A.DETAIL1_QUERY, new HPSB008(), false, new EiBlockMeta(), EiConstant.queryBlock, CommonConstant.Field.DETAIL1, CommonConstant.Field.DETAIL1, HPSB003A.DETAIL1_COUNT);
}
}
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.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.sb.domain.HPSB003;
import com.baosight.hpjx.hp.sb.domain.HPSB004;
import com.baosight.hpjx.hp.sb.domain.HPSB004A;
import com.baosight.hpjx.hp.sb.tools.HPSBTools;
import com.baosight.hpjx.util.*;
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 com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/8/12
* @description 设备计划
*/
public class ServiceHPSB004 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outInfo = super.initLoad(inInfo,new HPSB004());
try {
CommonMethod.initBlock(outInfo,
Arrays.asList(DdynamicEnum.FACTORY_CODE_BOX_BLOCK_ID,DdynamicEnum.GROUP_CODE_BOX_BLOCK_ID,DdynamicEnum.USER_ID_BOX_BLOCK_ID),
new HashMap<String,Object>(){}
);
}catch (Exception e){
LogUtils.setDetailMsg(inInfo,e,"初始化失败");
}
return outInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.setCell(ACConstants.ROW_CODE_0, HPSB004.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String planDate = block.getCellStr(ACConstants.ROW_CODE_0,HPSB004.FIELD_PLAN_DATE);
String planStartDate = block.getCellStr(ACConstants.ROW_CODE_0,HPSB004.FIELD_PLAN_START_DATE);
String planEndDate = block.getCellStr(ACConstants.ROW_CODE_0,HPSB004.FIELD_PLAN_END_DATE);
if (!planDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB004.FIELD_PLAN_DATE, StringUtil.removeHorizontalLine(planDate));
}
if (!planStartDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB004.FIELD_PLAN_START_DATE, StringUtil.removeHorizontalLine(planStartDate));
}
if (!planEndDate.isEmpty()){
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB004.FIELD_PLAN_END_DATE, StringUtil.removeHorizontalLine(planEndDate));
}
return super.query(inInfo,HPSB004.QUERY,new HPSB004());
}
@OperationLogAnnotation(operModul = "设备计划",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPSB004 hgsb002 = new HPSB004();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb002.fromMap(map);
hgsb002.setDeleteFlag(CommonConstant.YesNo.YES_1);
AssertUtils.isTrue(hgsb002.getPlanStatus()==1,"设备计划已审批完成,无法删除!");
DaoUtils.update(HPSB004.DELETE_FLAG, hgsb002.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 保存操作
*/
@OperationLogAnnotation(operModul = "设备计划",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPSB004 hgsb002 = new HPSB004();
hgsb002.fromMap(resultRow);
if (hgsb002.getId() == null || hgsb002.getId() == 0) {
this.add(hgsb002);
} else {
this.modify(hgsb002);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPSB004 hgsb002) {
//生成工序编码
hgsb002.setPlanCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.PLAN_CODE));
DaoUtils.insert(HPSB004.INSERT, hgsb002);
}
/**
* 修改操作
*/
public void modify(HPSB004 hgsb002) {
DaoUtils.update(HPSB004.UPDATE, hgsb002);
}
@OperationLogAnnotation(operModul = "设备计划",operType = "修改",operDesc = "修改状态操作")
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPSB004 hgsb002 = new HPSB004();
hgsb002.fromMap(map);
Map<String,Object> qarma = new HashMap<>();
List list = HPSBTools.Hpsb004.getDetails(hgsb002.getId());
AssertUtils.isEmpty(list, "设备计划详情不能为空,无法审批完成!");
DaoUtils.update(HPSB004.UPDATE_STATUS, hgsb002);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "审批失败");
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "设备计划",operType = "保存",operDesc = "定时添加设备计划")
public EiInfo autoAdd(EiInfo inInfo) {
try {
String systemDate = DateUtils.formatShort(DateUtils.date());
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB003.FIELD_MAINTAIN_DATE,systemDate);
List<HPSB003> hgsb001s= DaoBase.getInstance().query(HPSB003.QUERY,new HashMap<String,String>(){{
put(HPSB003.FIELD_MAINTAIN_DATE,systemDate);
}});
//List<HGSB001> resultBlock = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map<String,List<HPSB003>> hgsb001Map = hgsb001s.stream().collect(Collectors.groupingBy(HPSB003::getCompanyCode,Collectors.toList()));
for (Map.Entry<String, List<HPSB003>> entry : hgsb001Map.entrySet()) {
String companyCode = entry.getKey();
List<HPSB003> hgsb001List = entry.getValue();
HPSB004 hgsb002 = new HPSB004();
hgsb002.setDeleteFlag(CommonConstant.YesNo.NO_0);
hgsb002.setPlanDate(systemDate);
hgsb002.setPlanType(2);
hgsb002.setPlanStartDate(systemDate.substring(0,6)+"01");
hgsb002.setPlanEndDate(systemDate.substring(0,6)+DateUtils.getDaysOfMonth(systemDate));
hgsb002.setPlanUserId("system");
hgsb002.setPlanUserName("system");
hgsb002.setPlanStatus(0);
hgsb002.setTaskStatus(0);
this.add(hgsb002);
this.addHgsb002a(hgsb001List,hgsb002);
}
}catch (Exception e){
LogUtils.setDetailMsg(inInfo,e,"自动添加设备计划失败");
}
return inInfo;
}
public void addHgsb002a(List<HPSB003> hgsb003List, HPSB004 hpsb004) {
for (HPSB003 hgsb003: hgsb003List) {
//HGSB001 hgsb001 = new HGSB001();
//hgsb001.fromMap(map);
HPSB004A hgsb004a = new HPSB004A();
hgsb004a.setDeleteFlag(CommonConstant.YesNo.NO_0);
hgsb004a.setParentId(hpsb004.getId());
hgsb004a.setGroupCode(hgsb003.getGroupCode());
//hgsb004a.setGroupName(hgsb003.getGroupName());
hgsb004a.setDeviceType(hgsb003.getDeviceType());
hgsb004a.setDeviceCode(hgsb003.getDeviceCode());
hgsb004a.setDeviceName(hgsb003.getDeviceName());
hgsb004a.setDeviceModel(hgsb003.getDeviceModel());
DaoUtils.insert(HPSB004A.INSERT,hgsb004a);
String planCode = DateUtils.getDateOfDays(hpsb004.getPlanDate(),hgsb003.getPeriodDays(),DateUtils.DATE8_PATTERN);
hgsb003.setMaintainDate(planCode);
DaoUtils.update(HPSB003.UPDATE,hgsb003);
}
}
}
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.hp.sb.domain.HPSB004;
import com.baosight.hpjx.hp.sb.domain.HPSB004A;
import com.baosight.hpjx.hp.sb.tools.HPSBTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
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;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/8/12
* @description 设备计划详情
*/
public class ServiceHPSB004A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB004A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String factoryCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB004.FIELD_FACTORY_CODE);
inInfo = super.query(inInfo, HPSB004A.QUERY, new HPSB004A());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_CODE_BOX_BLOCK_ID,DdynamicEnum.GROUP_CODE_BOX_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSB004.FIELD_FACTORY_CODE, factoryCode);
put(HPSB004A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);}}
);
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB004A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPSB004A.QUERY,new HPSB004A());
}
@OperationLogAnnotation(operModul = "设备计划详情",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
Long parentId = Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB004A.FIELD_PARENT_ID));
HPSB004 hgsb002 = HPSBTools.Hpsb004.get(parentId);
if (hgsb002.getPlanStatus().equals(CommonConstant.PlanStatus.UN_PLAN)){
throw new PlatException("设备计划审批已完成,无法删除");
}
HPSB004A hgsb002a = new HPSB004A();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb002a.fromMap(map);
hgsb002a.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPSB004A.DELETE_FLAG, hgsb002a.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "设备计划详情",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Long parentId = Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB004A.FIELD_PARENT_ID));
HPSB004 hgsb004 = HPSBTools.Hpsb004.get(parentId);
List<HPSB004A> hgsb004aList = HPSBTools.Hpsb004.getDetails(parentId);
// 写入数据
for (Map resultRow : resultRows) {
HPSB004A hgsb002a = new HPSB004A();
hgsb002a.fromMap(resultRow);
// 状态==1抛出异常
if (hgsb004.getPlanStatus()==1) {
throw new PlatException("设备计划已审批完成,保存失败!");
}
if (hgsb002a.getId() == null || hgsb002a.getId() == 0) {
List<HPSB004A> hgsb002aList = hgsb004aList.stream().filter(hgsb002a1 ->
hgsb002a1.getDeviceCode().equals(hgsb002a.getDeviceCode())
&&hgsb002a1.getGroupCode().equals(hgsb002a.getGroupCode())).collect(Collectors.toList());
AssertUtils.isNotEmpty(hgsb002aList, "无法重复添加!");
hgsb002a.setParentId(parentId);
this.add(hgsb002a);
} else {
this.modify(hgsb002a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPSB004A hgsb002a) {
DaoUtils.insert(HPSB004A.INSERT, hgsb002a);
}
/**
* 修改操作
*/
public void modify(HPSB004A hgsb002a) {
DaoUtils.update(HPSB004A.UPDATE, hgsb002a);
}
}
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.hp.constant.HPConstant;
import com.baosight.hpjx.hp.sb.domain.HPSB005;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
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 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/8/12
* @description 设备维修
*/
public class ServiceHPSB005 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outInfo = super.initLoad(inInfo,new HPSB005());
try {
Map<String,Object> qarma = new HashMap<>();
//EiInfoUtils.addBlock(outInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
//角色公司
//List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
//qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.FACTORY_CODE_BOX_BLOCK_ID,DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID),null);
}catch (Exception e){
LogUtils.setDetailMsg(outInfo,e,"初始化失败");
}
return outInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.setCell(ACConstants.ROW_CODE_0, HPSB005.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String applyDate = block.getCellStr(ACConstants.ROW_CODE_0,HPSB005.FIELD_APPLY_DATE);
if (!applyDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB005.FIELD_APPLY_DATE, StringUtil.removeHorizontalLine(applyDate));
}
return super.query(inInfo,HPSB005.QUERY,new HPSB005());
}
@OperationLogAnnotation(operModul = "设备维修申请",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPSB005 hgsb003 = new HPSB005();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb003.fromMap(map);
hgsb003.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hgsb003.getStatus().equals(CommonConstant.PlanStatus.UN_PLAN)){
throw new PlatException("维保申请审批完成,无法删除");
}
DaoUtils.update(HPSB005.DELETE_FLAG, hgsb003.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 保存操作
*/
@OperationLogAnnotation(operModul = "设备维修申请",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
// 写入数据
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPSB005 hpsb005 = new HPSB005();
hpsb005.fromMap(map);
if (hpsb005.getId() == null || hpsb005.getId() == 0) {
this.add(hpsb005);
} else {
this.modify(hpsb005);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + eiBlock.getRowCount() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPSB005 hpsb005) {
//生成申请单号
hpsb005.setApplyCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.APPLY_CODE));
DaoUtils.insert(HPSB005.INSERT, hpsb005);
}
/**
* 修改操作
*/
public void modify(HPSB005 hpsb005) {
DaoUtils.update(HPSB005.UPDATE, hpsb005);
}
@OperationLogAnnotation(operModul = "设备申请维修",operType = "修改",operDesc = "修改状态操作")
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
HPSB005 hgsb003 = new HPSB005();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb003.fromMap(map);
DaoUtils.update(HPSB005.UPDATE_STATUS, hgsb003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "设备申请维修",operType = "上传附件",operDesc = "上传附件操作")
public EiInfo updateDocId(EiInfo inInfo){
int i = 0;
try {
HPSB005 hgsb003 = new HPSB005();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb003.fromMap(map);
DaoUtils.update(HPSB005.UPDATE_DOC_ID, hgsb003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "上传失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.sb.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
/**
* @author LiuYang
* @version 1.0 2024/8/13
* @description 附件上传
*/
public class ServiceHPSB005A extends ServiceEPBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "查询",operDesc = "初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* 附件上传.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "上传",operDesc = "附件上传")
public EiInfo form(EiInfo inInfo) {
return inInfo;
}
}
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.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.sb.domain.HPSB004;
import com.baosight.hpjx.hp.sb.domain.HPSB006;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
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 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/8/12
* @description 设备点检
*/
public class ServiceHPSB006 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outInfo = super.initLoad(inInfo,new HPSB006());
try {
Map<String,Object> qarma = new HashMap<>();
//EiInfoUtils.addBlock(outInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
//List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
//qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.FACTORY_CODE_BOX_BLOCK_ID,DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
}catch (Exception e){
LogUtils.setDetailMsg(inInfo,e,"初始化失败");
}
return outInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.setCell(ACConstants.ROW_CODE_0, HPSB006.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String planDate = block.getCellStr(ACConstants.ROW_CODE_0,HPSB006.FIELD_INSPEC_DATE);
if (!planDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB006.FIELD_INSPEC_DATE, StringUtil.removeHorizontalLine(planDate));
}
return super.query(inInfo,HPSB006.QUERY,new HPSB006());
}
@OperationLogAnnotation(operModul = "设备点检",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPSB006 hgsb004 = new HPSB006();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb004.fromMap(map);
hgsb004.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hgsb004.getCheckStatus()==1) {
String str = "设备点检已审批完成,无法删除!";
throw new PlatException(str);
}
Map map1 = new HashMap<>();
map1.put(HPSB004.FIELD_COMPANY_CODE,hgsb004.getCompanyCode());
map1.put(HPSB004.FIELD_PLAN_CODE,hgsb004.getPlanCode());
map1.put(HPSB004.FIELD_PLAN_START_DATE,hgsb004.getPlanStartDate());
map1.put(HPSB004.FIELD_PLAN_END_DATE,hgsb004.getPlanEndDate());
map1.put(HPSB004.FIELD_PLAN_TYPE,1);
List<HPSB004> list = DaoBase.getInstance().query(HPSB004.QUERY, map1);
for (HPSB004 hpsb004 : list){
hpsb004.setTaskStatus(0);
DaoUtils.update(HPSB004.UPDATE, hpsb004);
}
DaoUtils.update(HPSB004.DELETE_FLAG, hgsb004.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
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++) {
HPSB006 hgsb004 = new HPSB006();
hgsb004.fromMap(resultRows.get(i));
if (hgsb004.getId() == null || hgsb004.getId() == 0) {
this.add(hgsb004);
} else {
this.modify(hgsb004);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPSB006 hgsb004) {
//生成点检单号
hgsb004.setInspecCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.INSPEC_CODE));
DaoUtils.insert(HPSB006.INSERT, hgsb004);
}
/**
* 修改操作
*/
public void modify(HPSB006 hgsb004) {
hgsb004.setInspecDate(StringUtil.removeHorizontalLine(hgsb004.getInspecDate()));
DaoUtils.update(HPSB006.UPDATE, hgsb004);
}
@OperationLogAnnotation(operModul = "设备点检",operType = "修改",operDesc = "修改状态操作")
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
HPSB006 hgsb004 = new HPSB006();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb004.fromMap(map);
DaoUtils.update(HPSB006.UPDATE_STATUS, hgsb004);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
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.hp.sb.domain.HPSB004A;
import com.baosight.hpjx.hp.sb.domain.HPSB006;
import com.baosight.hpjx.hp.sb.domain.HPSB006A;
import com.baosight.hpjx.hp.sb.domain.HPSB007;
import com.baosight.hpjx.hp.sb.tools.HPSBTools;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
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/8/12
* @description 设备点检详情
*/
public class ServiceHPSB006A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB006A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String factoryCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB006.FIELD_FACTORY_CODE);
//String groupCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB006A.FIELD_GROUP_CODE);
inInfo = super.query(inInfo, HPSB006A.QUERY, new HPSB006A());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_CODE_BOX_BLOCK_ID),null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSB006.FIELD_FACTORY_CODE,factoryCode);
//put(HPSB006A.FIELD_GROUP_CODE,groupCode);
put(HPSB006A.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);}}
);
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB006A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPSB006A.QUERY,new HPSB006A());
}
@OperationLogAnnotation(operModul = "设备点检详情",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
Long parentId = Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB004A.FIELD_PARENT_ID));
HPSB006 hgsb004 = HPSBTools.Hpsb006.getId(parentId);
if (hgsb004.getCheckStatus().equals(CommonConstant.PlanStatus.UN_PLAN)){
throw new PlatException("设备点检审批完成,无法删除");
}
HPSB006A hgsb004a = new HPSB006A();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb004a.fromMap(map);
hgsb004a.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPSB006A.DELETE_FLAG, hgsb004a.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
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++) {
HPSB006A hgsb004a = new HPSB006A();
hgsb004a.fromMap(resultRows.get(i));
if (hgsb004a.getId() == null || hgsb004a.getId() == 0) {
hgsb004a.setParentId(Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB006A.FIELD_PARENT_ID)));
this.add(hgsb004a);
} else {
this.modify(hgsb004a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPSB006A hgsb004a) {
DaoUtils.insert(HPSB006A.INSERT, hgsb004a);
}
/**
* 修改操作
*/
public void modify(HPSB006A hgsb004a) {
DaoUtils.update(HPSB006A.UPDATE, hgsb004a);
}
@OperationLogAnnotation(operModul = "设备点检详情",operType = "上传附件",operDesc = "上传附件操作")
public EiInfo updateDocId(EiInfo inInfo){
int i = 0;
try {
HPSB006A hgsb004a = new HPSB006A();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb004a.fromMap(map);
DaoUtils.update(HPSB006A.UPDATE_DOC_ID, hgsb004a);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "上传失败");
}
return inInfo;
}
}
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.hp.constant.HPConstant;
import com.baosight.hpjx.hp.sb.domain.*;
import com.baosight.hpjx.hp.sb.tools.HPSBTools;
import com.baosight.hpjx.util.*;
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.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/8/13
* @description 设备点检
*/
public class ServiceHPSB006B extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB004.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB004.FIELD_TASK_STATUS, CommonConstant.YesNo.NO_0);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB004.FIELD_PLAN_STATUS, CommonConstant.YesNo.YES_1);
inInfo = super.query(inInfo, HPSB004.QUERY, new HPSB004());
try {
Map<String,Object> qarma = new HashMap<>();
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_CODE_BOX_BLOCK_ID,DdynamicEnum.GROUP_RECORD_BLOCK_ID),qarma);
//EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
//List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
//qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
}catch (Exception e){
LogUtils.setDetailMsg(inInfo,e,"初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.setCell(ACConstants.ROW_CODE_0, HPSB004.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String planDate = block.getCellStr(ACConstants.ROW_CODE_0, HPSB004.FIELD_PLAN_DATE);
if (!planDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB004.FIELD_PLAN_DATE, StringUtil.removeHorizontalLine(planDate));
}
return super.query(inInfo,HPSB004.QUERY,new HPSB004());
}
/**
* 保存操作
*/
@OperationLogAnnotation(operModul = "设备计划",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
EiBlock block =inInfo.getBlock(EiConstant.queryBlock);
String pageNumber = block.getCellStr(ACConstants.ROW_CODE_0,"pageNumber");
Map<String,String> map = new HashMap<String,String>();
map.put(HPSB006.FIELD_INSPEC_USER_ID,block.getCellStr(ACConstants.ROW_CODE_0,HPSB006.FIELD_INSPEC_USER_ID));
map.put(HPSB006.FIELD_INSPEC_USER_NAME,block.getCellStr(ACConstants.ROW_CODE_0,HPSB006.FIELD_INSPEC_USER_NAME));
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HPSB004A> hpsb004A;
// 写入数据
for (Map resultRow : resultRows) {
HPSB004 hpsb004 = new HPSB004();
hpsb004.fromMap(resultRow);
if ("HPSB006".equals(pageNumber)) {
//添加设备点检
HPSB006 hpsb006 = addHgsb004(hpsb004,map);
hpsb004A = HPSBTools.Hpsb004.getDetails(hpsb004.getId());
addHgsb004a(hpsb004A,hpsb006.getId());
}else if ("HPSB007".equals(pageNumber)){
//添加设备保养
HPSB007 hpsb007 = addHgsb005(hpsb004,map);
hpsb004A = HPSBTools.Hpsb004.getDetails(hpsb004.getId());
addHgsb005a(hpsb004A,hpsb007.getId());
//修改保养日期
updateMaintainDate(hpsb004A,hpsb004);
}
hpsb004.setTaskStatus(1);
DaoUtils.update(HPSB004.UPDATE,hpsb004);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 添加设备点检
*/
private HPSB006 addHgsb004(HPSB004 hgsb002,Map<String,String> map){
HPSB006 hpsb006 = new HPSB006();
hpsb006.setCompanyCode(hgsb002.getCompanyCode());
hpsb006.setFactoryCode(hgsb002.getFactoryCode());
hpsb006.setPlanCode(hgsb002.getPlanCode());
hpsb006.setPlanStartDate(hgsb002.getPlanStartDate());
hpsb006.setPlanEndDate(hgsb002.getPlanEndDate());
hpsb006.setInspecDate(DateUtils.formatShort(DateUtils.date()));
hpsb006.setInspecCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.INSPEC_CODE));
hpsb006.setInspecUserId(map.get(HPSB006.FIELD_INSPEC_USER_ID));
hpsb006.setInspecUserName(map.get(HPSB006.FIELD_INSPEC_USER_NAME));
DaoUtils.insert(HPSB006.INSERT, hpsb006);
Map map1 = hpsb006.toMap();
map1.remove(HPSB006.FIELD_ID);
List<HPSB006> hgsb004List = this.dao.query(HPSB006.QUERY,map1);
AssertUtils.isEmpty(hgsb004List, "设备点检添加失败");
return hgsb004List.get(0);
}
/**
* 添加设备点检
*/
private void addHgsb004a(List<HPSB004A> hpsb004AList, Long id){
AssertUtils.isEmpty(hpsb004AList, "设备计划详情不能为空");
for (HPSB004A hpsb004a: hpsb004AList) {
HPSB006A hpsb006A = new HPSB006A();
hpsb006A.setCheckItem(hpsb004a.getCheckItem());
hpsb006A.setCheckDescrip(hpsb004a.getCheckDescrip());
hpsb006A.setDeviceCode(hpsb004a.getDeviceCode());
hpsb006A.setDeviceName(hpsb004a.getDeviceName());
hpsb006A.setDeleteFlag(CommonConstant.YesNo.NO_0);
hpsb006A.setGroupCode(hpsb004a.getGroupCode());
hpsb006A.setGroupName(hpsb004a.getGroupName());
hpsb006A.setDeviceType(hpsb004a.getDeviceType());
hpsb006A.setParentId(id);
DaoUtils.insert(HPSB006A.INSERT, hpsb006A);
}
}
/**
* 添加设备保养
*/
private HPSB007 addHgsb005(HPSB004 hpsb004,Map<String,String> map){
HPSB007 hpsb007 = new HPSB007();
hpsb007.setCompanyCode(hpsb004.getCompanyCode());
hpsb007.setFactoryCode(hpsb004.getFactoryCode());
hpsb007.setPlanCode(hpsb004.getPlanCode());
hpsb007.setPlanStartDate(hpsb004.getPlanStartDate());
hpsb007.setPlanEndDate(hpsb004.getPlanEndDate());
hpsb007.setUpkeepDate(DateUtils.formatShort(DateUtils.date()));
hpsb007.setUpkeepCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.INSPEC_CODE));
hpsb007.setUpkeepUserId(map.get(HPSB006.FIELD_INSPEC_USER_ID));
hpsb007.setUpkeepUserName(map.get(HPSB006.FIELD_INSPEC_USER_NAME));
DaoUtils.insert(HPSB007.INSERT, hpsb007);
Map map1 = hpsb007.toMap();
map1.remove(HPSB006.FIELD_ID);
List<HPSB007> hgsb005List = this.dao.query(HPSB007.QUERY,map1);
AssertUtils.isEmpty(hgsb005List, "设备保养添加失败");
return hgsb005List.get(0);
}
/**
* 添加设备保养详情
*/
private void addHgsb005a(List<HPSB004A> hpsb004aList,Long id){
AssertUtils.isEmpty(hpsb004aList, "设备计划详情不能为空");
for (HPSB004A hgsb002a: hpsb004aList) {
HPSB007A hpsb007A = new HPSB007A();
hpsb007A.setCheckItem(hgsb002a.getCheckItem());
hpsb007A.setCheckDescrip(hgsb002a.getCheckDescrip());
hpsb007A.setDeviceCode(hgsb002a.getDeviceCode());
hpsb007A.setDeviceName(hgsb002a.getDeviceName());
hpsb007A.setDeleteFlag(CommonConstant.YesNo.NO_0);
hpsb007A.setGroupCode(hgsb002a.getGroupCode());
hpsb007A.setGroupName(hgsb002a.getGroupName());
hpsb007A.setDeviceType(hgsb002a.getDeviceType());
hpsb007A.setParentId(id);
DaoUtils.insert(HPSB007A.INSERT, hpsb007A);
}
}
/**
* 修改保养日期
*/
private void updateMaintainDate(List<HPSB004A> hpsb004aList, HPSB004 hpsb004){
for (HPSB004A hpsb004a: hpsb004aList) {
HPSB003 hpsb003 = new HPSB003();
hpsb003.fromMap(hpsb004a.toMap());
hpsb003.setCompanyCode(hpsb004.getCompanyCode());
hpsb003.setMaintainDate(DateUtils.formatShort(DateUtils.date()));
DaoUtils.update(HPSB003.UPDATE_MAINTAIN_DATE,hpsb003);
}
}
}
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.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.sb.domain.HPSB004;
import com.baosight.hpjx.hp.sb.domain.HPSB007;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils;
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 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/8/12
* @description 设备保养
*/
public class ServiceHPSB007 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outInfo = super.initLoad(inInfo,new HPSB007());
try {
Map<String,Object> qarma = new HashMap<>();
//EiInfoUtils.addBlock(outInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.FACTORY_CODE_BOX_BLOCK_ID,DdynamicEnum.GROUP_RECORD_BLOCK_ID), qarma);
//角色公司
//List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
//qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
}catch (Exception e){
LogUtils.setDetailMsg(inInfo,e,"初始化失败");
}
return outInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.setCell(ACConstants.ROW_CODE_0, HPSB007.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String upkeepDate = block.getCellStr(ACConstants.ROW_CODE_0,HPSB007.FIELD_UPKEEP_DATE);
if (!upkeepDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB007.FIELD_UPKEEP_DATE, StringUtil.removeHorizontalLine(upkeepDate));
}
return super.query(inInfo,HPSB007.QUERY,new HPSB007());
}
@OperationLogAnnotation(operModul = "设备保养",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPSB007 hpsb007 = new HPSB007();
hpsb007.fromMap(map);
hpsb007.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpsb007.getCheckStatus()==1) {
throw new PlatException("设备保养已审批完成,无法删除!");
}
Map map1 = new HashMap<>();
map1.put(HPSB004.FIELD_COMPANY_CODE,hpsb007.getCompanyCode());
map1.put(HPSB004.FIELD_PLAN_CODE,hpsb007.getPlanCode());
map1.put(HPSB004.FIELD_PLAN_START_DATE,hpsb007.getPlanStartDate());
map1.put(HPSB004.FIELD_PLAN_END_DATE,hpsb007.getPlanEndDate());
map1.put(HPSB004.FIELD_PLAN_TYPE,2);
List<HPSB004> list = DaoBase.getInstance().query(HPSB004.QUERY, map1);
for (HPSB004 hpsb004 : list){
hpsb004.setTaskStatus(0);
DaoUtils.update(HPSB004.UPDATE, hpsb004);
}
DaoUtils.update(HPSB007.DELETE_FLAG, hpsb007.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 保存操作
*/
@OperationLogAnnotation(operModul = "设备保养",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPSB007 hgsb005 = new HPSB007();
hgsb005.fromMap(resultRow);
if (hgsb005.getId() == null || hgsb005.getId() == 0) {
this.add(hgsb005);
} else {
this.modify(hgsb005);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPSB007 hgsb005) {
//生成保养单号
hgsb005.setUpkeepDate(SequenceGenerator.getNextSequence(HPConstant.SequenceId.UPKEEP_CODE));
DaoUtils.insert(HPSB007.INSERT, hgsb005);
}
/**
* 修改操作
*/
public void modify(HPSB007 hgsb005) {
hgsb005.setUpkeepDate(DateUtils.formatShort(hgsb005.getUpkeepDate()));
DaoUtils.update(HPSB007.UPDATE, hgsb005);
}
@OperationLogAnnotation(operModul = "设备保养",operType = "修改",operDesc = "修改状态操作")
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
HPSB007 hpsb007 = new HPSB007();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsb007.fromMap(map);
DaoUtils.update(HPSB007.UPDATE_STATUS, hpsb007);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
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.hp.sb.domain.HPSB007;
import com.baosight.hpjx.hp.sb.domain.HPSB007A;
import com.baosight.hpjx.hp.sb.tools.HPSBTools;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
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.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/8/12
* @description 设备保养详情
*/
public class ServiceHPSB007A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB007A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String factoryCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB007.FIELD_FACTORY_CODE);
//String groupCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB005A.FIELD_GROUP_CODE);
inInfo = super.query(inInfo, HPSB007A.QUERY, new HPSB007A());
Map qarma = new HashMap();
/*Map userCompany = HGSBTools.getUserCompany();
if (!userCompany.isEmpty()) {
qarma.put(Org.FIELD_PARENT_ORG_ID,userCompany.get(HGSB002.FIELD_COMPANY_CODE));
}*/
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_CODE_BOX_BLOCK_ID,DdynamicEnum.GROUP_RECORD_BLOCK_ID),qarma);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSB007.FIELD_FACTORY_CODE,factoryCode);
//put(HGSB005A.FIELD_GROUP_CODE,groupCode);
put(HPSB007A.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);}}
);
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB007A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPSB007A.QUERY,new HPSB007A());
}
@OperationLogAnnotation(operModul = "设备保养详情",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
Long parentId = Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB007A.FIELD_PARENT_ID));
HPSB007 hgsb005 = HPSBTools.Hpsb007.getId(parentId);
if (hgsb005.getCheckStatus().equals(CommonConstant.PlanStatus.UN_PLAN)){
throw new PlatException("设备保养审批完成,无法删除");
}
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPSB007A hgsb005a = new HPSB007A();
hgsb005a.fromMap(map);
hgsb005a.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPSB007A.DELETE_FLAG, hgsb005a.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + eiBlock.getRowCount() + "]条数据删除成功!");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "设备保养详情",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPSB007A hgsb005a = new HPSB007A();
hgsb005a.fromMap(resultRow);
if (hgsb005a.getId() == null || hgsb005a.getId() == 0) {
hgsb005a.setParentId(Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB007A.FIELD_PARENT_ID)));
this.add(hgsb005a);
} else {
this.modify(hgsb005a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPSB007A hpsb007a) {
DaoUtils.insert(HPSB007A.INSERT, hpsb007a);
}
/**
* 修改操作
*/
public void modify(HPSB007A hpsb007a) {
DaoUtils.update(HPSB007A.UPDATE, hpsb007a);
}
@OperationLogAnnotation(operModul = "设备保养详情",operType = "上传附件",operDesc = "上传附件操作")
public EiInfo updateDocId(EiInfo inInfo){
int i = 0;
try {
HPSB007A hpsb007a = new HPSB007A();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsb007a.fromMap(map);
DaoUtils.update(HPSB007A.UPDATE_DOC_ID, hpsb007a);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + eiBlock.getRowCount() + "]条数据修改成功!");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
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.hp.constant.HPConstant;
import com.baosight.hpjx.hp.sb.domain.HPSB003;
import com.baosight.hpjx.hp.sb.domain.HPSB008;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
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.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
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/8/12
* @description 安全记录
*/
public class ServiceHPSB008 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
//拼接名称 包含逻辑删除数据
CommonMethod.initBlock(inInfo,
Arrays.asList(
DdynamicEnum.FACTORY_CODE_BOX_BLOCK_ID,
DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID,
DdynamicEnum.DEVICE_CODE_BLOCK_ID
),
new HashMap<String,Object>(){}
);
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
if (block != null) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSB003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String recordDate = block.getCellStr(ACConstants.ROW_CODE_0,HPSB008.FIELD_RECORD_DATE);
if (!recordDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPSB008.FIELD_RECORD_DATE, StringUtil.removeHorizontalLine(recordDate));
}
}
return super.query(inInfo,HPSB008.QUERY,new HPSB008());
}
@Override
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo, HPSB008.DELETE);
}
@OperationLogAnnotation(operModul = "安全记录",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPSB008 hpsb008 = new HPSB008();
hpsb008.fromMap(resultRow);
if (hpsb008.getId() == null || hpsb008.getId() == 0) {
this.add(hpsb008);
} else {
this.modify(hpsb008);
}
}
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(HPSB008 hgsb002) {
//生成工序编码
hgsb002.setRecordCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.RECORD_CODE));
DaoUtils.insert(HPSB008.INSERT, hgsb002);
}
/**
* 修改操作
*/
public void modify(HPSB008 hgsb002) {
DaoUtils.update(HPSB008.UPDATE, hgsb002);
}
}
package com.baosight.hpjx.hp.sb.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.sb.domain.HPSB099;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ProjectInfo;
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.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/8/14
* @description 附件
*/
public class ServiceHPSB099 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSB099().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
try {
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (CommonConstant.ProjectEnv.RUN.equalsIgnoreCase(projectEnv)) {
inInfo = super.query(inInfo, "HPSB099.queryRun", new HPSB099());
} else {
inInfo = super.query(inInfo, "HPSB099.queryDev", new HPSB099());
}
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "设备附件详情",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPSB099 hgsb099 = new HPSB099();
hgsb099.fromMap(resultRow);
DaoUtils.update(HPSB099.DELETE, hgsb099);
if (!hgsb099.getDocId().isEmpty()) {
this.delectDoc(hgsb099.getDocId());
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "设备附件详情",operType = "新增",operDesc = "新增操作")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPSB099 hgsb099 = new HPSB099();
hgsb099.fromMap(resultRow);
DaoUtils.insert(HPSB099.INSERT, hgsb099);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/**
* 删除文件
* @param docId 文件ID
*/
public void delectDoc(String docId){
Map<String,Object> map = new HashMap<>();
map.put("docId",docId);
List<HPDS002> list = this.dao.query(HPDS002.QUERY,map);
if (list.size() > 0) {
String realPath = list.get(0).getRealPath();
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.ProjectEnv.RUN)) {
EiInfo queryInfo = new EiInfo();
queryInfo.set(HPSB099.FIELD_DOC_ID,list.get(0).getDocId());
//获取文档信息
queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}
}else {
FileUtils.deleteFile(realPath);
}
this.dao.delete(HPDS002.DELETE,map);
}
}
}
......@@ -2,22 +2,39 @@
<!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 id="column">
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-启用 -->
SUP_CODE as "supCode", <!-- 供应商编码 -->
SUP_NAME as "supName", <!-- 供应商名称 -->
HEAD_NAME as "headName", <!-- 负责人 -->
PHONE_NAME as "phoneName", <!-- 负责人联系方式 -->
ADDRESS as "address", <!-- 地址 -->
PERIOD_DAYS as "periodDays"
</sql>
<sql id="condition">
<include refid="SqlBase.authCondition"/>
<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>
......@@ -73,6 +90,48 @@
DEVICE_CODE = #deviceCodeStr#
</isNotEmpty>
</sql>
<!--排除权限条件-->
<sql id="notAuthCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</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>
<isNotEmpty prepend=" AND " property="deviceCodeStr">
DEVICE_CODE = #deviceCodeStr#
</isNotEmpty>
</sql>
<!--根据companyCode获取用户绑定的组织的工厂编码-->
<sql id="queryFactoryCodeBase">
......@@ -92,28 +151,8 @@
<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-启用 -->
<include refid="column"/>
FROM ${hpjxSchema}.T_HPSB003 WHERE 1=1
<include refid="authCondition"/>
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......@@ -128,7 +167,6 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPSB003 WHERE 1=1
<include refid="authCondition"/>
<include refid="condition" />
</select>
......@@ -215,9 +253,17 @@
PURCHASE_DATE, <!-- 购置日期 -->
MAINTAIN_DATE, <!-- 保养日期 -->
DEVICE_USER_ID, <!-- 设备负责人 -->
DEVICE_STATUS <!-- 设备状态 0-停止 1-启用 -->
DEVICE_STATUS, <!-- 设备状态 0-停止 1-启用 -->
SUP_CODE, <!-- 供应商编码 -->
SUP_NAME, <!-- 供应商名称 -->
HEAD_NAME, <!-- 负责人 -->
PHONE_NAME, <!-- 负责人联系方式 -->
ADDRESS, <!-- 地址 -->
PERIOD_DAYS
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #factoryCode#, #groupCode#, #deviceType#, #deviceCode#, #deviceName#, #deviceModel#, #purchaseDate#, #maintainDate#, #deviceUserId#, #deviceStatus#)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #factoryCode#, #groupCode#, #deviceType#, #deviceCode#, #deviceName#,
#deviceModel#, #purchaseDate#, #maintainDate#, #deviceUserId#, #deviceStatus#, #supCode#, #supName#, #headName#, #phoneName#, #address#, #periodDays#)
</insert>
<delete id="delete">
......@@ -257,7 +303,13 @@
PURCHASE_DATE = #purchaseDate#, <!-- 购置日期 -->
MAINTAIN_DATE = #maintainDate#, <!-- 保养日期 -->
DEVICE_USER_ID = #deviceUserId#, <!-- 设备负责人 -->
DEVICE_STATUS = #deviceStatus# <!-- 设备状态 0-停止 1-启用 -->
DEVICE_STATUS = #deviceStatus#, <!-- 设备状态 0-停止 1-启用 -->
SUP_CODE = #supCode#, <!-- 供应商编码 -->
SUP_NAME = #supName#, <!-- 供应商名称 -->
HEAD_NAME = #headName#, <!-- 负责人 -->
PHONE_NAME = #phoneName#, <!-- 负责人联系方式 -->
ADDRESS = #address#, <!-- 地址 -->
PERIOD_DAYS = #periodDays#
WHERE
ID = #id#
</update>
......@@ -273,6 +325,19 @@
ID = #id#
</update>
<select id="queryDeviceCodeBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT distinct
DEVICE_CODE as "deviceCode", <!-- 设备编码 -->
CONCAT(DEVICE_NAME,'[',DEVICE_CODE,']',DEVICE_MODEL) as "deviceName", <!-- 设备名称 -->
DEVICE_TYPE as "deviceType", <!-- 设备类型 -->
COMPANY_CODE as "companyCode",
FACTORY_CODE as "factoryCode",
GROUP_CODE as "groupCode",
DEVICE_STATUS as "deviceStatus"
FROM ${hpjxSchema}.T_HPSB003 WHERE 1=1
<include refid="notAuthCondition" />
</select>
<select id="queryFactoryCodeBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
FACTORY_CODE as "factoryCode",
......@@ -383,7 +448,29 @@
DEVICE_CODE as "deviceCode" <!-- 设备编码 -->
FROM ${hpjxSchema}.T_HPSB003
WHERE 1=1
<include refid="condition" />
<include refid="notAuthCondition" />
</select>
<update id="updateMaintainDate">
UPDATE ${hpjxSchema}.T_HPSB003
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
MAINTAIN_DATE = #maintainDate# <!-- 保养日期 -->
WHERE DEVICE_CODE = #deviceCode#
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceType">
DEVICE_TYPE = #deviceType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceName">
DEVICE_NAME = #deviceName#
</isNotEmpty>
</update>
</sqlMap>
<?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-08-12 16:10:55
Version : 1.0
schema : hpjx
tableName : T_HPSB004A
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
PARENT_ID BIGINT,
GROUP_CODE VARCHAR,
GROUP_NAME VARCHAR,
DEVICE_TYPE VARCHAR,
DEVICE_CODE VARCHAR,
DEVICE_NAME VARCHAR,
DEVICE_MODEL VARCHAR,
CHECK_ITEM VARCHAR,
CHECK_DESCRIP VARCHAR
-->
<sqlMap namespace="HPSB004A">
<sql id="column">
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-是 -->
PARENT_ID as "parentId", <!-- 父级ID -->
GROUP_CODE as "groupCode", <!-- 设备区域编码 -->
GROUP_NAME as "groupName", <!-- 设备区域名称 -->
DEVICE_TYPE as "deviceType", <!-- 设备类型 -->
DEVICE_CODE as "deviceCode", <!-- 设备编码 -->
DEVICE_NAME as "deviceName", <!-- 设备名称 -->
DEVICE_MODEL as "deviceModel", <!-- 设备型号 -->
CHECK_ITEM as "checkItem", <!-- 检查项 -->
CHECK_DESCRIP as "checkDescrip" <!-- 检查描述 -->
</sql>
<sql id="condition">
<include refid="authCondition"/>
<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="parentId">
PARENT_ID = #parentId#
</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 = #deviceCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceName">
DEVICE_NAME LIKE CONCAT('%', #deviceName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceModel">
DEVICE_MODEL LIKE CONCAT('%', #deviceModel#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="checkItem">
CHECK_ITEM = #checkItem#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="checkDescrip">
CHECK_DESCRIP = #checkDescrip#
</isNotEmpty>
</sql>
<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>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sb.domain.HPSB004A">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPSB004A WHERE 1=1
<include refid="authCondition"/>
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc,ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPSB004A 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="parentId">
PARENT_ID = #parentId#
</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="checkItem">
CHECK_ITEM = #checkItem#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="checkDescrip">
CHECK_DESCRIP = #checkDescrip#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPSB004A (ID, <!-- ID -->
COMPANY_CODE, <!-- 公司编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
PARENT_ID, <!-- 父级ID -->
GROUP_CODE, <!-- 设备区域编码 -->
GROUP_NAME, <!-- 设备区域名称 -->
DEVICE_TYPE, <!-- 设备类型 -->
DEVICE_CODE, <!-- 设备编码 -->
DEVICE_NAME, <!-- 设备名称 -->
DEVICE_MODEL, <!-- 设备型号 -->
CHECK_ITEM, <!-- 检查项 -->
CHECK_DESCRIP <!-- 检查描述 -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #parentId#, #groupCode#, #groupName#, #deviceType#, #deviceCode#, #deviceName#, #deviceModel#, #checkItem#, #checkDescrip#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPSB004A WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPSB004A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPSB004A
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-是 -->
PARENT_ID = #parentId#, <!-- 父级ID -->
GROUP_CODE = #groupCode#, <!-- 设备区域编码 -->
GROUP_NAME = #groupName#, <!-- 设备区域名称 -->
DEVICE_TYPE = #deviceType#, <!-- 设备类型 -->
DEVICE_CODE = #deviceCode#, <!-- 设备编码 -->
DEVICE_NAME = #deviceName#, <!-- 设备名称 -->
DEVICE_MODEL = #deviceModel#, <!-- 设备型号 -->
CHECK_ITEM = #checkItem#, <!-- 检查项 -->
CHECK_DESCRIP = #checkDescrip# <!-- 检查描述 -->
WHERE
ID = #id#
</update>
</sqlMap>
package com.baosight.hpjx.hp.sb.tools;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.sb.domain.*;
import com.baosight.hpjx.util.AssertUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/8/12
* @description
*/
public class HPSBTools {
/**
* Hgsb002公共DAO方法定义
*
*/
public static class Hpsb004 {
public static HPSB004 get(Long id){
AssertUtils.isNull(id, "设备计划不能为空");
Map queryMap = new HashMap();
queryMap.put(HPSB004.FIELD_ID, id);
queryMap.put(HPSB004.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HPSB004> results = DaoBase.getInstance().query(HPSB004.QUERY, queryMap);
AssertUtils.isEmpty(results, "设备计划不存在");
return results.get(0);
}
public static List<HPSB004> getList(Map queryMap) {
List<HPSB004> results = DaoBase.getInstance().query(HPSB004.QUERY, queryMap);
return results;
}
/**
* 查询设备计划详情
*
* @param id
*/
public static List<HPSB004A> getDetails(Long id) {
AssertUtils.isNull(id, "设备计划不能为空");
Map queryMap = new HashMap();
queryMap.put(HPSB004A.FIELD_PARENT_ID, id);
queryMap.put(HPSB004A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HPSB004A> results = DaoBase.getInstance().query(HPSB004A.QUERY, queryMap);
return results;
}
/**
* 查询设备计划详情
*
* @param queryMap
*/
public static List<HPSB004A> getDetails(Map queryMap) {
queryMap.put(HPSB004A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HPSB004A> results = DaoBase.getInstance().query(HPSB004A.QUERY, queryMap);
return results;
}
}
/**
* Hgsb004公共DAO方法定义
*
*/
public static class Hpsb006 {
/**
* 查询
*
* @param id
*/
public static HPSB006 getId(Long id) {
AssertUtils.isNull(id, "设备点检不能为空");
Map queryMap = new HashMap();
queryMap.put(HPSB006.FIELD_ID, id);
queryMap.put(HPSB006.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HPSB006> results = DaoBase.getInstance().query(HPSB006.QUERY, queryMap);
AssertUtils.isEmpty(results, "设备点检不存在");
return results.get(0);
}
/**
* 查询
*
* @param hpsb006
*/
public static List<HPSB006> get(HPSB006 hpsb006) {
AssertUtils.isNull(hpsb006, "设备点检不能为空");
List<HPSB006> results = DaoBase.getInstance().query(HPSB006.QUERY, hpsb006);
return results;
}
/**
* 查询设备点检详情
*
* @param parentId
*/
public static List<HPSB006A> getDetails(Long parentId) {
AssertUtils.isNull(parentId, "设备点检不能为空");
Map queryMap = new HashMap();
queryMap.put(HPSB006A.FIELD_PARENT_ID, parentId);
queryMap.put(HPSB006A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HPSB006A> results = DaoBase.getInstance().query(HPSB006A.QUERY, queryMap);
return results;
}
}
public static class Hpsb007 {
public static HPSB007 getId(Long id) {
AssertUtils.isNull(id, "设备保养不能为空");
Map queryMap = new HashMap();
queryMap.put(HPSB007.FIELD_ID, id);
queryMap.put(HPSB007.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HPSB007> results = DaoBase.getInstance().query(HPSB007.QUERY, queryMap);
AssertUtils.isEmpty(results, "设备保养不存在");
return results.get(0);
}
public static List<HPSB007A> getDetails(Long parentId) {
AssertUtils.isNull(parentId, "设备保养不能为空");
Map queryMap = new HashMap();
queryMap.put(HPSB007A.FIELD_PARENT_ID, parentId);
queryMap.put(HPSB007A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HPSB007A> results = DaoBase.getInstance().query(HPSB007A.QUERY, queryMap);
return results;
}
}
}
......@@ -12,4 +12,9 @@
<!-- 用户服务 -->
<sqlMap resource="com/baosight/hpjx/hp/xs/sql/HPXS007A.xml"/>
<!--设备管理-->
<sqlMap resource="com/baosight/hpjx/hp/sb/sql/HPSB003.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/sb/sql/HPSB004.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/sb/sql/HPSB099.xml"/>
</sqlMapConfig>
......@@ -32,6 +32,10 @@ $(function () {
let auditStatus = item.deviceStatus;
let template = '';
if (item.factoryCode && item.groupCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.factoryCode+'\',\''+item.groupCode+'\',' +
'\''+item.deviceType+'\',\''+item.deviceName+'\')" >台账详情</a>';
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="updateStatus(' + item.id + ',1)" >启用</a>';
......@@ -88,10 +92,6 @@ $(function () {
}
return dataItem["groupCode"]
}
},{
field: "deviceCode",
title: "设备编码",
}
],
loadComplete: function(grid) {
......@@ -106,8 +106,18 @@ $(function () {
loadChange(grid,e,"factoryCode");
}
loadChange(grid,e,"userId");
}else if (e.field == "deviceCode"){
}else if (e.field === "periodDays") {
if (e.items[0]["periodDays"] !== "null"){
let purchaseDate = e.items[0]["purchaseDate"];
let periodDays = e.items[0]["periodDays"];
let maintainDate = dayjs(purchaseDate).add(periodDays,"day").format("YYYYMMDD");
resultGrid.setCellValue(e.items[0],"maintainDate",maintainDate);
}
}else if (e.field === "maintainDate") {
let purchaseDate = dayjs(e.items[0]["purchaseDate"]);
let maintainDate = dayjs(e.items[0]["maintainDate"]);
let periodDays =maintainDate.diff(purchaseDate,"d");
resultGrid.setCellValue(e.items[0],"periodDays",periodDays);
}
});
},
......@@ -119,15 +129,7 @@ $(function () {
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) {
// 阻止默认请求,使用自定义保存
......@@ -207,6 +209,20 @@ let query = function () {
}
/**
* 显示详情
*/
function showDetail(id,factoryCode,groupCode,deviceType,deviceName) {
let url = "HPSB003A?methodName=initLoad&inqu_status-0-factoryCode="+factoryCode+"&inqu_status-0-groupCode="+groupCode+"&inqu_status-0-deviceType="+deviceType+"&inqu_status-0-deviceName="+deviceName;
//window.open(url);
JSColorbox.open({
href: url,
title: "<div style='text-align: center;'>设备台账详情</div>",
width: "75%",
height: "95%",
});
}
/**
* 保存
*/
let save = function (btnNode) {
......
......@@ -5,21 +5,21 @@
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" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script>
<EF:EFPage title="设备管理">
<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">
......@@ -41,11 +41,11 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" queryMethod="query" autoBind="true">
<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:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
......@@ -72,23 +72,37 @@
<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"
<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"
<EF:EFColumn ename="periodDays" cname="保养周期天数" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="15" required="true"
data-regex="/^-?[0-9]{1,15}?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFComboColumn ename="deviceUserId" cname="设备负责人" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" defaultValue="${loginName}"
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="supCode" cname="供应商名称" hidden="true"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" hidden="true"/>
<EF:EFColumn ename="headName" cname="联系人" width="100" enable="true" readonly="false" align="center" required="true" hidden="true"/>
<EF:EFColumn ename="phoneName" cname="联系电话" width="160" enable="true" readonly="false" align="center" required="true" hidden="true"/>
<EF:EFColumn ename="address" cname="地址" width="200" enable="true" readonly="false" align="center" required="true" hidden="true"/>
<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"
<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"/>--%>
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/13
Time: 14:17
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" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<EF:EFPage title="设备台账详情">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="factoryCode" cname="工厂名称" colWidth="3" readonly="true" 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:EFInput blockId="inqu_status" row="0" ename="groupName" cname="设备区域" readonly="true" placeholder="模糊查询" colWidth="3"/>--%>
<EF:EFSelect blockId="inqu_status" row="0" ename="deviceType" cname="设备类型" readonly="true" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceName" cname="设备名称" readonly="true" placeholder="模糊查询" colWidth="3"/>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="inspecDate" cname="点检日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="upkeepDate" cname="保养日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="点检记录">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="inspecDate" cname="点检日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="inspecCode" cname="点检单号" width="100" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="checkItem" cname="检查项" width="100" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="checkDescrip" cname="检查描述" editType="textarea" width="160" align="center"/>
<EF:EFColumn ename="checkResult" cname="检查结果" editType="textarea" width="160" align="center"/>
<EF:EFColumn ename="docId" cname="点检图片" width="100" enable="false" readonly="true" align="center"/>
<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:EFRegion id="detail" title="保养记录">
<EF:EFGrid blockId="detail" autoDraw="override" isFloat="true" queryMethod="queryDetail">
<EF:EFColumn ename="upkeepDate" cname="保养日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="upkeepCode" cname="保养单号" width="100" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="checkItem" cname="检查项" width="100" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="checkDescrip" cname="检查描述" editType="textarea" width="160" align="center"/>
<EF:EFColumn ename="checkResult" cname="检查结果" editType="textarea" width="160" align="center"/>
<EF:EFColumn ename="docId" cname="保养图片" width="100" enable="false" readonly="true" align="center"/>
<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:EFRegion id="detail1" title="安全记录">
<EF:EFGrid blockId="detail1" autoDraw="override" isFloat="true" queryMethod="queryDetail1">
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<%--<EF:EFColumn ename="docId" cname="附件" width="100" enable="false" readonly="true" align="center"/>--%>
<EF:EFColumn ename="upkeepDate" cname="记录日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="upkeepCode" cname="记录单号" width="100" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="checkDescrip" cname="安全事故描述" editType="textarea" width="160" align="center"/>
<EF:EFColumn cname="记录人" ename="createdName" align="center" width="100" readonly="true" required="false" enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/13
Time: 8:46
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" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<EF:EFPage title="设备计划">
<EF:EFRegion id="inqu" title="查询条件">
<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:EFInput blockId="inqu_status" row="0" ename="groupName" cname="设备区域" placeholder="模糊查询" colWidth="3"/>--%>
<EF:EFSelect blockId="inqu_status" row="0" ename="planType" cname="计划类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpsb.planType"/>
</EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="planDate" cname="计划日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="planUserName" cname="计划人" placeholder="模糊查询" colWidth="3"/>
<EF:EFDateSpan startCname="计划开始日期" endCname="计划结束日期" blockId="inqu_status"
startName="planStartDate" endName="planEndDate" row="0" role="date"
format="yyyy-MM-dd" satrtRatio="4:8" endRatio="4:8">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" autoBind="true" queryMethod="query" isFloat="true">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="160" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司名称" hidden="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂名称" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="factoryCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="planDate" cname="计划日期" width="120" enable="true" readonly="false" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="planCode" cname="计划单号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="planType" cname="计划类型"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="120" readonly="false" required="true"
align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpsb.planType" />
</EF:EFComboColumn>
<EF:EFColumn ename="planStartDate" cname="计划开始日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
<EF:EFColumn ename="planEndDate" cname="计划结束日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
<EF:EFComboColumn ename="planUserId" cname="计划人" defaultValue="${loginName}"
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="planStatus" cname="审批状态" width="80" align="center" enable="false" required="true" defaultValue="0">
<EF:EFCodeOption codeName="hpjx.hpsb.approveStatus"/>
</EF:EFComboColumn>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="120" 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="150" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
var deviceCodeBox = __eiInfo.getBlock("deviceCodeBox_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: "groupCode",
attributes: {
class: "i-input-readonly"
},
/*defaultValue: function () {
return __eiInfo.getBlock("inqu_status").getMappedRows()[0]["groupCode"];
},*/
filter: function (options) {
return _.filter(groupCodeBox, function (item) {
return item["param1Field"]==__eiInfo.getBlock("inqu_status").getMappedRows()[0]["factoryCode"] ;
})
},
template: function (dataItem) {
for (let i = 0; i < groupCodeBox.length; i++) {
if (groupCodeBox[i]['valueField'] === dataItem['groupCode']) {
dataItem['groupName'] = groupCodeBox[i]['textField'].split("]")[1]
return groupCodeBox[i]['textField'];
}
}
return dataItem["groupCode"]
}
}, {
field: "deviceCode",
filter: function (options) {
let deviceType = options.model['deviceType'];
let groupCode = options.model['groupCode'];
if(deviceType && groupCode) {
// 返回我们过滤后的数据集
return _.filter(deviceCodeBox, function (item) {
return item["param1Field"]==deviceType && item["param4Field"] == groupCode && item["param5Field"] == "true";
})
}
if (deviceType){
return _.filter(deviceCodeBox, function (item) {
return item["param1Field"]==deviceType && item["param5Field"] == "true";
})
}
if (groupCode){
return _.filter(deviceCodeBox, function (item) {
return item["param4Field"] == groupCode && item["param5Field"] == "true";
})
}
return options.values;
},
template: function (dataItem) {
for (let i = 0; i < deviceCodeBox.length; i++) {
if (deviceCodeBox[i]['valueField'] === dataItem['deviceCode']) {
return deviceCodeBox[i]['textField'].split("[")[0]
}
}
return dataItem["deviceCode"]
}
}
],
exportGrid: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "设备计划详情_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "deviceType") {
loadChange(grid,e,"deviceCode");
}else if (e.field === "deviceCode") {
let item = e.items[0];
for (let i = 0; i < deviceCodeBox.length; i++) {
let deviceName = deviceCodeBox[i]['textField'].split("[")[0];
let deviceModel = deviceCodeBox[i]['textField'].split("]")[1]
if (deviceCodeBox[i]['valueField'] === item['deviceCode']) {
item['deviceName'] = deviceName;
//resultGrid.setCellValue(item,"deviceName",deviceName);
resultGrid.setCellValue(item,"deviceModel",deviceModel);
if (item['groupCode'].length === 0){
resultGrid.setCellValue(item,"groupCode",deviceCodeBox[i]['param4Field']);
}
if (item['deviceType'] == ""){
resultGrid.setCellValue(item,"deviceType",deviceCodeBox[i]['param1Field']);
}
loadChange(grid,e,"checkItem");
break;
}
}
//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) {
}
}
}
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 groupCode= item.get("groupCode");
let deviceType= item.get("deviceType");
let deviceCode= item.get("deviceCode");
let checkItem= item.get("checkItem");
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(checkItem)){
message("选中的第"+(index+1)+"行\"检查项\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSB004A", "save", true);
btnNode.attr("disabled", false);
}
});
}
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/13
Time: 8:48
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" disabled="true">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factoryCodeBox_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:EFInput blockId="inqu_status" row="0" ename="deviceName" cname="设备名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="groupCode" cname="设备区间编码" colWidth="3" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="groupName" cname="设备区间名称" colWidth="3" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="上级ID" colWidth="3" type="hidden"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" autoBind="true" queryMethod="query">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" hidden="true"/>
<EF:EFComboColumn ename="groupCode" cname="设备区域" blockName="groupCodeBox_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
width="200" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFComboColumn ename="deviceType" cname="设备类型"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="100" required="true"
align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType" />
</EF:EFComboColumn>
<EF:EFComboColumn ename="deviceCode" cname="设备名称" readonly="true" blockName="deviceCodeBox_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="220" required="true"
align="center" filter="contains" sort="true">
<%--<EF:EFOptions blockId="deviceCodeBox_block_id" textField="textField" valueField="valueField"/>--%>
</EF:EFComboColumn>
<EF:EFColumn ename="deviceModel" cname="设备型号" width="120" enable="false" readonly="false" align="center"/>
<EF:EFColumn ename="checkItem" cname="检查项" width="150" enable="true" align="center" required="true"/>
<EF:EFColumn ename="checkDescrip" cname="检查描述" type="textarea" width="200" align="center"/>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="120" 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="150" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/13
Time: 8:49
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" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<EF:EFPage title="维保申请">
<EF:EFRegion id="inqu" title="查询条件">
<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:EFDatePicker blockId="inqu_status" row="0" ename="applyDate" cname="申请日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceName" cname="设备名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="checkItem" cname="检查项" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="applyUserName" cname="申请人" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyStr" cname="公司名称" type="hidden" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="160" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司名称" hidden="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="factoryCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="applyDate" cname="申请日期" width="120" enable="true" readonly="false" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="applyCode" cname="申请单号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="deviceCode" cname="设备名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="220" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="deviceCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="checkItem" cname="检查项" width="120" enable="true" readonly="false" align="center" required="true"/>
<EF:EFColumn ename="checkDescrip" cname="检查描述" type="textarea" width="160" align="center"/>
<EF:EFComboColumn ename="applyUserId" cname="申请人" defaultValue="${loginName}"
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="status" cname="审批状态" width="80" align="center" enable="false" required="true" defaultValue="0">
<EF:EFCodeOption codeName="hpjx.hpsb.approveStatus"/>
</EF:EFComboColumn>
<%--<EF:EFColumn ename="docId" cname="维修图片" width="100" enable="false" readonly="true" align="center"/>--%>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="120" 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="150" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFUpload = {
uploadFile: {
success: function(e) {
let docId = e.response.docId;
let docName = e.response.docName;
let id = $("#inqu_status-0-matId").val()
if (isBlank(docId)) {
return;
}
$("#fileDocId").val(docId);
NotificationUtil("附件上传成功");
saveTemp(e);
try {
parent.JSColorbox.setValueCallback(e.response);
parent.JSColorbox.close();
} catch (e){
}
},
}
};
function saveTemp(e) {
let docId = e.response.docId;
let docName = e.response.docName;
let docSize = e.response.docSize;
let docTag = e.response.docTag;
let docUrl = e.response.docUrl;
let result = new EiInfo();
result.set("result-0-docId",docId);
result.set("result-0-docName",docName);
result.set("result-0-docSize",docSize);
result.set("result-0-docTag",docTag);
result.set("result-0-realPath",docUrl);
result.set("result-0-bizType",$("#inqu_status-0-bizType").val());
result.set("result-0-matId",$("#inqu_status-0-matId").val());
EiCommunicator.send("HPDS002", "insert", result, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
});
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/13
Time: 8:59
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ 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:EFInput blockId="inqu_status" row="0" ename="matId" cname="ID" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFRegion id="result">
<EF:EFUpload blockId="result" ename="uploadFile" docTag="hg_file003" path="HGSB"/>
</EF:EFRegion>
<EF:EFInput ename="fileDocId" cname="" hidden="true"/>
</EF:EFPage>
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/13
Time: 8:50
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" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<EF:EFPage title="设备点检">
<EF:EFRegion id="inqu" title="查询条件">
<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:EFDatePicker blockId="inqu_status" row="0" ename="inspecDate" cname="点检日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="planCode" cname="计划单号" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="inspecUserName" cname="点检人" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyStr" cname="公司名称" type="hidden" 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="companyCode" cname="账套" hidden="true"/>
<%--blockName="factoryCodeBox_block_id"--%>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="160" align="center"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="factoryCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="inspecDate" cname="点检日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="inspecCode" cname="点检单号" width="120" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="planCode" cname="计划单号" width="120" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="planStartDate" cname="计划开始日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="true" required="true"/>
<EF:EFColumn ename="planEndDate" cname="计划结束日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="true" required="true"/>
<EF:EFComboColumn ename="inspecUserId" cname="点检人" defaultValue="${loginName}"
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="checkStatus" cname="审核状态" width="80" align="center" enable="false" readonly="false" required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpsb.approveStatus"/>
</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>
$(function () {
var deviceCodeBox = __eiInfo.getBlock("deviceCodeBox_block_id").getMappedRows();
//var groupCodeBox = __eiInfo.getBlock("groupCodeBox_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
/* 页面查询框的尺寸设置 */
$.extend(true, IPLATUI.Config, {
EFGrid: {
height: $(document).height() - $("#inqu").height() - $("#ef_form_head").height() - 100,
}
});
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let auditStatus = item.status;
let template = '';
if (item.id) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="uploadFile(' + item.id + ')" >附件详情</a>';
}
return template;
}
}, {
field: "deviceCode",
filter: function (options) {
var deviceType = options.model['deviceType'];
if(deviceType) {
// 返回我们过滤后的数据集
return _.filter(deviceCodeBox, function (item) {
return item["param1Field"]==deviceType;
})
}
return deviceCodeBox;
},
template: function (dataItem) {
for (let i = 0; i < deviceCodeBox.length; i++) {
if (deviceCodeBox[i]['valueField'] === dataItem['deviceCode']) {
dataItem['deviceName'] = deviceCodeBox[i]['textField'].split("[")[0]
return deviceCodeBox[i]['textField'].split("[")[0];
}
}
return dataItem["deviceCode"]
}
}/*, {
field: "docId",
template: function (item) {
let template = '';
if (item.id>0 && item.docId.trim().length>0){
template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(item.docId) + '" target="_blank">'+item.docName+'</a>';
}
return template;
}
}*/
],
exportGrid: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "设备点检详情_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "deviceType") {
loadChange(grid,e,"deviceCode");
}else if (e.field === "deviceCode") {
if (e.items[0].deviceType.length===0){
loadChange(grid,e,"deviceType");
}
//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) {
}
}
}
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 groupCode= item.get("groupCode");
let deviceType= item.get("deviceType");
let deviceCode= item.get("deviceCode");
let checkItem= item.get("checkItem");
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(checkItem)){
message("选中的第"+(index+1)+"行\"检查项\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSB006A", "save", true);
btnNode.attr("disabled", false);
}
});
}
}
/**
* 文件上传
*
* @param id
*/
function uploadFile(id) {
let checkStatus = $("#inqu_status-0-checkStatus").val();
JSColorbox.open({
href: "HPSB099?methodName=initLoad&inqu_status-0-matId="+id+"&inqu_status-0-bizType=SB006&inqu_status-0-checkStatus="+checkStatus,
title: "<div style='text-align: center;'>附件详情</div>",
width: "70%",
height: "50%",
//callbackName: uploadFileCallback
});
}
/**
* 附件上传回调
*
* @param docId
*/
function uploadFileCallback(result) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", result.id);
inEiInfo.set("result-0-docId", result.docId);
inEiInfo.set("result-0-docName", result.docName);
EiCommunicator.send('HPSB006A', 'updateDocId', inEiInfo, {
onSuccess(ei) {
if (ei.status == "-1") {
NotificationUtil({msg: ei.msg, detailMsg: ei.detailMsg}, "error");
} else {
NotificationUtil(ei.msg);
query();
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
});
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/13
Time: 8:52
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:EFInput blockId="inqu_status" row="0" ename="groupName" cname="设备区域" colWidth="3"/>--%>
<%--<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: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:EFInput blockId="inqu_status" row="0" ename="checkItem" cname="检查项" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="上级ID" colWidth="3" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="checkStatus" cname="审核状态" colWidth="3" type="hidden"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<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:EFComboColumn ename="deviceCode" 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="deviceCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="checkItem" cname="检查项" width="100" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="checkDescrip" cname="检查描述" editType="textarea" width="160" align="center"/>
<EF:EFColumn ename="checkResult" cname="检查结果" editType="textarea" width="160" align="center"/>
<%--<EF:EFColumn ename="docId" cname="点检图片" width="100" enable="false" readonly="true" align="center"/>--%>
<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>
$(function () {
var groupCodeBox = __eiInfo.getBlock("group_record_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [],
exportGrid: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "设备计划任务_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function(grid) {
$("#CONFIRM").on("click",confirm);
},
afterEdit:function (e) {
},
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) {
}
}
}
/**
* 取消
*/
$('#cancel').on('click', function () {
// 关闭弹窗
parent.JSColorbox.close();
})
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 确认
*/
let confirm = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对数据做\"确认\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSB006B", "save", true,
function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback(e);
//parent.JSColorbox.close();
}else {
NotificationUtil({msg: e.msg, detailMsg: e.detailMsg}, "error");
}
});
}
});
}
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let factoryCode= item.get("factoryCode");
let groupCode= item.get("groupCode");
let planDate= item.get("planDate");
let planType= item.get("planType");
let planStartDate= item.get("planStartDate");
let planEndDate= item.get("planEndDate");
let planUserId= item.get("planUserId");
if(isBlank(factoryCode)){
message("选中的第"+(index+1)+"行\"工厂\",不能为空!");
flag = false;
return false;
}
if(isBlank(groupCode)){
message("选中的第"+(index+1)+"行\"设备区域\",不能为空!");
flag = false;
return false;
}
if(isBlank(planDate)){
message("选中的第"+(index+1)+"行\"计划日期\",不能为空!");
flag = false;
return false;
}
if(isBlank(planType)){
message("选中的第"+(index+1)+"行\"计划类型\",不能为空!");
flag = false;
return false;
}
if(isBlank(planStartDate)){
message("选中的第"+(index+1)+"行\"计划开始日期\",不能为空!");
flag = false;
return false;
}
if(isBlank(planEndDate)){
message("选中的第"+(index+1)+"行\"计划结束日期\",不能为空!");
flag = false;
return false;
}
if(isBlank(planUserId)){
message("选中的第"+(index+1)+"行\"计划人\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSB006", "save", true);
btnNode.attr("disabled", false);
}
});
}
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/13
Time: 8:54
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" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
UserSession.web2Service(request);
String userName = UserSession.getLoginCName();
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<c:set var="userName" value="<%=userName%>" />
<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:EFDatePicker blockId="inqu_status" row="0" ename="planDate" cname="计划日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="inspecUserId" cname="点检人" value="${loginName}" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="inspecUserName" cname="点检人名称" value="${userName}" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="planType" cname="计划类型" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="taskStatus" cname="任务类型" value="0" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="planStatus" cname="审批状态" value="1" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="pageNumber" cname="页面号" type="hidden"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="账套" hidden="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="200" 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="group_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>--%>
<EF:EFColumn ename="planDate" cname="计划日期" width="120" enable="true" readonly="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="planCode" cname="计划单号" width="140" enable="false" readonly="true" align="center" required="true"/>
<EF:EFComboColumn ename="planType" cname="计划类型"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="100" readonly="true" required="true"
align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpsb.planType" />
</EF:EFComboColumn>
<EF:EFColumn ename="planStartDate" cname="计划开始日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
<EF:EFColumn ename="planEndDate" cname="计划结束日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
<%--defaultValue="${loginName}"--%>
<EF:EFComboColumn ename="planUserId" 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="planStatus" cname="审批状态" width="80" align="center" readonly="false" required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpsb.approveStatus"/>
</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>
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/13
Time: 8:55
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" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<EF:EFPage title="设备保养">
<EF:EFRegion id="inqu" title="查询条件">
<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:EFDatePicker blockId="inqu_status" row="0" ename="upkeepDate" cname="保养日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="planCode" cname="计划单号" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="upkeepUserName" cname="保养人" placeholder="模糊查询" 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="companyCode" cname="账套" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="160" align="center"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="factoryCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="upkeepDate" cname="保养日期" width="120" enable="true" readonly="false" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="upkeepCode" cname="保养单号" width="100" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="planCode" cname="计划单号" width="100" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="planStartDate" cname="计划开始日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="true" required="true"/>
<EF:EFColumn ename="planEndDate" cname="计划结束日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="true" required="true"/>
<EF:EFComboColumn ename="upkeepUserId" cname="保养人" defaultValue="${loginName}"
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="checkStatus" cname="审核状态" width="80" align="center" enable="false" required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpsb.approveStatus"/>
</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>
$(function () {
var deviceCodeBox = __eiInfo.getBlock("deviceCodeBox_block_id").getMappedRows();
//var groupCodeBox = __eiInfo.getBlock("groupCodeBox_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let auditStatus = item.status;
let template = '';
if (item.id) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="uploadFile(' + item.id + ')" >附件详情</a>';
}
return template;
}
}, {
field: "deviceCode",
filter: function (options) {
var deviceType = options.model['deviceType'];
if(deviceType) {
// 返回我们过滤后的数据集
return _.filter(deviceCodeBox, function (item) {
return item["param1Field"]==deviceType;
})
}
return deviceCodeBox;
},
template: function (dataItem) {
for (let i = 0; i < deviceCodeBox.length; i++) {
if (deviceCodeBox[i]['valueField'] === dataItem['deviceCode']) {
dataItem['deviceName'] = deviceCodeBox[i]['textField'].split("[")[0]
return deviceCodeBox[i]['textField'].split("[")[0];
}
}
return dataItem["deviceCode"]
}
}/*, {
field: "docId",
template: function (item) {
let template = '';
if (item.id>0 && item.docId.trim().length>0){
template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(item.docId) + '" target="_blank">'+item.docName+'</a>';
}
return template;
}
}*/
],
exportGrid: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "设备保养详情_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "deviceType") {
loadChange(grid,e,"deviceCode");
}else if (e.field === "deviceCode") {
if (e.items[0].deviceType.length===0){
loadChange(grid,e,"deviceType");
}
//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) {
}
}
}
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 groupCode= item.get("groupCode");
let deviceType= item.get("deviceType");
let deviceCode= item.get("deviceCode");
let checkItem= item.get("checkItem");
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(checkItem)){
message("选中的第"+(index+1)+"行\"检查项\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSB007A", "save", true);
btnNode.attr("disabled", false);
}
});
}
}
/**
* 文件上传
*
* @param id
*/
function uploadFile(id) {
let checkStatus = $("#inqu_status-0-checkStatus").val();
JSColorbox.open({
href: "HPSB099?methodName=initLoad&inqu_status-0-matId="+id+"&inqu_status-0-bizType=SB007&inqu_status-0-checkStatus="+checkStatus,
title: "<div style='text-align: center;'>附件详情</div>",
width: "60%",
height: "60%",
//callbackName: uploadFileCallback
});
}
/**
* 附件上传回调
*
* @param result
*/
function uploadFileCallback(result) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", result.id);
inEiInfo.set("result-0-docId", result.docId);
inEiInfo.set("result-0-docName", result.docName);
EiCommunicator.send('HPSB007A', 'updateDocId', inEiInfo, {
onSuccess(ei) {
if (ei.status == "-1") {
NotificationUtil({msg: ei.msg, detailMsg: ei.detailMsg}, "error");
} else {
NotificationUtil(ei.msg);
query();
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
});
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/13
Time: 8:56
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="deviceType" cname="设备类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="checkItem" cname="检查项" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="上级ID" colWidth="3" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="checkStatus" cname="审核状态" colWidth="3" type="hidden"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<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:EFComboColumn ename="deviceCode" 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="deviceCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="checkItem" cname="检查项" width="100" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="checkDescrip" cname="检查描述" editType="textarea" width="160" align="center"/>
<EF:EFColumn ename="checkResult" cname="检查结果" editType="textarea" width="160" align="center"/>
<%--<EF:EFColumn ename="docId" cname="点检图片" width="100" enable="false" readonly="true" align="center"/>--%>
<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>
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/12
Time: 18:18
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="deviceCode" cname="设备名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="deviceCode_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="recordDate" cname="记录日期"
role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="recordCode" cname="记录单号" colWidth="3" placeholder="模糊查询"/>
<EF:EFInput blockId="inqu_status" row="0" ename="createdName" cname="记录人" colWidth="3" placeholder="模糊查询"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" autoBind="true" queryMethod="query">
<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:EFColumn ename="recordDate" cname="记录日期" width="120" enable="true" readonly="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="recordCode" cname="记录单号" width="120" enable="false" readonly="true" align="center" required="false"/>
<EF:EFComboColumn ename="deviceCode" 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="deviceCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="deviceName" cname="设备名称" width="160" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="secureDesc" cname="安全事故描述" width="200" etype="textarea" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="createdName" cname="记录人" align="center" width="100" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(item.docId) + '" target="_blank">附件下载</a>';
return template;
}
}],
loadComplete: function(grid){
// 附件上传
$("#UPLOAD_FILE").on("click", uploadFile);
// 删除
$("#BTN_DELETE").on("click", deleteFunc);
},
dataBound: function () {
}
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
}
/**
* 文件上传
*
* @param id
*/
function uploadFile(id) {
JSColorbox.open({
href: "HPSB005A?methodName=initLoad&inqu_status-0-bizType="+$("#inqu_status-0-bizType").val()+"&inqu_status-0-matId="+$("#inqu_status-0-matId").val(),
title: "<div style='text-align: center;'>附件上传</div>",
width: "60%",
height: "70%",
callbackName: uploadFileCallback
});
}
/**
* 附件上传回调
*
* @param docId
*/
function uploadFileCallback(item) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-matId", $("#inqu_status-0-matId").val());
inEiInfo.set("result-0-docId", item.docId);
inEiInfo.set("result-0-docName",item.docName);
inEiInfo.set("result-0-docSize",item.docSize);
inEiInfo.set("result-0-docTag",item.docTag);
inEiInfo.set("result-0-realPath",item.docUrl);
inEiInfo.set("result-0-bizType", $("#inqu_status-0-bizType").val());
EiCommunicator.send('HPSB099', 'insert', inEiInfo, {
onSuccess(response) {
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
});
}
/**
* 删除
*/
function deleteFunc() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
let checkStatus = $("#inqu_status-0-checkStatus").val();
if (checkStatus==1){
message("审批完成,不能删除!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HPSB099", "delete", true);
}
})
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/14
Time: 16:53
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ 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="查询区域" type="query">
<EF:EFInput cname="主表ID" ename="matId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="checkStatus" cname="审核状态" colWidth="3" type="hidden"/>
<div class="row">
<EF:EFInput cname="文件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3" />
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="150"/>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="150"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="200" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -19,10 +19,10 @@ $(function () {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + filePath1 + ')" >附件</a>';
}
if (zlprodTaskNo) {
/*if (zlprodTaskNo) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showZlDetail(\'' + prodTaskNo + '\')" >质检单</a>';
}
}*/
return template
}
}, {
......
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