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

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)

效果

相关推荐
小雨笙笙3 分钟前
C语言:指针
c语言·开发语言
Jialu.20 分钟前
中文 NLP 模型部署实战:FastAPI 接口 + Streamlit 看板
人工智能·python·自然语言处理·fastapi
旧梦952729 分钟前
Java EnumMap 详解:原理、用法与实战
java·开发语言
snow@li1 小时前
Java:微服务项目与单体项目区别、市场占有率全景深度分析
java·开发语言·微服务
Asum1ta1 小时前
K8s 学习环境搭建:Python 与 PyCharm 开发环境配置指南
python·学习·kubernetes
知识汲取者1 小时前
FastAPI 学习教程(写给想学 FastAPI 的 Java 工程师的)
python·学习·fastapi
吴声子夜歌2 小时前
Java——性能和效率
java·开发语言
飞Link2 小时前
动作方法中的分割与过度分割方法全解析(含代码实战与踩坑案例)
人工智能·python·算法·计算机视觉
小鹿的周先生2 小时前
第四章-SpringAI-函数调用&ToolCalling
开发语言·人工智能·python
神仙别闹2 小时前
基于C++ MFC 实现的智慧公交系统
开发语言·c++·mfc