马昊 2 years ago
parent
commit
2bd5d4ae60
  1. 139
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ItemTransformNoteConverter.cs
  2. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs
  3. 1
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.csproj
  4. 1
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs
  5. 45
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteDetailExchangeDto.cs
  6. 30
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteExchangeDto.cs
  7. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDTO.cs
  8. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDetailDTO.cs
  9. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsStoreRequestAppServiceBase.cs
  10. 24
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs
  11. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs

139
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ItemTransformNoteConverter.cs

@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Auth.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp;
using Win_in.Sfs.Wms.DataExchange.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.WMS.ItemTransformNote;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Outgoing;
public class ItemTransformNoteConverter : IOutgoingConverter
{
private readonly IOutgoingFromWmsManager _outgoingFromWmsManager;
private readonly IOutgoingToExternalManager _outgoingToExternalManager;
private readonly ISupplierAsnAppService _supplierAsnAppService;
private readonly IDepartmentAppService _departmentAppService;
private readonly IObjectMapper _objectMapper;
public ItemTransformNoteConverter(
IOutgoingFromWmsManager outgoingFromWmsManager
, IOutgoingToExternalManager outgoingToExternalManager
, ISupplierAsnAppService supplierAsnAppService
, IDepartmentAppService departmentAppService
, IObjectMapper objectMapper
)
{
_outgoingFromWmsManager = outgoingFromWmsManager;
_outgoingToExternalManager = outgoingToExternalManager;
_supplierAsnAppService = supplierAsnAppService;
_departmentAppService = departmentAppService;
_objectMapper = objectMapper;
}
public virtual async Task<List<OutgoingToExternal>> ConvertAsync()
{
var outgoingToExternalList = new List<OutgoingToExternal>();
var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.Item_Transform, EnumSystemType.ERP).ConfigureAwait(false);
foreach (var outgoingFromWms in outgoingFromWmsList)
{
var wmsCountAdjust = JsonSerializer.Deserialize<ItemTransformNoteDTO>(outgoingFromWms.DataContent);
if (Enum.Parse<EnumTransSubType>(wmsCountAdjust.Type) == EnumTransSubType.Item_Transform)
{
var department = await _departmentAppService.GetByUsernameAsync(wmsCountAdjust.Worker).ConfigureAwait(false);
var departmentCode = department == null ? "" : department.Code;
var details = wmsCountAdjust.Details.GroupBy(r => new { r.ItemCode, r.ToItemCode, r.LocationErpCode, r.ToLocationCode }).Select(p => new ItemTransformNoteDetailExchangeDto { ToQty = p.Sum(itm => itm.ToQty), FromQty = p.Sum(itm => itm.FromQty), ItemCode = p.Key.ItemCode, ToItemCode = p.Key.ToItemCode, LocationErpCode = p.Key.LocationErpCode, ReasonCode = String.Join("、", p.Select(x => x.ReasonCode).ToArray()) });
foreach (var detail in details)
{
List<ItemTransformNoteDetailExchangeDto> ItemTransform = new List<ItemTransformNoteDetailExchangeDto>();
ItemTransformNoteDetailExchangeDto ItemTrans = new ItemTransformNoteDetailExchangeDto();
ItemTrans.ItemCode = detail.ItemCode;
ItemTrans.LocationErpCode = detail.LocationErpCode;
ItemTrans.FromQty = detail.FromQty - detail.FromQty - detail.FromQty;
ItemTrans.ReasonCode = detail.ReasonCode;
ItemTransform.Add(ItemTrans);
ItemTransformNoteDetailExchangeDto ItemTranss = new ItemTransformNoteDetailExchangeDto();
ItemTranss.ItemCode = detail.ToItemCode;
ItemTranss.LocationErpCode = detail.LocationErpCode;
ItemTranss.FromQty = detail.ToQty;
ItemTranss.ReasonCode = detail.ReasonCode;
ItemTransform.Add(ItemTranss);
foreach (var Item in ItemTransform)
{
var outgoingToExternal = new OutgoingToExternal()
{
DataType = outgoingFromWms.DataType,
DataAction = outgoingFromWms.DataAction,
SourceSystem = EnumSystemType.WMS.ToString(),
SourceDataId = wmsCountAdjust.Number,
SourceDataGroupCode = wmsCountAdjust.Number,
SourceDataDetailCode = Item.ItemCode,
Writer = nameof(TyrpOutgoingBackgroundWorker),
DestinationSystem = EnumSystemType.ERP.ToString(),
DestinationDataId = "",
};
outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate);
var exchangeIssue = await BuildPurchaseReceiptExchangeDtoAsync(wmsCountAdjust, Item).ConfigureAwait(false);
outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeIssue);
var arrive = BuildIssue(exchangeIssue, departmentCode);
outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive);
outgoingToExternalList.Add(outgoingToExternal);
}
}
}
}
await _outgoingToExternalManager.CreateManyAsync(outgoingToExternalList).ConfigureAwait(false); ;
//将outgoingFromWms数据归档
await _outgoingFromWmsManager.ArchiveManyAsync(outgoingFromWmsList).ConfigureAwait(false); ;
return outgoingToExternalList;
//插入到中间表OutgoingToExternal
}
private CountAdjust BuildIssue(ItemTransformNoteExchangeDto exchangeCountAdjust, string departmentCode)
{
var detail = exchangeCountAdjust.Detail;
string asdtype = "";
if (Enum.Parse<EnumTransSubType>(exchangeCountAdjust.Type) == EnumTransSubType.Item_Transform)
{
asdtype = "4003";
}
var counta = new CountAdjust()
{
mesout_asd_refc = departmentCode,
mesout_asd_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"),
mesout_asd_type = asdtype,
mesout_asd_part = detail.ItemCode,
mesout_asd_date = exchangeCountAdjust.ActiveDate.ToString("yyyyMMdd"),
mesout_asd_loc = detail.LocationErpCode,
mesout_asd_code = detail.ReasonCode,
mesout_asd_qty = detail.FromQty,
mesout_asd_user = exchangeCountAdjust.Worker,
mesout_asd_k = string.Empty,
mesout_asd_stat = "Y"
};
return counta;
}
private async Task<ItemTransformNoteExchangeDto> BuildPurchaseReceiptExchangeDtoAsync(
ItemTransformNoteDTO wmsCountAdjust, ItemTransformNoteDetailExchangeDto wmsCountAdjustDetail)
{
var exchangeCountAdjust = _objectMapper.Map<ItemTransformNoteDTO, ItemTransformNoteExchangeDto>(wmsCountAdjust);
exchangeCountAdjust.Detail = wmsCountAdjustDetail;
return exchangeCountAdjust;
}
}

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs

