Browse Source

同步sap返回失败时,提示信息加上明细中第一条失败信息

chenxy 5 năm trước cách đây
mục cha
commit
0b5b53fb98
1 tập tin đã thay đổi với 42 bổ sung25 xóa
  1. 42 25
      DK.Service/SAPDataService/SAPDataLogic.cs

+ 42 - 25
DK.Service/SAPDataService/SAPDataLogic.cs

@@ -1914,35 +1914,43 @@ namespace Dongke.IBOSS.PRD.Service.SAPHegiiDataService
 					// 登录
 					UserNamePasswordClientCredential credential =
 						sapClient.ClientCredentials.UserName;
-                    //credential.UserName = "hgsapdk";
-                    //credential.Password = "Sapdk#240";
-                    INIUtility ini = INIUtility.Instance(INIUtility.IniFile.SAP_HEGII);
-                    credential.UserName = ini.ReadIniData("SAP_HEGII", "UserName");
-                    credential.Password = ini.ReadIniData("SAP_HEGII", "Password");
-                    // 参数
-                    sapParameter.ZSUMSpecified = true;
+					//credential.UserName = "hgsapdk";
+					//credential.Password = "Sapdk#240";
+					INIUtility ini = INIUtility.Instance(INIUtility.IniFile.SAP_HEGII);
+					credential.UserName = ini.ReadIniData("SAP_HEGII", "UserName");
+					credential.Password = ini.ReadIniData("SAP_HEGII", "Password");
+					// 参数
+					sapParameter.ZSUMSpecified = true;
 					sapParameter.TABLE_OUT = new ZSPP100[0];
 					// 接口
 					sapResult = sapClient.ZPPFM008(sapParameter);
 
-                    if (sapResult.ZTYPE == "S")
-                    {
-                        // 结果
-                        OutputLog.TraceLog(LogPriority.Information,
-                                "HGSAPDK_ZPPFM008",
-                                "yyyymmdd:" + yyyymmdd + " datacode:" + datacode + " Zsum:" + sapParameter.ZSUM,
-                                " Ztype:" + sapResult.ZTYPE + " Zmsg:" + sapResult.ZMSG,
-                                LocalPath.LogExePath + "SAP_HEGII\\Info_");
-                    }
-                    else
-                    {
-                        // 结果
-                        OutputLog.TraceLog(LogPriority.Information,
-                                "HGSAPDK_ZPPFM008",
-                                "yyyymmdd:" + yyyymmdd + " datacode:" + datacode + " Zsum:" + sapParameter.ZSUM + " Ztype:" + sapResult.ZTYPE + " Zmsg:" + sapResult.ZMSG,
-                                JsonHelper.ToJson(sapResult),
-                                LocalPath.LogExePath + "SAP_HEGII\\Error_");
-                    }
+					if (sapResult.ZTYPE == "S")
+					{
+						// 结果
+						OutputLog.TraceLog(LogPriority.Information,
+								"HGSAPDK_ZPPFM008",
+								"yyyymmdd:" + yyyymmdd + " datacode:" + datacode + " Zsum:" + sapParameter.ZSUM,
+								" Ztype:" + sapResult.ZTYPE + " Zmsg:" + sapResult.ZMSG,
+								LocalPath.LogExePath + "SAP_HEGII\\Info_");
+					}
+					else
+					{
+						foreach (ZSPP100 item in sapResult.TABLE_OUT)
+						{
+							if (!string.IsNullOrWhiteSpace(item.ZMSG))
+							{
+								sapResult.ZMSG += $"[{item.ZMSG}]";
+								break;
+							}
+						}
+						// 结果
+						OutputLog.TraceLog(LogPriority.Information,
+								"HGSAPDK_ZPPFM008",
+								"yyyymmdd:" + yyyymmdd + " datacode:" + datacode + " Zsum:" + sapParameter.ZSUM + " Ztype:" + sapResult.ZTYPE + " Zmsg:" + sapResult.ZMSG,
+								JsonHelper.ToJson(sapResult),
+								LocalPath.LogExePath + "SAP_HEGII\\Error_");
+					}
 				}
 			}
 			catch (Exception ex)
@@ -2002,6 +2010,15 @@ namespace Dongke.IBOSS.PRD.Service.SAPHegiiDataService
                     }
                     else
                     {
+                        foreach (ZSPP110 item in sapResult.TABLE_OUT)
+                        {
+							if (!string.IsNullOrWhiteSpace(item.ZMSG))
+							{
+								sapResult.ZMSG += $"[{item.ZMSG}]";
+								break;
+							}
+                        }
+
                         // 结果
                         OutputLog.TraceLog(LogPriority.Information,
                                 "HGSAPDK_ZPPFM010",