diff --git a/src/BarCode.Web.Api/Controllers/BoxMarkController.cs b/src/BarCode.Web.Api/Controllers/BoxMarkController.cs index 44c4d10..f0a24e8 100644 --- a/src/BarCode.Web.Api/Controllers/BoxMarkController.cs +++ b/src/BarCode.Web.Api/Controllers/BoxMarkController.cs @@ -25,16 +25,19 @@ namespace BarCode.Web.Api.Controllers private readonly IBoxMarkService _boxMarkService; private readonly IBoxMarkRepositories _boxMarkRepositories; private readonly IExportExcelService _exportExcelService; + private readonly IErpBasicDataExtendService _erpBasicDataExtendService; + public BoxMarkController( ILoginService loginService, IBoxMarkRepositories boxMarkRepositories, IBoxMarkService boxMarkService, - IExportExcelService exportExcelService) + IExportExcelService exportExcelService, IErpBasicDataExtendService erpBasicDataExtendService) { this._loginService = loginService; this._boxMarkService = boxMarkService; this._exportExcelService = exportExcelService; this._boxMarkRepositories = boxMarkRepositories; + this._erpBasicDataExtendService = erpBasicDataExtendService; } /// diff --git a/src/BarCode.Web.Api/wwwroot/BarCode.Web.Core.xml b/src/BarCode.Web.Api/wwwroot/BarCode.Web.Core.xml index 210cc99..c194ee9 100644 --- a/src/BarCode.Web.Api/wwwroot/BarCode.Web.Core.xml +++ b/src/BarCode.Web.Api/wwwroot/BarCode.Web.Core.xml @@ -160,16 +160,16 @@ 物料规格型号 - - - 物料编码 - - 物料名称 + + + 物料编码 + + 69条码 @@ -266,6 +266,16 @@ 物料 + + + 物料规格 + + + + + 物料名称 + + 产品数量 diff --git a/src/BarCode.Web.Api/wwwroot/BarCode.Web.Domain.xml b/src/BarCode.Web.Api/wwwroot/BarCode.Web.Domain.xml index 376c7bb..0bbe084 100644 --- a/src/BarCode.Web.Api/wwwroot/BarCode.Web.Domain.xml +++ b/src/BarCode.Web.Api/wwwroot/BarCode.Web.Domain.xml @@ -181,6 +181,16 @@ 物料编码 + + + 物料编码 + + + + + 物料名称 + + 产品数量 diff --git a/src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs b/src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs index 51fe966..ec3565f 100644 --- a/src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs +++ b/src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs @@ -34,14 +34,15 @@ namespace BarCode.Web.Core.Dto /// public string Specifications { get; set; } /// + /// 物料名称 + /// + public string MaterialName { get; set; } + /// /// 物料编码 /// public string MaterialNumber { get; set; } - /// - /// 物料名称 - /// - public string MaterialName { get; set; } + /// /// 69条码 diff --git a/src/BarCode.Web.Core/Dto/BoxMark/GenerateBoxMarkDto.cs b/src/BarCode.Web.Core/Dto/BoxMark/GenerateBoxMarkDto.cs index a11834a..78c7273 100644 --- a/src/BarCode.Web.Core/Dto/BoxMark/GenerateBoxMarkDto.cs +++ b/src/BarCode.Web.Core/Dto/BoxMark/GenerateBoxMarkDto.cs @@ -28,6 +28,14 @@ namespace BarCode.Web.Core.Dto [Required(ErrorMessage = "物料不能为空")] public string MaterialNumber { get; set; } = string.Empty; + /// + /// 物料规格 + /// + public string? Specifications { get; set; } = string.Empty; + /// + /// 物料名称 + /// + public string? MaterialName { get; set; } = string.Empty; /// /// 产品数量 /// diff --git a/src/BarCode.Web.Domain/Entitys/BoxMark.cs b/src/BarCode.Web.Domain/Entitys/BoxMark.cs index df3a2e3..b4e7779 100644 --- a/src/BarCode.Web.Domain/Entitys/BoxMark.cs +++ b/src/BarCode.Web.Domain/Entitys/BoxMark.cs @@ -36,8 +36,20 @@ namespace BarCode.Web.Domain.Entitys /// /// 物料编码 /// + public string MaterialNumber { get; set; } + /// + /// 物料编码 + /// + [Column("Specifications")] + public string Specifications { get; set; } + + /// + /// 物料名称 + /// + [Column("MaterialName")] + public string MaterialName { get; set; } /// /// 产品数量 /// diff --git a/src/BarCode.Web.Domain/Services/BoxMarkService.cs b/src/BarCode.Web.Domain/Services/BoxMarkService.cs index acc66d5..964a4f9 100644 --- a/src/BarCode.Web.Domain/Services/BoxMarkService.cs +++ b/src/BarCode.Web.Domain/Services/BoxMarkService.cs @@ -1,19 +1,22 @@ using AutoMapper; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Erp; using BarCode.Web.Core.Dto.Login; using BarCode.Web.Core.Internal.Results; using BarCode.Web.Domain.Entitys; using BarCode.Web.Domain.Infrastructure; using BarCode.Web.Domain.IService; using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Services.Public; using BarCode.Web.Domain.Values; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Org.BouncyCastle.Utilities.Date; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; namespace BarCode.Web.Domain.Services { @@ -26,14 +29,18 @@ namespace BarCode.Web.Domain.Services public readonly IBasicsRepositories _transactionRepositories; private readonly IBoxMarkRepositories _boxMarkRepositories; private readonly ILogger _logger; + private readonly IErpBasicDataExtendService _erpBasicDataExtendService; + private readonly IErpService _erpService; public BoxMarkService(IMapper mapper, ILogger logger, IBasicsRepositories transactionRepositories, - IBoxMarkRepositories boxMarkRepositories) + IBoxMarkRepositories boxMarkRepositories, IErpBasicDataExtendService erpBasicDataExtendService, IErpService erpService) { _mapper = mapper; _logger = logger; _transactionRepositories = transactionRepositories; _boxMarkRepositories = boxMarkRepositories; + _erpBasicDataExtendService = erpBasicDataExtendService; + _erpService = erpService; } /// @@ -54,12 +61,23 @@ namespace BarCode.Web.Domain.Services //1.获取最新的箱唛信息 var billNo_new = await _boxMarkRepositories.GetLastBillNo(); + var materials_result = _erpService.BillQueryForMaterial().GetAwaiter().GetResult(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + dto.Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, dto.MaterialNumber); + dto.MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, dto.MaterialNumber); + + + //2.dto映射实体 var entity = new BoxMark(); entity= _mapper.Map(dto, entity); entity.Create(loginInfo.UserInfo.UcId); entity.SupplierCode = supplierCode; entity.OrgCode = orgCode; + entity.Specifications = dto.Specifications; + entity.MaterialName=dto.MaterialName; int new_firstBillNo = billNo_new == null ? 0 : billNo_new.FirstBillNo; int new_lastBillNo = billNo_new == null ? 0 : billNo_new.LastBillNo; entity.GenerateBillNo(new_firstBillNo, new_lastBillNo); diff --git a/src/BarCode.Web.Repositories/BoxMarkRepositories.cs b/src/BarCode.Web.Repositories/BoxMarkRepositories.cs index 388c9ce..4744fcb 100644 --- a/src/BarCode.Web.Repositories/BoxMarkRepositories.cs +++ b/src/BarCode.Web.Repositories/BoxMarkRepositories.cs @@ -155,9 +155,9 @@ namespace BarCode.Web.Repositories DetailId=s.detail.Id, BillNo = s.detail.BillNo, OrderBillNo = s.order.OrderBillNo, - MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.order.MaterialNumber), + MaterialName = string.IsNullOrEmpty(s.order.MaterialName) ? _erpBasicDataExtendService.GetMaterialName(materials, s.order.MaterialNumber) : s.order.MaterialName, //_erpBasicDataExtendService.GetMaterialName(materials, s.order.MaterialNumber), MaterialNumber = s.order.MaterialNumber, - Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.order.MaterialNumber), + Specifications = string.IsNullOrEmpty(s.order.Specifications) ? _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.order.MaterialNumber) : s.order.Specifications,//_erpBasicDataExtendService.GetMaterialSpecifications(materials, s.order.MaterialNumber), BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.order.MaterialNumber), CratingQty = s.order.CratingQty,