@ -120,6 +120,10 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
var scrapNoteList = await scrapNoteConvert.ConvertAsync().ConfigureAwait(false);
await countadjustWriter.WriteAsync(scrapNoteList).ConfigureAwait(false);
Logger.LogInformation($"Write ItemTransformNote");//回收料调整单
var ItemTransformNoteConvert = workerContext.ServiceProvider.GetRequiredService<ItemTransformNoteConverter>();
var ItemTransformNoteList = await ItemTransformNoteConvert.ConvertAsync().ConfigureAwait(false);
await countadjustWriter.WriteAsync(ItemTransformNoteList).ConfigureAwait(false);
Logger.LogInformation($"Completed: Handling {Outgoing}");
}

1
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.csproj

@ -31,6 +31,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\Hosts\Auth.Host\src\Win_in.Sfs.Auth.Application.Contracts\Win_in.Sfs.Auth.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\Modules\BaseData\src\Win_in.Sfs.Basedata.Application\Win_in.Sfs.Basedata.Application.csproj" />
<ProjectReference Include="..\..\..\Modules\Label\src\Win_in.Sfs.Label.Application.Contracts\Win_in.Sfs.Label.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\Modules\Shared\src\Win_in.Sfs.Shared.Host\Win_in.Sfs.Shared.Host.csproj" />
<ProjectReference Include="..\..\..\Modules\Store\src\Win_in.Sfs.Wms.Store.Application.Contracts\Win_in.Sfs.Wms.Store.Application.Contracts.csproj" />

1
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs

