You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

241 lines
6.6 KiB
C#

11 months ago
using Common.Utilities;
11 months ago
using djy.IService.Afr;
using djy.Model.AmsDto;
11 months ago
using djy_AfrApi.Attributes;
using Microsoft.AspNetCore.Authorization;
11 months ago
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
namespace djy_AfrApi.Controllers.Common
{
11 months ago
[Route("api/[controller]")]
[ApiController]
[Authorize]
11 months ago
public class CommonController
11 months ago
{
11 months ago
private readonly IAfrService ser;
public CommonController(IAfrService service)
{
this.ser = service;
}
11 months ago
#region 下拉接口
/// <summary>
/// 下拉获取国家
/// </summary>
/// <returns></returns>
[HttpGet("GetCountry")]
11 months ago
[RedisCaching]
11 months ago
public Response<List<CommonCNEN>> GetCountry()
11 months ago
{
var result = new Response<List<CommonCNEN>>();
try
{
11 months ago
result.Result = ser.GetCountry("", 0, 0);
11 months ago
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取船公司
/// </summary>
/// <returns></returns>
[HttpGet("GetCARRIER")]
11 months ago
[RedisCaching]
11 months ago
public Response<List<CommonMappiCode>> GetCARRIER()
{
var result = new Response<List<CommonMappiCode>>();
try
{
result.Result = ser.GetCARRIER();
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取箱型
/// </summary>
/// <returns></returns>
[HttpGet("GetCTNALL")]
11 months ago
[RedisCaching]
11 months ago
public Response<List<CommonMappiCode>> GetCTNALL()
11 months ago
{
11 months ago
var result = new Response<List<CommonMappiCode>>();
11 months ago
try
{
result.Result = ser.GetCTNALL();
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取包装单位
/// </summary>
/// <returns></returns>
[HttpGet("GetPackage")]
11 months ago
[RedisCaching]
11 months ago
public Response<List<CommonMappiCode>> GetPackage()
11 months ago
{
11 months ago
var result = new Response<List<CommonMappiCode>>();
11 months ago
try
{
result.Result = ser.GetPackage();
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取危品等级及 CODE
/// </summary>
/// <returns></returns>
[HttpGet("GetDangerousGoods")]
11 months ago
[RedisCaching]
11 months ago
public Response<List<CodeDangerGradeDto>> GetDangerousGoods()
11 months ago
{
var result = new Response<List<CodeDangerGradeDto>>();
try
{
11 months ago
result.Result = ser.GetDangerousGoods("");
11 months ago
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///// <summary>
///// 下拉获取起运港口
///// </summary>
///// <returns></returns>
//[HttpGet("GetCodePortLoad")]
//public Response<List<CommonCodeValue>> GetCodePortLoad()
//{
// var result = new Response<List<CommonCodeValue>>();
// try
// {
// result.Result = ser.GetCodePortLoad();
// }
// catch (Exception ex)
// {
// result.Code = 500;
// result.Message = ex.InnerException?.Message ?? ex.Message;
// }
// return result;
//}
/// <summary>
/// 下拉获取港口
/// </summary>
/// <returns></returns>
[HttpGet("GetPort")]
11 months ago
[RedisCaching]
11 months ago
public Response<List<CommonCodeValue>> GetPort()
11 months ago
{
var result = new Response<List<CommonCodeValue>>();
try
{
11 months ago
result.Result = ser.GetPort("", 0, 0);
11 months ago
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取船名
/// </summary>
/// <returns></returns>
[HttpGet("GetVessel")]
11 months ago
[RedisCaching]
11 months ago
public Response<List<CommonCodeValue>> GetVessel()
11 months ago
{
var result = new Response<List<CommonCodeValue>>();
try
{
11 months ago
result.Result = ser.GetVessel("", 0, 0);
11 months ago
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///// <summary>
///// 下拉获取省份
///// </summary>
///// <returns></returns>
//[HttpGet("GetCodeProvince")]
//public Response<List<CommonCodeValue>> GetCodeProvince(string code)
//{
// var result = new Response<List<CommonCodeValue>>();
// try
// {
// result.Result = ser.GetCodeProvince(code);
// }
// catch (Exception ex)
// {
// result.Code = 500;
// result.Message = ex.InnerException?.Message ?? ex.Message;
// }
// return result;
//}
///// <summary>
///// 下拉获取城市 邮编
///// </summary>
///// <returns></returns>
//[HttpGet("GetCodeCity")]
//public Response<List<CodeCityDto>> GetCodeCity(string provinceCode)
//{
// var result = new Response<List<CodeCityDto>>();
// try
// {
// result.Result = ser.GetCodeCity(provinceCode);
// }
// catch (Exception ex)
// {
// result.Code = 500;
// result.Message = ex.InnerException?.Message ?? ex.Message;
// }
// return result;
//}
#endregion
}
}