|
|
@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
using DS.Module.Core;
|
|
|
|
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Code.Entity;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Code.Interface;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Code.Method
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public class CodeInvoiceService : ServiceBase, ICodeInvoiceService
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 初始化
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="serviceProvider"></param>
|
|
|
|
|
|
|
|
public CodeInvoiceService(IServiceProvider serviceProvider) : base(serviceProvider)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 列表
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public async Task<DataResult<List<CodeInvoice>>> GetListAsync(PageRequest request)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
|
|
|
var whereList = request.GetConditionalModels(Db);
|
|
|
|
|
|
|
|
var data = TenantDb.Queryable<CodeInvoice>()
|
|
|
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
|
|
|
.ToQueryPage(request.PageCondition);
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取详情
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public async Task<DataResult<CodeInvoice>> GetAsync(long id)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var ci = await TenantDb.Queryable<CodeInvoice>().FirstAsync(x => x.Id == id);
|
|
|
|
|
|
|
|
return DataResult<CodeInvoice>.Success(ci);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 新增/修改
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="ci"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public async Task<DataResult<CodeInvoice>> EditAsync(CodeInvoice ci)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await TenantDb.Storageable(ci).DefaultAddElseUpdate().ExecuteCommandAsync();
|
|
|
|
|
|
|
|
return DataResult<CodeInvoice>.Success(ci);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await ex.LogAsync(Db);
|
|
|
|
|
|
|
|
return DataResult<CodeInvoice>.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 删除
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="ids"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public async Task<DataResult> DeleteAsync(params long[] ids)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int rows = await TenantDb.Deleteable<CodeInvoice>().Where(x => ids.Contains(x.Id)).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|