Commit 55b6ca6e authored by lijingjing's avatar lijingjing

Merge branch 'contract' into develop

parents 864b82fc 52e7300f
This diff is collapsed.
create or replace package con_contract_workflow_pkg is
-- Author : LIJINGJING
-- Created : 2019/9/24 17:26:56
-- Purpose :
procedure contract_submit(p_contract_id NUMBER, p_user_id NUMBER);
end con_contract_workflow_pkg;
/
create or replace package body con_contract_workflow_pkg is
procedure contract_submit(p_contract_id NUMBER, p_user_id NUMBER) is
v_contract_rec con_contract%ROWTYPE;
v_contract_status_error exception;
v_instance_id number;
v_approval_method hls_document_type.approval_method%Type;
BEGIN
SELECT *
INTO v_contract_rec
FROM con_contract cc
WHERE cc.contract_id = p_contract_id;
IF v_contract_rec.contract_status NOT IN ('NEW', 'RETURN') then
RAISE v_contract_status_error;
END IF;
Select approval_method
Into v_approval_method
From hls_document_type
Where document_category = v_contract_rec.document_category
And document_type = v_contract_rec.document_type;
--条件表调用工作流
v_instance_id := v_contract_rec.wfl_instance_id;
If v_approval_method = 'WORK_FLOW' Then
hls_workflow_pkg.workflow_start(p_instance_id => v_instance_id,
p_document_category => 'CONTRACT',
p_document_type =>'CARCON',
p_company_id => v_contract_rec.company_id,
p_user_id => p_user_id,
p_function_code => '',
p_parameter_1 => 'CONTRACT_ID',
p_parameter_1_value => p_contract_id,
p_parameter_2 => 'DOCUMENT_INFO',
p_parameter_2_value => '合同审批' || '-' ||
v_contract_rec.contract_name || '-' ||
v_contract_rec.contract_number,
p_parameter_3 => 'SUBMITTED_BY',
p_parameter_3_value => p_user_id);
UPDATE CON_CONTRACT T
SET T.wfl_contract_status = 'APPROVING',
t.wfl_instance_id=v_instance_id
WHERE T.CONTRACT_ID = P_CONTRACT_ID;
End If;
EXCEPTION
WHEN v_contract_status_error THEN
sys_raise_app_error_pkg.raise_sys_others_error(p_message => '只有新建和审批退回的单据才可以提交审批!!',
p_created_by => p_user_id,
p_package_name => 'con_contract_workflow_pkg',
p_procedure_function_name => 'contract_submit');
raise_application_error(sys_raise_app_error_pkg.c_error_number,
sys_raise_app_error_pkg.g_err_line_id);
END;
end con_contract_workflow_pkg;
/
create or replace package prj_project_check_pkg is
-- Author : LIJINGJING
-- Created : 2019/9/19 18:32:46
-- Purpose :
procedure check_prj_record(p_project_id number,
p_payment_deduction in out varchar2,
p_secondary_lease in out varchar2,
p_price_list in out varchar2);
procedure check_prj_lease_item(p_machine_number varchar2,
p_user_id number);
end prj_project_check_pkg;
/
create or replace package body prj_project_check_pkg is
procedure check_prj_record(p_project_id number,
p_payment_deduction in out varchar2,
p_secondary_lease in out varchar2,
p_price_list in out varchar2) is
begin
select p.payment_deduction,
p.secondary_lease,
(select pq.price_list
from prj_quotation pq
where pq.document_id = p.project_id
and pq.document_category = 'PROJECT')
into p_payment_deduction, p_secondary_lease, p_price_list
from prj_project p
where p.project_id = p_project_id;
end;
procedure check_prj_lease_item(p_machine_number varchar2,
p_user_id number) is
v_count number;
e_count_err exception;
begin
select count(*)
into v_count
from prj_project_lease_item t
where t.machine_number = p_machine_number;
if v_count > 0 then
raise e_count_err;
end if;
exception
when e_count_err then
sys_raise_app_error_pkg.raise_sys_others_error(p_message => '该机号已存在,请重新确认!',
p_created_by => p_user_id,
p_package_name => 'prj_project_check_pkg',
p_procedure_function_name => 'check_prj_lease_item');
raise_application_error(sys_raise_app_error_pkg.c_error_number,
sys_raise_app_error_pkg.g_err_line_id);
end;
end prj_project_check_pkg;
/
This source diff could not be displayed because it is too large. You can view the blob instead.
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