Commit 09d2cc53 by liuyang

1、调整设备管理审批功能

parent 6bc3b7b9
......@@ -135,15 +135,19 @@ public class ServiceHPSB004 extends ServiceEPBase {
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);
List<Map> list = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<String> ids = list.stream().map(map -> map.get(HPSB004.FIELD_ID)).map(Object::toString).distinct().collect(Collectors.toList());
AssertUtils.isEmpty(ids, "设备计划ID不能为空,无法审批完成!");
Map<String,Object> qarma = new HashMap<>();
qarma.put("parentIds",ids);
List<HPSB004A> hpsb004AList = HPSBTools.Hpsb004.getDetails(qarma);
for (Map map:list) {
HPSB004 hgsb004 = new HPSB004();
hgsb004.fromMap(map);
long count = hpsb004AList.stream().filter(hpsb004A -> hpsb004A.getParentId().equals(hgsb004.getId())).count();
AssertUtils.isTrue(count == 0, "设备计划详情不能为空,无法审批完成!");
hgsb004.setPlanStatus(CommonConstant.PlanStatus.UN_PLAN);
DaoUtils.update(HPSB004.UPDATE_STATUS, hgsb004);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
......
......@@ -6,10 +6,7 @@ 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.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -137,6 +134,8 @@ public class ServiceHPSB005 extends ServiceEPBase {
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb003.fromMap(map);
AssertUtils.isTrue(hgsb003.getStatus()==CommonConstant.PlanStatus.UN_PLAN,"维保申请审批完成,无法修改状态");
hgsb003.setStatus(CommonConstant.PlanStatus.UN_PLAN);
DaoUtils.update(HPSB005.UPDATE_STATUS, hgsb003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
......@@ -8,6 +8,7 @@ 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.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
......@@ -141,12 +142,14 @@ public class ServiceHPSB006 extends ServiceEPBase {
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);
HPSB006 hgsb006 = new HPSB006();
hgsb006.fromMap(map);
AssertUtils.isTrue(hgsb006.getCheckStatus()==CommonConstant.PlanStatus.UN_PLAN, "设备点检已审批完成,无法修改!");
hgsb006.setCheckStatus(CommonConstant.PlanStatus.UN_PLAN);
DaoUtils.update(HPSB006.UPDATE_STATUS, hgsb006);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
......
......@@ -8,10 +8,7 @@ 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.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -143,11 +140,14 @@ public class ServiceHPSB007 extends ServiceEPBase {
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 hpsb007 = new HPSB007();
hpsb007.fromMap(map);
AssertUtils.isTrue(hpsb007.getCheckStatus()==CommonConstant.PlanStatus.UN_PLAN, "设备保养已审批完成,无法修改!");
hpsb007.setCheckStatus(CommonConstant.PlanStatus.UN_PLAN);
DaoUtils.update(HPSB007.UPDATE_STATUS, hpsb007);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
......@@ -44,15 +44,6 @@ $(function () {
if (item.factoryCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.factoryCode+'\')" >计划详情</a>';
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批</a>';
/*template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',-1)" >审批未通过</a>';*/
} else if (auditStatus == -1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批完成</a>';
}
}
return template;
}
......@@ -172,6 +163,7 @@ $(function () {
//loadChange(grid,e,"userId");
}
});*/
$("#SUBMIT").on("click", submitFunc);
},
afterEdit:function (e) {
/*if (e.field === "groupCode" && e.model["companyCode"].length === 0){
......@@ -339,31 +331,35 @@ let save = function (btnNode) {
}
}
function updateStatus(id,deviceStatus) {
JSUtils.confirm("确定是否\"审批完成\"操作? ", {
ok: function () {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-planStatus", deviceStatus);
EiCommunicator.send('HPSB004', 'updateStatus', inEiInfo, {
onSuccess(response) {
if (response.status == 1){
NotificationUtil(response.msg);
function submitFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("planStatus");
if(isBlank(status) || status == 1){
message("选中的第"+(index+1)+"行\"已审批\",不能重复审批!");
flag = false;
return false;
}
});
if (flag){
JSUtils.confirm("确定是否\"审批完成\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSB004", "updateStatus", true,
function (ei) {
if (ei.getStatus() != -1){
query();
}else {
NotificationUtil(response.msg, "error");
NotificationUtil(ei.getMsg(), "error");
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
)
}
});
});
}
});
}
}
/**
......
......@@ -32,18 +32,6 @@ $(function () {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="uploadFile(' + item.id + ',\''+item.status+'\')" >附件详情</a>';
}
if (item.id) {
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批</a>';
/*template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',-1)" >审批未通过</a>';*/
}
if (auditStatus == -1){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批完成</a>';
}
}
return template;
}
},{
......@@ -145,6 +133,7 @@ $(function () {
//loadChange(grid,e,"userId");
}
});*/
$("#SUBMIT").on("click", submitFunc);
},
afterEdit:function (e) {
/*if (e.field === "groupCode" && e.model["companyCode"].length === 0){
......@@ -260,30 +249,35 @@ let save = function (btnNode) {
}
}
function updateStatus(id,deviceStatus) {
JSUtils.confirm("确定是否\"审批完成\"操作? ", {
ok: function () {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-status", deviceStatus);
EiCommunicator.send('HPSB005', 'updateStatus', 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
}
);
function submitFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("status");
if(isBlank(status) || status == 1){
message("选中的第"+(index+1)+"行\"已审批\",不能重复审批!");
flag = false;
return false;
}
});
if (flag){
JSUtils.confirm("确定是否\"审批完成\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSB005", "updateStatus", true,
function (ei) {
if (ei.getStatus() != -1){
query();
}else {
NotificationUtil(ei.getMsg(), "error");
}
});
}
});
}
}
/**
......
......@@ -32,16 +32,6 @@ $(function () {
if (item.companyCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.factoryCode+'\',\''+item.checkStatus+'\')" >点检详情</a>';
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批</a>';
/*template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',-1)" >审批未通过</a>';*/
}
if (auditStatus == -1){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批</a>';
}
}
return template;
}
......@@ -136,6 +126,7 @@ $(function () {
//loadChange(grid,e,"userId");
}
});
$("#SUBMIT").on("click", submitFunc);
},
afterEdit:function (e) {
/*if (e.field === "groupCode" && e.model["companyCode"].length === 0){
......@@ -273,29 +264,38 @@ let save = function (btnNode) {
}
}
function updateStatus(id,deviceStatus) {
JSUtils.confirm("确定是否\"审批完成\"操作? ", {
ok: function () {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-checkStatus", deviceStatus);
EiCommunicator.send('HPSB006', 'updateStatus', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
function submitFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("checkStatus");
if(isBlank(status) || status == 1){
message("选中的第"+(index+1)+"行\"已审批\",不能重复审批!");
flag = false;
return false;
}
})
});
if (flag){
JSUtils.confirm("确定是否\"审批完成\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSB006", "updateStatus", true,
function (ei) {
if (ei.getStatus() != -1){
query();
}else {
NotificationUtil(ei.getMsg(), "error");
}
});
}
});
}
}
/**
* 显示详情
*/
......
......@@ -32,16 +32,6 @@ $(function () {
if (item.companyCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.factoryCode+'\',\''+item.checkStatus+'\')" >保养详情</a>';
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批</a>';
/*template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',-1)" >审批未通过</a>';*/
}
if (auditStatus == -1){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批</a>';
}
}
return template;
}
......@@ -127,6 +117,7 @@ $(function () {
//loadChange(grid,e,"userId");
}
});
$("#SUBMIT").on("click", submitFunc);
},
afterEdit:function (e) {
/*if (e.field === "groupCode" && e.model["companyCode"].length === 0){
......@@ -264,27 +255,35 @@ let save = function (btnNode) {
}
}
function updateStatus(id,deviceStatus) {
JSUtils.confirm("确定是否\"审批完成\"操作? ", {
ok: function () {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-checkStatus", deviceStatus);
EiCommunicator.send('HPSB007', 'updateStatus', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
function submitFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("checkStatus");
if(isBlank(status) || status == 1){
message("选中的第"+(index+1)+"行\"已审批\",不能重复审批!");
flag = false;
return false;
}
})
});
if (flag){
JSUtils.confirm("确定是否\"审批完成\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSB007", "updateStatus", true,
function (ei) {
if (ei.getStatus() != -1){
query();
}else {
NotificationUtil(ei.getMsg(), "error");
}
});
}
});
}
}
/**
......
......@@ -118,11 +118,11 @@ let save = function (btnNode) {
flag = false;
return false;
}
if(isChinese(fileName)){
/*if(isChinese(fileName)){
message("选中的第"+(index+1)+"行\"目录名称\",不能包含特殊字符!");
flag = false;
return false;
}
}*/
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
......
......@@ -87,11 +87,17 @@ let save = function (btnNode) {
let flag = true;
$.each(rows, function(index, item) {
let projCode= item.get("projName");
let fileName= item.get("fileName");
if(isBlank(projCode)){
message("选中的第"+(index+1)+"行\"所属项目\",不能为空!");
flag = false;
return false;
}
if(isBlank(fileName)){
message("选中的第"+(index+1)+"行\"目录名称\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
......
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