@ -30,6 +30,7 @@ public enum EnumOutgoingDataType
RecycledMaterialReceipt = 22,
ScrapNote = 23,
ProductRecycle = 24,
Item_Transform = 25
}
public enum EnumExchangeTableType
{

45
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteDetailExchangeDto.cs

@ -0,0 +1,45 @@
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Wms.DataExchange.WMS.ItemTransformNote;
public class ItemTransformNoteDetailExchangeDto
{
/// <summary>
/// 物品代码
/// </summary>
[Display(Name = "物品代码")]
public string ItemCode { get; set; }
/// <summary>
/// ERP库位
/// </summary>
[Display(Name = "ERP库位")]
public string LocationErpCode { get; set; }
/// <summary>
/// 原因代码
/// </summary>
[Display(Name = "原因代码")]
public string ReasonCode { get; set; }
/// <summary>
/// 调整数量
/// </summary>
[Display(Name = "来源数量")]
public decimal FromQty { get; set; }
/// <summary>
/// 目标数量
/// </summary>
[Display(Name = "目标数量")]
public decimal ToQty { get; set; }
/// <summary>
/// 目标库位
/// </summary>
[Display(Name = "目标库位")]
[Required(ErrorMessage = "{0}是必填项")]
public string ToLocationCode { get; set; }
/// <summary>
/// 目标物品代码
/// </summary>
[Display(Name = "目标物品代码")]
public string ToItemCode { get; set; }
}

30
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteExchangeDto.cs

@ -0,0 +1,30 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Wms.DataExchange.WMS.ItemTransformNote;
public class ItemTransformNoteExchangeDto
{
/// <summary>
/// 单据号
/// </summary>
public string Number { get; set; }
/// <summary>
/// 生效日期
/// </summary>
public DateTime ActiveDate { get; set; } = DateTime.Now.Date;
/// <summary>
/// 操作员
/// </summary>
public string Worker { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 明细
/// </summary>
[Display(Name = "明细")]
public ItemTransformNoteDetailExchangeDto Detail { get; set; } = new();
}

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDTO.cs

@ -19,5 +19,8 @@ public class ItemTransformNoteDTO : SfsStoreDTOBase<ItemTransformNoteDetailDTO>,
[Display(Name = "任务单号")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string JobNumber { get; set; }
/// <summary>
/// 调整类型
/// </summary>
public string Type { get; set; }
}

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDetailDTO.cs

@ -214,7 +214,11 @@ public class ItemTransformNoteDetailDTO : SfsStoreDetailDTOBase
/// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// ERP库位
/// </summary>
[Display(Name = "ERP库位")]
public string LocationErpCode { get; set; }
/// <summary>
/// 目标仓库
/// </summary>

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsStoreRequestAppServiceBase.cs

@ -157,7 +157,8 @@ public abstract class SfsStoreRequestAppServiceBase<TEntity, TEntityDto, TReques
public virtual async Task<TEntityDto> CompleteByNumberAsync(string number)
{
var entity = await _repository.FindAsync(p => p.Number == number).ConfigureAwait(false);
Check.NotNull(entity, typeof(TEntity).Name);
if (entity == null) return null;
// Check.NotNull(entity, typeof(TEntity).Name);
var result = await _requestManager.CompleteAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<TEntity, TEntityDto>(result);
return dto;

24
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs

@ -35,14 +35,14 @@ public class DeliverRequestFisAppService :
public DeliverRequestFisAppService(
IDeliverRequestRepository repository,
IDeliverRequestManager DeliverRequestManager,
IDeliverRequestManager deliverRequestManager,
IAreaAppService areaApp,
ICustomerAppService customerApp,
ICustomerAddressAppService customerAddressApp
)
: base(repository, DeliverRequestManager)
: base(repository, deliverRequestManager)
{
_deliverRequestManager = DeliverRequestManager;
_deliverRequestManager = deliverRequestManager;
_areaApp = areaApp;
_customerApp = customerApp;
_customerAddressApp = customerAddressApp;
@ -60,6 +60,24 @@ public class DeliverRequestFisAppService :
return base.GetPagedListByFilterAsync(sfsRequestInput, includeDetails, cancellationToken);
}
/// <summary>
/// 【创建】发货申请
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
//[Authorize(DeliverRequestPermissions.Create)]
public override async Task<DeliverRequestDTO> CreateAsync(DeliverRequestEditInput input)
{
var entity = ObjectMapper.Map<DeliverRequestEditInput, DeliverRequest>(input);
await _deliverRequestManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<DeliverRequest, DeliverRequestDTO>(entity);
return dto;
}
#region import
protected virtual async Task CheckImportInputBusinessAsync(

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs

@ -7,7 +7,6 @@ using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
using Win_in.Sfs.Wms.Store.Event.Transaction;

Loading…
Cancel
Save