From 5283fa35215bc599aba8d4914d4ccb868da99596 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期五, 06 三月 2026 11:22:06 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs | 106 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 97 insertions(+), 9 deletions(-)
diff --git a/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs b/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
index 6914c54..34c7096 100644
--- a/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
+++ b/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
@@ -903,7 +903,8 @@
{ "zh-Hans", "HFieldName"},
{ "zh-Hant", "HFieldName"},
{ "en", "HTranslationText_English"},
- { "es", "HTranslationText_Spain"}
+ { "es", "HTranslationText_Spain"},
+ { "Thai", "HTranslationText_Thai"}
};
/// <summary>
@@ -928,7 +929,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))
@@ -948,7 +949,7 @@
using (StreamReader sr = new StreamReader(Path.Combine(path, $"{language}.json"), Encoding.UTF8))
{
string lines;
- while ((lines = sr.ReadLine()) != null)//涓�琛屼竴琛屽幓璇伙紝濡傛灉璇诲彇杩欎竴琛岃祴鍊糽ines,骞朵笖lines= null璇佹槑璇诲彇瀹屼簡
+ while ((lines = sr.ReadLine()) != null)
{
JsonStr1 += lines;
@@ -961,11 +962,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();
// 缁熻姣忎釜瀛楃妯″潡涓� 瀛楁鐮佸嚭鐜扮殑娆℃暟 濡傛灉鍑虹幇澶氭锛屽垯鏄犲皠涓篔Array绫诲瀷
Dictionary<string, int> HFieldCodeDict = ds.Tables[0].AsEnumerable()
.GroupBy(row => new
@@ -981,7 +988,7 @@
keySelector: p => $@"{p.HModuleCode}_{p.HFieldCode}",
elementSelector: p => p.rowNum
);
-
+ int subIndex = 0;
// 鐗堟湰鍙蜂笉涓�鑷� 鍒欒鍙栨暟鎹簱涓殑瀛楁锛屽皢瀛楁鍐欏叆鍒癹son瀵硅薄涓�
foreach (DataRow row in ds.Tables[0].Rows)
{
@@ -1007,8 +1014,23 @@
languagePack[HModuleCode][HFieldCode] = new JArray();
}
- var targetJArray = (JArray)languagePack[HModuleCode][HFieldCode];
- targetJArray.Add(row[lang].ToString());
+ var targetJArray = languagePack[HModuleCode][HFieldCode] as JArray;
+
+ if (subIndex < rowNum - 1)
+ {
+ if (targetJArray.Count < subIndex + 1)
+ {
+ targetJArray.Add(row[lang].ToString());
+ }else
+ {
+ targetJArray[subIndex] = row[lang].ToString();
+ }
+ subIndex++;
+ }else
+ {
+ subIndex = 0;
+ }
+
}
}
@@ -1019,7 +1041,7 @@
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Success锛�";
- objJsonResult.data = languagePack.ToString();
+ objJsonResult.data = languagePack;
return objJsonResult;
} else
{
@@ -1027,7 +1049,7 @@
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Success锛�";
- objJsonResult.data = JsonStr1;
+ objJsonResult.data = JObject.Parse(JsonStr1);
return objJsonResult;
}
}
@@ -1036,6 +1058,72 @@
LogService.Write("Exception锛�" + e.ToString());
objJsonResult.code = "0";
objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鍗曟嵁缈昏瘧 璇█鍖呯己澶辩殑閿� 鍙嶅悜鏄犲皠鍒版暟鎹簱
+ [Route("Xt_grdAlignment_WMES/syncMissingKeyToDB")]
+ [HttpGet]
+ public Object syncMissingKeyToDB(string missingObj)
+ {
+ oCN.BeginTran();
+ try
+ {
+ // 閫掑叆鐨勫弬鏁� 缁撴瀯鏄� { 妯″潡鍚�: [瀛楁鍚�1,瀛楁鍚�2] }
+ JObject missingKeys = JObject.Parse(missingObj);
+
+
+ // 閬嶅巻椤跺眰JObject瀵硅薄
+ foreach(var HMouldNameKVP in missingKeys)
+ {
+ // 鏌ヨ涓昏〃涓槸鍚﹀瓨鍦ㄨ妯″潡 瀛樺湪锛屽垯杩斿洖涓昏〃涓殑妯″潡HInterID锛屼笉瀛樺湪锛屽垯鑾峰彇鏈�澶InterID+1
+ string HMouldCode = HMouldNameKVP.Key;
+ ds = oCN.RunProcReturn($"Exec h_p_syncMissingKeyToDB @HModuleCode='{HMouldCode}'", "h_p_syncMissingKeyToDB");
+ int HInterID = (int)ds.Tables[0].Rows[0]["HInterID"];
+ int rowCount = (int)ds.Tables[0].Rows[0]["rc"];
+ int HEntryID = (int)ds.Tables[0].Rows[0]["HEntryID"];
+
+ // 鎻掑叆涓昏〃
+ if (rowCount == 0)
+ {
+ oCN.RunProc($@"insert into Xt_LanModuleMain(HInterID, HBillType, HModuleName, HModuleCode)
+ values({HInterID}, 3033, '', '{HMouldCode}')");
+ }
+
+
+ string sql = $@"insert into Xt_LanModuleSub(HInterID, HEntryID, HFieldModelType, HFieldCode, HFieldName, HTranslationText_English, HTranslationText_Spain)
+ values";
+ // 鎻掑叆瀛愯〃
+ JArray HFieldCodes = HMouldNameKVP.Value as JArray;
+ for(int i=0;i<HFieldCodes.Count; i++)
+ {
+
+ sql += $@"({HInterID}, {HEntryID+i}, 'i18n', '{HFieldCodes[i]}','{HFieldCodes[i]}','{HFieldCodes[i]}','{HFieldCodes[i]}'),";
+ }
+
+ sql = sql.Substring(0, sql.Length - 1) + ";";
+
+ oCN.RunProc(sql);
+ }
+
+
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Success!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ LogService.Write("Exception锛�" + e.ToString());
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
objJsonResult.Message = "Exception锛�" + e.Message.ToString();
objJsonResult.data = null;
return objJsonResult;
--
Gitblit v1.9.1