|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
|
using DS.WMS.Core.Fee.Dtos;
|
|
|
|
|
using DS.WMS.Core.Fee.Entity;
|
|
|
|
|
using DS.WMS.Core.Fee.Interface;
|
|
|
|
|
using Mapster;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 往来单位固定费用
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class FeeCustTemplateDetailService : FeeServiceBase, IFeeCustTemplateDetailService
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="serviceProvider"></param>
|
|
|
|
|
public FeeCustTemplateDetailService(IServiceProvider serviceProvider) : base(serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult<List<FeeCustTemplateDetailRes>> GetListByPage(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
var whereList = request.GetConditionalModels(Db);
|
|
|
|
|
var data = TenantDb.Queryable<FeeCustTemplateDetail>()
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Select<FeeCustTemplateDetailRes>().ToQueryPage(request.PageCondition);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 编辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult EditFeeCustTemplateDetail(FeeCustTemplateDetailReq req)
|
|
|
|
|
{
|
|
|
|
|
if (req.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
if (TenantDb.Queryable<FeeCustTemplateDetail>()
|
|
|
|
|
.Where(x => x.FeeId == req.FeeId && x.CustomerId == req.CustomerId && x.FeeType == req.FeeType).Any())
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed("往来单位固定费用已存在!", MultiLanguageConst.FeeCustTemplateDetailExist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = req.Adapt<FeeCustTemplateDetail>();
|
|
|
|
|
|
|
|
|
|
var entity = TenantDb.Insertable(data).ExecuteReturnEntity();
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var info = TenantDb.Queryable<FeeCustTemplateDetail>().Where(x => x.Id == req.Id).First();
|
|
|
|
|
|
|
|
|
|
info = req.Adapt(info);
|
|
|
|
|
|
|
|
|
|
TenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|
|
|
|
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 详情
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult<FeeCustTemplateDetailRes> GetFeeCustTemplateDetailInfo(string id)
|
|
|
|
|
{
|
|
|
|
|
var data = TenantDb.Queryable<FeeCustTemplateDetail>()
|
|
|
|
|
.Where(x => x.Id == long.Parse(id))
|
|
|
|
|
.Select<FeeCustTemplateDetailRes>()
|
|
|
|
|
.First();
|
|
|
|
|
return DataResult<FeeCustTemplateDetailRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据ID批量删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult> DeleteAsync(IdModel model)
|
|
|
|
|
{
|
|
|
|
|
int rows = await TenantDb.Deleteable<FeeCustTemplateDetail>().Where(x => model.Ids.Contains(x.Id)).ExecuteCommandAsync();
|
|
|
|
|
return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|