Commit 97317e0e by liuyang

2024-04-25 设备日志和设备异常显示优化和调整

parent 316ce184
......@@ -386,6 +386,12 @@ public enum DdynamicEnum {
WORKER_BLOCK_ID("worker_block_id","userId","userName","HPPZ013.queryComboBox"),
PLAN_SALES_CODE_BLOCK_ID("planSalesCode_block_id","planSalesCode","yearMonth","HPPZ018.queryPlanSalesCode"),
/**
* 模块:设备编码
* 用途:设备日志下拉框
* 编写:ly
*/
DEVICE_CODE_BLOCK_ID("deviceCode_block_id","deviceCode","deviceName","HPSB003.queryDeviceCode"),
;
......
......@@ -52,7 +52,7 @@ public class LogInformationController {
if (equipmentType.equals(HPConstants.STARUS_TYPE)) {
//解析设备状态
List<CutterbarStatus> cutterbarStatusList = XmlUtils.readXml(hpsb00A.getDataContent(), CutterbarStatus.class);
hpsb002.setId(StringUtils.uuid());
//hpsb002.setId(StringUtils.uuid());
hpsb002.setEquipmentCode(hpsb00A.getEquipmentCode());
hpsb002.setEquipmentType(hpsb00A.getEquipmentType());
hpsb002.setLogValue(cutterbarStatusList.get(0).getStatus().toString());
......@@ -68,7 +68,7 @@ public class LogInformationController {
if (equipmentType.equals(HPConstants.TIME_TYPE)) {
//解析开机时间
List<CutterbarTime> cutterbarTimeList = XmlUtils.readXml(hpsb00A.getDataContent(), CutterbarTime.class);
hpsb002.setId(StringUtils.uuid());
//hpsb002.setId(StringUtils.uuid());
hpsb002.setEquipmentCode(hpsb00A.getEquipmentCode());
hpsb002.setEquipmentType(hpsb00A.getEquipmentType());
hpsb002.setLogValue(cutterbarTimeList.get(0).getTime());
......@@ -88,7 +88,7 @@ public class LogInformationController {
if (CollectionUtils.isNotEmpty(cutterbarWarningBaseList)) {
cutterbarWarning = CutterbarWarning.convertBase(cutterbarWarningBaseList.get(0));
}
hpsb001.setId(StringUtils.uuid());
//hpsb001.setId(StringUtils.uuid());
hpsb001.setErrorCode(cutterbarWarning.getErrorCode());
hpsb001.setPrio(cutterbarWarning.getPrio());
hpsb001.setProgramNo(cutterbarWarning.getProgramNo());
......
......@@ -59,7 +59,7 @@ public class CutterbarWarning {
warning.setFileName(base.getFileName());
}else if(no.compareTo(new Integer(300))>=0&&no.compareTo(new Integer(399))<=0){
warning.setRowNo(base.getArg1());
warning.setFileName(warning.getFileName());
warning.setFileName(warning.getFileName()==null?base.getFileName():warning.getFileName());
}
}
return warning;
......
......@@ -5,6 +5,7 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.sb.domain.HPSB001;
import com.baosight.hpjx.hp.sb.domain.HPSB003;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.ErrorCodeUtils;
......@@ -18,10 +19,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
/**
*
......@@ -35,10 +33,12 @@ public class ServiceHPSB001 extends ServiceBase {
*/
@OperationLogAnnotation(operModul = "设备异常日志",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
HPSB001 hpsb001 = new HPSB001();
EiInfo outInfo = super.initLoad(inInfo, hpsb001);
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(hpsb001.eiMetadata);
return inInfo;
EiInfo outInfo = super.query(inInfo, "HPSB001.query", new HPSB001());
CommonMethod.initBlock(outInfo,
Arrays.asList(DdynamicEnum.DEVICE_CODE_BLOCK_ID),
new HashMap<String,Object>(){}
);
return outInfo;
}
......@@ -67,10 +67,12 @@ public class ServiceHPSB001 extends ServiceBase {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsb001.fromMap(map);
hpsb001.setCreatedBy(UserSession.getUserId());
hpsb001.setCreatedTime(sdf.format(new Date()));
hpsb001.setUpdatedBy(null);
hpsb001.setUpdatedTime(null);
List<HPSB003> list = this.dao.query(HPSB003.QUERY,new HashMap<String,Object>(){{
put(HPSB003.FIELD_DEVICE_CODE,hpsb001.getEquipmentCode());
}});
if (list.size() >0) {
hpsb001.setCompanyCode(list.get(0).getCompanyCode());
}
DaoUtils.insert("HPSB001.insert", hpsb001.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
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.dao.DaoUtils;
import com.baosight.hpjx.hp.sb.domain.HPSB002;
import com.baosight.hpjx.hp.sb.domain.HPSB003;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -13,9 +16,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
/**
*
......@@ -29,10 +30,12 @@ public class ServiceHPSB002 extends ServiceBase {
*/
@OperationLogAnnotation(operModul = "设备日志",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
HPSB002 hpsb002 = new HPSB002();
EiInfo outInfo = super.initLoad(inInfo, hpsb002);
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(hpsb002.eiMetadata);
return inInfo;
EiInfo outInfo = super.query(inInfo, "HPSB002.query", new HPSB002());
CommonMethod.initBlock(outInfo,
Arrays.asList(DdynamicEnum.DEVICE_CODE_BLOCK_ID),
new HashMap<String,Object>(){}
);
return outInfo;
}
......@@ -61,10 +64,12 @@ public class ServiceHPSB002 extends ServiceBase {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsb002.fromMap(map);
hpsb002.setCreatedBy(UserSession.getUserId());
hpsb002.setCreatedTime(sdf.format(new Date()));
hpsb002.setUpdatedBy(null);
hpsb002.setUpdatedTime(null);
List<HPSB003> list = this.dao.query(HPSB003.QUERY,new HashMap<String,Object>(){{
put(HPSB003.FIELD_DEVICE_CODE,hpsb002.getEquipmentCode());
}});
if (list.size() >0) {
hpsb002.setCompanyCode(list.get(0).getCompanyCode());
}
DaoUtils.insert("HPSB002.insert", hpsb002.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
......@@ -23,66 +23,16 @@
-->
<sqlMap namespace="HPSB001">
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sb.domain.HPSB001">
SELECT
ID as "id", <!-- ID -->
ERROR_CODE as "errorCode", <!-- 异常编码 -->
PRIO as "prio", <!-- 异常登记 -->
PROGRAM_NO as "programNo", <!-- 程序号 -->
ROWNO as "rowno", <!-- 行号 -->
GOTO_ROW_NONE as "gotoRowNone", <!-- 不存在跳转行 -->
FILE_NAME as "fileName", <!-- 文件名 -->
EQUIPMENT_TYPE as "equipmentType", <!-- 设备状态 -->
EQUIPMENT_CODE as "equipmentCode", <!-- 设备编码 -->
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.是 -->
FROM hpjx.t_hpsb001 WHERE 1=1
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY LIKE CONCAT('%', #createdBy#, '%')
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="errorCode">
ERROR_CODE LIKE CONCAT('%', #errorCode#, '%')
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpsb001 WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY LIKE CONCAT('%', #createdBy#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="errorCode">
ERROR_CODE LIKE CONCAT('%', #errorCode#, '%')
</isNotEmpty>
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="errorCode">
ERROR_CODE = #errorCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prio">
PRIO = #prio#
</isNotEmpty>
......@@ -102,7 +52,7 @@
EQUIPMENT_TYPE = #equipmentType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="equipmentCode">
EQUIPMENT_CODE = #equipmentCode#
EQUIPMENT_CODE LIKE CONCAT('%', #equipmentCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
......@@ -125,10 +75,53 @@
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
-->
<isNotEmpty prepend=" AND " property="errorText">
ERROR_TEXT = #errorText#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sb.domain.HPSB001">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode",
ERROR_CODE as "errorCode", <!-- 异常编码 -->
PRIO as "prio", <!-- 异常登记 -->
PROGRAM_NO as "programNo", <!-- 程序号 -->
ROWNO as "rowno", <!-- 行号 -->
GOTO_ROW_NONE as "gotoRowNone", <!-- 不存在跳转行 -->
FILE_NAME as "fileName", <!-- 文件名 -->
EQUIPMENT_TYPE as "equipmentType", <!-- 设备状态 -->
EQUIPMENT_CODE as "equipmentCode", <!-- 设备编码 -->
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.是 -->
ERROR_TEXT as "errorText" <!-- 异常文本 -->
FROM ${hpjxSchema}.T_HPSB001 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME DESC
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPSB001 WHERE 1=1
<include refid="condition" />
</select>
<insert id="insert">
INSERT INTO hpjx.t_hpsb001 (ID, <!-- ID -->
INSERT INTO ${hpjxSchema}.T_HPSB001 (ID, <!-- ID -->
COMPANY_CODE,
ERROR_CODE, <!-- 异常编码 -->
PRIO, <!-- 异常登记 -->
PROGRAM_NO, <!-- 程序号 -->
......@@ -143,24 +136,21 @@
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人名称 -->
UPDATED_TIME, <!-- 更新时间 -->
DELETE_FLAG <!-- 是否删除0.否1.是 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
ERROR_TEXT <!-- 异常文本 -->
)
VALUES (#id#, #errorCode#, #prio#, #programNo#, #rowno#, #gotoRowNone#, #fileName#, #equipmentType#, #equipmentCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#)
VALUES (#id#, #companyCode#, #errorCode#, #prio#, #programNo#, #rowno#, #gotoRowNone#, #fileName#, #equipmentType#, #equipmentCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #errorText#)
</insert>
<delete id="delete">
DELETE FROM hpjx.t_hpsb001 WHERE
DELETE FROM ${hpjxSchema}.T_HPSB001 WHERE
ID = #id#
</delete>
<delete id="deleteByCreatedTime">
DELETE FROM hpjx.t_hpsb001 WHERE
SUBSTR(CREATED_TIME,1,8) &lt; DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 day),'%Y%m%d')
</delete>
<update id="update">
UPDATE hpjx.t_hpsb001
UPDATE ${hpjxSchema}.T_HPSB001
SET
COMPANY_CODE = #companyCode#,
ERROR_CODE = #errorCode#, <!-- 异常编码 -->
PRIO = #prio#, <!-- 异常登记 -->
PROGRAM_NO = #programNo#, <!-- 程序号 -->
......@@ -175,9 +165,15 @@
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0.否1.是 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
ERROR_TEXT = #errorText# <!-- 异常文本 -->
WHERE
ID = #id#
</update>
<delete id="deleteByCreatedTime">
DELETE FROM hpjx.t_hpsb001 WHERE
SUBSTR(CREATED_TIME,1,8) &lt; DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 day),'%Y%m%d')
</delete>
</sqlMap>
\ No newline at end of file
......@@ -19,13 +19,60 @@
-->
<sqlMap namespace="HPSB002">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileName">
FILE_NAME = #fileName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="equipmentType">
EQUIPMENT_TYPE = #equipmentType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="equipmentCode">
EQUIPMENT_CODE LIKE CONCAT('%', #equipmentCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="logInivalue">
LOG_INIVALUE = #logInivalue#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="logValue">
LOG_VALUE = #logValue#
</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>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sb.domain.HPSB002">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode",
FILE_NAME as "fileName", <!-- 文件名 -->
EQUIPMENT_TYPE as "equipmentType", <!-- 设备状态 -->
EQUIPMENT_CODE as "equipmentCode", <!-- 设备编码 -->
LOG_INIVALUE as "logInivalue", <!-- 初始类容 -->
LOG_VALUE as "logValue", <!-- 日志类容 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
......@@ -34,38 +81,31 @@
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag" <!-- 是否删除0.否1.是 -->
FROM hpjx.t_hpsb002 WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY LIKE CONCAT('%', #createdBy#, '%')
</isNotEmpty>
FROM ${hpjxSchema}.T_HPSB002 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc
CREATED_TIME DESC
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpsb002 WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY LIKE CONCAT('%', #createdBy#, '%')
</isNotEmpty>
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPSB002 WHERE 1=1
<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="fileName">
FILE_NAME = #fileName#
</isNotEmpty>
......@@ -75,6 +115,9 @@
<isNotEmpty prepend=" AND " property="equipmentCode">
EQUIPMENT_CODE = #equipmentCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="logInivalue">
LOG_INIVALUE = #logInivalue#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="logValue">
LOG_VALUE = #logValue#
</isNotEmpty>
......@@ -102,10 +145,12 @@
-->
<insert id="insert">
INSERT INTO hpjx.t_hpsb002 (ID, <!-- ID -->
INSERT INTO ${hpjxSchema}.T_HPSB002 (ID, <!-- ID -->
COMPANY_CODE,
FILE_NAME, <!-- 文件名 -->
EQUIPMENT_TYPE, <!-- 设备状态 -->
EQUIPMENT_CODE, <!-- 设备编码 -->
LOG_INIVALUE, <!-- 初始类容 -->
LOG_VALUE, <!-- 日志类容 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
......@@ -115,25 +160,22 @@
UPDATED_TIME, <!-- 更新时间 -->
DELETE_FLAG <!-- 是否删除0.否1.是 -->
)
VALUES (#id#, #fileName#, #equipmentType#, #equipmentCode#, #logValue#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#)
VALUES (#id#, #companyCode#, #fileName#, #equipmentType#, #equipmentCode#, #logInivalue#, #logValue#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#)
</insert>
<delete id="delete">
DELETE FROM hpjx.t_hpsb002 WHERE
DELETE FROM ${hpjxSchema}.T_HPSB002 WHERE
ID = #id#
</delete>
<delete id="deleteByCreatedTime">
DELETE FROM hpjx.t_hpsb002 WHERE
SUBSTR(CREATED_TIME,1,8) &lt; DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 day),'%Y%m%d')
</delete>
<update id="update">
UPDATE hpjx.t_hpsb002
UPDATE ${hpjxSchema}.T_HPSB002
SET
COMPANY_CODE = #companyCode#,
FILE_NAME = #fileName#, <!-- 文件名 -->
EQUIPMENT_TYPE = #equipmentType#, <!-- 设备状态 -->
EQUIPMENT_CODE = #equipmentCode#, <!-- 设备编码 -->
LOG_INIVALUE = #logInivalue#, <!-- 初始类容 -->
LOG_VALUE = #logValue#, <!-- 日志类容 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
......@@ -146,4 +188,10 @@
ID = #id#
</update>
<delete id="deleteByCreatedTime">
DELETE FROM hpjx.t_hpsb002 WHERE
SUBSTR(CREATED_TIME,1,8) &lt; DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 day),'%Y%m%d')
</delete>
</sqlMap>
\ No newline at end of file
......@@ -377,4 +377,13 @@
</isNotEmpty>-->
</select>
<select id="queryDeviceCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
select distinct
DEVICE_NAME as "deviceName", <!-- 设备名称 -->
DEVICE_CODE as "deviceCode" <!-- 设备编码 -->
FROM ${hpjxSchema}.T_HPSB003
WHERE 1=1
<include refid="condition" />
</select>
</sqlMap>
package com.baosight.hpjx.hp.tc.service;
import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.equipment.hp.domain.CutterbarStatus;
import com.baosight.hpjx.equipment.hp.domain.CutterbarTime;
import com.baosight.hpjx.equipment.hp.domain.CutterbarWarning;
import com.baosight.hpjx.equipment.hp.domain.CutterbarWarningBase;
import com.baosight.hpjx.hp.sb.domain.HPSB001;
import com.baosight.hpjx.hp.sb.domain.HPSB002;
import com.baosight.hpjx.hp.sb.domain.HPSB003;
import com.baosight.hpjx.hp.sb.domain.HPSB00A;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.StringUtils;
......@@ -17,6 +19,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class ServiceHPTCP001 extends ServiceBase {
......@@ -36,15 +39,23 @@ public class ServiceHPTCP001 extends ServiceBase {
hpsb00A.setDataContent(dataContent);
hpsb00A.setEquipmentType(equipmentType);
hpsb00A.setEquipmentCode(equipmentCode);
List<HPSB003> list = this.dao.query(HPSB003.QUERY,new HashMap<String,Object>(){{
put(HPSB003.FIELD_DEVICE_CODE,equipmentCode);
put(HPSB003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
}});
if (list.size() >0) {
hpsb001.setCompanyCode(list.get(0).getCompanyCode());
hpsb002.setCompanyCode(list.get(0).getCompanyCode());
}
if (StringUtils.isNotEmpty(equipmentType)) {
if (equipmentType.equals(HPConstants.STARUS_TYPE)) {
//解析设备状态
List<CutterbarStatus> cutterbarStatusList = XmlUtils.readXml(hpsb00A.getDataContent(), CutterbarStatus.class);
hpsb002.setId(StringUtils.uuid());
//hpsb002.setId(StringUtils.uuid());
hpsb002.setEquipmentCode(hpsb00A.getEquipmentCode());
hpsb002.setEquipmentType(hpsb00A.getEquipmentType());
hpsb002.setLogValue(cutterbarStatusList.get(0).getStatus().toString());
hpsb002.setLogInivalue(formatStatus(cutterbarStatusList.get(0).getStatus().toString()));
hpsb002.setCreatedBy("自动化中转程序");
hpsb002.setCreatedTime(DateUtils.shortDateTime());
this.dao.insert("HPSB002.insert",hpsb002);
......@@ -55,10 +66,11 @@ public class ServiceHPTCP001 extends ServiceBase {
if (equipmentType.equals(HPConstants.TIME_TYPE)) {
//解析开机时间
List<CutterbarTime> cutterbarTimeList = XmlUtils.readXml(hpsb00A.getDataContent(), CutterbarTime.class);
hpsb002.setId(StringUtils.uuid());
//hpsb002.setId(StringUtils.uuid());
hpsb002.setEquipmentCode(hpsb00A.getEquipmentCode());
hpsb002.setEquipmentType(hpsb00A.getEquipmentType());
hpsb002.setLogValue(cutterbarTimeList.get(0).getTime());
hpsb002.setLogInivalue(String.format("开机启动时间[%s]", cutterbarTimeList.get(0).getTime()));
hpsb002.setCreatedBy("自动化中转程序");
hpsb002.setCreatedTime(DateUtils.shortDateTime());
this.dao.insert("HPSB002.insert",hpsb002);
......@@ -73,7 +85,7 @@ public class ServiceHPTCP001 extends ServiceBase {
if (CollectionUtils.isNotEmpty(cutterbarWarningBaseList)) {
cutterbarWarning = CutterbarWarning.convertBase(cutterbarWarningBaseList.get(0));
}
hpsb001.setId(StringUtils.uuid());
//hpsb001.setId(StringUtils.uuid());
hpsb001.setErrorCode(cutterbarWarning.getErrorCode());
hpsb001.setPrio(cutterbarWarning.getPrio());
hpsb001.setProgramNo(cutterbarWarning.getProgramNo());
......@@ -82,9 +94,18 @@ public class ServiceHPTCP001 extends ServiceBase {
hpsb001.setFileName(cutterbarWarning.getFileName());
hpsb001.setEquipmentCode(hpsb00A.getEquipmentCode());
hpsb001.setEquipmentType(hpsb00A.getEquipmentType());
Integer errorCode = Integer.parseInt(cutterbarWarning.getErrorCode());
if(errorCode.compareTo(new Integer(200))>=0 && errorCode.compareTo(new Integer(299))<=0){
hpsb001.setErrorText(String.format("(程序号:%s,行号 %s)goto 跳转行%s 不存在", cutterbarWarning.getProgramNo(),
cutterbarWarning.getRowNo(),cutterbarWarning.getGotoRowNone()));
}else if(errorCode.compareTo(new Integer(300))>=0 && errorCode.compareTo(new Integer(399))<=0){
hpsb001.setErrorText(String.format(" (文件:%s,行号 %s)括号不匹配", cutterbarWarning.getFileName(),
cutterbarWarning.getRowNo()));
}
hpsb001.setCreatedBy("自动化中转程序");
hpsb001.setCreatedTime(DateUtils.shortDateTime());
this.dao.insert("HPSB001.insert",hpsb002);
this.dao.insert("HPSB001.insert",hpsb001);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg(outInfo.getMsg());
return inInfo;
......@@ -95,4 +116,28 @@ public class ServiceHPTCP001 extends ServiceBase {
return inInfo;
}
public String formatStatus(String status){
String str = "";
switch (status){
case "2":
str = "运行状态";
break;
case "3":
str = "暂停状态";
break;
case "4":
str = "复位状态";
break;
case "5":
str = "一级报警状态";
break;
case "6":
str = "二级报警状态";
break;
default:
str = "默认状态";
}
return str;
}
}
......@@ -9,7 +9,7 @@
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="操作人" ename="inqu_status-0-createdBy" colWidth="3"/>
<EF:EFInput cname="设备编码" ename="inqu_status-0-equipmentCode" colWidth="3"/>
<EF:EFInput cname="异常编码" ename="inqu_status-0-errorCode" colWidth="3"/>
</div>
</EF:EFRegion>
......@@ -17,16 +17,24 @@
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="主键id" hidden="true"/>
<EF:EFColumn ename="createdBy" cname="操作人" enable="false" readonly="true" width="150" align="center"/>
<EF:EFColumn ename="errorCode" cname="异常编码" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="programNo" cname="程序号" enable="false" readonly="true" width="80" align="center"/>
<EF:EFColumn ename="equipmentType" cname="设备状态" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="equipmentCode" cname="设备编码" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="prio" cname="数据内容" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="rowno" cname="行号" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="gotoRowNone" cname="不存在跳转行" enable="false" readonly="true" width="100" align="center"/>
<%--<EF:EFColumn ename="createdBy" cname="操作人" enable="false" readonly="true" width="150" align="center"/>--%>
<EF:EFComboColumn ename="equipmentType" cname="日志类型" enable="false" readonly="true" width="100" align="center">
<EF:EFOption label="" value=""/>
<EF:EFOption label="异常报警" value="WARNING_TYPE"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="equipmentCode" cname="设备编码" blockName="deviceCode_block_id"
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#"
textField="#=textField#" valueField="valueField"
enable="false" readonly="true" width="100" align="center">
</EF:EFComboColumn>
<EF:EFColumn ename="errorCode" cname="异常编码" enable="false" readonly="true" width="40" align="center"/>
<EF:EFColumn ename="programNo" cname="程序号" enable="false" readonly="true" width="40" align="center"/>
<EF:EFColumn ename="prio" cname="数据内容" enable="false" readonly="true" width="40" align="center"/>
<EF:EFColumn ename="rowno" cname="行号" enable="false" readonly="true" width="30" align="center"/>
<EF:EFColumn ename="gotoRowNone" cname="不存在跳转行" enable="false" readonly="true" width="50" align="center"/>
<EF:EFColumn ename="fileName" cname="文件名" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" readonly="true" width="120" align="center"
<EF:EFColumn ename="errorText" cname="异常文本" width="150" readonly="true"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" readonly="true" width="100" align="center"
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
</EF:EFGrid>
</EF:EFRegion>
......
......@@ -9,17 +9,25 @@
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="操作人" ename="inqu_status-0-createdBy" colWidth="3"/>
<EF:EFInput cname="设备编码" ename="inqu_status-0-equipmentCode" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="主键id" hidden="true"/>
<EF:EFColumn ename="createdBy" cname="操作人" enable="false" readonly="true" width="150" align="center"/>
<EF:EFColumn ename="equipmentType" cname="设备状态" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="equipmentCode" cname="设备编码" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="logValue" cname="数据内容" enable="false" readonly="true" width="100" align="center"/>
<%--<EF:EFColumn ename="createdBy" cname="操作人" enable="false" readonly="true" width="150" align="center"/>--%>
<EF:EFColumn ename="equipmentType" cname="日志类型" enable="false" readonly="true" width="100" align="center"/>
<EF:EFComboColumn ename="equipmentType" cname="日志类型" enable="false" readonly="true" width="100" align="center">
<EF:EFOption label="设备状态" value="STARUS_TYPE"/>
<EF:EFOption label="开机时间" value="TIME_TYPE"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="equipmentCode" cname="设备编码" blockName="deviceCode_block_id"
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#"
textField="#=textField#" valueField="valueField"
enable="false" readonly="true" width="100" align="center">
</EF:EFComboColumn>
<EF:EFColumn ename="logInivalue" cname="数据内容" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" readonly="true" width="120" align="center"
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
</EF:EFGrid>
......@@ -30,5 +38,3 @@
var ctx = "${ctx}";
</script>
<script src="${ctx}/HP/SB/HPSB002.js"></script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment