Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
OA
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
PHP
OA
Commits
f78ec97d
提交
f78ec97d
authored
8月 02, 2020
作者:
fengzy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OA数据同步生产环境测试
上级
e6bdc336
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
342 行增加
和
2 行删除
+342
-2
oafkModel.php
webmain/model/flow/oafkModel.php
+342
-2
没有找到文件。
webmain/model/flow/oafkModel.php
浏览文件 @
f78ec97d
...
...
@@ -9,13 +9,230 @@ class flow_oafkClassModel extends flowModel
return
$rs
;
}
protected
function
flowcheckafter
(
$zt
,
$sm
){
$flowid
=
$this
->
getflow
();
if
(
$flowid
[
'nowcheckid'
]
==
'1085'
){
$payee
=
$this
->
rs
[
'payee'
];
//收款方
$supplier
=
m
(
'supplier'
)
->
getall
(
"name = '
$payee
' "
,
'number'
);
$details_fk
=
$this
->
db
->
getrows
(
'c_fund_details_fk'
,
"mid='"
.
$this
->
rs
[
'id'
]
.
"'"
);
$arr
=
[];
foreach
(
$details_fk
as
$k
=>
$value
)
{
foreach
(
$value
as
$key
=>
$val
)
{
switch
(
$key
)
{
case
'charge_type'
:
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FCOSTID'
][
'FNUMBER'
]
=
self
::
getbxlx
(
$val
);
break
;
case
'cbzx_code'
:
$arr
[
'FPAYBILLENTRY'
][
$k
][
'F_PAEZ_Cbzx'
][
'FNUMBER'
]
=
$val
;
break
;
case
'charge_amount'
:
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FPAYTOTALAMOUNTFOR'
]
=
$val
;
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FPAYAMOUNTFOR_E'
]
=
$val
;
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FSETTLEPAYAMOUNTFOR'
]
=
$val
;
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FREALPAYAMOUNTFOR_D'
]
=
$val
;
break
;
default
:
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FSETTLETYPEID'
][
'FNumber'
]
=
'JSFS04_SYS'
;
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FPURPOSEID'
][
'FNumber'
]
=
'SFKYT12_SYS'
;
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FCostType'
][
'FNUMBER'
]
=
'CBLX0017'
;
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FCostModel'
][
'FNUMBER'
]
=
'00'
;
$arr
[
'FPAYBILLENTRY'
][
$k
][
'F_KXType'
][
'FNUMBER'
]
=
'00'
;
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FENDDATE'
]
=
$this
->
rs
[
'applydt'
]
.
' 00:00:00'
;
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FPOSTDATE'
]
=
$this
->
rs
[
'applydt'
]
.
' 00:00:00'
;
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FOPPOSITEBANKACCOUNT'
]
=
$data
[
'bank_code'
];
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FOPPOSITECCOUNTNAME'
]
=
$data
[
'bank_holder'
];
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FOPPOSITEBANKNAME'
]
=
$data
[
'open_bank_name'
];
$arr
[
'FPAYBILLENTRY'
][
$k
][
'FOpenAddressRec'
]
=
$data
[
'open_address'
];
break
;
}
}
}
$cloudUrl
=
"http://36.110.39.211/k3cloud/"
;
//登陆参数
$data
=
array
(
'5e64f6ff0bd47f'
,
//帐套Id
// '5ef2c166ad1afa',//帐套Id
'Administrator'
,
//用户名
'666666'
,
//密码
'2052'
//语言标识359010087
);
//定义记录Cloud服务端返回的Session
$cookie_jar
=
tempnam
(
'/tmp'
,
'CloudSession'
);
$post_content
=
self
::
create_postdata
(
$data
);
$result
=
self
::
invoke_login
(
$cloudUrl
,
$post_content
,
$cookie_jar
);
header
(
"Content-type: text/html; charset=utf8"
);
$applicant
=
$this
->
rs
[
'applicant'
];
//申请人
$applicationdpt
=
$this
->
rs
[
'applicationdpt'
];
//申请部门
$applydt
=
$this
->
rs
[
'applydt'
];
//申请日期
$data_model
=
'{
"Creator": "",
"NeedUpDateFields": [],
"NeedReturnFields": [],
"IsDeleteEntry": "true",
"SubSystemId": "",
"IsVerifyBaseDataField": "false",
"IsEntryBatchFill": "true",
"ValidateFlag": "true",
"NumberSearch": "true",
"InterationFlags": "",
"IsAutoSubmitAndAudit": "false",
"Model": {
"FID": 0,
"FBillTypeID": {
"FNUMBER": "FKDLX10_SYS"
},
"FDATE": "2020-08-02 00:00:00",
"FCONTACTUNITTYPE": "BD_Supplier",
"FCONTACTUNIT": {
"FNumber": "GDGYS-0002"
},
"FRECTUNITTYPE": "BD_Supplier",
"FRECTUNIT": {
"FNumber": "GDGYS-0002"
},
"FDepartment": {
"FNumber": "CQ.BM.01"
},
"FISINIT": false,
"FCURRENCYID": {
"FNumber": "PRE001"
},
"FEXCHANGERATE": 1.0,
"FSETTLERATE": 1.0,
"FSETTLEORGID": {
"FNumber": "1000"
},
"FDOCUMENTSTATUS": "Z",
"FCancelStatus": "A",
"FPAYORGID": {
"FNumber": "1000"
},
"FISSAMEORG": true,
"FIsCredit": false,
"FSETTLECUR": {
"FNUMBER": "PRE001"
},
"FIsWriteOff": false,
"FREALPAY": false,
"FISCARRYRATE": false,
"FSETTLEMAINBOOKID": {
"FNUMBER": "PRE001"
},
"F_PAEZ_OADJBH": "123213"
}
}'
;
$model
=
json_decode
(
$data_model
,
true
);
$model
[
'Model'
][
'FDATE'
]
=
$applydt
;
$model
[
'Model'
][
'F_PAEZ_OADJBH'
]
=
$this
->
rs
[
'docnum'
];
$model
[
'Model'
][
'FCONTACTUNIT'
][
'FNumber'
]
=
$supplier
[
'number'
];
$model
[
'Model'
][
'FRECTUNIT'
][
'FNumber'
]
=
$supplier
[
'number'
];
$model
[
'Model'
][
'FDepartment'
][
'FNumber'
]
=
self
::
dept
(
$this
->
rs
[
'applicationdpt'
]);
$model
[
'Model'
][
'FPAYBILLENTRY'
]
=
$arr
[
'FPAYBILLENTRY'
];
$data_model
=
json_encode
(
$model
);
$data
=
array
(
'AP_PAYBILL'
,
//业务对象标识FormId
$data_model
//具体Json字串
);
$post_content
=
self
::
create_postdata
(
$data
);
$result
=
self
::
invoke_add
(
$cloudUrl
,
$post_content
,
$cookie_jar
);
$array
=
json_decode
(
$result
,
true
);
if
(
$array
[
'Result'
][
'ResponseStatus'
][
'IsSuccess'
]){
$num
=
$array
[
'Result'
][
'Number'
];
$this
->
update
(
"`fbillno`='
$num
'"
,
$this
->
rs
[
'id'
]);
$this
->
erplog
(
$this
->
rs
[
'docnum'
],
'c_fininfom_oafk'
,
'保存成功'
,
json_encode
(
$array
),
date
(
"Y-m-d H:i:s"
),
2
,
$num
,
$array
[
'Result'
][
'Id'
],
1
);
if
(
$this
->
oafk_submit
(
$cloudUrl
,
$cookie_jar
,
$array
[
'Result'
][
'Id'
],
$array
[
'Result'
][
'Number'
])){
$this
->
erplog
(
$this
->
rs
[
'docnum'
],
'c_fininfom_oafk'
,
'提交成功'
,
json_encode
(
$array
),
date
(
"Y-m-d H:i:s"
),
2
,
$num
,
$array
[
'Result'
][
'Id'
],
2
);
}
else
{
$this
->
erplog
(
$this
->
rs
[
'docnum'
],
'c_fininfom_oafk'
,
'提交失败'
,
json_encode
(
$array
),
date
(
"Y-m-d H:i:s"
),
1
,
$num
,
$array
[
'Result'
][
'Id'
],
2
);
}
}
else
{
$this
->
erplog
(
$this
->
rs
[
'docnum'
],
'c_fininfom_oafk'
,
'保存失败'
,
json_encode
(
$array
),
date
(
"Y-m-d H:i:s"
),
1
,
$num
,
$array
[
'Result'
][
'Id'
],
1
);
m
(
'erplog'
)
->
insert
(
$erp_log
);
}
}
}
public
static
function
dept
(
$data
)
{
$sql
=
" name= '
$data
'"
;
$data
=
m
(
'tmp_department'
)
->
getone
(
$sql
,
'id,number'
);
//查询账户表成本中心id
return
$data
[
'number'
];
}
private
function
erplog
(
$sericnum
,
$table
,
$name
,
$remark
,
$optdt
,
$level
,
$fbillno
,
$fbillnoid
,
$fbillno_type
){
$erp_log
=
array
(
'sericnum'
=>
$sericnum
,
'table'
=>
$table
,
'name'
=>
$name
,
'remark'
=>
$remark
,
'optdt'
=>
$optdt
,
'level'
=>
$level
,
'fbillno'
=>
$fbillno
,
'fbillnoid'
=>
$fbillnoid
,
'fbillno_type'
=>
$fbillno_type
,
);
m
(
'erplog'
)
->
insert
(
$erp_log
);
}
//二级 或一级审批同意之后进行预扣款
protected
function
flowcheckbefore
(
$zt
,
$sm
){
$id
=
$this
->
rs
[
'id'
];
$sql
=
" mid ='
$id
' and `table`='c_fininfom_oafk' "
;
$flow_bill
=
m
(
'flow_bill'
)
->
getone
(
$sql
,
'allcheckid'
);
$allcheckid
=
explode
(
','
,
$flow_bill
[
'allcheckid'
]);
$option
=
m
(
'option'
)
->
getall
(
'pid = 1533 and num =1 order by sort desc'
,
'num,name,value,sort'
);
$optionid
=
m
(
'option'
)
->
getone
(
"num = 'oafk_manager' "
,
'id'
);
$optionid
=
$optionid
[
'id'
];
$option
=
m
(
'option'
)
->
getall
(
"pid = '
$optionid
' and num =1 order by sort desc"
,
'num,name,value,sort'
);
foreach
(
$option
as
$key
=>
$value
)
{
if
(
in_array
(
$value
[
'value'
],
$allcheckid
)){
$checkid
=
$value
[
'value'
];
...
...
@@ -24,7 +241,7 @@ class flow_oafkClassModel extends flowModel
}
if
(
empty
(
$checkid
)){
$option
=
m
(
'option'
)
->
getall
(
'pid = 1533 and num =2 order by sort desc'
,
'num,name,value,sort,`explain`'
);
$option
=
m
(
'option'
)
->
getall
(
"pid = '
$optionid
' and num =2 order by sort desc"
,
'num,name,value,sort,`explain`'
);
foreach
(
$option
as
$key
=>
$value
)
{
if
(
in_array
(
$value
[
'value'
],
$allcheckid
)){
$checkid
=
$value
[
'value'
];
...
...
@@ -206,4 +423,126 @@ class flow_oafkClassModel extends flowModel
}
public
function
oafk_submit
(
$cloudUrl
,
$cookie_jar
,
$id
,
$number
){
$start_time
=
microtime
(
true
);
$data_model
=
"{
'CreateOrgId': 0,
'Numbers': [],
'Ids':
$id
,
'SelectedPostId': 0
}"
;
$data
=
array
(
'AP_PAYBILL'
,
//业务对象标识FormId
$data_model
//具体Json字串
);
$post_content
=
self
::
create_postdata
(
$data
);
$result
=
self
::
invoke_submit
(
$cloudUrl
,
$post_content
,
$cookie_jar
);
$array
=
json_decode
(
$result
,
true
);
return
$array
;
}
//登陆
static
function
invoke_login
(
$cloudUrl
,
$post_content
,
$cookie_jar
)
{
$loginurl
=
$cloudUrl
.
'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc'
;
return
self
::
invoke_post
(
$loginurl
,
$post_content
,
$cookie_jar
,
TRUE
);
}
//查询
static
function
invoke_save
(
$cloudUrl
,
$post_content
,
$cookie_jar
)
{
$invokeurl
=
$cloudUrl
.
'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.View.common.kdsvc'
;
return
self
::
invoke_post
(
$invokeurl
,
$post_content
,
$cookie_jar
,
FALSE
);
}
//添加
static
function
invoke_add
(
$cloudUrl
,
$post_content
,
$cookie_jar
)
{
$invokeurl
=
$cloudUrl
.
'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc'
;
return
self
::
invoke_post
(
$invokeurl
,
$post_content
,
$cookie_jar
,
FALSE
);
}
//提交
static
function
invoke_submit
(
$cloudUrl
,
$post_content
,
$cookie_jar
)
{
$invokeurl
=
$cloudUrl
.
'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit.common.kdsvc'
;
return
self
::
invoke_post
(
$invokeurl
,
$post_content
,
$cookie_jar
,
FALSE
);
}
//审核
static
function
invoke_audit
(
$cloudUrl
,
$post_content
,
$cookie_jar
)
{
$invokeurl
=
$cloudUrl
.
'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc'
;
return
self
::
invoke_post
(
$invokeurl
,
$post_content
,
$cookie_jar
,
FALSE
);
}
static
function
invoke_post
(
$url
,
$post_content
,
$cookie_jar
,
$isLogin
)
{
$ch
=
curl_init
(
$url
);
$this_header
=
array
(
'Content-Type: application/json'
,
'Content-Length: '
.
strlen
(
$post_content
)
);
curl_setopt
(
$ch
,
CURLOPT_CUSTOMREQUEST
,
'POST'
);
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
$this_header
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$post_content
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
if
(
$isLogin
){
curl_setopt
(
$ch
,
CURLOPT_COOKIEJAR
,
$cookie_jar
);
}
else
{
curl_setopt
(
$ch
,
CURLOPT_COOKIEFILE
,
$cookie_jar
);
}
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
5
);
$result
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
return
$result
;
}
static
function
getbxlx
(
$name
)
{
$data
=
m
(
'c_bxlx'
)
->
getone
(
"name='"
.
$name
.
"'"
,
'name,number'
);
return
$data
[
'number'
];
}
//构造Web API请求格式
static
function
create_postdata
(
$args
)
{
$postdata
=
array
(
'format'
=>
1
,
'useragent'
=>
'ApiClient'
,
'rid'
=>
self
::
create_guid
(),
'parameters'
=>
$args
,
'timestamp'
=>
date
(
'Y-m-d'
),
'v'
=>
'1.0'
);
return
json_encode
(
$postdata
);
}
//生成guid
static
function
create_guid
()
{
$charid
=
strtoupper
(
md5
(
uniqid
(
mt_rand
(),
true
)));
$hyphen
=
chr
(
45
);
// "-"
$uuid
=
chr
(
123
)
// "{"
.
substr
(
$charid
,
0
,
8
)
.
$hyphen
.
substr
(
$charid
,
8
,
4
)
.
$hyphen
.
substr
(
$charid
,
12
,
4
)
.
$hyphen
.
substr
(
$charid
,
16
,
4
)
.
$hyphen
.
substr
(
$charid
,
20
,
12
)
.
chr
(
125
);
// "}"
return
$uuid
;
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论