Exemple #1
0
        /// <summary>
        /// K3WebApi接口
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="dataType"></param>
        /// <param name="operateType"></param>
        /// <param name="formId"></param>
        /// <param name="numbers"></param>
        /// <param name="pkIds"></param>
        /// <param name="json"></param>
        /// <returns></returns>
        public static HttpResponseResult InvokeBatchOperate(Context ctx, SynchroDataType dataType, SynOperationType operateType, string formId, IEnumerable <string> numbers = null, IEnumerable <int> pkIds = null, string json = null)
        {
            HttpResponseResult response = default(HttpResponseResult);

            try
            {
                type = DynamicInvoke.GetType(DynamicInvoke.GetAssembly(Assembly.GetExecutingAssembly().Location), "Hands.K3.SCM.App.Synchro.Utils.K3WebApi.InvokeWebApi");

                if (type != null)
                {
                    response = DynamicInvoke.InvokeMethod <HttpResponseResult>(ctx, type, GetMethodName(type, operateType), GetAgrs(ctx, operateType, dataType, formId, json, numbers, pkIds));

                    if (response != null)
                    {
                        if (!string.IsNullOrEmpty(response.Message) && response.Message.Contains("Timeout 时间已到。在操作完成之前超时时间已过或服务器未响应。"))
                        {
                            LogUtils.WriteSynchroLog(ctx, dataType, "数据批量" + operateType + "过程中出现异常,异常信息:服务器没有响应!!!");
                        }
                    }
                }
                else
                {
                    response         = new HttpResponseResult();
                    response.Success = false;
                    response.Message = "反射获取程序集失败!";

                    LogUtils.WriteSynchroLog(ctx, dataType, "数据批量" + operateType + "过程中出现异常,异常信息:" + response.Message);
                    return(response);
                }
            }

            catch (Exception ex)
            {
                LogUtils.WriteSynchroLog(ctx, dataType, "数据批量" + operateType + "过程中出现异常,异常信息:" + ex.Message + System.Environment.NewLine + ex.StackTrace);
            }

            return(response);
        }