Browse Source

采购上价打印后修改商家记录得remark

增加采购价格相关服务
dev_DY_CC
lvzb 1 year ago
parent
commit
61aff77568
  1. 27
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/PlanReader.cs
  2. 46
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/DTOs/PurchasePriceSheetDTO.cs
  3. 4
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/IPurchasePriceSheetAppService.cs
  4. 18
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs
  5. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAutoMapperProfile.cs
  6. 25
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/PurchasePrices/PurchasePriceSheet.cs
  7. 7
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/PurchasePrices/PurchasePriceSheetDbContextModelCreatingExtensions.cs
  8. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PutawayNotes/IPutawayNoteAppService.cs
  9. 20
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs
  10. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs

27
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 System.Threading.Tasks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Volo.Abp.Guids; using Volo.Abp.Guids;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS;
@ -20,17 +21,20 @@ public class PlanReader : IReader
private readonly IIncomingFromExternalManager _incomingFromExternalManager; private readonly IIncomingFromExternalManager _incomingFromExternalManager;
private readonly ILogger<PlanReader> _logger; private readonly ILogger<PlanReader> _logger;
private readonly IGuidGenerator _guidGenerator; private readonly IGuidGenerator _guidGenerator;
private readonly IPurchasePriceSheetAppService _purchasePriceSheetAppService;
public PlanReader( public PlanReader(
IPlanManager planManager IPlanManager planManager
, IIncomingFromExternalManager incomingFromExternalManager , IIncomingFromExternalManager incomingFromExternalManager
, ILogger<PlanReader> logger , ILogger<PlanReader> logger
, IGuidGenerator guidGenerator , IGuidGenerator guidGenerator,
IPurchasePriceSheetAppService purchasePriceSheetAppService
) )
{ {
_planManager = planManager; _planManager = planManager;
_incomingFromExternalManager = incomingFromExternalManager; _incomingFromExternalManager = incomingFromExternalManager;
_logger = logger; _logger = logger;
_guidGenerator = guidGenerator; _guidGenerator = guidGenerator;
_purchasePriceSheetAppService = purchasePriceSheetAppService;
} }
@ -43,6 +47,12 @@ public class PlanReader : IReader
_logger.LogInformation("no plans"); _logger.LogInformation("no plans");
return new List<IncomingFromExternal>(); return new List<IncomingFromExternal>();
} }
var pobillno = await GetPriceItems(toBeProcessedPlans).ConfigureAwait(false);
if (pobillno.Count > 0)
{
toBeProcessedPlans = toBeProcessedPlans.Where(r => !pobillno.Contains(r.PlanBillNo)).ToList();
}
//Plan逐一转换为PurchaseOrder //Plan逐一转换为PurchaseOrder
var incomingDataList = BuildIncomingFromExternalFromPlanAsync(toBeProcessedPlans); var incomingDataList = BuildIncomingFromExternalFromPlanAsync(toBeProcessedPlans);
await _incomingFromExternalManager.CreateBulkAsync(incomingDataList).ConfigureAwait(false); await _incomingFromExternalManager.CreateBulkAsync(incomingDataList).ConfigureAwait(false);
@ -50,7 +60,22 @@ public class PlanReader : IReader
await _planManager.UpdateProcessedListAsync(toBeProcessedPlans).ConfigureAwait(false); await _planManager.UpdateProcessedListAsync(toBeProcessedPlans).ConfigureAwait(false);
return incomingDataList; return incomingDataList;
} }
private async Task<List<string>> GetPriceItems(List<Plan> toBeProcessedPlans)
{
List<string> pobillno = new List<string>();
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<IncomingFromExternal> BuildIncomingFromExternalFromPlanAsync(List<Plan> toBeProcessedPlans) private List<IncomingFromExternal> BuildIncomingFromExternalFromPlanAsync(List<Plan> toBeProcessedPlans)
{ {
var incomingDataList = new List<IncomingFromExternal>(); var incomingDataList = new List<IncomingFromExternal>();

46
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;
/// </summary> /// </summary>
[Display(Name = "采购价格单")] [Display(Name = "采购价格单")]
public class PurchasePriceSheetDTO : SfsBaseDataDTOBase, IHasCode, IHasName public class PurchasePriceSheetDTO : SfsBaseDataDTOBase
{ {
/// <summary> /// <summary>
/// 供应商ID /// 价格单编码
/// </summary> /// </summary>
[Display(Name = "物料代码")]
[Display(Name = "供应商Id")]
[Required(ErrorMessage = "{0}是必填项")] [Required(ErrorMessage = "{0}是必填项")]
public Guid SupplierId { get; set; } [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
/// <summary> public string ItemCode { get; set; }
/// 供应商名称
/// </summary>
[Display(Name = "供应商名称")]
public string SupplierName { get; set; }
/// <summary> /// <summary>
/// 价格单编码 /// 物料价格
/// </summary> /// </summary>
[Display(Name = "代码")] [Display(Name = "物料价格")]
[Required(ErrorMessage = "{0}是必填项")] public decimal MaterialPrice { get; set; }
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Code { get; set; }
/// <summary> /// <summary>
/// 价格单名称 /// 成品价格
/// </summary> /// </summary>
[Display(Name = "价格单名称")] [Display(Name = "成品价格")]
public string Name { get; set; } public decimal ProductPrice { get; set; }
/// <summary> /// <summary>
/// 价格单描述 /// 价格单描述
/// </summary> /// </summary>
[Display(Name = "价格单描述")] [Display(Name = "价格单描述")]
public string Description { get; set; } public string Description { get; set; }
/// <summary>
/// 货币ID
/// </summary>
[Display(Name = "货币Id")]
[Required(ErrorMessage = "{0}是必填项")]
public Guid CurrencyId { get; set; }
/// <summary>
/// 货币名称
/// </summary>
[Display(Name = "货币名称")]
public string CurrencyName { get; set; }
//[Display(Name = "子表单")]
//public virtual List<PurchasePriceDetailDTO> PurchasePriceDetails { get; set; }
//
} }

4
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; namespace Win_in.Sfs.Basedata.Application.Contracts;
public interface IPurchasePriceSheetAppService : ISfsBaseDataAppServiceBase<PurchasePriceSheetDTO, SfsBaseDataRequestInputBase, PurchasePriceSheetEditInput> public interface IPurchasePriceSheetAppService : ISfsBaseDataAppServiceBase<PurchasePriceSheetDTO, SfsBaseDataRequestInputBase, PurchasePriceSheetEditInput>
{ {
Task<PurchasePriceSheetDTO> GetByItemCodeAsync(string itemCode);
} }

18
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.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Caching; using Volo.Abp.Caching;
@ -12,12 +13,25 @@ namespace Win_in.Sfs.Basedata.Application;
public class PurchasePriceSheetAppService : SfsBaseDataAppServiceBase<PurchasePriceSheet, PurchasePriceSheetDTO, SfsBaseDataRequestInputBase, PurchasePriceSheetEditInput, PurchasePriceSheetImportInput>, IPurchasePriceSheetAppService public class PurchasePriceSheetAppService : SfsBaseDataAppServiceBase<PurchasePriceSheet, PurchasePriceSheetDTO, SfsBaseDataRequestInputBase, PurchasePriceSheetEditInput, PurchasePriceSheetImportInput>, IPurchasePriceSheetAppService
{ {
private readonly IPurchasePriceSheetRepository _purchasePriceSheetRepository;
public PurchasePriceSheetAppService(IPurchasePriceSheetRepository repository, IDistributedCache<PurchasePriceSheetDTO> cache) : base(repository, cache) public PurchasePriceSheetAppService(IPurchasePriceSheetRepository repository, IDistributedCache<PurchasePriceSheetDTO> cache) : base(repository, cache)
{ {
_purchasePriceSheetRepository= repository;
base.CreatePolicyName = PurchasePriceSheetPermissions.Create; base.CreatePolicyName = PurchasePriceSheetPermissions.Create;
base.UpdatePolicyName = PurchasePriceSheetPermissions.Update; base.UpdatePolicyName = PurchasePriceSheetPermissions.Update;
base.DeletePolicyName = PurchasePriceSheetPermissions.Delete; base.DeletePolicyName = PurchasePriceSheetPermissions.Delete;
} }
/// <summary>
/// 根据供应零件号查询
/// </summary>
/// <param name="supplierCode"></param>
/// <param name="itemCode"></param>
/// <returns></returns>
[HttpGet("by-item-code")]
public virtual async Task<PurchasePriceSheetDTO> GetByItemCodeAsync(string itemCode)
{
var entity = await _purchasePriceSheetRepository.FindAsync(p => p.ItemCode== itemCode).ConfigureAwait(false);
var dto = ObjectMapper.Map<PurchasePriceSheet, PurchasePriceSheetDTO>(entity);
return dto;
}
} }

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAutoMapperProfile.cs

@ -10,8 +10,6 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
private void PurchasePriceSheetAutoMapperProfile() private void PurchasePriceSheetAutoMapperProfile()
{ {
CreateMap<PurchasePriceSheet, PurchasePriceSheetDTO>() CreateMap<PurchasePriceSheet, PurchasePriceSheetDTO>()
.Ignore(x => x.SupplierName)
.Ignore(x => x.CurrencyName)
.ReverseMap(); .ReverseMap();
} }
} }

25
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/PurchasePrices/PurchasePriceSheet.cs

@ -7,24 +7,13 @@ namespace Win_in.Sfs.Basedata.Domain;
/// <summary> /// <summary>
/// 采购价格单 /// 采购价格单
/// </summary> /// </summary>
public class PurchasePriceSheet : SfsBaseDataAggregateRootBase, IHasCode, IHasName public class PurchasePriceSheet : SfsBaseDataAggregateRootBase
{ {
/// <summary> /// <summary>
/// 供应商ID /// 物品代码
/// </summary> /// </summary>
[IgnoreUpdate] [IgnoreUpdate]
public Guid SupplierId { get; set; } public string ItemCode { get; set; }
/// <summary>
/// 编码
/// </summary>
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 价格单名称
/// </summary>
public string Name { get; set; }
/// <summary> /// <summary>
/// 价格单描述 /// 价格单描述
/// </summary> /// </summary>
@ -33,6 +22,14 @@ public class PurchasePriceSheet : SfsBaseDataAggregateRootBase, IHasCode, IHasNa
/// 货币ID /// 货币ID
/// </summary> /// </summary>
public Guid CurrencyId { get; set; } public Guid CurrencyId { get; set; }
/// <summary>
/// 物料价格
/// </summary>
public decimal MaterialPrice { get; set; }
/// <summary>
/// 成品价格
/// </summary>
public decimal ProductPrice { get; set; }
#region details handler #region details handler
//public virtual void AddDetail(IGuidGenerator guidGenerator, PurchasePriceDetail detail) //public virtual void AddDetail(IGuidGenerator guidGenerator, PurchasePriceDetail detail)

7
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/PurchasePrices/PurchasePriceSheetDbContextModelCreatingExtensions.cs

@ -20,17 +20,14 @@ public static class PurchasePriceSheetDbContextModelCreatingExtensions
b.ConfigureSfsBase(); b.ConfigureSfsBase();
//Properties //Properties
b.Property(q => q.Code).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ItemCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Name).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.Description).HasMaxLength(SfsPropertyConst.DescLength); 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 //Relations
//None //None
//Indexes //Indexes
b.HasIndex(q => new { q.Code }).IsUnique(); b.HasIndex(q => new { q.ItemCode }).IsUnique();
}); });
} }
} }

2
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.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -52,4 +53,5 @@ public interface IPutawayNoteAppService : ISfsStoreMasterReadOnlyAppServiceBase<
CancellationToken cancellationToken = default); CancellationToken cancellationToken = default);
Task<List<PutawayNoteDTO>> GetListByAsnNumbers(IEnumerable<string> asnNumbers); Task<List<PutawayNoteDTO>> GetListByAsnNumbers(IEnumerable<string> asnNumbers);
Task<bool> PrintUpdateRemark(Guid id);
} }

20
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs

@ -222,4 +222,24 @@ public class PutawayNoteAppService :
return dtos; return dtos;
} }
[HttpPost("print-update-remark/{id}")]
public virtual async Task<bool> 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;
}
} }

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs

@ -191,6 +191,7 @@ public class PurchaseOrderAppService :
return result; return result;
} }
#endregion #endregion
#endregion #endregion

Loading…
Cancel
Save