金蝶云星空调用第三方接口

BOS开发

接口调用插件

复制代码
import clr
#添加对cloud插件开发的常用组件的引用
clr.AddReference("System")
clr.AddReference("System.Web.Extensions")
clr.AddReference("Kingdee.BOS")
clr.AddReference("Kingdee.BOS.Core")
clr.AddReference("Newtonsoft.Json")
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
import sys
from System import *
from System.Collections.Generic import *
from System.Threading import *
from System.IO import *
from System.Net import *
from System.Text import *
from System.Security.Cryptography import *
from System.Web.Script.Serialization import *
from System.Collections.Generic import Dictionary
from Newtonsoft.Json.Linq import *

def post(url,postdata):
 	encode = "UTF-8";
	webRequest = HttpWebRequest.Create(url);
	webRequest.Method = "POST";
	webRequest.ContentType = "application/json"; 
	paraUrlCoded = postdata;
	payload = Encoding.GetEncoding(encode.ToUpper()).GetBytes(paraUrlCoded);
	webRequest.ContentLength = payload.Length;
	writer = webRequest.GetRequestStream();
	writer.Write(payload, 0, payload.Length);
	writer.Close();
	response = webRequest.GetResponse();
	sr = StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encode));
	res = sr.ReadToEnd(); 
	return res; 

def BarItemClick(e) :
	if e.BarItemKey=="tbApprove" :	
		F_workFlowContainerId  = this.View.Model.GetValue("F_workFlowContainerId")
		FDocumentStatus  = this.View.Model.GetValue("FDocumentStatus")
		userName = this.Context.UserName
		remarks = "审批单据";
            #workFlowContainerId  = this.View.Model.GetValue("F_workFlowContainerId")
		postdata = '''{\"workFlowContainerId\":\"'''+F_workFlowContainerId+'''\",\"processResult\":\"S\",\"backReason\":\"'''+userName+remarks+'''\"}''';
		test = post("http://10.20.26.23:7002/rest/v1/ErpPushBackPlmMessage/FlowContainerReasonForRejection",postdata)
复制代码
import clr
#添加对cloud插件开发的常用组件的引用
clr.AddReference("System")
clr.AddReference("System.Web.Extensions")
clr.AddReference("Kingdee.BOS")
clr.AddReference("Kingdee.BOS.Core")
clr.AddReference("Newtonsoft.Json")
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
import sys
from System import *
from System.Collections.Generic import *
from System.Threading import *
from System.IO import *
from System.Net import *
from System.Text import *
from System.Security.Cryptography import *
from System.Web.Script.Serialization import *
from System.Collections.Generic import Dictionary
from Newtonsoft.Json.Linq import *

def post(url,postdata):
 	encode = "UTF-8";
	webRequest = HttpWebRequest.Create(url);
	webRequest.Method = "POST";
	webRequest.ContentType = "application/json"; 
	paraUrlCoded = postdata;
	payload = Encoding.GetEncoding(encode.ToUpper()).GetBytes(paraUrlCoded);
	webRequest.ContentLength = payload.Length;
	writer = webRequest.GetRequestStream();
	writer.Write(payload, 0, payload.Length);
	writer.Close();
	response = webRequest.GetResponse();
	sr = StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encode));
	res = sr.ReadToEnd(); 
	return res; 

def BarItemClick(e) :
	if e.BarItemKey=="tbReject" :	
		F_workFlowContainerId  = this.View.Model.GetValue("F_workFlowContainerId")
		FDocumentStatus  = this.View.Model.GetValue("FDocumentStatus")
		userName = this.Context.UserName
		remarks = "反审单据";
            #workFlowContainerId  = this.View.Model.GetValue("F_workFlowContainerId")
		postdata = '''{\"workFlowContainerId\":\"'''+F_workFlowContainerId+'''\",\"processResult\":\"E\",\"backReason\":\"'''+userName+remarks+'''\"}''';
		test = post("http://10.20.26.23:7002/rest/v1/ErpPushBackPlmMessage/FlowContainerReasonForRejection",postdata)
		this.View.ShowMessage(test)

效果

相关推荐
Yolanda_20221 分钟前
26.网络模型的保存与读取
人工智能·pytorch·python
涉密IT资质笔记3 分钟前
涉密资质投入产出分析模型:时间成本、四块成本构成与 ROI 决策框架
java·开发语言·算法
北风toto16 分钟前
KMP 算法详解:从暴力匹配到 O(n+m) 的字符串搜索
java·开发语言·算法
william_yangshun17 分钟前
WordCraft 观察:纯 Rust 重写文字处理器,把文档变成可编程对象
开发语言·后端·rust·文档自动化
weixin1997010801618 分钟前
《京东JOS API:落地方案、接口边界与业务踩坑 —— 联盟免费 vs 商家按量的双轨制》(附python源码)
java·网络·python
外收内放19 分钟前
数据分析(数据查询与选择)
python·学习·数据分析
dtq042421 分钟前
C++ - 变量
开发语言·c++
林澈在路上23 分钟前
哪个写歌软件可以用自己声音?MELO音乐详解
人工智能·python·算法
撸串-研究生23 分钟前
面向景区的综合服务管理平台设计——以稻城亚丁景区为例【附源码】
java·开发语言·vue.js·前后端分离·稻城亚丁景区
wuyk55524 分钟前
样章-第03讲-FreeRTOS在16KB-RAM上的裁剪与陷阱
c语言·开发语言·stm32·单片机·嵌入式硬件·物联网·系统架构