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

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)

效果

相关推荐
人道领域1 小时前
【LeetCode刷题日记】131.分割回文串,动态规划优化
java·开发语言·leetcode
z落落1 小时前
C# 接口 interface (多接口实现、类+接口、成员重名)
java·开发语言
张高兴2 小时前
张高兴的 Hailo-10 开发指南:(二)使用 LangChain 搭建本地大模型 RAG 问答应用
python·边缘计算·hailo
财经资讯数据_灵砚智能2 小时前
基于全球经济类多源新闻的NLP情感分析与数据可视化(日间)2026年6月6日
大数据·人工智能·python·ai·信息可视化·自然语言处理·灵砚智能
Land03292 小时前
Python + RPA 双引擎实战:从手写脚本到可交付自动化应用的完整链路
python·自动化·rpa
菜到离谱但坚持2 小时前
【小白零基础】RAG+LangChain 搭建私有知识库问答系统(完整可运行代码+超详细教程+避坑指南)
python·langchain·rag
知识的宝藏2 小时前
Xpaht self::div 轴语法
开发语言
keykey6.2 小时前
卷积神经网络(CNN):让AI学会“看“
开发语言·人工智能·深度学习·机器学习
ss2732 小时前
【入门OJ题解】分苹果问题(Python/Java/C 实现)
java·c语言·python
IsJunJianXin2 小时前
谷歌搜索cookie NID逆向生成
开发语言·python·google搜索·sgss·nid-cookie·算法生成nid·google-cookie