| | |
| | | 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; |
| | |
| | | { |
| | | 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) |
| | |
| | | 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) |
| | | { |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |