Commit inicial: ITCA_API_SAP_WMS (.NET Core 3.1)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
2b82744eb8
168 files changed
+11066
No files matched your search
@@ -0,0 +1,58 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Net.Business.DTO.WMS.HojaRuta;
|
||||
using Net.Business.DTO.WMS.Picking;
|
||||
using Net.Business.Services.Log;
|
||||
using Net.Data;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Business.Services.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ApiExplorerSettings(GroupName = "ApiSAPWMS")]
|
||||
[Authorize(AuthenticationSchemes = "Bearer")]
|
||||
public class HojaRutaController : ControllerBase
|
||||
{
|
||||
private readonly IRepositoryWrapper _repository;
|
||||
public HojaRutaController(IRepositoryWrapper repository)
|
||||
{
|
||||
this._repository = repository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ProducesResponseType(StatusCodes.Status201Created)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<IActionResult> POST([FromBody] Dto_HojaRutaCreate value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Master object is null"), "Hoja Ruta", "", "", "0", "0");
|
||||
return BadRequest("Master object is null");
|
||||
}
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Invalid model object"), "Hoja Ruta", "", "", "0", "0");
|
||||
return BadRequest("Invalid model object");
|
||||
}
|
||||
|
||||
var ObjectNew = await _repository.HR.SetCreateHojaRuta(value.RetornaModelo());
|
||||
|
||||
if (ObjectNew.StatusCode != 200)
|
||||
{
|
||||
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Hoja Ruta", "", "", "0", "0");
|
||||
return BadRequest(ObjectNew);
|
||||
}
|
||||
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Hoja Ruta", "", "", ObjectNew?.DocNum.ToString(), ObjectNew?.DocEntry.ToString());
|
||||
return Ok(ObjectNew);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user