From 9f38d372f716349ec19bc27e209eaf476ef4935b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Mon, 14 Oct 2024 17:49:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8F=91=E7=A5=A8=E4=BB=A3=E7=A0=81API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Code/Interface/ICodeInvoiceService.cs | 36 +++++++++ .../Code/Method/CodeInvoiceService.cs | 74 +++++++++++++++++++ .../Controllers/CodeInvoiceController.cs | 69 +++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 ds-wms-service/DS.WMS.Core/Code/Interface/ICodeInvoiceService.cs create mode 100644 ds-wms-service/DS.WMS.Core/Code/Method/CodeInvoiceService.cs create mode 100644 ds-wms-service/DS.WMS.MainApi/Controllers/CodeInvoiceController.cs diff --git a/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeInvoiceService.cs new file mode 100644 index 00000000..e066b15b --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeInvoiceService.cs @@ -0,0 +1,36 @@ +using DS.Module.Core; +using DS.WMS.Core.Code.Entity; + +namespace DS.WMS.Core.Code.Interface +{ + public interface ICodeInvoiceService + { + /// + /// 列表 + /// + /// + /// + Task>> GetListAsync(PageRequest request); + + /// + /// 获取详情 + /// + /// + /// + Task> GetAsync(long id); + + /// + /// 新增/修改 + /// + /// + /// + Task> EditAsync(CodeInvoice ci); + + /// + /// 删除 + /// + /// + /// + Task DeleteAsync(params long[] ids); + } +} diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodeInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodeInvoiceService.cs new file mode 100644 index 00000000..c25db05a --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodeInvoiceService.cs @@ -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 + { + /// + /// 初始化 + /// + /// + public CodeInvoiceService(IServiceProvider serviceProvider) : base(serviceProvider) + { + } + + /// + /// 列表 + /// + /// + /// + public async Task>> GetListAsync(PageRequest request) + { + //序列化查询条件 + var whereList = request.GetConditionalModels(Db); + var data = TenantDb.Queryable() + .Where(whereList) + .ToQueryPage(request.PageCondition); + return data; + } + + /// + /// 获取详情 + /// + /// + /// + public async Task> GetAsync(long id) + { + var ci = await TenantDb.Queryable().FirstAsync(x => x.Id == id); + return DataResult.Success(ci); + } + + /// + /// 新增/修改 + /// + /// + /// + public async Task> EditAsync(CodeInvoice ci) + { + try + { + await TenantDb.Storageable(ci).DefaultAddElseUpdate().ExecuteCommandAsync(); + return DataResult.Success(ci); + } + catch (Exception ex) + { + await ex.LogAsync(Db); + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); + } + } + + /// + /// 删除 + /// + /// + /// + public async Task DeleteAsync(params long[] ids) + { + int rows = await TenantDb.Deleteable().Where(x => ids.Contains(x.Id)).ExecuteCommandAsync(); + return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); + } + } +} diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeInvoiceController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeInvoiceController.cs new file mode 100644 index 00000000..b5d2e032 --- /dev/null +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeInvoiceController.cs @@ -0,0 +1,69 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using DS.WMS.Core.Code.Entity; +using DS.WMS.Core.Code.Interface; +using Microsoft.AspNetCore.Mvc; + +namespace DS.WMS.MainApi.Controllers +{ + /// + /// 发票代码API + /// + public class CodeInvoiceController : ApiController + { + private readonly ICodeInvoiceService _invokeService; + + /// + /// 构造函数 + /// + /// + public CodeInvoiceController(ICodeInvoiceService invokeService) + { + _invokeService = invokeService; + } + + /// + /// 列表 + /// + /// + /// + [HttpPost, Route("GetList")] + public async Task>> GetListAsync([FromBody] PageRequest request) + { + return await _invokeService.GetListAsync(request); + } + + /// + /// 获取详情 + /// + /// 发票代码ID + /// + [HttpGet, Route("Edit")] + public async Task> GetAsync([FromQuery] long id) + { + return await _invokeService.GetAsync(id); + } + + /// + /// 新增/修改 + /// + /// 发票代码 + /// + [HttpPost, Route("Edit")] + public async Task> EditAsync([FromBody] CodeInvoice ci) + { + return await _invokeService.EditAsync(ci); + } + + /// + /// 删除 + /// + /// + /// + [HttpPost, Route("Delete")] + public async Task DeleteAsync([FromBody] IdModel idModel) + { + return await _invokeService.DeleteAsync(idModel.Ids); + } + } +} From 5c74b7e68309791b1ad608a6882dff2f032f1528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Mon, 14 Oct 2024 17:52:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E9=93=B6=E8=A1=8C=E7=9A=84=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=80=A7=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs index b94e63f7..f6e531f5 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs @@ -58,8 +58,8 @@ public class ClientBankService : ServiceBase, IClientBankService { if (req.Id == 0) { - if (await TenantDb.Queryable().Where(x => x.CodeName == req.CodeName).AnyAsync()) - return DataResult.Failed("客户银行信息已存在!", MultiLanguageConst.ClientBankExist); + //if (await TenantDb.Queryable().Where(x => x.CodeName == req.CodeName).AnyAsync()) + // return DataResult.Failed("客户银行信息已存在!", MultiLanguageConst.ClientBankExist); var data = req.Adapt(); var entity = await TenantDb.InsertNav(data).Include(x => x.InvoiceHeaders).ExecuteReturnEntityAsync();