From d3e81088f1afdc01b14af6bdac533116ab0cdb60 Mon Sep 17 00:00:00 2001 From: bklLiudl <673013083@qq.com> Date: 星期五, 27 六月 2025 17:04:54 +0800 Subject: [PATCH] Merge branch 'master' into Liudl --- Wms/WMS.BLL/SysServer/CustomerServer.cs | 41 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 1 deletions(-) diff --git a/Wms/WMS.BLL/SysServer/CustomerServer.cs b/Wms/WMS.BLL/SysServer/CustomerServer.cs index 0d8783c..3ffd2fb 100644 --- a/Wms/WMS.BLL/SysServer/CustomerServer.cs +++ b/Wms/WMS.BLL/SysServer/CustomerServer.cs @@ -4,8 +4,10 @@ using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; +using Model.InterFaceModel; using Model.ModelDto.SysDto; using SqlSugar; +using WMS.Entity.Context; using WMS.Entity.LogEntity; using WMS.Entity.SysEntity; using WMS.IBLL.ILogServer; @@ -16,6 +18,7 @@ { public class CustomerServer : ICustomerServer { + private static readonly SqlSugarScope Db = DataContext.Db; public ICustomerRepository CustomerRst { get; set; } private readonly IOperationSysServer _operation; //鎿嶄綔鏃ュ織 public CustomerServer(ICustomerRepository customerRst, IOperationSysServer operation) @@ -23,7 +26,7 @@ CustomerRst = customerRst; _operation = operation; } - + public async Task<List<CustomerDto>> GetCustomerList(string no, string name, int? type, string linkMan, string phone, int page, int limit, RefAsync<int> count) { @@ -172,5 +175,41 @@ var num = await CustomerRst.RemoveAllAsync(list, userId); return num > 0; } + + /// <summary> + /// SAP鏂板瀹㈡埛渚涘簲鍟嗘暟鎹� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + /// <exception cref="Exception"></exception> + public async Task<string> AddCustomerSap(SendCustomerVm model) + { + try + { + //鍒ゆ柇鏄惁閲嶅 + var customer = Db.Queryable<SysCustomer>().First(m => m.IsDel == "0" && m.CustomerNo == model.customerNo.ToString()); + if (customer != null) + { + throw new Exception("鐩稿悓缂栫爜鐨勫鎴峰凡瀛樺湪锛岃鍕块噸澶嶆坊鍔�"); + } + var addCustomer = new SysCustomer() + { + CustomerNo = model.customerNo.ToString(), + CustomerName = model.customerName, + Type = int.Parse(model.CustomerType), + Address = model.streetAddress, + LinkMan = model.contact, + Phone = model.contactMobile, + + CreateUser = 0, + }; + await Db.Insertable(addCustomer).ExecuteCommandAsync(); + return "0"; + } + catch (Exception e) + { + throw new Exception(e.Message); + } + } } } -- Gitblit v1.8.0