| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region#SAP实体类 |
| | | public class SapSkuInfoVm |
| | | { |
| | | public SendSkuInfoVm data { get; set; } |
| | | } |
| | | public class SendSkuInfoVm |
| | | { |
| | | /// <summary> |
| | | /// 物料号 |
| | | /// </summary> |
| | | public long skuNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 物料名称 |
| | | /// </summary> |
| | | public string skuName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 物料类目 |
| | | /// </summary> |
| | | public string categoryNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 物料类目名称 |
| | | /// </summary> |
| | | public string categoryName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 物料存放区域 |
| | | /// </summary> |
| | | public string regionNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否免检 |
| | | /// </summary> |
| | | public int consume { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 基本单位 |
| | | /// </summary> |
| | | public string unit { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 包装数量 |
| | | /// </summary> |
| | | public decimal packageQty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 箱单位 |
| | | /// </summary> |
| | | public string packageName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 规格 |
| | | /// </summary> |
| | | public string specification { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 保质期 |
| | | /// </summary> |
| | | public string? shelfLife { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 出库临期天数 |
| | | /// </summary> |
| | | public string? remainingDays { get; set; } |
| | | } |
| | | |
| | | public class SapCustomerVm |
| | | { |
| | | public SendCustomerVm data { get; set; } |
| | | } |
| | | /// <summary> |
| | | /// 下发同步客户供应商数据 |
| | | /// </summary> |
| | | public class SendCustomerVm |
| | | { |
| | | /// <summary> |
| | | /// 编号 |
| | | /// </summary> |
| | | public long customerNo { get; set; } |
| | | /// <summary> |
| | | /// 名称 |
| | | /// </summary> |
| | | public string customerName { get; set; } |
| | | /// <summary> |
| | | /// 类型 0:客户、1:供应商、 |
| | | /// </summary> |
| | | public string CustomerType { get; set; } |
| | | /// <summary> |
| | | /// 地址 |
| | | /// </summary> |
| | | public string streetAddress { get; set; } |
| | | /// <summary> |
| | | /// 联系人 |
| | | /// </summary> |
| | | public string contact { get; set; } |
| | | /// <summary> |
| | | /// 联系人电话 |
| | | /// </summary> |
| | | public string contactMobile { get; set; } |
| | | } |
| | | #endregion |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using AutoMapper; |
| | | using Model.InterFaceModel; |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using Utility; |
| | |
| | | #endregion |
| | | |
| | | #region erp |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取erp数据 |
| | | /// </summary> |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region sap |
| | | |
| | | /// <summary> |
| | | /// SAP新增物料主数据数据 |
| | | /// </summary> |
| | | /// <param name="model">erp实体</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<string> AddSkuSap(SendSkuInfoVm model) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | if (string.IsNullOrWhiteSpace(model.skuNo.ToString()) || string.IsNullOrWhiteSpace(model.skuName) || string.IsNullOrWhiteSpace(model.categoryNo)) |
| | | { |
| | | throw new Exception("参数错误"); |
| | | } |
| | | //判断是否唯一 |
| | | var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == model.skuNo.ToString()); |
| | | if (sku != null) |
| | | { |
| | | throw new Exception("当前物料已存在"); |
| | | } |
| | | //开启事务 |
| | | Db.BeginTran(); |
| | | |
| | | var category = Db.Queryable<SysMaterialCategory>().First(w => w.IsDel == "0" && w.CategoryNo == model.categoryNo); |
| | | if (category == null) |
| | | { |
| | | category = new SysMaterialCategory() |
| | | { |
| | | CategoryNo = model.categoryNo, |
| | | CategoryName = model.categoryName, |
| | | CreateUser = 1 |
| | | }; |
| | | //添加物料类别信息 |
| | | Db.Insertable(category).ExecuteCommand(); |
| | | } |
| | | var pack = new SysPackag() |
| | | { |
| | | PackagNo = model.skuNo.ToString(), |
| | | PackagName = model.skuName, |
| | | L1Num = 1, |
| | | L1Name = model.unit, |
| | | L2Num = Convert.ToInt32(model.packageQty), |
| | | L2Name = model.packageName |
| | | }; |
| | | //添加包装信息 |
| | | Db.Insertable(pack).ExecuteCommand(); |
| | | |
| | | var addSku = new SysMaterials() |
| | | { |
| | | SkuNo = model.skuNo.ToString(), |
| | | SkuName = model.skuName, |
| | | Standard = model.specification, |
| | | CategoryNo = category.CategoryNo, |
| | | AuditStatusNo = "9", //model.AuditStatusNo |
| | | Type = "0", |
| | | IsControlled = "0",//是否请验,0:是 1:否 |
| | | IsInspect = model.consume.ToString() == "0" ? "1" : "0", |
| | | IsPasteCode = "1", |
| | | Origin = "SAP", |
| | | UnitNo = model.unit, |
| | | PackagNo = pack.PackagNo, |
| | | Environment = null, |
| | | Weight = null, |
| | | Warranty = Convert.ToInt32(model.shelfLife.Trim()), |
| | | UnpackWarranty = null, |
| | | Price = null, |
| | | AdventTime = Convert.ToInt32(model.remainingDays) |
| | | }; |
| | | await Db.Insertable(addSku).ExecuteCommandAsync(); |
| | | |
| | | //提交事务 |
| | | Db.CommitTran(); |
| | | |
| | | return "0"; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //回滚事务 |
| | | Db.RollbackTran(); |
| | | //抛出异常 |
| | | throw new Exception("新增erp数据异常", ex); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | using Model.ModelDto.SysDto; |
| | | using Model.InterFaceModel; |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | /// <param name="userId"></param> |
| | | /// <returns></returns> |
| | | Task<bool> DelsCustomer(List<int> ids, int userId); |
| | | |
| | | /// <summary> |
| | | /// SAP新增客户供应商数据 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | Task<string> AddCustomerSap(SendCustomerVm model); |
| | | } |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Model.InterFaceModel; |
| | | using Model.ModelDto.SysDto; |
| | | using WMS.Entity.SysEntity; |
| | | |
| | |
| | | Task<int> EditERP(ERPTestDto erpdto); |
| | | |
| | | #endregion |
| | | |
| | | #region sap |
| | | |
| | | /// <summary> |
| | | /// SAP新增物料主数据数据 |
| | | /// </summary> |
| | | /// <param name="model">erp实体</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | Task<string> AddSkuSap(SendSkuInfoVm model); |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | using WMS.IBLL; |
| | | using ZXing.QrCode.Internal; |
| | | using System.Xml.Linq; |
| | | using WMS.IBLL.ISysServer; |
| | | |
| | | namespace Wms.Controllers |
| | | { |
| | |
| | | private readonly IStockCheckServer _stockCheckSvc;//盘点单Svc |
| | | private readonly IProcurePlanServer _procurePlanSvc;//采购单Svs |
| | | private readonly IPdaAsnServer _pdaAsnServer;// PDA |
| | | private readonly IMaterialsServer _materialSvc;//物料Svc |
| | | private readonly ICustomerServer _customerSvc;//客户Svc |
| | | private readonly IHttpServer _http; |
| | | |
| | | |
| | | private string logStr = $@".\log\SAP赋码\Sap下发报文" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | |
| | | public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc, IPdaAsnServer pdaAsnServer, IHttpServer http) |
| | | public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc, IPdaAsnServer pdaAsnServer, IMaterialsServer materialSvc, ICustomerServer customerSvc, IHttpServer http) |
| | | { |
| | | _config = setting.Value; |
| | | _exNoticeSvc = exNoticeSvc; |
| | |
| | | _stockCheckSvc = stockCheckSvc; |
| | | _procurePlanSvc = procurePlanSvc; |
| | | _pdaAsnServer = pdaAsnServer; |
| | | _materialSvc = materialSvc; |
| | | _customerSvc = customerSvc; |
| | | _http = http; |
| | | } |
| | | #endregion |
| | |
| | | /// <returns></returns> |
| | | [AllowAnonymous] |
| | | [HttpPost] |
| | | public IActionResult CreateSku(object model) |
| | | public async Task<IActionResult> CreateSku(SapSkuInfoVm model) |
| | | { |
| | | var logStr = $@".\log\SAP\物料主数据下发" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | try |
| | | { |
| | | LogFile.SaveLogToFile($"Sap物料主数据:( {model} ),", logStr); |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | | LogFile.SaveLogToFile($"Sap物料主数据:( {jsonData} ),", logStr);; |
| | | |
| | | var str = await _materialSvc.AddSkuSap(model.data); |
| | | |
| | | var list = new { Success = 0, Message = "下发成功" }; |
| | | if (!str.Contains("0")) |
| | | { |
| | | list = new { Success = -1, Message = str }; |
| | | } |
| | | |
| | | LogFile.SaveLogToFile($"SAP物料主数据下发:( {JsonConvert.SerializeObject(list)} ),", logStr); |
| | | return Ok(new { result = true, code = "1" ,message = "success" }); |
| | | } |
| | | catch (Exception e) |
| | |
| | | /// <returns></returns> |
| | | [AllowAnonymous] |
| | | [HttpPost] |
| | | public IActionResult CreateCustomer(object model) |
| | | public async Task<IActionResult> CreateCustomer(SapCustomerVm model) |
| | | { |
| | | |
| | | var logStr = $@".\log\SAP\客户供应商主数据同步" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | try |
| | | { |
| | | LogFile.SaveLogToFile($"Sap客户信息主数据:( {model} ),", logStr); |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | | LogFile.SaveLogToFile($"Sap客户信息主数据:( {jsonData} ),", logStr); |
| | | |
| | | var str = await _customerSvc.AddCustomerSap(model.data); |
| | | |
| | | var list = new { Success = 0, Message = "下发成功" }; |
| | | if (!str.Contains("0")) |
| | | { |
| | | list = new { Success = -1, Message = str }; |
| | | } |
| | | |
| | | LogFile.SaveLogToFile($"客户供应商主数据同步:( {JsonConvert.SerializeObject(list)} ),", logStr); |
| | | |
| | | return Ok(new { result = true, code = "1", message = "success" }); |
| | | } |
| | | catch (Exception e) |