using Procurement.Enums;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc;
using Procurement.EntityFrameworkCore.SqlRepositories;
using Procurement.ViewModel;
using Procurement.Helpers;
using System.Data.SqlClient;
using System.Data;
namespace Procurement.Controllers
{
[Produces("application/json")]
[Route("api/[controller]")]
public class ASNBOLShipperMasterController : AbpController
{
private readonly ISqlRepository _repository;
public ASNBOLShipperMasterController(ISqlRepository sqlRepository)
{
_repository = sqlRepository;
}
///
/// ΅₯ΊΕΡ‘ΤρΑΠ±ν
///
///
///
[Route("nbrselectlist")]
[HttpGet]
public async Task Get(string domain, string type, string userno)
{
ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
string subMsg = "";
dynamic items = null;
try
{
SqlParameter[] parameters = {
new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
new SqlParameter { ParameterName = "@Type", Value = type,SqlDbType=SqlDbType.VarChar},
new SqlParameter { ParameterName = "@UserNo", Value = userno,SqlDbType=SqlDbType.VarChar},
};
items = await _repository.GetSingleListByProcAsync("pr_WMS_GetASNBOLShipperList", parameters);
}
catch (Exception ex)
{
subMsg = ex.Message;
code = ResultCode.Fail;
subCode = ResultCode.Fail;
}
ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
return Ok(result);
}
[Route("nbrdetails")]
[HttpGet]
public async Task GetNbrDetails(string domain, string nbr, string type)
{
ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
string subMsg = "";
dynamic items = null;
try
{
SqlParameter[] parameters = {
new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
new SqlParameter { ParameterName = "@Nbr", Value = nbr,SqlDbType=SqlDbType.VarChar},
new SqlParameter { ParameterName = "@Type", Value = type,SqlDbType=SqlDbType.VarChar}
};
items = await _repository.GetListByProcAsync("pr_WMS_GetASNBOLShipperDetails", parameters);
}
catch (Exception ex)
{
subMsg = ex.Message;
code = ResultCode.Fail;
subCode = ResultCode.Fail;
}
ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
return Ok(result);
}
}
}