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

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)

效果

相关推荐
噢,我明白了29 分钟前
JAVA中的一些基础应用知识点
java·开发语言
时间的拾荒人2 小时前
Redis 入门详解:核心特性、重要文件与全局命令实战
开发语言·redis·面试
敲上瘾2 小时前
Qt Widgets入门:项目模板解析与Hello World
开发语言·数据库·c++·qt·ui·qt6.3
合尘猫2 小时前
图片表格变结构化数据:OCR 后的三个坑
python·ocr
小小张说故事2 小时前
Python 里弱引用到底弱在哪:拆开 weakref.ref、回调陷阱和 WeakValueDictionary
python
用户019027581613 小时前
用 DuckDB 存查 A 股 K 线:零服务、SQL 直接分析
python
码途行者3 小时前
网站的SQL 注入:从攻击原理到防御措施
开发语言·sql·php
旖旎夜光3 小时前
【C++ 基础入门】C++ 多态(中):虚函数表、多态原理与动静绑定
开发语言·c++·笔记·学习
你看我名字3 小时前
产品参数昨天还对,今天已过期:数眼智能与大模型应用如何做资料版本校验
开发语言·架构
程序员果子4 小时前
本体构建方法
人工智能·python·知识图谱·agent框架·本体