New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Newtonsoft.Json; |
| | | |
| | | namespace WebAPI |
| | | { |
| | | public static class InvokeHelper |
| | | { |
| | | //private static string CloudUrl = "http://localhost/k3cloud/";//K/3 Cloud 业务站点地址 |
| | | //private static string CloudUrl = "http://60.190.4.42:9002/k3cloud/";//K/3 Cloud 业务站点地址 |
| | | //private static string CloudUrl = "http://47.96.97.237/k3cloud/";//K/3 Cloud 业务站点地址 |
| | | private static string CloudUrl = "http://60.190.4.42:9002/K3CLOUD/";//夏宝 |
| | | |
| | | /// <summary> |
| | | /// 登陆 |
| | | /// </summary> |
| | | public static string Login() |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc"); |
| | | |
| | | List<object> Parameters = new List<object>(); |
| | | Parameters.Add("61b14ea86f5c8a");//账套标示 |
| | | Parameters.Add("Administrator");//用户名 |
| | | Parameters.Add("888888");//密码 |
| | | Parameters.Add(2052);//2052代表中文 |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | |
| | | public static async Task<string> LoginAsync() |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc"); |
| | | List<object> Parameters = new List<object>(); |
| | | Parameters.Add("5f9258a311401c");//账套标示 |
| | | Parameters.Add("Administrator");//用户名 |
| | | Parameters.Add("qaz!@#123");//密码 |
| | | Parameters.Add(2052);//2052代表中文 |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | |
| | | return await httpClient.AsyncRequest(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 保存 |
| | | /// </summary> |
| | | /// <param name="formId"></param> |
| | | /// <param name="content"></param> |
| | | /// <returns></returns> |
| | | public static string Save(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc"); |
| | | |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | |
| | | public static string BatchSave(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.BatchSave.common.kdsvc"); |
| | | |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | |
| | | public static async Task<string> SaveAsync(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc"); |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return await httpClient.AsyncRequest(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 提交 |
| | | /// </summary> |
| | | /// <param name="formId"></param> |
| | | /// <param name="content"></param> |
| | | /// <returns></returns> |
| | | public static string Submit(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit.common.kdsvc"); |
| | | |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | /// <summary> |
| | | /// 删除 |
| | | /// </summary> |
| | | /// <param name="formId"></param> |
| | | /// <param name="content"></param> |
| | | /// <returns></returns> |
| | | public static string Delete(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Delete.common.kdsvc"); |
| | | |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | |
| | | public static async Task<string> DeleteAsync(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Delete.common.kdsvc"); |
| | | |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return await httpClient.AsyncRequest(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 审核 |
| | | /// </summary> |
| | | /// <param name="formId"></param> |
| | | /// <param name="content"></param> |
| | | /// <returns></returns> |
| | | public static string Audit(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc"); |
| | | |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | /// <summary> |
| | | /// 查询 |
| | | /// </summary> |
| | | /// <param name="formId"></param> |
| | | /// <param name="content"></param> |
| | | /// <returns></returns> |
| | | public static string View(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.View.common.kdsvc"); |
| | | |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | |
| | | public static string UnAudit(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.UnAudit.common.kdsvc"); |
| | | |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | |
| | | public static string Push(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Push.common.kdsvc"); |
| | | |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | |
| | | public static string Query(string formId, string content) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc"); |
| | | List<object> Parameters = new List<object>(); |
| | | //业务对象Id |
| | | //Parameters.Add(formId); |
| | | //Json字串 |
| | | Parameters.Add(content); |
| | | httpClient.Content = JsonConvert.SerializeObject(Parameters); |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 自定义 |
| | | /// </summary> |
| | | /// <param name="key">自定义方法标识</param> |
| | | /// <param name="args">参数</param> |
| | | /// <returns></returns> |
| | | public static string AbstractWebApiBusinessService(string key, List<object> args) |
| | | { |
| | | HttpClient httpClient = new HttpClient(); |
| | | httpClient.Url = string.Concat(CloudUrl, key, ".common.kdsvc"); |
| | | |
| | | httpClient.Content = JsonConvert.SerializeObject(args); |
| | | return httpClient.SyncRequest(); |
| | | } |
| | | } |
| | | } |