和先锋系统对接记录

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

和先锋系统对接记录

from clr import AddReference
AddReference("System")
AddReference("System.Net.Http")
AddReference("Newtonsoft.Json")
import clr
clr.AddReference("System")
clr.AddReference("System.Web.Extensions")
clr.AddReference("Kingdee.BOS.Core")
clr.AddReference("Kingdee.BOS")
clr.AddReference("Newtonsoft.Json")
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS.App')
clr.AddReference('Kingdee.BOS.ServiceHelper')
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 *
from System.Data import *
from Kingdee.BOS.App.Data import *
from Kingdee.BOS.ServiceHelper import *
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
sys.setdefaultencoding('utf-8')
from System.Text import *
from System.Net.Http import HttpClient,StringContent
from Newtonsoft.Json import JsonConvert

AddReference("System")
from System.Net import SecurityProtocolType,ServicePointManager


AddReference("Kingdee.BOS.App")

from Kingdee.BOS.App.Data import DBUtils


def AfterDoOperation(e):
     if e.Operation.Operation.upper() == "AUDIT" and e.ExecuteResult:
                if (e.OperationResult.IsSuccess == True):
                        no = this.Model.GetValue("fnumber")
                        #DJZT = this.Model.GetValue("FDOCUMENTSTATUS")   #重新审核D   新建A
                        xjorsh = this.Model.GetValue("F_TBXI_Text")   #通过这个字段判断这个物料是新建还是修改
        
                        if  xjorsh =="1":
                            JK = "UPDATE_MATERIAL";
                            tk = "重新审核";
                        else :
                            JK = "INSERT_MATERIAL";
                            tk = "新建";
                    SQLSAVE = """UPDATE T_BD_MATERIAL  SET  F_TBXI_Text = 1 WHERE fnumber = '%s'    """%no
        
                    count  = DBUtils.Execute(this.Context,SQLSAVE);
        
                        sql = """
                                                 SELECT  * FROM JK_WL where WLBM= '%s'
                                 """%no
                 
                        returnData = DBUtils.ExecuteEnumerable(this.Context,sql)#返回的是动态字符
                        for i in returnData:
                                s ={
                                        'classifyType':i["FZMC"],
                                        'classifyTypeNum':i["FZBM"].ToString(),
                                        'materialName':i["WLMC"],
                                        'materialNum':i["WLBM"].ToString(),
                                        'specification':i["GGXH"].ToString(),
                                        'minAmount':i["AQKC"].ToString(),
                                        'serviceType':JK,#插入INSERT_MATERIAL ,UPDATE_MATERIAL 修改, DEL_MATERIAL  删除
                                        'type':i["SJFZMC"],
                                        'typeNum':i["SJFZBM"].ToString(),
                                        'unit':i["DWMC"],
                                        'unitNumber':i["DWBM"].ToString(),
                                        'materialId':i["WLNM"].ToString(),                             
                                         'messageKey': i["WLBM"].ToString()+i["WLMC"]+i["GGXH"]
                                        }
          
         
            
         #               this.View.ShowWarnningMessage(sql+str(s));
              
                        url = "http://17777777777/out/materials/updateInfo"
                        data = s 
                        
                        JsonObjString = JsonConvert.SerializeObject(data)#构造json格式数据类型
                        httpContent = StringContent(JsonObjString,Encoding.UTF8, "application/json")#转换成符合http的数据类型
                        client = HttpClient() #实例化对象
                        response = client.PostAsync(url,httpContent)
                        text = response.Result.Content.ReadAsStringAsync().Result.ToString()
                        if text[11:16] == "false":
                        #this.View.InvokeFormOperation(FormOperationEnum.UnCancel)
                    this.View.InvokeFormOperation("UnAudit")
                    this.View.ShowMessage("审核失败!"+text);
                        else :
                            this.View.ShowMessage(text);
                            
                    
                    


先锋系统是什么啊?

和先锋系统对接记录

from clr import AddReferenceAddReference("System")AddReference("System.Net.Http")AddReference("Newtonsoft.Json")import clrclr.AddR...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息