Commit 0dfd5c29 by liuyang

2024-05-24 设备保养功能调整1、未审批完成可以查看保养详情,删除提示调整

parent 5db22179
...@@ -91,6 +91,7 @@ public class ServiceHGSB004 extends ServiceEPBase { ...@@ -91,6 +91,7 @@ public class ServiceHGSB004 extends ServiceEPBase {
map1.put(HGSB002.FIELD_PLAN_CODE,hgsb004.getPlanCode()); map1.put(HGSB002.FIELD_PLAN_CODE,hgsb004.getPlanCode());
map1.put(HGSB002.FIELD_PLAN_START_DATE,hgsb004.getPlanStartDate()); map1.put(HGSB002.FIELD_PLAN_START_DATE,hgsb004.getPlanStartDate());
map1.put(HGSB002.FIELD_PLAN_END_DATE,hgsb004.getPlanEndDate()); map1.put(HGSB002.FIELD_PLAN_END_DATE,hgsb004.getPlanEndDate());
map1.put(HGSB002.FIELD_PLAN_TYPE,1);
List<HGSB002> list = DaoBase.getInstance().query(HGSB002.QUERY, map1); List<HGSB002> list = DaoBase.getInstance().query(HGSB002.QUERY, map1);
for (HGSB002 hgsb002 : list){ for (HGSB002 hgsb002 : list){
hgsb002.setTaskStatus(0); hgsb002.setTaskStatus(0);
......
...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.sb.service; ...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.sb.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
...@@ -77,26 +78,32 @@ public class ServiceHGSB005 extends ServiceEPBase { ...@@ -77,26 +78,32 @@ public class ServiceHGSB005 extends ServiceEPBase {
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
int i = 0; int i = 0;
try { try {
HGSB005 hgsb005 = new HGSB005();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) { for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
HGSB005 hgsb005 = new HGSB005();
hgsb005.fromMap(map); hgsb005.fromMap(map);
hgsb005.setDeleteFlag(CommonConstant.YesNo.YES_1); hgsb005.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hgsb005.getCheckStatus()==1) { if (hgsb005.getCheckStatus()==1) {
String str = "设备保养已审批完成,无法删除!"; throw new PlatException("设备保养已审批完成,无法删除!");
throw new PlatException(str); }
Map map1 = new HashMap<>();
map1.put(HGSB002.FIELD_COMPANY_CODE,hgsb005.getCompanyCode());
map1.put(HGSB002.FIELD_PLAN_CODE,hgsb005.getPlanCode());
map1.put(HGSB002.FIELD_PLAN_START_DATE,hgsb005.getPlanStartDate());
map1.put(HGSB002.FIELD_PLAN_END_DATE,hgsb005.getPlanEndDate());
map1.put(HGSB002.FIELD_PLAN_TYPE,2);
List<HGSB002> list = DaoBase.getInstance().query(HGSB002.QUERY, map1);
for (HGSB002 hgsb002 : list){
hgsb002.setTaskStatus(0);
DaoUtils.update(HGSB002.UPDATE, hgsb002);
} }
DaoUtils.update(HGSB005.DELETE_FLAG, hgsb005.toMap()); DaoUtils.update(HGSB005.DELETE_FLAG, hgsb005.toMap());
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")}); inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) { } catch (PlatException e) {
e.printStackTrace(); LogUtils.setDetailMsg(inInfo, e, "删除失败");
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
} }
return inInfo; return inInfo;
} }
...@@ -157,11 +164,7 @@ public class ServiceHGSB005 extends ServiceEPBase { ...@@ -157,11 +164,7 @@ public class ServiceHGSB005 extends ServiceEPBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")}); inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) { } catch (PlatException e) {
e.printStackTrace(); LogUtils.setDetailMsg(inInfo, e, "修改失败");
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
} }
return inInfo; return inInfo;
} }
......
...@@ -4,9 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,9 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sb.domain.HGSB002; import com.baosight.hggp.hg.sb.domain.*;
import com.baosight.hggp.hg.sb.domain.HGSB005A;
import com.baosight.hggp.hg.sb.domain.HGSB005;
import com.baosight.hggp.hg.sb.tools.HGSBTools; import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
...@@ -63,10 +61,16 @@ public class ServiceHGSB005A extends ServiceEPBase { ...@@ -63,10 +61,16 @@ public class ServiceHGSB005A extends ServiceEPBase {
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
int i = 0; int i = 0;
try { try {
HGSB005A hgsb005a = new HGSB005A(); Long parentId = Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB005A.FIELD_PARENT_ID));
HGSB005 hgsb005 = HGSBTools.Hgsb005.getId(parentId);
if (hgsb005.getCheckStatus().equals(CommonConstant.PlanStatus.UN_PLAN)){
throw new PlatException("设备保养审批完成,无法删除");
}
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) { for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
HGSB005A hgsb005a = new HGSB005A();
hgsb005a.fromMap(map); hgsb005a.fromMap(map);
hgsb005a.setDeleteFlag(CommonConstant.YesNo.YES_1); hgsb005a.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSB005A.DELETE_FLAG, hgsb005a.toMap()); DaoUtils.update(HGSB005A.DELETE_FLAG, hgsb005a.toMap());
...@@ -74,11 +78,7 @@ public class ServiceHGSB005A extends ServiceEPBase { ...@@ -74,11 +78,7 @@ public class ServiceHGSB005A extends ServiceEPBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")}); inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) { } catch (PlatException e) {
e.printStackTrace(); LogUtils.setDetailMsg(inInfo, e, "删除失败");
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
} }
return inInfo; return inInfo;
} }
...@@ -88,9 +88,9 @@ public class ServiceHGSB005A extends ServiceEPBase { ...@@ -88,9 +88,9 @@ public class ServiceHGSB005A extends ServiceEPBase {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据 // 写入数据
for (int i = 0; i < resultRows.size(); i++) { for (Map resultRow : resultRows) {
HGSB005A hgsb005a = new HGSB005A(); HGSB005A hgsb005a = new HGSB005A();
hgsb005a.fromMap(resultRows.get(i)); hgsb005a.fromMap(resultRow);
if (hgsb005a.getId() == null || hgsb005a.getId() == 0) { if (hgsb005a.getId() == null || hgsb005a.getId() == 0) {
hgsb005a.setParentId(Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB005A.FIELD_PARENT_ID))); hgsb005a.setParentId(Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB005A.FIELD_PARENT_ID)));
this.add(hgsb005a); this.add(hgsb005a);
......
...@@ -5,10 +5,7 @@ import com.baosight.hggp.core.constant.CommonConstant; ...@@ -5,10 +5,7 @@ import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sb.domain.HGSB002; import com.baosight.hggp.hg.sb.domain.*;
import com.baosight.hggp.hg.sb.domain.HGSB002A;
import com.baosight.hggp.hg.sb.domain.HGSB004;
import com.baosight.hggp.hg.sb.domain.HGSB004A;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.domain.UserGroup; import com.baosight.hggp.hg.xs.domain.UserGroup;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
...@@ -168,4 +165,26 @@ public class HGSBTools { ...@@ -168,4 +165,26 @@ public class HGSBTools {
return results; return results;
} }
} }
public static class Hgsb005 {
public static HGSB005 getId(Long id) {
AssertUtils.isNull(id, "设备保养不能为空");
Map queryMap = new HashMap();
queryMap.put(HGSB005.FIELD_ID, id);
queryMap.put(HGSB005.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HGSB005> results = DaoBase.getInstance().query(HGSB005.QUERY, queryMap);
AssertUtils.isEmpty(results, "设备保养不存在");
return results.get(0);
}
public static List<HGSB005A> getDetails(Long parentId) {
AssertUtils.isNull(parentId, "设备保养不能为空");
Map queryMap = new HashMap();
queryMap.put(HGSB005A.FIELD_PARENT_ID, parentId);
queryMap.put(HGSB005A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HGSB005A> results = DaoBase.getInstance().query(HGSB005A.QUERY, queryMap);
return results;
}
}
} }
...@@ -30,10 +30,8 @@ $(function () { ...@@ -30,10 +30,8 @@ $(function () {
let auditStatus = item["checkStatus"]; let auditStatus = item["checkStatus"];
let template = ''; let template = '';
if (item.companyCode) { if (item.companyCode) {
if (auditStatus == 1){ template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' + 'onclick="showDetail(' + item.id + ',\''+item.companyCode+'\',\''+item.companyName+'\')" >点检详情</a>';
+ 'onclick="showDetail(' + item.id + ',\''+item.companyCode+'\',\''+item.companyName+'\')" >点检详情</a>';
}
if (auditStatus == 0) { if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' + template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批完成</a>'; 'onclick="updateStatus(' + item.id + ',1)" >审批完成</a>';
......
...@@ -30,10 +30,8 @@ $(function () { ...@@ -30,10 +30,8 @@ $(function () {
let auditStatus = item["checkStatus"]; let auditStatus = item["checkStatus"];
let template = ''; let template = '';
if (item.companyCode) { if (item.companyCode) {
if (auditStatus == 1){ template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' + 'onclick="showDetail(' + item.id + ',\''+item.companyCode+'\',\''+item.companyName+'\')" >保养详情</a>';
+ 'onclick="showDetail(' + item.id + ',\''+item.companyCode+'\',\''+item.companyName+'\')" >保养详情</a>';
}
if (auditStatus == 0) { if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' + template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批完成</a>'; 'onclick="updateStatus(' + item.id + ',1)" >审批完成</a>';
......
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