Commit 2fb75f01 authored by 刘学辉's avatar 刘学辉

品质异常单(采购)调整

parent 870cb26f
......@@ -28,6 +28,8 @@
<x:hidden name="personMemberName"/>
<x:hidden name="statusId"/>
<x:hidden name="frgdt"/>
<x:hidden name="handleNodeId"/>
<x:hidden name="handleNodeName"/>
<div class="hg-form-cols">
<c:if test="${statusId==3}">
<div style="float: right; margin-right: 10px;" class="btn-group" id="buttonBox">
......
......@@ -43,6 +43,8 @@ import com.huigou.uasp.bpm.FlowBroker;
import com.huigou.uasp.bpm.ProcessAction;
import com.huigou.uasp.bpm.ProcessStartModel;
import com.huigou.uasp.bpm.engine.application.WorkflowApplication;
import com.huigou.uasp.bpm.engine.domain.model.ProcUnitHandler;
import com.huigou.uasp.bpm.engine.domain.model.TaskExtension;
import com.huigou.util.*;
import freemarker.template.Template;
import org.activiti.engine.delegate.DelegateExecution;
......@@ -101,11 +103,8 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
@Autowired
private MannualStartWorkApplication mannualStartWorkApplication;
@Autowired
private CodeGenerator codeGenerator;
@Autowired
private WorkflowApplication workflowApplication;
@Autowired
private SapPermitApplication sapPermitApplication;
@Autowired
private TaskExecutor asyncWriteExecutor;
......@@ -160,6 +159,24 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
if (StringUtils.isBlank(exceptionReport.getDutyDept())){
exceptionReport.setDutyDept("0");
}
if (exceptionReport.getStatusId()==1&&("purchase".equals(exceptionReport.getBillType())||"outgoing".equals(exceptionReport.getBillType()))
//&&!"auditDept".equals(exceptionReport.getHandleNodeId()) //不是审计部审批的
&&StringUtils.isBlank(exceptionReport.getDutyDept()) //责任部门是空 最后的审批人就是责任人
){
// String ds=exceptionReport.getHandleNodeId();
Map<String, Object> mapSigns=workflowApplication.queryCounterSignHandlers(exceptionReport.getId(),"Approve");
List <Map<String,Object>>plist=(List)mapSigns.get("Rows");
if (Integer.parseInt(mapSigns.get("Total").toString())>0) {
Map map = plist.get(Integer.parseInt(mapSigns.get("Total").toString()) - 1);
exceptionReport.setCheckOperator(map.get("handlerId").toString());
exceptionReport.setCheckOperatorName(map.get("handlerName").toString());
exceptionReport.setDutyDeptName(map.get("deptName").toString());
Org org = orgApplication.loadOrg(map.get("handlerId").toString());
exceptionReport.setDutyDept(org.getDeptId());
}
}
exceptionReport = this.saveExceptionReport(exceptionReport);
if (CollectionUtil.isNotEmpty(exceptionReportItems)){
......@@ -172,7 +189,7 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
List<ExceptionReportPayable> exceptionReportPayableList = this.getBizEntities(ExceptionReportPayable.class, "handlePayable");
List<ExceptionReportCash> exceptionReportCashList = this.getBizEntities(ExceptionReportCash.class, "handleCash");
List<ExceptionReportGoods> exceptionReportGoodsList = this.getBizEntities(ExceptionReportGoods.class, "handleGoods");
if ("supplier".equals(exceptionReport.getBillType())){
if ("supplier".equals(exceptionReport.getBillType())){ //供应商 默认类型
exceptionReport.setExceptionType("out");
}
......@@ -200,7 +217,6 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
if (CollectionUtil.isNotEmpty(exceptionReportGoodsList)) {
exceptionReportGoodsApplication.saveExceptionReportGoodsList(exceptionReport.getId(),exceptionReportGoodsList);
}
return exceptionReport.getId();
}
......@@ -211,7 +227,22 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
protected Map<String, Object> getProcessBizParams(String bizId) {
return ClassHelper.toMap(exceptionReportRepository.findOne(bizId));
}
@Override
public void onCreate(DelegateTask delegateTask) {
super.onCreate(delegateTask);
if (!isApplyProcUnit(delegateTask)) {
TaskExtension te = actApplication.loadRuntimeTaskExtension(delegateTask.getId());
Assert.notNull(te, String.format("未查询到流程任务【%s】的扩展信息", delegateTask.getId()));
// 获取流程任务对应的审批环节信息
ProcUnitHandler procUnitHandler = procUnitHandlerApplication.loadProcUnitHandler(te.getProcUnitHandlerId());
// 审批环节名称
String id = delegateTask.getExecution().getProcessBusinessKey();
ExceptionReport exceptionReport = this.exceptionReportRepository.findOne(id);
exceptionReport.setHandleNodeName(procUnitHandler.getSubProcUnitName());
exceptionReport.setHandleNodeId(procUnitHandler.getSubProcUnitId());
exceptionReportRepository.save(exceptionReport);
}
}
/**
* 删除流程实例事件
*/
......@@ -296,13 +327,9 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
resultMap.put("TYPE", sapResult.getTYPE());
resultMap.put("MESSAGE", sapResult.getMESSAGE());
}
// orderItems.stream().forEach(orderItem->{
//根据供应商来匹配赋值采购订单号
// if (lifnrSet.equals(orderItem.getLifnr())){
exceptionReport.setDealResult(sapResult.getMESSAGE_V1());
// processOutsourceOrderItemRepository.save(orderItem);
// }
// });
} catch (IOException e) {
resultMap.put("TYPE", "E");
resultMap.put("MESSAGE", e.getMessage());
......@@ -312,7 +339,7 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
}
}
}
// this.saveExceptionReport(exceptionReport);
this.saveExceptionReport(exceptionReport);
//采购异常单根据责任部门是采购部门则生成供应商异常单
if ("purchase".equals(exceptionReport.getBillType())
//&&StringUtil.isNotBlank(exceptionReport.getDutyDept())
......
......@@ -187,6 +187,12 @@ public class ExceptionReport extends FlowBillAbstractEntity {
@Column(name = "need_guarantee")
private String needGuarantee;
@Column(name = "handle_node_name")
private String handleNodeName;
@Column(name = "handle_node_id")
private String handleNodeId;
@Override
protected String getCodeRuleId() {
return "exceptionReport";
......
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