Commit 8acfd9da authored by 1650842865's avatar 1650842865

采购申请审批、采购订单审批增加强制终止功能(用于sap删除了单据,bpm结束任务)

parent dc3a3377
var itemGridManager = null; var itemGridManager = null;
$(function () { $(function () {
$("#toolBar").toolBar("enable", "forceAbortTask");
initItemGrid(); initItemGrid();
bindEvent(); bindEvent();
}); });
......
var itemGridManager = null; var itemGridManager = null;
$(function () { $(function () {
$("#toolBar").toolBar("enable", "forceAbortTask");
initItemGrid(); initItemGrid();
bindEvent(); bindEvent();
}); });
......
...@@ -24,4 +24,6 @@ public interface SapPurchaseApprovalApplication { ...@@ -24,4 +24,6 @@ public interface SapPurchaseApprovalApplication {
void saveSapPurchaseApprovalVo(SapPurchaseApprovalDto sapPurchaseApprovalDto); void saveSapPurchaseApprovalVo(SapPurchaseApprovalDto sapPurchaseApprovalDto);
String revokeApproval(String id); String revokeApproval(String id);
void abortPurchaseApproval(String id,String jobPageId);
} }
...@@ -450,24 +450,28 @@ public class SapPurchaseApprovalApplicationImpl extends FlowBroker implements Sa ...@@ -450,24 +450,28 @@ public class SapPurchaseApprovalApplicationImpl extends FlowBroker implements Sa
resultMap.put("businessType", "采购审批"); resultMap.put("businessType", "采购审批");
resultMap.put("businessId", sapPurchaseApproval.getId()); resultMap.put("businessId", sapPurchaseApproval.getId());
resultMap.put("parameter", JSON.toJSONString(param)); resultMap.put("parameter", JSON.toJSONString(param));
String type = "";
String message = "";
try { try {
String result = defaultHttpClient.execute(param, url); String result = defaultHttpClient.execute(param, url);
List<Map<String, Object>> resultList = objectMapper.readValue(result, new TypeReference<List<Map<String, Object>>>() {}); List<Map<String, Object>> resultList = objectMapper.readValue(result, new TypeReference<List<Map<String, Object>>>() {});
Map<String, Object> backMap = resultList.get(0); Map<String, Object> backMap = resultList.get(0);
if (!"S".equals(backMap.get("TYPE"))) { type = (String) backMap.get("TYPE");
throw new RuntimeException("数据传输失败,请稍后手动重试!"+backMap.get("MESSAGE")); message = (String) backMap.get("MESSAGE");
if (!"S".equals(type)) {
throw new RuntimeException("数据传输失败,请稍后手动重试!"+message);
} else { } else {
resultMap.put("TYPE", backMap.get("TYPE")); resultMap.put("TYPE", type);
resultMap.put("MESSAGE", backMap.get("MESSAGE")); resultMap.put("MESSAGE", message);
} }
sapPurchaseApproval.setType((String) backMap.get("TYPE"));
sapPurchaseApproval.setMessage((String) backMap.get("MESSAGE"));
sapPurchaseApprovalRepository.save(sapPurchaseApproval);
} catch (Exception e) { } catch (Exception e) {
resultMap.put("TYPE", "E"); resultMap.put("TYPE", "E");
resultMap.put("MESSAGE", e.getMessage()); resultMap.put("MESSAGE", e.getMessage());
throw new RuntimeException("数据传输失败请检查数据后重试!"+e.getMessage()); throw new RuntimeException("数据传输失败请检查数据后重试!"+e.getMessage());
}finally { }finally {
sapPurchaseApproval.setType(type);
sapPurchaseApproval.setMessage(message);
sapPurchaseApprovalRepository.save(sapPurchaseApproval);
sapMutualEpLogApplication.saveSapMutualEpLog(resultMap); sapMutualEpLogApplication.saveSapMutualEpLog(resultMap);
} }
} }
...@@ -500,4 +504,18 @@ public class SapPurchaseApprovalApplicationImpl extends FlowBroker implements Sa ...@@ -500,4 +504,18 @@ public class SapPurchaseApprovalApplicationImpl extends FlowBroker implements Sa
return newSapPurchaseApproval.getId(); return newSapPurchaseApproval.getId();
} }
@Override
public void abortPurchaseApproval(String id,String jobPageId) {
//先标记终止状态
SapPurchaseApproval purchaseApproval = sapPurchaseApprovalRepository.findOne(id);
if ("E".equals(purchaseApproval.getType()) && purchaseApproval.getMessage().contains("不存在")){
purchaseApproval.setStatusId(BizBillStatus.ABORTED.getId());
//删除待办
actApplication.deleteRuntimeTaskExtension(jobPageId);
sapPurchaseApprovalRepository.save(purchaseApproval);
}else {
throw new RuntimeException("正常流程不能强制终止");
}
}
} }
...@@ -101,4 +101,17 @@ public class SapPurchaseApprovalController extends CommonController { ...@@ -101,4 +101,17 @@ public class SapPurchaseApprovalController extends CommonController {
String newId=sapPurchaseApprovalApplication.revokeApproval(id); String newId=sapPurchaseApprovalApplication.revokeApproval(id);
return success(); return success();
} }
/**
* 强制删除待办
* @return
*/
public String forceAbortPurchaseApproval(){
SDO sdo = this.getSDO();
String id = sdo.getId();
//任务ID
String jobPageId = sdo.getString("jobPageId");
sapPurchaseApprovalApplication.abortPurchaseApproval(id, jobPageId);
return success();
}
} }
...@@ -32,4 +32,6 @@ public interface SapPurchaseOrderApplication { ...@@ -32,4 +32,6 @@ public interface SapPurchaseOrderApplication {
Map<String, Object> print(String id); Map<String, Object> print(String id);
void updateProcessOutStatus(List<String> ids); void updateProcessOutStatus(List<String> ids);
void abortPurchaseOrder(String id, String jobPageId);
} }
...@@ -27,6 +27,7 @@ import com.huigou.topsun.sap.processOutsource.repository.ProcessOutsourceOrderIt ...@@ -27,6 +27,7 @@ import com.huigou.topsun.sap.processOutsource.repository.ProcessOutsourceOrderIt
import com.huigou.topsun.sap.processQuotedPrice.application.ProcessQuotedPriceItemApplication; import com.huigou.topsun.sap.processQuotedPrice.application.ProcessQuotedPriceItemApplication;
import com.huigou.topsun.sap.processQuotedPrice.domain.ProcessQuotedPriceItemNumber; import com.huigou.topsun.sap.processQuotedPrice.domain.ProcessQuotedPriceItemNumber;
import com.huigou.topsun.sap.purchaseApproval.application.impl.SapPurchaseApprovalApplicationImpl; import com.huigou.topsun.sap.purchaseApproval.application.impl.SapPurchaseApprovalApplicationImpl;
import com.huigou.topsun.sap.purchaseApproval.domain.SapPurchaseApproval;
import com.huigou.topsun.sap.purchaseOrder.application.SapPurchaseOrderApplication; import com.huigou.topsun.sap.purchaseOrder.application.SapPurchaseOrderApplication;
import com.huigou.topsun.sap.purchaseOrder.application.SapPurchaseOrderItemApplication; import com.huigou.topsun.sap.purchaseOrder.application.SapPurchaseOrderItemApplication;
import com.huigou.topsun.sap.purchaseOrder.domain.SapPurchaseOrder; import com.huigou.topsun.sap.purchaseOrder.domain.SapPurchaseOrder;
...@@ -388,28 +389,24 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu ...@@ -388,28 +389,24 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
String url = "pass_approval/approval"; String url = "pass_approval/approval";
String type = "";
String message = "";
try { try {
String result = defaultHttpClient.execute(param, url); String result = defaultHttpClient.execute(param, url);
List<Map<String, Object>> resultList = objectMapper.readValue(result, new TypeReference<List<Map<String, Object>>>() { List<Map<String, Object>> resultList = objectMapper.readValue(result, new TypeReference<List<Map<String, Object>>>() {
}); });
Map<String, Object> resultMap = resultList.get(0); Map<String, Object> resultMap = resultList.get(0);
if ("S".equals(resultMap.get("TYPE"))) { type = (String) resultMap.get("TYPE");
sapPurchaseOrder.setMsgId((String) resultMap.get("ID")); message = (String) resultMap.get("MESSAGE");
sapPurchaseOrder.setNumber((String) resultMap.get("NUMBER")); if (!"S".equals(type)) {
sapPurchaseOrder.setMsgType((String) resultMap.get("TYPE"));
sapPurchaseOrder.setLogNo((String) resultMap.get("LOG_NO"));
sapPurchaseOrder.setLogMsgNo((String) resultMap.get("LOG_MSG_NO"));
sapPurchaseOrder.setMessage((String) resultMap.get("MESSAGE"));
sapPurchaseOrder.setMessageV1((String) resultMap.get("MESSAGE_V1"));
sapPurchaseOrder.setMessageV2((String) resultMap.get("MESSAGE_V1"));
sapPurchaseOrder.setMessageV3((String) resultMap.get("MESSAGE_V1"));
sapPurchaseOrder.setMessageV4((String) resultMap.get("MESSAGE_V1"));
this.sapPurchaseOrderRepository.save(sapPurchaseOrder);
} else {
throw new RuntimeException("数据传输失败,请稍后手动重试!" + resultMap.get("MESSAGE")); throw new RuntimeException("数据传输失败,请稍后手动重试!" + resultMap.get("MESSAGE"));
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("数据传输失败请检查数据后重试!" + e.getMessage()); throw new RuntimeException("数据传输失败请检查数据后重试!" + e.getMessage());
}finally {
sapPurchaseOrder.setMsgType(type);
sapPurchaseOrder.setMessage(message);
this.sapPurchaseOrderRepository.save(sapPurchaseOrder);
} }
} }
...@@ -476,6 +473,20 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu ...@@ -476,6 +473,20 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu
sapPurchaseOrderRepository.save(orderList); sapPurchaseOrderRepository.save(orderList);
} }
@Override
public void abortPurchaseOrder(String id, String jobPageId) {
//先标记终止状态
SapPurchaseOrder purchaseOrder = sapPurchaseOrderRepository.findOne(id);
if ("E".equals(purchaseOrder.getMsgType())){
purchaseOrder.setStatusId(BizBillStatus.ABORTED.getId());
//删除待办
actApplication.deleteRuntimeTaskExtension(jobPageId);
sapPurchaseOrderRepository.save(purchaseOrder);
}else {
throw new RuntimeException("正常流程不能强制终止");
}
}
public Map<String, Object> getSupplierInfo(Map<String, Object> map, String lifnr){ public Map<String, Object> getSupplierInfo(Map<String, Object> map, String lifnr){
List<SuppliersInfo> suppliersInfoList = new ArrayList<>(); List<SuppliersInfo> suppliersInfoList = new ArrayList<>();
suppliersInfoList = suppliersInfoRepository.findByPartner(lifnr); suppliersInfoList = suppliersInfoRepository.findByPartner(lifnr);
......
...@@ -119,4 +119,17 @@ public class SapPurchaseOrderController extends CommonController { ...@@ -119,4 +119,17 @@ public class SapPurchaseOrderController extends CommonController {
sapPurchaseOrderApplication.updateProcessOutStatus(ids); sapPurchaseOrderApplication.updateProcessOutStatus(ids);
return success(); return success();
} }
/**
* 强制删除待办
* @return
*/
public String forceAbortTask(){
SDO sdo = this.getSDO();
String id = sdo.getId();
//任务ID
String jobPageId = sdo.getString("jobPageId");
sapPurchaseOrderApplication.abortPurchaseOrder(id, jobPageId);
return success();
}
} }
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