|
|
|
|
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;
|
|
|
|
|
using Furion.Logging;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Core.Service
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// EDI参数设置服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ApiDescriptionSettings(Name = "DjyEdiSetting", Order = 1)]
|
|
|
|
|
public class DjyEdiSettingService : IDjyEdiSettingService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
private readonly SqlSugarRepository<DjyEdiSetting> _rep;
|
|
|
|
|
private readonly ILogger<DjyEdiSetting> _logger;
|
|
|
|
|
|
|
|
|
|
public DjyEdiSettingService(SqlSugarRepository<DjyEdiSetting> rep, ILogger<DjyEdiSetting> logger)
|
|
|
|
|
{
|
|
|
|
|
_rep = rep;
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页查询EDI参数设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/DjyEdiSetting/page")]
|
|
|
|
|
public async Task<dynamic> Page([FromQuery] QueryDjyEdiSettingInput input)
|
|
|
|
|
{
|
|
|
|
|
_rep.Context.QueryFilter.Clear();
|
|
|
|
|
var entities = await _rep.AsQueryable()
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.EDICODE), u => u.EDICODE == input.EDICODE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.EDINAME), u => u.EDINAME.Contains(input.EDINAME.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SERVERIP), u => u.SERVERIP.Contains(input.SERVERIP.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FOLDERNAME), u => u.FOLDERNAME.Contains(input.FOLDERNAME.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.USERNAME), u => u.USERNAME.Contains(input.USERNAME.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PASSWORD), u => u.PASSWORD.Contains(input.PASSWORD.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SENDCODE), u => u.SENDCODE.Contains(input.SENDCODE.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RECEIVECODE), u => u.RECEIVECODE.Contains(input.RECEIVECODE.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SENDNAME), u => u.SENDNAME.Contains(input.SENDNAME.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SENDATTN), u => u.SENDATTN.Contains(input.SENDATTN.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SENDTEL), u => u.SENDTEL.Contains(input.SENDTEL.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SENDEMAIL), u => u.SENDEMAIL.Contains(input.SENDEMAIL.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SENDCOMPANYCODE), u => u.SENDCOMPANYCODE.Contains(input.SENDCOMPANYCODE.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SENDSUBCOMPANYCODE), u => u.SENDSUBCOMPANYCODE.Contains(input.SENDSUBCOMPANYCODE.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CARRIERID), u => u.CARRIERID.Contains(input.CARRIERID.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RECEIVEEMAIL), u => u.RECEIVEEMAIL.Contains(input.RECEIVEEMAIL.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RECEIVESIEMAIL), u => u.RECEIVESIEMAIL.Contains(input.RECEIVESIEMAIL.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RECEIVEOP), u => u.RECEIVEOP.Contains(input.RECEIVEOP.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RECEIVESALE), u => u.RECEIVESALE.Contains(input.RECEIVESALE.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RECEIVEDEPT), u => u.RECEIVEDEPT.Contains(input.RECEIVEDEPT.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERTEL), u => u.SHIPPERTEL.Contains(input.SHIPPERTEL.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEETEL), u => u.CONSIGNEETEL.Contains(input.CONSIGNEETEL.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYTEL), u => u.NOTIFYPARTYTEL == input.NOTIFYPARTYTEL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ISUSETEL), u => u.ISUSETEL == input.ISUSETEL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TenantName), u => u.TenantName.Contains(input.TenantName.Trim()))
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
return entities.XnPagedResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加EDI参数设置(同一租户、同一代码的会更新)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/DjyEdiSetting/add")]
|
|
|
|
|
public async Task Add(AddDjyEdiSettingInput input)
|
|
|
|
|
{
|
|
|
|
|
_rep.Context.QueryFilter.Clear();
|
|
|
|
|
var entity = _rep.FirstOrDefault(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId);
|
|
|
|
|
if (entity == null)
|
|
|
|
|
{
|
|
|
|
|
entity = input.Adapt<DjyEdiSetting>();
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity = input.Adapt(entity);
|
|
|
|
|
await _rep.UpdateAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新EDI参数设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/DjyEdiSetting/edit")]
|
|
|
|
|
public async Task Update(UpdateDjyEdiSettingInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<DjyEdiSetting>();
|
|
|
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除EDI参数设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/DjyEdiSetting/delete")]
|
|
|
|
|
public async Task Delete(GetDjyEdiSettingInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
|
await _rep.DeleteAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取EDI参数设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/DjyEdiSetting/detail")]
|
|
|
|
|
public async Task<DjyEdiSetting> Get([FromQuery] GetDjyEdiSettingInput input)
|
|
|
|
|
{
|
|
|
|
|
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// 获取EDI参数设置列表
|
|
|
|
|
///// </summary>
|
|
|
|
|
///// <param name="input"></param>
|
|
|
|
|
///// <returns></returns>
|
|
|
|
|
//[HttpGet("/DjyEdiSetting/list")]
|
|
|
|
|
//public async Task<dynamic> List([FromQuery] QueryDjyEdiSettingInput input)
|
|
|
|
|
//{
|
|
|
|
|
// return await _rep.ToListAsync();
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|