提交 6e5134e1 authored 作者: fengzy's avatar fengzy

OA数据同步生产环境测试

上级 bc600a7c
......@@ -13,10 +13,203 @@ class flow_finfybxClassModel extends flowModel
}
// protected function flowcheckafter($zt, $sm){
protected function flowcheckafter($zt, $sm){
$flowid=$this->getflow();
if($flowid['nowcheckid']=='1085'){
$data=$this->db->getone('oa_personfile',"name='".$this->rs['applicant']."'");
$gonncode=$data['gonncode'];
// $data['pfbanknum'];//对方银行卡号
// $data['gonncode'];//员工编号
$cbxmid=$this->rs['cbxmid'];//成本中心
$cbxmid=substr($cbxmid,0,strpos($cbxmid, "("));
//明细
$oa_fininfos=$this->db->getrows('oa_fininfos',"mid='".$this->rs['id']."'");
$arr=[];
foreach ($oa_fininfos as $k=> $value) {
foreach ($value as $key => $val) {
switch ($key) {
case 'bxType':
$arr['FPAYBILLENTRY'][$k]['FCOSTID']['FNUMBER']=self::getbxlx($val);
break;
case 'money':
$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]['F_PAEZ_Cbzx']['FNUMBER']=$cbxmid;
$arr['FPAYBILLENTRY'][$k]['FPURPOSEID']['FNumber']='JSFS04_SYS';
$arr['FPAYBILLENTRY'][$k]['FPAYPURPOSEID']['FNumber']='SFKYT10_SYS';
$arr['FPAYBILLENTRY'][$k]['FPOSTDATE']=$this->rs['applydt'].' 00:00:00';
break;
}
}
}
$cloudUrl = "http://36.110.39.211/k3cloud/";
//登陆参数
$data = array(
'5e64f6ff0bd47f',//帐套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");
$money=$this->rs['money'];//合计金额
$data_model ='{
"Creator": "",
"NeedUpDateFields": [],
"NeedReturnFields": [],
"IsDeleteEntry": "true",
"SubSystemId": "",
"IsVerifyBaseDataField": "false",
"IsEntryBatchFill": "true",
"ValidateFlag": "true",
"NumberSearch": "true",
"InterationFlags": "",
"IsAutoSubmitAndAudit": "false",
"Model": {
"FID": 0,
"FBillTypeID": {
"FNUMBER": "FKDLX04_SYS"
},
"FDATE": "2020-08-02 00:00:00",
"FCONTACTUNITTYPE": "BD_Empinfo",
"FCONTACTUNIT": {
"FNumber": "BJYQ-001"
},
"FRECTUNITTYPE": "BD_Empinfo",
"FRECTUNIT": {
"FNumber": "BJYQ-001"
},
"FDepartment": {
"FNumber": "GS.BM.02"
},
"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": "222222"
}
}';
$model=json_decode($data_model,true);
$model['Model']['FDATE']=$this->rs['applydt'].' 00:00:00';
$model['Model']['FCONTACTUNIT']['FNumber']=$gonncode;
$model['Model']['FDepartment']['FNumber']=self::dept($this->rs['applicationdpt']);
$model['Model']['F_PAEZ_OADJBH']=$this->rs['docnum'];;
$model['Model']['FRECTUNIT']['FNumber']=$gonncode;
$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);
var_dump($array);die;
if($array['Result']['ResponseStatus']['IsSuccess']){
$num=$array['Result']['Number'];
$this->update("`fbillno`='$num'", $this->rs['id']);
$this->erplog($this->rs['docnum'],'fininfom','保存成功',json_encode($array),date("Y-m-d H:i:s"),2,$num,$array['Result']['Id'],1);
m('erplog')->insert($erp_log);
if($this->fybx_submit($cloudUrl,$cookie_jar,$array['Result']['Id'],$array['Result']['Number'])){
$this->erplog($this->rs['docnum'],'fininfom','提交成功',json_encode($array),date("Y-m-d H:i:s"),2,$num,$array['Result']['Id'],2);
m('erplog')->insert($erp_log);
}else{
$this->erplog($this->rs['docnum'],'fininfom','提交失败',json_encode($array),date("Y-m-d H:i:s"),1,$num,$array['Result']['Id'],2);
m('erplog')->insert($erp_log);
}
}else{
$this->erplog($this->rs['docnum'],'fininfom','保存失败',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'];
}
public function fybx_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;
}
// }
//二级 或一级审批同意之后进行预扣款
protected function flowcheckbefore($zt, $sm){
$id=$this->rs['id'];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论