From 61aff77568c638c1a7829566235f19bd9089e1d5 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Thu, 22 Feb 2024 16:27:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E4=B8=8A=E4=BB=B7=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E5=90=8E=E4=BF=AE=E6=94=B9=E5=95=86=E5=AE=B6=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=BE=97remark=20=E5=A2=9E=E5=8A=A0=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E7=9B=B8=E5=85=B3=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Incoming/PlanReader.cs | 27 ++++++++++- .../DTOs/PurchasePriceSheetDTO.cs | 46 +++++-------------- .../IPurchasePriceSheetAppService.cs | 4 +- .../PurchasePriceSheetAppService.cs | 18 +++++++- .../PurchasePriceSheetAutoMapperProfile.cs | 2 - .../PurchasePrices/PurchasePriceSheet.cs | 25 +++++----- ...ceSheetDbContextModelCreatingExtensions.cs | 7 +-- .../PutawayNotes/IPutawayNoteAppService.cs | 2 + .../PutawayNotes/PutawayNoteAppService.cs | 20 ++++++++ .../PurchaseOrders/PurchaseOrderAppService.cs | 1 + 10 files changed, 92 insertions(+), 60 deletions(-) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/PlanReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/PlanReader.cs index 8ef4e92dd..cdca95ebf 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/PlanReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/PlanReader.cs @@ -5,6 +5,7 @@ using System.Text.Json; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Volo.Abp.Guids; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS; @@ -20,17 +21,20 @@ public class PlanReader : IReader private readonly IIncomingFromExternalManager _incomingFromExternalManager; private readonly ILogger _logger; private readonly IGuidGenerator _guidGenerator; + private readonly IPurchasePriceSheetAppService _purchasePriceSheetAppService; public PlanReader( IPlanManager planManager , IIncomingFromExternalManager incomingFromExternalManager , ILogger logger - , IGuidGenerator guidGenerator + , IGuidGenerator guidGenerator, + IPurchasePriceSheetAppService purchasePriceSheetAppService ) { _planManager = planManager; _incomingFromExternalManager = incomingFromExternalManager; _logger = logger; _guidGenerator = guidGenerator; + _purchasePriceSheetAppService = purchasePriceSheetAppService; } @@ -43,6 +47,12 @@ public class PlanReader : IReader _logger.LogInformation("no plans"); return new List(); } + var pobillno = await GetPriceItems(toBeProcessedPlans).ConfigureAwait(false); + if (pobillno.Count > 0) + { + toBeProcessedPlans = toBeProcessedPlans.Where(r => !pobillno.Contains(r.PlanBillNo)).ToList(); + } + //Plan逐一转换为PurchaseOrder var incomingDataList = BuildIncomingFromExternalFromPlanAsync(toBeProcessedPlans); await _incomingFromExternalManager.CreateBulkAsync(incomingDataList).ConfigureAwait(false); @@ -50,7 +60,22 @@ public class PlanReader : IReader await _planManager.UpdateProcessedListAsync(toBeProcessedPlans).ConfigureAwait(false); return incomingDataList; } + private async Task> GetPriceItems(List toBeProcessedPlans) + { + List pobillno = new List(); + foreach (var plan in toBeProcessedPlans) + { + if (pobillno.Contains(plan.PlanBillNo)) continue; + var price = await _purchasePriceSheetAppService.GetByItemCodeAsync(plan.ERP).ConfigureAwait(false); + if (price == null) + { + pobillno.Add(plan.PlanBillNo); + } + + } + return pobillno; + } private List BuildIncomingFromExternalFromPlanAsync(List toBeProcessedPlans) { var incomingDataList = new List(); diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/DTOs/PurchasePriceSheetDTO.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/DTOs/PurchasePriceSheetDTO.cs index b1cc52eba..307e4ed58 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/DTOs/PurchasePriceSheetDTO.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/DTOs/PurchasePriceSheetDTO.cs @@ -12,55 +12,31 @@ namespace Win_in.Sfs.Basedata.Application.Contracts; /// [Display(Name = "采购价格单")] -public class PurchasePriceSheetDTO : SfsBaseDataDTOBase, IHasCode, IHasName +public class PurchasePriceSheetDTO : SfsBaseDataDTOBase { - /// - /// 供应商ID + /// 价格单编码 /// - - [Display(Name = "供应商Id")] + [Display(Name = "物料代码")] [Required(ErrorMessage = "{0}是必填项")] - public Guid SupplierId { get; set; } - /// - /// 供应商名称 - /// - [Display(Name = "供应商名称")] - public string SupplierName { get; set; } + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ItemCode { get; set; } /// - /// 价格单编码 + /// 物料价格 /// - [Display(Name = "代码")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Code { get; set; } + [Display(Name = "物料价格")] + public decimal MaterialPrice { get; set; } /// - /// 价格单名称 + /// 成品价格 /// - [Display(Name = "价格单名称")] - public string Name { get; set; } + [Display(Name = "成品价格")] + public decimal ProductPrice { get; set; } /// /// 价格单描述 /// [Display(Name = "价格单描述")] public string Description { get; set; } - /// - /// 货币ID - /// - [Display(Name = "货币Id")] - [Required(ErrorMessage = "{0}是必填项")] - public Guid CurrencyId { get; set; } - /// - /// 货币名称 - /// - [Display(Name = "货币名称")] - public string CurrencyName { get; set; } - - //[Display(Name = "子表单")] - //public virtual List PurchasePriceDetails { get; set; } - - // } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/IPurchasePriceSheetAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/IPurchasePriceSheetAppService.cs index 47645e931..2178b0950 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/IPurchasePriceSheetAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/IPurchasePriceSheetAppService.cs @@ -1,6 +1,8 @@ +using System.Threading.Tasks; + namespace Win_in.Sfs.Basedata.Application.Contracts; public interface IPurchasePriceSheetAppService : ISfsBaseDataAppServiceBase { - + Task GetByItemCodeAsync(string itemCode); } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs index 279a697c4..e2c9e3bce 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp.Caching; @@ -12,12 +13,25 @@ namespace Win_in.Sfs.Basedata.Application; public class PurchasePriceSheetAppService : SfsBaseDataAppServiceBase, IPurchasePriceSheetAppService { - + private readonly IPurchasePriceSheetRepository _purchasePriceSheetRepository; public PurchasePriceSheetAppService(IPurchasePriceSheetRepository repository, IDistributedCache cache) : base(repository, cache) { - + _purchasePriceSheetRepository= repository; base.CreatePolicyName = PurchasePriceSheetPermissions.Create; base.UpdatePolicyName = PurchasePriceSheetPermissions.Update; base.DeletePolicyName = PurchasePriceSheetPermissions.Delete; } + /// + /// 根据供应零件号查询 + /// + /// + /// + /// + [HttpGet("by-item-code")] + public virtual async Task GetByItemCodeAsync(string itemCode) + { + var entity = await _purchasePriceSheetRepository.FindAsync(p => p.ItemCode== itemCode).ConfigureAwait(false); + var dto = ObjectMapper.Map(entity); + return dto; + } } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAutoMapperProfile.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAutoMapperProfile.cs index 8643b7752..10326b686 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAutoMapperProfile.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAutoMapperProfile.cs @@ -10,8 +10,6 @@ public partial class BasedataApplicationAutoMapperProfile : Profile private void PurchasePriceSheetAutoMapperProfile() { CreateMap() - .Ignore(x => x.SupplierName) - .Ignore(x => x.CurrencyName) .ReverseMap(); } } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/PurchasePrices/PurchasePriceSheet.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/PurchasePrices/PurchasePriceSheet.cs index 618868693..c728f2fb4 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/PurchasePrices/PurchasePriceSheet.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/PurchasePrices/PurchasePriceSheet.cs @@ -7,24 +7,13 @@ namespace Win_in.Sfs.Basedata.Domain; /// /// 采购价格单 /// -public class PurchasePriceSheet : SfsBaseDataAggregateRootBase, IHasCode, IHasName +public class PurchasePriceSheet : SfsBaseDataAggregateRootBase { /// - /// 供应商ID + /// 物品代码 /// [IgnoreUpdate] - public Guid SupplierId { get; set; } - - /// - /// 编码 - /// - [IgnoreUpdate] - public string Code { get; set; } - - /// - /// 价格单名称 - /// - public string Name { get; set; } + public string ItemCode { get; set; } /// /// 价格单描述 /// @@ -33,6 +22,14 @@ public class PurchasePriceSheet : SfsBaseDataAggregateRootBase, IHasCode, IHasNa /// 货币ID /// public Guid CurrencyId { get; set; } + /// + /// 物料价格 + /// + public decimal MaterialPrice { get; set; } + /// + /// 成品价格 + /// + public decimal ProductPrice { get; set; } #region details handler //public virtual void AddDetail(IGuidGenerator guidGenerator, PurchasePriceDetail detail) diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/PurchasePrices/PurchasePriceSheetDbContextModelCreatingExtensions.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/PurchasePrices/PurchasePriceSheetDbContextModelCreatingExtensions.cs index b472310e5..c591fa1e0 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/PurchasePrices/PurchasePriceSheetDbContextModelCreatingExtensions.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/PurchasePrices/PurchasePriceSheetDbContextModelCreatingExtensions.cs @@ -20,17 +20,14 @@ public static class PurchasePriceSheetDbContextModelCreatingExtensions b.ConfigureSfsBase(); //Properties - b.Property(q => q.Code).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); - b.Property(q => q.Name).HasMaxLength(SfsPropertyConst.NameLength); + b.Property(q => q.ItemCode).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.Description).HasMaxLength(SfsPropertyConst.DescLength); - b.Property(x => x.SupplierId).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); - b.Property(x => x.CurrencyId).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); //Relations //None //Indexes - b.HasIndex(q => new { q.Code }).IsUnique(); + b.HasIndex(q => new { q.ItemCode }).IsUnique(); }); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PutawayNotes/IPutawayNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PutawayNotes/IPutawayNoteAppService.cs index 936a32a74..a3bcdad39 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PutawayNotes/IPutawayNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PutawayNotes/IPutawayNoteAppService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -52,4 +53,5 @@ public interface IPutawayNoteAppService : ISfsStoreMasterReadOnlyAppServiceBase< CancellationToken cancellationToken = default); Task> GetListByAsnNumbers(IEnumerable asnNumbers); + Task PrintUpdateRemark(Guid id); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs index a0ef39adc..96813e3c8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs @@ -222,4 +222,24 @@ public class PutawayNoteAppService : return dtos; } + [HttpPost("print-update-remark/{id}")] + public virtual async Task PrintUpdateRemark(Guid id) + { + bool result = true; + try + { + var entitie = await _repository.GetAsync(p => p.Id == id).ConfigureAwait(false); + if (entitie != null) + { + entitie.Remark = "已打印"; + } + await _repository.UpdateAsync(entitie).ConfigureAwait(false); + + } + catch (Exception) + { + result = false; + } + return result; + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs index 15a9d0daf..74e382612 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs @@ -191,6 +191,7 @@ public class PurchaseOrderAppService : return result; } + #endregion #endregion