流程发布-保存前校验修改

This commit is contained in:
lihongyu 2022-09-27 23:08:34 +08:00
parent 79f24052db
commit bf66607edb
3 changed files with 94 additions and 69 deletions

View File

@ -183,7 +183,7 @@ public class ProcesNumberUtil {
String updateSql = "update BO_ACT_COE_PUBLISH_C set CHANGE_NUMBER = '%s' where ID = '%s'"; String updateSql = "update BO_ACT_COE_PUBLISH_C set CHANGE_NUMBER = '%s' where ID = '%s'";
rowMap = DBSql.getMap("SELECT PLVER,PLMETHODID FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID='" rowMap = DBSql.getMap("SELECT PLVER,PLMETHODID FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID='"
+ changAfterFileId + "' AND" + " ISUSE = 1 "); + changAfterFileId + "' AND" + " ISUSE = 1 ");
String name = "18R18"; String name = "";
String fileName = "file_number"; String fileName = "file_number";
String plver = "2.0"; String plver = "2.0";
if (rowMap != null) { if (rowMap != null) {

View File

@ -3407,78 +3407,100 @@ public class ProcessPublishWeb extends ActionWeb {
return ro.toString(); return ro.toString();
} }
/** /**
* 校验发布相关数据是否在其它未办理完成的表单中存在 * 校验发布相关数据是否在其它未办理完成的表单中存在 只要有相同versionId的流程存在未办理情况即校验不通过
* 只要有相同versionId的流程存在未办理情况即校验不通过 */
*/ private void validPublisData(HashSet<String> set, String processInstId, String wsId, JSONArray array) {
private void validPublisData(HashSet<String> set, String processInstId, String wsId, JSONArray array) { if (set.isEmpty())
if (set.isEmpty()) return; return;
Set<String> filter = new HashSet<>(); Set<String> filter = new HashSet<>();
List<BO> list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").addQuery("ISEND =", 0).list(); List<BO> list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").addQuery("ISEND =", 0).list();
if (list != null && list.size() > 0) if (list != null && list.size() > 0)
for (BO bo : list) { for (BO bo : list) {
if (bo.getBindId().equals(processInstId)) ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(bo.getBindId());
System.err.println("--------instanceById-------"+instanceById);
if (instanceById != null) {
if ("terminate".equals(instanceById.getControlState())) {
continue;
}
TaskInstance instance = SDK.getTaskAPI().getInstanceById(instanceById.getStartTaskInstId());
if (instance != null) {
String controlState = instance.getControlState();
if (!"complete".equals(controlState))
continue;
}
}else {
continue; continue;
// 获取三个子表 }
{// 发布表
BO newBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").detailByBindId(bo.getBindId()); if (bo.getBindId().equals(processInstId))
if (newBo != null) { continue;
PALRepositoryModel temp1 = PALRepositoryCache.getCache().get(newBo.getString("PUBLISHFILEID"));
if (temp1 != null) { // 获取三个子表
List<PALRepositoryModel> list1 = PALRepositoryCache.getByVersionId(wsId, temp1.getVersionId()); {// 发布表
for (PALRepositoryModel model : list1) BO newBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").detailByBindId(bo.getBindId());
if (newBo != null) {
PALRepositoryModel temp1 = PALRepositoryCache.getCache().get(newBo.getString("PUBLISHFILEID"));
if (temp1 != null) {
List<PALRepositoryModel> list1 = PALRepositoryCache.getByVersionId(wsId,
temp1.getVersionId());
for (PALRepositoryModel model : list1)
if (set.contains(model.getId()) && !filter.contains(model.getId())) { if (set.contains(model.getId()) && !filter.contains(model.getId())) {
// 存在未办理完成的表单 // 存在未办理完成的表单
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("type", "new"); obj.put("type", "new");
obj.put("id", model.getId()); obj.put("id", model.getId());
obj.put("name", model.getName()); obj.put("name", model.getName());
obj.put("version", VersionUtil.getVersionStr(model.getVersion())); obj.put("version", VersionUtil.getVersionStr(model.getVersion()));
array.add(obj); array.add(obj);
} }
} }
} }
} }
{// 变更表 {// 变更表
BO changeBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").detailByBindId(bo.getBindId()); BO changeBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").detailByBindId(bo.getBindId());
if (changeBo != null) { if (changeBo != null) {
PALRepositoryModel temp2 = PALRepositoryCache.getCache().get(changeBo.getString("CHANGEFILEID")); PALRepositoryModel temp2 = PALRepositoryCache.getCache()
if (temp2 != null) { .get(changeBo.getString("CHANGEFILEID"));
List<PALRepositoryModel> list1 = PALRepositoryCache.getByVersionId(wsId, temp2.getVersionId()); if (temp2 != null) {
for (PALRepositoryModel model : list1) List<PALRepositoryModel> list1 = PALRepositoryCache.getByVersionId(wsId,
temp2.getVersionId());
for (PALRepositoryModel model : list1)
if (set.contains(model.getId()) && !filter.contains(model.getId())) { if (set.contains(model.getId()) && !filter.contains(model.getId())) {
// 存在未办理完成的表单 // 存在未办理完成的表单
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("type", "change"); obj.put("type", "change");
obj.put("id", model.getId()); obj.put("id", model.getId());
obj.put("name", model.getName()); obj.put("name", model.getName());
obj.put("version", VersionUtil.getVersionStr(model.getVersion())); obj.put("version", VersionUtil.getVersionStr(model.getVersion()));
array.add(obj); array.add(obj);
} }
} }
} }
} }
{// 停用表 {// 停用表
BO stopBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").detailByBindId(bo.getBindId()); BO stopBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").detailByBindId(bo.getBindId());
if (stopBo != null) { if (stopBo != null) {
PALRepositoryModel temp3 = PALRepositoryCache.getCache().get(stopBo.getString("STOPFILEID")); PALRepositoryModel temp3 = PALRepositoryCache.getCache().get(stopBo.getString("STOPFILEID"));
if (temp3 != null) { if (temp3 != null) {
List<PALRepositoryModel> list1 = PALRepositoryCache.getByVersionId(wsId, temp3.getVersionId()); List<PALRepositoryModel> list1 = PALRepositoryCache.getByVersionId(wsId,
for (PALRepositoryModel model : list1) temp3.getVersionId());
for (PALRepositoryModel model : list1)
if (set.contains(model.getId()) && !filter.contains(model.getId())) { if (set.contains(model.getId()) && !filter.contains(model.getId())) {
// 存在未办理完成的表单 // 存在未办理完成的表单
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("type", "stop"); obj.put("type", "stop");
obj.put("id", model.getId()); obj.put("id", model.getId());
obj.put("name", model.getName()); obj.put("name", model.getName());
obj.put("version", VersionUtil.getVersionStr(model.getVersion())); obj.put("version", VersionUtil.getVersionStr(model.getVersion()));
array.add(obj); array.add(obj);
} }
} }
} }
} }
} }
} }
/** /**
* 表单保存/办理前执行批量 * 表单保存/办理前执行批量

View File

@ -2010,6 +2010,8 @@ function dealPublishCheck(isCheck, type) {
// 单独保存子表操作 // 单独保存子表操作
function saveFormData(type) { function saveFormData(type) {
alert(1111111)
debugger
$.simpleAlert('正在保存', 'loading'); $.simpleAlert('正在保存', 'loading');
var saveData = []; var saveData = [];
if (type == 'new') { if (type == 'new') {
@ -2040,7 +2042,7 @@ function saveFormData(type) {
data : param, data : param,
success : function(r) { success : function(r) {
if (r.result == 'error') { if (r.result == 'error') {
flag = false; flag = true;
tempData = r.data.data; tempData = r.data.data;
} }
}, },
@ -2049,6 +2051,7 @@ function saveFormData(type) {
} }
}); });
$.simpleAlert('close'); $.simpleAlert('close');
debugger
if (flag) { if (flag) {
var msg = '以下文件已经在其他未办理完成的表单中,不允许保存/办理'; var msg = '以下文件已经在其他未办理完成的表单中,不允许保存/办理';
if (tempData.length > 0) { if (tempData.length > 0) {