1
zrg
昨天 639ea7256f10697d19c19cc878e999bcb7b1e6a1
WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
@@ -18,6 +18,7 @@
        public DataSet ds = new DataSet();
        public WebServer webserver = new WebServer();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        grdAlignment omdelMian = new grdAlignment();
        List<grdAlignmentSub> omdelsub = new List<grdAlignmentSub>();
@@ -903,7 +904,8 @@
            { "zh-Hans", "HFieldName"},
            { "zh-Hant", "HFieldName"},
            { "en", "HTranslationText_English"},
            { "es", "HTranslationText_Spain"}
            { "es", "HTranslationText_Spain"},
            { "Thai", "HTranslationText_Thai"}
        };
        /// <summary>
@@ -916,8 +918,23 @@
        [HttpGet]
        public object SelectMESLanguage_JSON(string language, bool forceUpdate)
        {
            try
            {
                // 判断是否启用多语言配置
               string enableRemote = oSystemParameter.GetSingleSystemParameter("Xt_grdAlignment_WMES_RemoteTransFileCTL", ref DBUtility.ClsPub.sErrInfo);
               if (enableRemote == "N")
               {
                   objJsonResult.code = "1";
                   objJsonResult.count = 1;
                   objJsonResult.Message = "Success!";
                   objJsonResult.data = null;
                   var objJObj = JObject.FromObject(objJsonResult);
                   objJObj["EnableRemoteI18n"] = enableRemote;
                   return objJObj;
               }
                // 获取项目根目录
                string path = HttpContext.Current.Server.MapPath($"~/LanguagePack"); ;
                string lang;
@@ -928,7 +945,7 @@
                    language = "zh-Hans";
                    lang = "HFieldName";
                }
                ds = oCN.RunProcReturn("select * from  h_v_Xt_LanModuleList where 1=1", "h_v_Xt_LanModuleList");
                ds = oCN.RunProcReturn("select * from  h_v_Xt_LanModuleList where 1=1 order by HUpdateDate desc", "h_v_Xt_LanModuleList");
                // 如果目录不存在则创建目录
                if (!Directory.Exists(path))
@@ -961,11 +978,17 @@
                {
                    languagePack["_Version"] = 0;
                }
                if (languagePack["_UpdateDate"] == null)
                {
                    languagePack["_UpdateDate"] = "";
                }
                LogService.Write("语言包中数据条数: " + languagePack["_Version"].ToString() + "\n数据库中数据条数: " + ds.Tables[0].Rows.Count.ToString());
                if (languagePack["_Version"].Value<int>() != ds.Tables[0].Rows.Count || forceUpdate == true)
                if (languagePack["_Version"].Value<int>() != ds.Tables[0].Rows.Count || forceUpdate == true || languagePack["_UpdateDate"].Value<string>() != ds.Tables[0].Rows[0]["HUpdateDate"].ToString())
                {
                    // 更新版本号(数据条目数)
                    languagePack["_Version"] = ds.Tables[0].Rows.Count;
                    //更新字段翻译日期
                    languagePack["_UpdateDate"] = ds.Tables[0].Rows[0]["HUpdateDate"].ToString();
                    // 统计每个字符模块中 字段码出现的次数 如果出现多次,则映射为JArray类型
                    Dictionary<string, int> HFieldCodeDict = ds.Tables[0].AsEnumerable()
                    .GroupBy(row => new
@@ -1035,7 +1058,9 @@
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Success!";
                    objJsonResult.data = languagePack;
                    return objJsonResult;
                    var objJObj = JObject.FromObject(objJsonResult);
                    objJObj["EnableRemoteI18n"] = enableRemote;
                    return objJObj;
                } else
                {
                    // 版本号一致, 则直接返回读取的Json字符串
@@ -1043,7 +1068,9 @@
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Success!";
                    objJsonResult.data = JObject.Parse(JsonStr1);
                    return objJsonResult;
                    var objJObj = JObject.FromObject(objJsonResult);
                    objJObj["EnableRemoteI18n"] = enableRemote;
                    return objJObj;
                }
            }
            catch(Exception e)
@@ -1053,7 +1080,9 @@
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
                var objJObj = JObject.FromObject(objJsonResult);
                objJObj["EnableRemoteI18n"] = "N";
                return objJObj;
            }
        }
        #endregion