#1409 แก้เป็นส่ง refId ของคำสั่งขอลาออกไปค้นที่ command ก่อนอัพ status = CANCEL
Some checks failed
release-dev / release-dev (push) Failing after 10s

This commit is contained in:
Bright 2025-09-29 11:44:31 +07:00
parent 081260a83b
commit be45cf58b8
2 changed files with 42 additions and 40 deletions

View file

@ -3047,6 +3047,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
commandCode = r.commandCode,
commandName = r.commandName,
remark = r.remark,
resignId = p.RetirementResign.Id,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -3075,26 +3076,26 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
}
}
else
{
var apiUrlOrg = $"{baseAPIOrg}/org/command/cancel-resign";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
{
commandId = resultData.Select(x => x.commandId).ToList(),
});
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
data.ForEach(profile => profile.Status = "DONE");
data.ForEach(profile => profile.RetirementResign.Status = "CANCEL");
await _context.SaveChangesAsync();
}
}
}
//else
//{
// var apiUrlOrg = $"{baseAPIOrg}/org/command/cancel-resign";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
// {
// commandId = resultData.Select(x => x.commandId).ToList(),
// });
// var _result = await _res.Content.ReadAsStringAsync();
// if (_res.IsSuccessStatusCode)
// {
// data.ForEach(profile => profile.Status = "DONE");
// data.ForEach(profile => profile.RetirementResign.Status = "CANCEL");
// await _context.SaveChangesAsync();
// }
// }
//}
return Success();
}

View file

@ -2542,6 +2542,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
commandCode = r.commandCode,
commandName = r.commandName,
remark = r.remark,
resignId = p.RetirementResignEmployee.Id
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -2571,26 +2572,26 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
}
}
else
{
var apiUrlOrg = $"{baseAPIOrg}/org/command/cancel-resign";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
{
commandId = resultData.Select(x => x.commandId).ToList(),
});
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
data.ForEach(profile => profile.Status = "DONE");
data.ForEach(profile => profile.RetirementResignEmployee.Status = "CANCEL");
await _context.SaveChangesAsync();
}
}
}
//else
//{
// var apiUrlOrg = $"{baseAPIOrg}/org/command/cancel-resign";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
// {
// commandId = resultData.Select(x => x.commandId).ToList(),
// });
// var _result = await _res.Content.ReadAsStringAsync();
// if (_res.IsSuccessStatusCode)
// {
// data.ForEach(profile => profile.Status = "DONE");
// data.ForEach(profile => profile.RetirementResignEmployee.Status = "CANCEL");
// await _context.SaveChangesAsync();
// }
// }
//}
return Success();
}