提交 80881cfa authored 作者: fengzy's avatar fengzy

oa付款单

上级 5370dd5a
...@@ -144,446 +144,446 @@ class flow_finfybxClassModel extends flowModel ...@@ -144,446 +144,446 @@ class flow_finfybxClassModel extends flowModel
} }
// //流程全部完成后调用 //流程全部完成后调用
// protected function flowcheckfinsh($zt){ protected function flowcheckfinsh($zt){
// $docnum=$this->rs['docnum']; $docnum=$this->rs['docnum'];
// $withhold_cost = m('c_withhold_fininform')->getall("docnum='$docnum' and status =1", 'id,cost_id,amount'); $withhold_cost = m('c_withhold_fininform')->getall("docnum='$docnum' and status =1", 'id,cost_id,amount');
// foreach ($withhold_cost as $key => $vo) { foreach ($withhold_cost as $key => $vo) {
// // 扣除账户余额 c_fund_account account_balance // 扣除账户余额 c_fund_account account_balance
// $cbzxid= $vo['cost_id']; $cbzxid= $vo['cost_id'];
// $model = 'c_fund_account'; $model = 'c_fund_account';
// $sql = " cost_id ='$cbzxid' and status = 1 and is_default=1"; $sql = " cost_id ='$cbzxid' and status = 1 and is_default=1";
// $data = m($model)->getone($sql,'id,name,account_balance,freeze_amount'); $data = m($model)->getone($sql,'id,name,account_balance,freeze_amount');
// $zfarr = array( $zfarr = array(
// 'account_balance' =>$data['account_balance']-$vo['amount'], 'account_balance' =>$data['account_balance']-$vo['amount'],
// ); );
// $id=$data['id']; $id=$data['id'];
// m('c_fund_account')->update($zfarr,"`id`='$id'"); m('c_fund_account')->update($zfarr,"`id`='$id'");
// $freeze = array( $freeze = array(
// 'freeze_amount' => $data['freeze_amount'] - $vo['amount'], 'freeze_amount' => $data['freeze_amount'] - $vo['amount'],
// ); );
// m('c_fund_account')->update($freeze, "`id`='$id'"); m('c_fund_account')->update($freeze, "`id`='$id'");
// // 成本中心 amount 变更 // 成本中心 amount 变更
// $cbzx = substr($cbzxid,0,strrpos($cbzxid,"(")); $cbzx = substr($cbzxid,0,strrpos($cbzxid,"("));
// $cbzxsql = " code ='$cbzx' and status = 1"; $cbzxsql = " code ='$cbzx' and status = 1";
// $cbzxdata = m('c_cbzx')->getone($cbzxsql,'id,amount'); $cbzxdata = m('c_cbzx')->getone($cbzxsql,'id,amount');
// $cbarr = array( $cbarr = array(
// 'amount' =>$cbzxdata['amount']+$vo['amount'], 'amount' =>$cbzxdata['amount']+$vo['amount'],
// ); );
// m('c_cbzx')->update($cbarr,"`code`='$cbzx'"); m('c_cbzx')->update($cbarr,"`code`='$cbzx'");
// //账户明细 c_account_detail //账户明细 c_account_detail
// $account_detail=array( $account_detail=array(
// 'account' => $data['name'], 'account' => $data['name'],
// 'opt_type' => 2, 'opt_type' => 2,
// 'amount' =>$vo['amount'], 'amount' =>$vo['amount'],
// 'trans_numb' => $this->rs['docnum'], 'trans_numb' => $this->rs['docnum'],
// 'account_balance' => $data['account_balance']-$vo['amount'], 'account_balance' => $data['account_balance']-$vo['amount'],
// 'create_time' =>date("Y-m-d H:i:s"), 'create_time' =>date("Y-m-d H:i:s"),
// 'uid' =>$this->rs['uid'], 'uid' =>$this->rs['uid'],
// ); );
// m('c_account_detail')->insert($account_detail); m('c_account_detail')->insert($account_detail);
// // 业务付款8业务预付款10费用报销11 oa_c_fund_detail // 业务付款8业务预付款10费用报销11 oa_c_fund_detail
// $fund_detail=array( $fund_detail=array(
// 'trans_numb' =>$this->rs['docnum'], 'trans_numb' =>$this->rs['docnum'],
// 'account' => $data['name'], 'account' => $data['name'],
// 'toaccount' =>$this->rs['applicant'], 'toaccount' =>$this->rs['applicant'],
// 'trans_amount' =>$vo['amount'], 'trans_amount' =>$vo['amount'],
// 'business_type' =>11, 'business_type' =>11,
// 'opt_type' =>2, 'opt_type' =>2,
// 'account_balance'=>$data['account_balance']-$vo['amount'], 'account_balance'=>$data['account_balance']-$vo['amount'],
// 'create_time' =>date("Y-m-d H:i:s"), 'create_time' =>date("Y-m-d H:i:s"),
// 'uid' =>$this->rs['uid'], 'uid' =>$this->rs['uid'],
// ); );
// m('c_fund_detail')->insert($fund_detail); m('c_fund_detail')->insert($fund_detail);
// } }
// } }
//审核完成后调用 //审核完成后调用
protected function flowcheckafter($zt, $sm,$nowcourse){ // protected function flowcheckafter($zt, $sm,$nowcourse){
$flowid=$this->getflow(); // $flowid=$this->getflow();
$cloudUrl = "http://36.110.39.211/k3cloud/"; // $cloudUrl = "http://36.110.39.211/k3cloud/";
//登陆参数 // //登陆参数
$data = array( // $data = array(
'5d8acc5a26042d',//帐套Id // '5d8acc5a26042d',//帐套Id
'Administrator',//用户名 // 'Administrator',//用户名
'kJyGjIQ5DW0tpd@B',//密码 // 'kJyGjIQ5DW0tpd@B',//密码
'2052'//语言标识359010087 // '2052'//语言标识359010087
); // );
//定义记录Cloud服务端返回的Session // //定义记录Cloud服务端返回的Session
$cookie_jar = tempnam('/tmp','CloudSession'); // $cookie_jar = tempnam('/tmp','CloudSession');
$post_content = self::create_postdata($data); // $post_content = self::create_postdata($data);
$result = self::invoke_login($cloudUrl,$post_content,$cookie_jar); // $result = self::invoke_login($cloudUrl,$post_content,$cookie_jar);
header("Content-type: text/html; charset=utf8"); // header("Content-type: text/html; charset=utf8");
$starttime = microtime(true); // $starttime = microtime(true);
$applicant=$this->rs['applicant'];//申请人 // $applicant=$this->rs['applicant'];//申请人
$FCREATORID=$this->db->getone('oa_personfile',"name='".$this->rs['applicant']."'"); // $FCREATORID=$this->db->getone('oa_personfile',"name='".$this->rs['applicant']."'");
$gonncode=$FCREATORID['gonncode']; //申请人编号 // $gonncode=$FCREATORID['gonncode']; //申请人编号
$applicationdpt=$this->rs['applicationdpt'];//申请部门 // $applicationdpt=$this->rs['applicationdpt'];//申请部门
$applydt=$this->rs['optdt'];//申请日期 // $applydt=$this->rs['optdt'];//申请日期
$amountOfThisPayment=$this->rs['amountOfThisPayment'];//金额 // $amountOfThisPayment=$this->rs['amountOfThisPayment'];//金额
$contractNumber=$this->rs['contractNumber'];//合同编号 // $contractNumber=$this->rs['contractNumber'];//合同编号
$contracta=(strpos($contractNumber, "(")); // $contracta=(strpos($contractNumber, "("));
$contractb=(strrpos($contractNumber, ")")); // $contractb=(strrpos($contractNumber, ")"));
$b = mb_strpos($contractNumber,"(") + mb_strlen("("); // $b = mb_strpos($contractNumber,"(") + mb_strlen("(");
$e = mb_strpos($contractNumber, ")") - $b; // $e = mb_strpos($contractNumber, ")") - $b;
$contractNumber=mb_substr($contractNumber,$b,$e); // $contractNumber=mb_substr($contractNumber,$b,$e);
$contract = $this->db->getone('oa_c_contract', 'numb = "' . $contractNumber . '"'); // $contract = $this->db->getone('oa_c_contract', 'numb = "' . $contractNumber . '"');
if($contract['receive']==2){ // if($contract['receive']==2){
$suppliername= $contract['partb_name'];//供应商名称 // $suppliername= $contract['partb_name'];//供应商名称
}else{ // }else{
$suppliername= $contract['parta_name'];//供应商名称 // $suppliername= $contract['parta_name'];//供应商名称
} // }
$sql = 'bank_code = ' .$contract['bankcode']; // $sql = 'bank_code = ' .$contract['bankcode'];
$data = $this->db->getone('oa_supplier_bank_info', $sql); // $data = $this->db->getone('oa_supplier_bank_info', $sql);
$paymentMethod=$this->rs['paymentMethod'];//付款方式 // $paymentMethod=$this->rs['paymentMethod'];//付款方式
$cbxmid=$this->rs['cbzxid'];//成本中心 // $cbxmid=$this->rs['cbzxid'];//成本中心
$cbxmid=substr($cbxmid,0,strpos($cbxmid, "(")); // $cbxmid=substr($cbxmid,0,strpos($cbxmid, "("));
// $data_model='{ // // $data_model='{
// "Creator": "", // // "Creator": "",
// "NeedUpDateFields": [], // // "NeedUpDateFields": [],
// "NeedReturnFields": [], // // "NeedReturnFields": [],
// "IsDeleteEntry": "true", // // "IsDeleteEntry": "true",
// "SubSystemId": "", // // "SubSystemId": "",
// "IsVerifyBaseDataField": "false", // // "IsVerifyBaseDataField": "false",
// "IsEntryBatchFill": "true", // // "IsEntryBatchFill": "true",
// "ValidateFlag": "true", // // "ValidateFlag": "true",
// "NumberSearch": "true", // // "NumberSearch": "true",
// "InterationFlags": "", // // "InterationFlags": "",
// "IsAutoSubmitAndAudit": "false", // // "IsAutoSubmitAndAudit": "false",
// "Model": { // // "Model": {
// "FID": 0, // // "FID": 0,
// "FBILLTYPEID": { // // "FBILLTYPEID": {
// "FNUMBER": "FKSQ008" // // "FNUMBER": "FKSQ008"
// }, // // },
// "FCREATORID": { // // "FCREATORID": {
// "FNUMBER": "" // // "FNUMBER": ""
// }, // // },
// "FDATE": "2020-03-02 00:00:00", // // "FDATE": "2020-03-02 00:00:00",
// "FCONTACTUNITTYPE": "BD_Supplier", // // "FCONTACTUNITTYPE": "BD_Supplier",
// "FCONTACTUNIT": { // // "FCONTACTUNIT": {
// "FNumber": "GSGYS-0005" // // "FNumber": "GSGYS-0005"
// }, // // },
// "FRECTUNITTYPE": "BD_Supplier", // // "FRECTUNITTYPE": "BD_Supplier",
// "FRECTUNIT": { // // "FRECTUNIT": {
// "FNumber": "GSGYS-0005" // // "FNumber": "GSGYS-0005"
// }, // // },
// "FCURRENCYID": { // // "FCURRENCYID": {
// "FNumber": "PRE001" // // "FNumber": "PRE001"
// }, // // },
// "FAPPLYORGID": { // // "FAPPLYORGID": {
// "FNumber": "1000" // // "FNumber": "1000"
// }, // // },
// "FPAYORGID": { // // "FPAYORGID": {
// "FNumber": "1000" // // "FNumber": "1000"
// }, // // },
// "FSETTLEORGID": { // // "FSETTLEORGID": {
// "FNumber": "1000" // // "FNumber": "1000"
// }, // // },
// "FPURCHASEORGID": { // // "FPURCHASEORGID": {
// "FNumber": "1000" // // "FNumber": "1000"
// }, // // },
// "FDOCUMENTSTATUS": "Z", // // "FDOCUMENTSTATUS": "Z",
// "FCANCELSTATUS": "A", // // "FCANCELSTATUS": "A",
// "FMAINBOOKID": { // // "FMAINBOOKID": {
// "FNUMBER": "PRE001" // // "FNUMBER": "PRE001"
// }, // // },
// "FIsCredit": false, // // "FIsCredit": false,
// "FSETTLECUR": { // // "FSETTLECUR": {
// "FNUMBER": "PRE001" // // "FNUMBER": "PRE001"
// }, // // },
// "FISCARRYRATE": false, // // "FISCARRYRATE": false,
// "F_PAEZ_Cbzx": { // // "F_PAEZ_Cbzx": {
// "FNUMBER": "GS.BJ.B01.02" // // "FNUMBER": "GS.BJ.B01.02"
// } // // }
// } // // }
// }'; // // }';
$data_model= '{ // $data_model= '{
"Creator": "", // "Creator": "",
"NeedUpDateFields": [], // "NeedUpDateFields": [],
"NeedReturnFields": [], // "NeedReturnFields": [],
"IsDeleteEntry": "true", // "IsDeleteEntry": "true",
"SubSystemId": "", // "SubSystemId": "",
"IsVerifyBaseDataField": "false", // "IsVerifyBaseDataField": "false",
"IsEntryBatchFill": "true", // "IsEntryBatchFill": "true",
"ValidateFlag": "true", // "ValidateFlag": "true",
"NumberSearch": "true", // "NumberSearch": "true",
"InterationFlags": "", // "InterationFlags": "",
"IsAutoSubmitAndAudit": "false", // "IsAutoSubmitAndAudit": "false",
"Model": { // "Model": {
"FID": 0, // "FID": 0,
"FBillTypeID": { // "FBillTypeID": {
"FNUMBER": "FKDLX08" // "FNUMBER": "FKDLX08"
}, // },
"FDATE": "2020-06-24 00:00:00", // "FDATE": "2020-06-24 00:00:00",
"FCONTACTUNITTYPE": "BD_Supplier", // "FCONTACTUNITTYPE": "BD_Supplier",
"FCONTACTUNIT": { // "FCONTACTUNIT": {
"FNumber": "GSGYS-0010" // "FNumber": "GSGYS-0010"
}, // },
"FRECTUNITTYPE": "BD_Supplier", // "FRECTUNITTYPE": "BD_Supplier",
"FRECTUNIT": { // "FRECTUNIT": {
"FNumber": "GSGYS-0010" // "FNumber": "GSGYS-0010"
}, // },
"FDepartment": { // "FDepartment": {
"FNumber": "06.06" // "FNumber": "06.06"
}, // },
"FISINIT": false, // "FISINIT": false,
"FCURRENCYID": { // "FCURRENCYID": {
"FNumber": "PRE001" // "FNumber": "PRE001"
}, // },
"FEXCHANGERATE": 1.0, // "FEXCHANGERATE": 1.0,
"FSETTLERATE": 1.0, // "FSETTLERATE": 1.0,
"FSETTLEORGID": { // "FSETTLEORGID": {
"FNumber": "1000" // "FNumber": "1000"
}, // },
"FDOCUMENTSTATUS": "Z", // "FDOCUMENTSTATUS": "Z",
"FCancelStatus": "A", // "FCancelStatus": "A",
"FPAYORGID": { // "FPAYORGID": {
"FNumber": "1000" // "FNumber": "1000"
}, // },
"FISSAMEORG": true, // "FISSAMEORG": true,
"FIsCredit": false, // "FIsCredit": false,
"FSETTLECUR": { // "FSETTLECUR": {
"FNUMBER": "PRE001" // "FNUMBER": "PRE001"
}, // },
"F_YeWuLine": { // "F_YeWuLine": {
"FNUMBER": "CWCLYWX-009" // "FNUMBER": "CWCLYWX-009"
}, // },
"FIsWriteOff": false, // "FIsWriteOff": false,
"FREALPAY": false, // "FREALPAY": false,
"F_ZHname": "无", // "F_ZHname": "无",
"FORDate": "2017-04-01 00:00:00", // "FORDate": "2017-04-01 00:00:00",
"FISCARRYRATE": false, // "FISCARRYRATE": false,
"FSETTLEMAINBOOKID": { // "FSETTLEMAINBOOKID": {
"FNUMBER": "PRE001" // "FNUMBER": "PRE001"
}, // },
"FPAYBILLENTRY": [ // "FPAYBILLENTRY": [
{ // {
"F_XM_ID": { // "F_XM_ID": {
"FNUMBER": " WLFX-3-TTTZ-19021" // "FNUMBER": " WLFX-3-TTTZ-19021"
}, // },
"FCostType": { // "FCostType": {
"FNUMBER": "CBLX0001" // "FNUMBER": "CBLX0001"
}, // },
"FCostModel": { // "FCostModel": {
"FNUMBER": "CBMS0001" // "FNUMBER": "CBMS0001"
}, // },
"F_KXType": { // "F_KXType": {
"FNUMBER": "009" // "FNUMBER": "009"
}, // },
"FSETTLETYPEID": { // "FSETTLETYPEID": {
"FNumber": "JSFS21_SYS" // "FNumber": "JSFS21_SYS"
}, // },
"FPURPOSEID": { // "FPURPOSEID": {
"FNumber": "SFKYT015" // "FNumber": "SFKYT015"
}, // },
"FPAYTOTALAMOUNTFOR": 99999.0, // "FPAYTOTALAMOUNTFOR": 99999.0,
"FPAYAMOUNTFOR_E": 99999.0, // "FPAYAMOUNTFOR_E": 99999.0,
"FSETTLEPAYAMOUNTFOR": 99999.0, // "FSETTLEPAYAMOUNTFOR": 99999.0,
"FREALPAYAMOUNTFOR_D": 99999.0, // "FREALPAYAMOUNTFOR_D": 99999.0,
"FRecType": "1", // "FRecType": "1",
"FPAYAMOUNT_E": 99999.0, // "FPAYAMOUNT_E": 99999.0,
"FPOSTDATE": "2020-06-24 00:00:00", // "FPOSTDATE": "2020-06-24 00:00:00",
"FPayType": "A", // "FPayType": "A",
"FRuZhangType": "1" // "FRuZhangType": "1"
} // }
] // ]
} // }
}'; // }';
// $arr['FPAYAPPLYENTRY'][0]['FENDDATE']=$this->rs['applydt'].' 00:00:00'; // // $arr['FPAYAPPLYENTRY'][0]['FENDDATE']=$this->rs['applydt'].' 00:00:00';
// $arr['FPAYAPPLYENTRY'][0]['FEXPECTPAYDATE']=$this->rs['applydt'].' 00:00:00'; // // $arr['FPAYAPPLYENTRY'][0]['FEXPECTPAYDATE']=$this->rs['applydt'].' 00:00:00';
// $arr['FPAYAPPLYENTRY'][0]['FAPPLYAMOUNTFOR']=intval($amountOfThisPayment); // // $arr['FPAYAPPLYENTRY'][0]['FAPPLYAMOUNTFOR']=intval($amountOfThisPayment);
// $arr['FPAYAPPLYENTRY'][0]['FEACHBANKACCOUNT']=$data['bank_code']; // // $arr['FPAYAPPLYENTRY'][0]['FEACHBANKACCOUNT']=$data['bank_code'];
// $arr['FPAYAPPLYENTRY'][0]['FEACHCCOUNTNAME']=$data['bank_holder']; // // $arr['FPAYAPPLYENTRY'][0]['FEACHCCOUNTNAME']=$data['bank_holder'];
// $arr['FPAYAPPLYENTRY'][0]['FEACHBANKNAME']=$data['open_bank_name']; // // $arr['FPAYAPPLYENTRY'][0]['FEACHBANKNAME']=$data['open_bank_name'];
// $model=json_decode($data_model,true); // // $model=json_decode($data_model,true);
// $model['Model']['F_PAEZ_Cbzx']['FNUMBER']=$cbxmid; // // $model['Model']['F_PAEZ_Cbzx']['FNUMBER']=$cbxmid;
// $model['Model']['FCREATORID']['FNUMBER']=$gonncode; // // $model['Model']['FCREATORID']['FNUMBER']=$gonncode;
// $model['Model']['FDATE']=$applydt; // // $model['Model']['FDATE']=$applydt;
// $model['Model']['FCONTACTUNIT']['FNumber']=$suppliername; // // $model['Model']['FCONTACTUNIT']['FNumber']=$suppliername;
// $model['Model']['FRECTUNIT']['FNumber']=$suppliername; // // $model['Model']['FRECTUNIT']['FNumber']=$suppliername;
// $model['Model']['FPAYAPPLYENTRY']=$arr['FPAYAPPLYENTRY']; // // $model['Model']['FPAYAPPLYENTRY']=$arr['FPAYAPPLYENTRY'];
// $data_model=json_encode($model); // // $data_model=json_encode($model);
$data = array( // $data = array(
'AP_PAYBILL',//业务对象标识FormId // 'AP_PAYBILL',//业务对象标识FormId
$data_model//具体Json字串 // $data_model//具体Json字串
); // );
$post_content = self::create_postdata($data); // $post_content = self::create_postdata($data);
$result = self::invoke_add($cloudUrl,$post_content,$cookie_jar); // $result = self::invoke_add($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true); // $array = json_decode($result,true);
echo "<pre>"; // echo "<pre>";
var_dump($array); // var_dump($array);
if($array['Result']['ResponseStatus']['IsSuccess']){ // if($array['Result']['ResponseStatus']['IsSuccess']){
// $num=$array['Result']['Number']; // // $num=$array['Result']['Number'];
// $this->update("`fbillno`='$num'", $this->rs['id']); // // $this->update("`fbillno`='$num'", $this->rs['id']);
var_dump($this->supplier_submit($cloudUrl,$cookie_jar,$array['Result']['Id'],$array['Result']['Number'])); // var_dump($this->supplier_submit($cloudUrl,$cookie_jar,$array['Result']['Id'],$array['Result']['Number']));
var_dump($this->supplier_audit($cloudUrl,$cookie_jar,$array['Result']['Id'],$array['Result']['Number'])); // var_dump($this->supplier_audit($cloudUrl,$cookie_jar,$array['Result']['Id'],$array['Result']['Number']));
} // }
} // }
public function supplier_submit($cloudUrl,$cookie_jar,$id,$number){ // public function supplier_submit($cloudUrl,$cookie_jar,$id,$number){
$start_time = microtime(true); // $start_time = microtime(true);
$data_model ="{ // $data_model ="{
'CreateOrgId': 0, // 'CreateOrgId': 0,
'Numbers': [], // 'Numbers': [],
'Ids': $id, // 'Ids': $id,
'SelectedPostId': 0 // 'SelectedPostId': 0
}"; // }";
$data = array( // $data = array(
'CN_PAYAPPLY',//业务对象标识FormId // 'CN_PAYAPPLY',//业务对象标识FormId
$data_model//具体Json字串 // $data_model//具体Json字串
); // );
$post_content = self::create_postdata($data); // $post_content = self::create_postdata($data);
$result = self::invoke_submit($cloudUrl,$post_content,$cookie_jar); // $result = self::invoke_submit($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true); // $array = json_decode($result,true);
return $array; // return $array;
} // }
public function supplier_audit($cloudUrl,$cookie_jar,$id,$number){ // public function supplier_audit($cloudUrl,$cookie_jar,$id,$number){
$data_model ="{ // $data_model ="{
'CreateOrgId': 0, // 'CreateOrgId': 0,
'Numbers': [], // 'Numbers': [],
'Ids': $id, // 'Ids': $id,
'InterationFlags': '' // 'InterationFlags': ''
}"; // }";
$data = array( // $data = array(
'CN_PAYAPPLY',//业务对象标识FormId // 'CN_PAYAPPLY',//业务对象标识FormId
$data_model//具体Json字串 // $data_model//具体Json字串
); // );
$post_content = self::create_postdata($data); // $post_content = self::create_postdata($data);
$result = self::invoke_audit($cloudUrl,$post_content,$cookie_jar); // $result = self::invoke_audit($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true); // $array = json_decode($result,true);
return $array; // return $array;
} // }
//登陆 // //登陆
static function invoke_login($cloudUrl,$post_content,$cookie_jar) // static function invoke_login($cloudUrl,$post_content,$cookie_jar)
{ // {
$loginurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc'; // $loginurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc';
return self::invoke_post($loginurl,$post_content,$cookie_jar,TRUE); // return self::invoke_post($loginurl,$post_content,$cookie_jar,TRUE);
} // }
//查询 // //查询
static function invoke_save($cloudUrl,$post_content,$cookie_jar) // static function invoke_save($cloudUrl,$post_content,$cookie_jar)
{ // {
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.View.common.kdsvc'; // $invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.View.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE); // return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
} // }
//添加 // //添加
static function invoke_add($cloudUrl,$post_content,$cookie_jar) // static function invoke_add($cloudUrl,$post_content,$cookie_jar)
{ // {
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc'; // $invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE); // return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
} // }
//提交 // //提交
static function invoke_submit($cloudUrl,$post_content,$cookie_jar) // static function invoke_submit($cloudUrl,$post_content,$cookie_jar)
{ // {
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit.common.kdsvc'; // $invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE); // return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
} // }
//审核 // //审核
static function invoke_audit($cloudUrl,$post_content,$cookie_jar) // static function invoke_audit($cloudUrl,$post_content,$cookie_jar)
{ // {
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc'; // $invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE); // return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
} // }
static function invoke_post($url,$post_content,$cookie_jar,$isLogin) // static function invoke_post($url,$post_content,$cookie_jar,$isLogin)
{ // {
$ch = curl_init($url); // $ch = curl_init($url);
$this_header = array( // $this_header = array(
'Content-Type: application/json', // 'Content-Type: application/json',
'Content-Length: '.strlen($post_content) // 'Content-Length: '.strlen($post_content)
); // );
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); // curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header); // curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_content); // curl_setopt($ch, CURLOPT_POSTFIELDS, $post_content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($isLogin){ // if($isLogin){
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar); // curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
} // }
else{ // else{
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar); // curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
} // }
curl_setopt($ch, CURLOPT_TIMEOUT, 5); // curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$result = curl_exec($ch); // $result = curl_exec($ch);
curl_close($ch); // curl_close($ch);
return $result; // return $result;
} // }
static function getbxlx($name) // static function getbxlx($name)
{ // {
if($name=='现金'){ // if($name=='现金'){
return 'JSFS01_SYS'; // return 'JSFS01_SYS';
}else{ // }else{
return 'JSFS04_SYS'; // return 'JSFS04_SYS';
} // }
} // }
//构造Web API请求格式 // //构造Web API请求格式
static function create_postdata($args) { // static function create_postdata($args) {
$postdata = array( // $postdata = array(
'format'=>1, // 'format'=>1,
'useragent'=>'ApiClient', // 'useragent'=>'ApiClient',
'rid'=>self::create_guid(), // 'rid'=>self::create_guid(),
'parameters'=>$args, // 'parameters'=>$args,
'timestamp'=>date('Y-m-d'), // 'timestamp'=>date('Y-m-d'),
'v'=>'1.0' // 'v'=>'1.0'
); // );
return json_encode($postdata); // return json_encode($postdata);
} // }
//生成guid // //生成guid
static function create_guid() { // static function create_guid() {
$charid = strtoupper(md5(uniqid(mt_rand(), true))); // $charid = strtoupper(md5(uniqid(mt_rand(), true)));
$hyphen = chr(45);// "-" // $hyphen = chr(45);// "-"
$uuid = chr(123)// "{" // $uuid = chr(123)// "{"
.substr($charid, 0, 8).$hyphen // .substr($charid, 0, 8).$hyphen
.substr($charid, 8, 4).$hyphen // .substr($charid, 8, 4).$hyphen
.substr($charid,12, 4).$hyphen // .substr($charid,12, 4).$hyphen
.substr($charid,16, 4).$hyphen // .substr($charid,16, 4).$hyphen
.substr($charid,20,12) // .substr($charid,20,12)
.chr(125);// "}" // .chr(125);// "}"
return $uuid; // return $uuid;
} // }
} }
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论