😎修改查询ecn逻辑、修改sap服务请求报文、优化输出参数逻辑

This commit is contained in:
bairubing 2024-11-12 10:44:15 +08:00
parent 4dac24916b
commit ad441155a5
2 changed files with 11 additions and 13 deletions

View File

@ -326,7 +326,7 @@ public class SapService : IDynamicApiController, ITransient
foreach (var item in items)
{
var element = new XElement("item",
new XElement("MATNR", item.Matnr)
new XElement("Matnr", item.Matnr)
);
itemElements.Add(element);
@ -367,9 +367,7 @@ public class SapService : IDynamicApiController, ITransient
new XElement("Datuv", input.Datuv),
new XElement("Lvorm", input.Lvorm),
new XElement("Item",
new XElement("item",
EcnItem(input.ItemList)
)
)
)
)

View File

@ -33,21 +33,21 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
public SqlSugarRepository<Obj118> _obj118Rep;
private readonly SysConfigService _sysConfigService;
public Common.DataValidationService _dataValidationService;
public SapService.SapService _sapService;
public SapService.SapService _sapService;
public ChangeNoticeEcnService(
SqlSugarRepository<Obj118> obj118Rep,
SysConfigService sysConfigService,
DataValidationService dataValidationService,
SapService.SapService sapService
)
{
_obj118Rep = obj118Rep;
_sysConfigService = sysConfigService;
_dataValidationService = dataValidationService;
_sapService = sapService;
}
/// <summary>
/// 分页查询变更通知ECN
@ -59,7 +59,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
public async Task<SqlSugarPagedList<ChangeNoticeEcnOutput>> Page(PageChangeNoticeEcnInput input)
{
var query = await _obj118Rep.AsQueryable()
.Where(x => (x.CheckedStatus == 1 || x.CheckedStatus == 0) && x.deleted == false && x.IsLatestVersion == true)
.Where(x => (x.CheckedStatus == 1 || x.CheckedStatus == 0) && x.deleted == false && x.IsLatestVersion == true && x._System_CurrentStage == "结束")
.WhereIF(!string.IsNullOrWhiteSpace(input._System_objNBS), u => u._System_objNBS.Contains(input._System_objNBS.Trim()))
.WhereIF(input.fld004693Range != null && input.fld004693Range.Length == 2, u => u.fld004693 >= input.fld004693Range[0] && u.fld004693 <= input.fld004693Range[1])
.Select<ChangeNoticeEcnOutput>()
@ -99,7 +99,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
var apiOutput = await _sapService.SapEcnApi(sapEcnInput);
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
var msg = apiOutput.msg;
if (apiOutput.msg == "")
if (apiOutput.msg == "" && apiOutput.code == "S")
{
msg = "同步成功";
}
@ -133,7 +133,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
[DisplayName("变更通知ECN-批量同步到SAP")]
public async Task<List<SapOutput>> BatchSyncToSAP(List<ChangeNoticeEcnInput> input)
{
var SapOutputList = new List<SapOutput>();
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
for (int i = 0; i < input.Count; i++)
@ -162,7 +162,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
var apiOutput = await _sapService.SapEcnApi(sapEcnInput);
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
var msg = apiOutput.msg;
if (apiOutput.msg == "")
if (apiOutput.msg == "" && apiOutput.code == "S")
{
msg = "同步成功";
}
@ -199,7 +199,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
public async Task<List<SapOutput>> TimingSyncToSAP()
{
var input = await _obj118Rep.AsQueryable()
.Where(x => (x.CheckedStatus == 1 || x.CheckedStatus == 0) && x.deleted == false && x.IsLatestVersion == true && (x.fld005292 == "A" || x.fld005292 == "M"))
.Where(x => (x.CheckedStatus == 1 || x.CheckedStatus == 0) && x._System_CurrentStage == "结束" && x.deleted == false && x.IsLatestVersion == true && x.fld005292 == "A")
.ToListAsync();
var SapOutputList = new List<SapOutput>();
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
@ -229,7 +229,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
var apiOutput = await _sapService.SapEcnApi(sapEcnInput);
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
var msg = apiOutput.msg;
if (apiOutput.msg == "")
if (apiOutput.msg == "" && apiOutput.code == "S")
{
msg = "同步成功";
}