Commit d099bde0 authored by 赵汉亭's avatar 赵汉亭

成本中心流程添加完成

parent 0c590a68
$(document).ready(function () {
initializateUI();
// loadProcessListGrid();
// bindQueryEvent();
bindEvent();
});
function initializateUI() {
UICtrl.layout("#layout", {leftWidth: 3});
}
function bindQueryEvent() {
$('#productName').searchbox({
type: "product", name: "productCode",
onChange: function (value, data) {
$('#id').val(data.productId);
$('#productName').val(data.productName);
}
});
}
function bindEvent() {
$("#save").click(function () {
saveData("save");
})
$("#submit").click(function () {
saveData("submit");
})
$("#close").click(function () {//关闭
closeDispatchTabItem();
})
}
function getCostCenterDetail(CostCenterAction) {
//采购订单保存时数据不进行必填验证,提交时数据才进行必填验证
var op = {};
......
......@@ -13,14 +13,24 @@
<x:script src='/biz/topsun/sap/costCenter/sapCostCenterDetail.js'/>
</head>
<body>
<%--<div class="container-fluid">--%>
<div class="container-fluid">
<x:billTitle title="成本中心" needStatus="false" needPerson="true"/>
<div class="blank_div clearfix"></div>
<button class="btn btn-default" type="button" id="close" style="left: 200px;float:right;bottom: 10px;">关闭</button>
<button class="btn btn-warning" type="button" id="submit" style="left: 200px;float:right;bottom: 10px;">提交</button>
<button class="btn btn-success" type="button" id="save" style="left: 200px;float:right;bottom: 10px;">保存</button>
<form class="hg-form" method="post" action="" id="submitForm">
<x:hidden name="id"/>
<x:hidden name="version"/>
<x:hidden name="billCode"/>
<x:hidden name="fillinDate" type="datetime"/>
<x:hidden name="fullId"/>
<x:hidden name="organId"/>
<x:hidden name="organName"/>
<x:hidden name="deptId"/>
<x:hidden name="deptName"/>
<x:hidden name="positionId"/>
<x:hidden name="positionName"/>
<x:hidden name="personMemberId"/>
<x:hidden name="personMemberName"/>
<x:hidden name="statusId"/>
<div class="hg-form-row">
<x:inputC name="KOSTL" required="true" label="成本中心编码" labelCol="2" maxLength="64" fieldCol="4"/>
<x:inputC name="KTEXT" required="true" label="名称" labelCol="2" maxLength="64" fieldCol="4"/>
......@@ -30,9 +40,11 @@
<x:inputC name="DATBI" required="true" label="有限截止日" labelCol="2" wrapper="date" fieldCol="4" value="9999-12-31"/>
<x:inputC name="VERAK" required="true" label="负责人" labelCol="2" maxLength="64" fieldCol="4"/>
<x:selectC name="PRCTR" required="true" label="利润中心" labelCol="2" dictionary="PRCTR" fieldCol="4"/>
<x:selectC name="formType" required="true" label="业务类型" labelCol="2" dictionary="formType" fieldCol="4"/>
<x:inputC name="reason" required="true" label="原因" labelCol="2" maxLength="255" fieldCol="4"/>
</div>
<div class="blank_div clearfix"></div>
</form>
<%--</div>--%>
</div>
</body>
</html>
......@@ -30,6 +30,11 @@ function loadCostCenterListGrid() {
{display: "有限截止日", name: "datbi", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "负责人", name: "verak", width: 100, minWidth: 60, type: "string", align: "left"},
{display: "利润中心", name: "prctrTextView", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "申请人", name: "personMemberName", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "申请部门", name: "deptName", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "联系方式", name: "telePhone", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "申请日期", name: "fillinDate", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "原因", name: "reason", width: 140, minWidth: 60, type: "string", align: "left"},
],
dataAction: "server",
......@@ -68,7 +73,7 @@ function addHandler() {
UICtrl.addTabItem({
tabid: 'sapCostCenterDetail',
text: "新增成本中心",
url: web_app.name + '/sapCostCenter/addCostCenterDetail.do'
url: web_app.name + '/sapCostCenter/addCostCenterDetail.job'
})
}
......
......@@ -16,6 +16,9 @@ public interface CostCenterApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/sap/costCenter/costCenter.xml";
String PROCESS_DEFINITION_KEY = "costCenterProc";
Map<String,Object> getCostCenterList(CostCenterQueryRequest costCenterQueryRequest);
CostCenterVo findCostCenterById(String id);
......
......@@ -8,7 +8,11 @@ import com.huigou.topsun.sap.costCenter.domain.CostCenter;
import com.huigou.topsun.sap.costCenter.domain.query.CostCenterQueryRequest;
import com.huigou.topsun.sap.costCenter.domain.vo.CostCenterVo;
import com.huigou.topsun.sap.costCenter.repository.CostCenterRepository;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.bpm.FlowBroker;
import com.huigou.util.ClassHelper;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -20,8 +24,8 @@ import java.util.Map;
* @Date: 2023/12/13/11:09
* @Description:
*/
@Service
public class CostCenterApplicationImpl extends BaseApplication implements CostCenterApplication {
@Service("costCenterApplication")
public class CostCenterApplicationImpl extends FlowBroker implements CostCenterApplication {
@Autowired
private CostCenterRepository costCenterRepository;
......@@ -64,4 +68,53 @@ public class CostCenterApplicationImpl extends BaseApplication implements CostCe
return CostCenterVo.getCostCenterVo(costCenterRepository.saveAndFlush(costCenter));
}
@Override
protected void onEnd(DelegateExecution delegateExecution) {
super.onEnd(delegateExecution);
String bizId = delegateExecution.getProcessBusinessKey();
BizBillStatus status = approvePassed() ? BizBillStatus.COMPLETED : BizBillStatus.ABORTED;
CostCenter costCenter = costCenterRepository.findOne(bizId);
costCenter.setStatusId(status.getId());
costCenterRepository.save(costCenter);
}
@Override
protected void onAbortProcessInstance(DelegateExecution delegateExecution) {
super.onAbortProcessInstance(delegateExecution);
String bizId = delegateExecution.getProcessBusinessKey();
CostCenter costCenter = costCenterRepository.findOne(bizId);
costCenter.setStatusId(BizBillStatus.ABORTED.getId());
costCenterRepository.save(costCenter);
}
@Override
protected void onBack(DelegateTask delegateTask, String destActivityId) {
super.onBack(delegateTask, destActivityId);
if ("Apply".equalsIgnoreCase(destActivityId)) {
String bizId = delegateTask.getExecution().getProcessBusinessKey();
CostCenter costCenter = costCenterRepository.findOne(bizId);
costCenter.setStatusId(BizBillStatus.APPLYING.getId());
costCenterRepository.save(costCenter);
}
}
@Override
protected Map<String, Object> getProcessBizParams(String bizId) {
return ClassHelper.toMap(costCenterRepository.getOne(bizId));
}
@Override
protected String saveBizAndApprovalData() {
super.saveBizAndApprovalData();
CostCenter costCenter = getBizEntity(CostCenter.class);
if (costCenter.isNew()) {
costCenter.setStatusId(BizBillStatus.APPLYING.getId());
} else {
costCenter = (CostCenter) commonDomainService.loadAndFillinProperties(costCenter);
}
costCenter = costCenterRepository.save(costCenter);
return costCenter.getId();
}
}
package com.huigou.topsun.sap.costCenter.controller;
import com.huigou.context.Operator;
import com.huigou.context.OrgUnit;
import com.huigou.topsun.sap.costCenter.application.CostCenterApplication;
import com.huigou.topsun.sap.costCenter.domain.CostCenter;
import com.huigou.topsun.sap.costCenter.domain.query.CostCenterQueryRequest;
import com.huigou.topsun.sap.costCenter.domain.vo.CostCenterVo;
import com.huigou.topsun.sap.fixedAssets.domain.SapFixedAssets;
import com.huigou.topsun.sap.fixedAssets.domain.vo.SapFixedAssetsVo;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -50,7 +55,28 @@ public class CostCenterController extends CommonController {
* 跳转到新增页面
*/
public String addCostCenterDetail() {
return forward("sapCostCenterDetail");
this.putAttribute("processDefinitionKey", costCenterApplication.PROCESS_DEFINITION_KEY);
// 新增的时候procUnitId一定要设置成Apply,不然jsp页面的所有表单元素是readonly状态
this.putAttribute("procUnitId", "Apply");
CostCenter costCenter = new CostCenter();
costCenter.setStatusId(BizBillStatus.APPLYING.getId());
/**
* 设置jsp页面初始化填充数据,如果不设置, 那么在jsp页面上填写完表单之后立即提交申请TaskDescription获取不到时间和相关人员信息
*/
Operator operator = getOperator();
costCenter.setDefaultValues(new OrgUnit(operator.getFullId(), operator.getFullName()));
return forward("sapCostCenterDetail",costCenter);
}
/**
* 跳转到增固定资产页面
*/
public String showCostCenter() {
SDO sdo = this.getSDO();
String id = sdo.getBizId();
CostCenterVo costCenterVo = costCenterApplication.findCostCenterById(id);
return forward("sapCostCenterDetail", costCenterVo);
}
/**
......
package com.huigou.topsun.sap.costCenter.domain;
import com.huigou.data.domain.model.AbstractEntity;
import com.huigou.data.domain.model.FlowBillAbstractEntity;
import com.topsunit.query.annotations.Dictionary;
import lombok.Data;
import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
......@@ -12,10 +14,10 @@ import java.util.Date;
* @Date: 2023/12/13/10:42
* @Description:
*/
@Table(name="sap_cost_center")
@Table(name = "sap_cost_center")
@Entity
@Data
public class CostCenter extends AbstractEntity {
public class CostCenter extends FlowBillAbstractEntity {
/**
* 成本中心编码
......@@ -74,7 +76,22 @@ public class CostCenter extends AbstractEntity {
@Dictionary("PRCTR")
private String PRCTR;
/**
* 业务类型
*/
@Column(name = "form_type")
@Dictionary("formType")
private String formType;
/**
* 创建原因 CHAR 100 手工输入
*/
@Column(name = "reason")
private String reason;
//创建原因 CHAR 100 手工输入
@Override
protected String getCodeRuleId() {
return "sapCostCenter";
}
}
package com.huigou.topsun.sap.costCenter.domain.query;
import com.huigou.data.domain.query.QueryAbstractRequest;
import com.topsunit.query.annotations.Dictionary;
import lombok.Data;
import javax.persistence.Column;
import java.util.Date;
/**
......@@ -63,4 +65,39 @@ public class CostCenterQueryRequest extends QueryAbstractRequest {
* 10001001 广州宝绅RFID利润中心
*/
private String PRCTR;
/**
* 业务类型
*/
private String formType;
/**
* 创建原因 CHAR 100 手工输入
*/
private String reason;
private Long version;
private Date fillinDate;
private String billCode;
private Integer statusId;
private String fullId;
private String organId;
private String organName;
private String deptId;
private String deptName;
private String positionId;
private String positionName;
private String personMemberId;
private String personMemberName;
}
......@@ -2,8 +2,12 @@ package com.huigou.topsun.sap.costCenter.domain.vo;
import com.alibaba.fastjson.JSON;
import com.huigou.topsun.sap.costCenter.domain.CostCenter;
import com.topsunit.query.annotations.Dictionary;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.io.Serializable;
import java.util.Date;
......@@ -66,8 +70,40 @@ public class CostCenterVo implements Serializable {
*/
private String PRCTR;
/**
* 业务类型
*/
private String formType;
/**
* 创建原因 CHAR 100 手工输入
*/
private String reason;
private Long version;
private Date fillinDate;
private String billCode;
private Integer statusId;
private String fullId;
private String organId;
private String organName;
private String deptId;
private String deptName;
private String positionId;
private String positionName;
private String personMemberId;
//创建原因 CHAR 100 手工输入
private String personMemberName;
public static CostCenterVo getCostCenterVo(CostCenter costCenter) {
return JSON.parseObject(JSON.toJSONString(costCenter), CostCenterVo.class);
......
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="costCenterProc" name="成本中心申请" isExecutable="true">
<extensionElements>
<activiti:executionListener event="start" delegateExpression="#{costCenterApplication}"></activiti:executionListener>
<activiti:executionListener event="end" delegateExpression="#{costCenterApplication}"></activiti:executionListener>
</extensionElements>
<startEvent id="startevent1" name="Start"></startEvent>
<endEvent id="endevent1" name="End"></endEvent>
<userTask id="Apply" name="成本中心申请" activiti:formKey="sapCostCenter/showCostCenter.job">
<extensionElements>
<activiti:taskListener event="all" delegateExpression="#{costCenterApplication}"></activiti:taskListener>
<activiti:taskListener event="saveBizData" delegateExpression="#{costCenterApplication}"></activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="Approve" name="成本中心审批" activiti:assignee="${assignee} " activiti:formKey="sapCostCenter/showCostCenter.job">
<extensionElements>
<activiti:taskListener event="all" delegateExpression="#{costCenterApplication}"></activiti:taskListener>
<activiti:taskListener event="saveBizData" delegateExpression="#{costCenterApplication}"></activiti:taskListener>
</extensionElements>
<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="handlerList" activiti:elementVariable="assignee">
<completionCondition>${chiefApprovePassed}</completionCondition>
</multiInstanceLoopCharacteristics>
</userTask>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="Apply"></sequenceFlow>
<sequenceFlow id="flow2" sourceRef="Apply" targetRef="Approve"></sequenceFlow>
<exclusiveGateway id="ApproveFinished" name="审批结束"></exclusiveGateway>
<sequenceFlow id="flow3" name="审批通过" sourceRef="ApprovePassed" targetRef="ApproveFinished">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${approvePassed}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow4" name="审批结束" sourceRef="ApproveFinished" targetRef="endevent1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${approveFinished}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow5" name="审批未结束" sourceRef="ApproveFinished" targetRef="Approve">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${!approveFinished}]]></conditionExpression>
</sequenceFlow>
<exclusiveGateway id="ApprovePassed" name="审批通过"></exclusiveGateway>
<sequenceFlow id="flow6" sourceRef="Approve" targetRef="ApprovePassed"></sequenceFlow>
<sequenceFlow id="flow9" name="审批未通过" sourceRef="ApprovePassed" targetRef="Apply">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${!approvePassed}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_costCenterProc">
<bpmndi:BPMNPlane bpmnElement="costCenterProc" id="BPMNPlane_costCenterProc">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="355.0" y="50.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="355.0" y="550.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="Apply" id="BPMNShape_Apply">
<omgdc:Bounds height="55.0" width="161.0" x="292.0" y="140.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="Approve" id="BPMNShape_Approve">
<omgdc:Bounds height="55.0" width="161.0" x="292.0" y="240.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ApproveFinished" id="BPMNShape_ApproveFinished">
<omgdc:Bounds height="40.0" width="40.0" x="352.0" y="440.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ApprovePassed" id="BPMNShape_ApprovePassed">
<omgdc:Bounds height="40.0" width="40.0" x="352.0" y="349.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="372.0" y="85.0"></omgdi:waypoint>
<omgdi:waypoint x="372.0" y="140.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="372.0" y="195.0"></omgdi:waypoint>
<omgdi:waypoint x="372.0" y="240.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="372.0" y="389.0"></omgdi:waypoint>
<omgdi:waypoint x="372.0" y="440.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="48.0" x="320.0" y="396.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="372.0" y="480.0"></omgdi:waypoint>
<omgdi:waypoint x="372.0" y="550.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="48.0" x="382.0" y="489.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="392.0" y="460.0"></omgdi:waypoint>
<omgdi:waypoint x="519.0" y="459.0"></omgdi:waypoint>
<omgdi:waypoint x="519.0" y="317.0"></omgdi:waypoint>
<omgdi:waypoint x="519.0" y="267.0"></omgdi:waypoint>
<omgdi:waypoint x="489.0" y="267.0"></omgdi:waypoint>
<omgdi:waypoint x="453.0" y="267.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="60.0" x="459.0" y="411.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="372.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="372.0" y="349.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
<omgdi:waypoint x="352.0" y="369.0"></omgdi:waypoint>
<omgdi:waypoint x="231.0" y="369.0"></omgdi:waypoint>
<omgdi:waypoint x="231.0" y="167.0"></omgdi:waypoint>
<omgdi:waypoint x="292.0" y="167.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="60.0" x="257.0" y="376.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
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