|
|
|
|
using Myshipping.Core;
|
|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 箱信息服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ApiDescriptionSettings("Application",Name = "BookingCtn", Order = 1)]
|
|
|
|
|
public class BookingCtnService : IBookingCtnService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
private readonly SqlSugarRepository<BookingCtn> _rep;
|
|
|
|
|
|
|
|
|
|
public BookingCtnService(SqlSugarRepository<BookingCtn> rep)
|
|
|
|
|
{
|
|
|
|
|
_rep = rep;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页查询箱信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/BookingCtn/page")]
|
|
|
|
|
public async Task<dynamic> Page([FromQuery] BookingCtnInput input)
|
|
|
|
|
{
|
|
|
|
|
var entities = await _rep.AsQueryable()
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CTNALL), u => u.CTNALL == input.CTNALL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CNTRNO), u => u.CNTRNO == input.CNTRNO)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SEALNO), u => u.SEALNO == input.SEALNO)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.KINDPKGS), u => u.KINDPKGS == input.KINDPKGS)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CTNSTATUS), u => u.CTNSTATUS == input.CTNSTATUS)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.WEIGHTYPE), u => u.WEIGHTYPE == input.WEIGHTYPE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.WEIGHATTN), u => u.WEIGHATTN == input.WEIGHATTN)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VGMCONNCOM), u => u.VGMCONNCOM == input.VGMCONNCOM)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.WEIGHTEL), u => u.WEIGHTEL == input.WEIGHTEL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.WEIGHDATE), u => u.WEIGHDATE == input.WEIGHDATE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VGMADDR), u => u.VGMADDR == input.VGMADDR)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VGMEMAIL), u => u.VGMEMAIL == input.VGMEMAIL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.REMARK), u => u.REMARK == input.REMARK)
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
return entities.XnPagedResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加箱信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingCtn/add")]
|
|
|
|
|
public async Task Add(AddBookingCtnInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<BookingCtn>();
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除箱信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingCtn/delete")]
|
|
|
|
|
public async Task Delete(DeleteBookingCtnInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
|
await _rep.DeleteAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新箱信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingCtn/edit")]
|
|
|
|
|
public async Task Update(UpdateBookingCtnInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<BookingCtn>();
|
|
|
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取箱信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/BookingCtn/detail")]
|
|
|
|
|
public async Task<BookingCtn> Get([FromQuery] QueryeBookingCtnInput input)
|
|
|
|
|
{
|
|
|
|
|
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取箱信息列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/BookingCtn/list")]
|
|
|
|
|
public async Task<dynamic> List([FromQuery] BookingCtnInput input)
|
|
|
|
|
{
|
|
|
|
|
return await _rep.ToListAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|