python脚本实现应付单提交时实时推送给接口原创
金蝶云社区-Lang图腾
Lang图腾
12人赞赏了该文章 1,309次浏览 未经作者许可,禁止转载编辑于2021年04月22日 08:38:46

from clr import AddReference

AddReference('System.Net.Http')

AddReference('Newtonsoft.Json')

from System.Net.Http import HttpClient, StringContent

from Newtonsoft.Json import JsonConvert


def BarItemClick(e):

     if e.BarItemKey=='tbSplitSubmit':

         bill_no = this.Model.GetValue('FBillNo')

         data = {

         'bill_no': bill_no

         }

         json_obj_string = JsonConvert.SerializeObject(data)

         http_content = StringContent(json_obj_string)

         client = HttpClient()

         url = 'http://127.0.0.1:9000/PushAPPayable'

         response = client.PostAsync(url, http_content).Result.Content.ReadAsStringAsync().Result.ToString()

         this.View.ShowMessage(response)


赞 12