提交 ee4b17e5 authored 作者: fengzy's avatar fengzy

OA数据同步生产环境测试

上级 bb2b3228
......@@ -12,67 +12,67 @@ class flow_finfybxClassModel extends flowModel
return $arr;
}
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]['FSETTLETYPEID']['FNumber']='JSFS04_SYS';
$arr['FPAYBILLENTRY'][$k]['FPURPOSEID']['FNumber']='SFKYT10_SYS';
$arr['FPAYBILLENTRY'][$k]['FPOSTDATE']=$this->rs['applydt'].' 00:00:00';
break;
}
}
}
$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]['FSETTLETYPEID']['FNumber']='JSFS04_SYS';
$arr['FPAYBILLENTRY'][$k]['FPURPOSEID']['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'];//合计金额
$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 ='{
$data_model ='{
"Creator": "",
"NeedUpDateFields": [],
"NeedReturnFields": [],
......@@ -130,84 +130,85 @@ class flow_finfybxClassModel extends flowModel
}
}';
$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'];
$model=json_decode($data_model,true);
$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'],'fininfom','保存成功',json_encode($array),date("Y-m-d H:i:s"),2,$num,$array['Result']['Id'],1);
m('erplog')->insert($erp_log);
$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字串
);
if($this->fybx_submit($cloudUrl,$cookie_jar,$array['Result']['Id'],$array['Result']['Number'])){
$post_content = self::create_postdata($data);
$result = self::invoke_add($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true);
$this->erplog($this->rs['docnum'],'fininfom','提交成功',json_encode($array),date("Y-m-d H:i:s"),2,$num,$array['Result']['Id'],2);
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);
}else{
$this->erplog($this->rs['docnum'],'fininfom','提交失败',json_encode($array),date("Y-m-d H:i:s"),1,$num,$array['Result']['Id'],2);
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'],1);
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)
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 ="{
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;
$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'];
......@@ -216,6 +217,7 @@ class flow_finfybxClassModel extends flowModel
$allcheckid=explode(',',$flow_bill['allcheckid']);
$optionid = m('option')->getone("num = 'finfybx_manager' ",'id');
$optionid=$optionid['id'];
$option = m('option')->getall("pid = '$optionid' and num =1 order by sort desc",'num,name,value,sort');
......@@ -340,97 +342,97 @@ class flow_finfybxClassModel extends flowModel
// 金蝶
$id=$this->rs['id'];
$sql = " mid ='$id' and `table`='fininfom' ";
// 金蝶
$id=$this->rs['id'];
$sql = " mid ='$id' and `table`='fininfom' ";
$optionid = m('option')->getone("num = 'fybx_accountant' ",'id');
$optionid=$optionid['id'];
$option = m('option')->getall("pid ='$optionid' ",'`explain`');
foreach ($option as $key => $value) {
$allcheckid[]=$value['explain'];
}
//查询流程为财务确认
$flowid = $this->getflow();
if(in_array($flowid['nowcourseid'],$allcheckid)){
if($flowid['nowcheckid']=='992'){
$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['FPAYAPPLYENTRY'][$k]['FCOSTID']['FNUMBER']=self::getbxlx($val);
break;
case 'money':
$arr['FPAYAPPLYENTRY'][$k]['FAPPLYAMOUNTFOR']=$val;
break;
case 'sm':
$arr['FPAYAPPLYENTRY'][$k]['FDescription']=$val;
break;
default:
$arr['FPAYAPPLYENTRY'][$k]['F_PAEZ_CBZX1']['FNUMBER']=$cbxmid;
$arr['FPAYAPPLYENTRY'][$k]['FSETTLETYPEID']['FNumber']='JSFS04_SYS';
$arr['FPAYAPPLYENTRY'][$k]['FPAYPURPOSEID']['FNumber']='SFKYT10_SYS';
$arr['FPAYAPPLYENTRY'][$k]['FENDDATE']=$this->rs['applydt'].' 00:00:00';
$arr['FPAYAPPLYENTRY'][$k]['FEXPECTPAYDATE']=$this->rs['applydt'].' 00:00:00';
$arr['FPAYAPPLYENTRY'][$k]['FEACHBANKACCOUNT']=$data['pfbanknum'];
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");
$starttime = microtime(true);
$applicant=$this->rs['applicant'];//申请人
$applicationdpt=$this->rs['applicationdpt'];//申请部门
$applydt=$this->rs['applydt'];//申请日期
$money=$this->rs['money'];//合计金额
// $applydt=$this->rs['applydt'];//发票日期
// $company_scale=$this->rs['company_scale'];//发票类型
// $web_site=$this->rs['web_site'];//发票号
// $settle_type=$this->rs['settle_type'];//费用科目
// $pay_condition=$this->rs['pay_condition'];// 金额
// $tend_type=$this->rs['tend_type'];// *说明
$option = m('option')->getall("pid ='$optionid' ",'`explain`');
foreach ($option as $key => $value) {
$allcheckid[]=$value['explain'];
}
//查询流程为财务确认
$flowid = $this->getflow();
if(in_array($flowid['nowcourseid'],$allcheckid)){
if($flowid['nowcheckid']=='992'){
$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['FPAYAPPLYENTRY'][$k]['FCOSTID']['FNUMBER']=self::getbxlx($val);
break;
case 'money':
$arr['FPAYAPPLYENTRY'][$k]['FAPPLYAMOUNTFOR']=$val;
break;
case 'sm':
$arr['FPAYAPPLYENTRY'][$k]['FDescription']=$val;
break;
default:
$arr['FPAYAPPLYENTRY'][$k]['F_PAEZ_CBZX1']['FNUMBER']=$cbxmid;
$arr['FPAYAPPLYENTRY'][$k]['FSETTLETYPEID']['FNumber']='JSFS04_SYS';
$arr['FPAYAPPLYENTRY'][$k]['FPAYPURPOSEID']['FNumber']='SFKYT10_SYS';
$arr['FPAYAPPLYENTRY'][$k]['FENDDATE']=$this->rs['applydt'].' 00:00:00';
$arr['FPAYAPPLYENTRY'][$k]['FEXPECTPAYDATE']=$this->rs['applydt'].' 00:00:00';
$arr['FPAYAPPLYENTRY'][$k]['FEACHBANKACCOUNT']=$data['pfbanknum'];
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");
$starttime = microtime(true);
$applicant=$this->rs['applicant'];//申请人
$applicationdpt=$this->rs['applicationdpt'];//申请部门
$applydt=$this->rs['applydt'];//申请日期
$data_model ='{
$money=$this->rs['money'];//合计金额
// $applydt=$this->rs['applydt'];//发票日期
// $company_scale=$this->rs['company_scale'];//发票类型
// $web_site=$this->rs['web_site'];//发票号
// $settle_type=$this->rs['settle_type'];//费用科目
// $pay_condition=$this->rs['pay_condition'];// 金额
// $tend_type=$this->rs['tend_type'];// *说明
$data_model ='{
"Creator": "",
"NeedUpDateFields": [],
"NeedReturnFields": [],
......@@ -489,65 +491,81 @@ class flow_finfybxClassModel extends flowModel
}
}';
$model=json_decode($data_model,true);
$model['Model']['FDATE']=$applydt;
$model['Model']['FDEPARTMENT']['FNumber']=self::dept($this->rs['applicationdpt']);
$model['Model']['FCONTACTUNIT']['FNumber']=$gonncode;
$model['Model']['F_PAEZ_OADJBH']=$this->rs['docnum'];;
$model['Model']['FRECTUNIT']['FNumber']=$gonncode;
$model['Model']['FPAYAPPLYENTRY']=$arr['FPAYAPPLYENTRY'];
$model=json_decode($data_model,true);
$data_model=json_encode($model);
$data = array(
'CN_PAYAPPLY',//业务对象标识FormId
$data_model//具体Json字串
);
$model['Model']['FDATE']=$applydt;
$model['Model']['FDEPARTMENT']['FNumber']=self::dept($this->rs['applicationdpt']);
$model['Model']['FCONTACTUNIT']['FNumber']=$gonncode;
$model['Model']['F_PAEZ_OADJBH']=$this->rs['docnum'];;
$model['Model']['FRECTUNIT']['FNumber']=$gonncode;
$model['Model']['FPAYAPPLYENTRY']=$arr['FPAYAPPLYENTRY'];
$data_model=json_encode($model);
$data = array(
'CN_PAYAPPLY',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_add($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true);
$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("`fsrcbillno`='$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);
if($array['Result']['ResponseStatus']['IsSuccess']){
$num=$array['Result']['Number'];
$this->update("`fsrcbillno`='$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->supplier_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);
}
if($this->supplier_audit($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'],3);
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'],3);
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);
if($this->supplier_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);
}
if($this->supplier_audit($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'],3);
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'],3);
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);
}
}
}
}
}
}
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 flowcheckfinsh($zt){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论