唐明亮 2 years ago
parent
commit
78c70451bc
  1. 62
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs
  2. 5
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs
  3. 5
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs
  4. 5
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ScontrolWriter.cs
  5. 2
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs
  6. 4
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs
  7. 20
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/DTOs/CountPlanForNoteExportDTO.cs
  8. 29
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs
  9. 18
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs

62
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs

@ -5,6 +5,7 @@ using System.Text.Json;
using System.Threading.Tasks;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Auth.Application.Contracts;
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.Tyrp;
@ -21,6 +22,7 @@ public class CountAdjustNoteConverter : IOutgoingConverter
private readonly ISupplierAsnAppService _supplierAsnAppService;
private readonly IDepartmentAppService _departmentAppService;
private readonly IObjectMapper _objectMapper;
private readonly ILocationAppService _locationAppService;
public CountAdjustNoteConverter(
IOutgoingFromWmsManager outgoingFromWmsManager
@ -28,6 +30,7 @@ public class CountAdjustNoteConverter : IOutgoingConverter
, ISupplierAsnAppService supplierAsnAppService
, IDepartmentAppService departmentAppService
, IObjectMapper objectMapper
, ILocationAppService locationAppService
)
{
_outgoingFromWmsManager = outgoingFromWmsManager;
@ -35,6 +38,7 @@ public class CountAdjustNoteConverter : IOutgoingConverter
_supplierAsnAppService = supplierAsnAppService;
_departmentAppService = departmentAppService;
_objectMapper = objectMapper;
_locationAppService= locationAppService;
}
public virtual async Task<List<OutgoingToExternal>> ConvertAsync()
@ -47,9 +51,41 @@ public class CountAdjustNoteConverter : IOutgoingConverter
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.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode });
var detal = details.ToList();
foreach (var detail in detal)
var locs =await _locationAppService.GetListByTypesAsync(new List<EnumLocationType> { EnumLocationType.WIP }).ConfigureAwait(false);
var locationCodes = locs.Select(p => p.Code);
var wipItems=wmsCountAdjust.Details.Where(p => locationCodes.Contains(p.LocationCode));//库位类型是线边,传线边仓调整
var Items = wmsCountAdjust.Details.Where(p => !locationCodes.Contains(p.LocationCode));//盘点
var WipDetails = wipItems.GroupBy(r => new { r.ItemCode, r.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode });
foreach (var detail in WipDetails)
{
//判断盘点数与库存数是否相等
if (detail.CountQty != detail.InventoryQty)
{
var outgoingToExternal = new OutgoingToExternal()
{
DataType = outgoingFromWms.DataType,
DataAction = outgoingFromWms.DataAction,
SourceSystem = EnumSystemType.WMS.ToString(),
SourceDataId = wmsCountAdjust.Number,
SourceDataGroupCode = wmsCountAdjust.Number,
SourceDataDetailCode = WipDetails.FirstOrDefault().ItemCode,
Writer = nameof(TyrpOutgoingBackgroundWorker),
DestinationSystem = EnumSystemType.ERP.ToString(),
DestinationDataId = "",
};
outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate);
var exchangeIssue = await BuildPurchaseReceiptExchangeDtoAsync(wmsCountAdjust, detail).ConfigureAwait(false);
outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeIssue);
var arrive = BuildWip(exchangeIssue, departmentCode);
outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive);
outgoingToExternalList.Add(outgoingToExternal);
}
}
var details = Items.GroupBy(r => new { r.ItemCode, r.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode });
foreach (var detail in details)
{
//判断盘点数与库存数是否相等
if (detail.CountQty != detail.InventoryQty)
@ -104,7 +140,25 @@ public class CountAdjustNoteConverter : IOutgoingConverter
return counta;
}
private CountAdjust BuildWip(CountAdjustNoteExchangeDto exchangeCountAdjust, string departmentCode)
{
var detail = exchangeCountAdjust.Detail;
var counta = new CountAdjust()
{
mesout_asd_refc = departmentCode,
mesout_asd_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"),
mesout_asd_type = "4041",
mesout_asd_part = detail.ItemCode,
mesout_asd_date = exchangeCountAdjust.ActiveDate.ToString("yyyyMMdd"),
mesout_asd_loc = string.Empty,
mesout_asd_code = detail.ReasonCode,
mesout_asd_qty = detail.CountQty + detail.InventoryQty,
mesout_asd_user = "WMS",
mesout_asd_k = string.Empty,
mesout_asd_stat = "Y"
};
return counta;
}
private async Task<CountAdjustNoteExchangeDto> BuildPurchaseReceiptExchangeDtoAsync(
CountAdjustNoteDTO wmsCountAdjust, CountAdjustNoteDetailExchangeDto wmsCountAdjustDetail)
{

5
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Volo.Abp.ObjectMapping;
@ -58,9 +59,9 @@ public class IssueNoteConverter : IOutgoingConverter
outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNote);
outgoingToExternalList.Add(outgoingToExternal);
#endregion
var sumDetails = wmsReceipt.Details.GroupBy(r => new { r.ItemCode, r.FromLocationErpCode, r.ToLocationErpCode }).Select(p => new IssueNoteDetailDTO { ItemCode = p.Key.ItemCode, FromLocationErpCode = p.Key.FromLocationErpCode, ToLocationErpCode = p.Key.ToLocationErpCode, Qty = p.Sum(x => x.Qty) }).ToList();
#region 明细
foreach (var detail in wmsReceipt.Details)
foreach (var detail in sumDetails)
{
var outgoingDetailToExternal = new OutgoingToExternal()
{

5
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Volo.Abp.ObjectMapping;
@ -61,8 +62,10 @@ public class PutawayNoteConverter : IOutgoingConverter
outgoingToExternalList.Add(outgoingToExternal);
#endregion
var sumDetails= wmsReceipt.Details.GroupBy(r => new { r.ItemCode, r.PoNumber, r.ToLocationErpCode }).Select(p => new PutawayNoteDetailDTO { ItemCode = p.Key.ItemCode, PoNumber = p.Key.PoNumber, ToLocationErpCode = p.Key.ToLocationErpCode ,Qty=p.Sum(x=>x.Qty)}).ToList();
#region 明细
foreach (var detail in wmsReceipt.Details)
foreach (var detail in sumDetails)
{
var outgoingDetailToExternal = new OutgoingToExternal()
{

5
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ScontrolWriter.cs

@ -49,6 +49,11 @@ public class ScontrolWriter : IWriter
}
try
{
//零件号和ERP库位以及单据号相同则汇总
//var groupScmsends= dataInterfaceDetailList.GroupBy(r => new { r.scmsend_type, r.scmsend_dt_w, r.scmsend_nbr, r.scmsend_stat1, r.scmsend_part, r.scmsend_delv_date, r.scmsend_orderno, r.scmsend_loc, r.scmsend_date, r.scmsend_wipd_loc, r.scmsend_userid })
// .Select(p=>new Scmsend { scmsend_type = p.Key.scmsend_type , scmsend_dt_w =p.Key.scmsend_dt_w , scmsend_nbr =p.Key.scmsend_nbr , scmsend_stat1 =p.Key.scmsend_stat1 , scmsend_part =p.Key.scmsend_part
// , scmsend_delv_date =p.Key.scmsend_delv_date , scmsend_orderno =p.Key.scmsend_orderno , scmsend_loc =p.Key.scmsend_loc , scmsend_date=p.Key.scmsend_date, scmsend_wipd_loc = p.Key.scmsend_wipd_loc,
// scmsend_userid=p.Key.scmsend_userid,scmsend_qty=p.Sum(itm=>itm.scmsend_qty)} ).ToList();
//dataInterface分主子表分别写入ERP
await _dataInterfaceManager.PostListAsync(dataInterfaceList, dataInterfaceDetailList).ConfigureAwait(false);
}

2
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs

@ -658,6 +658,8 @@ public class BalanceAppService
[HttpPost("update/item-basic-info")]
public async Task UpdateItemBasicInfoAsync(BalanceUpdateItemBasicInfoDto balanceUpdateItemBasicInfoDto)
{
//停用,可能用其他处理方案
return;
// 物品编码
var itemCodes = balanceUpdateItemBasicInfoDto.BalanceUpdateItemBasicInfos?.Select(c => c.ItemCode);
itemCodes = itemCodes?.Where(t => string.IsNullOrWhiteSpace(t) == false);

4
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs

@ -134,9 +134,9 @@ public enum EnumTransSubType
Issue_SafetyStock = 1504,
/// <summary>
/// 直接发料
/// 非生产调拨
/// </summary>
[Display(Name = "直接发料")]
[Display(Name = "非生产调拨")]
Issue_Direct = 1505,
/// <summary>

20
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/DTOs/CountPlanForNoteExportDTO.cs

@ -26,7 +26,7 @@ public class CountPlanForNoteExportDTO
/// <summary>
/// 物品代码
/// </summary>
[Display(Name = "物料号")]
[Display(Name = "物品代码")]
[Required(ErrorMessage = "{0}是必填项")]
public string ItemCode { get; set; }
@ -36,6 +36,24 @@ public class CountPlanForNoteExportDTO
[Display(Name = "物品名称")]
public string ItemName { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
[Display(Name = "物品描述1")]
public string ItemDesc1 { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
[Display(Name = "物品描述2")]
public string ItemDesc2 { get; set; }
/// <summary>
/// 配置码
/// </summary>
[Display(Name = "配置码")]
public string Configuration { get; set; }
/// <summary>
/// 箱码
/// </summary>

29
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs

@ -13,6 +13,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application;
using Win_in.Sfs.Basedata.Application;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
@ -36,13 +37,15 @@ public class CountPlanAppService :
private readonly ICountPlanManager _countPlanManager;
private readonly ITransactionTypeAppService _transactionTypeAppService;
private readonly IItemBasicAppService _itemBasicAppService;
public CountPlanAppService(ICountPlanRepository repository,
ICountPlanManager countPlanManager,
ITransactionTypeAppService transactionTypeAppService) : base(repository, countPlanManager)
ITransactionTypeAppService transactionTypeAppService, IItemBasicAppService itemBasicAppService) : base(repository, countPlanManager)
{
_countPlanManager = countPlanManager;
_transactionTypeAppService = transactionTypeAppService;
_itemBasicAppService = itemBasicAppService;
base.CreatePolicyName = CountPlanPermissions.Create;
base.UpdatePolicyName = CountPlanPermissions.Update;
@ -63,13 +66,13 @@ public class CountPlanAppService :
entity.Worker = CurrentUser.GetUserName();
TransactionTypeDTO tranTypeDTO = null;
TransactionTypeDTO tranTypeDto = null;
switch (input.RequestType)
{
case CountPlanRequestType.Manual:
tranTypeDTO = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan,
tranTypeDto = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan,
EnumTransSubType.ArtificialCountPlan).ConfigureAwait(false);
if (tranTypeDTO == null)
if (tranTypeDto == null)
{
throw new UserFriendlyException(
$"盘点方式 {input.RequestType} 没有设置库存事务类型。主事务类型{EnumTransType.CountPlan}," +
@ -78,9 +81,9 @@ public class CountPlanAppService :
break;
case CountPlanRequestType.Import:
tranTypeDTO = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan,
tranTypeDto = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan,
EnumTransSubType.ExcelInCountPlan).ConfigureAwait(false);
if (tranTypeDTO == null)
if (tranTypeDto == null)
{
throw new UserFriendlyException(
$"盘点方式 {input.RequestType} 没有设置库存事务类型。主事务类型{EnumTransType.CountPlan}," +
@ -93,11 +96,11 @@ public class CountPlanAppService :
throw new UserFriendlyException($"{input.RequestType}盘点方式设置错误");
}
entity.AutoCompleteJob = tranTypeDTO.AutoCompleteJob;
entity.AutoSubmit = tranTypeDTO.AutoSubmitRequest;
entity.AutoAgree = tranTypeDTO.AutoAgreeRequest;
entity.AutoHandle = tranTypeDTO.AutoHandleRequest;
entity.DirectCreateNote = tranTypeDTO.DirectCreateNote;
entity.AutoCompleteJob = tranTypeDto.AutoCompleteJob;
entity.AutoSubmit = tranTypeDto.AutoSubmitRequest;
entity.AutoAgree = tranTypeDto.AutoAgreeRequest;
entity.AutoHandle = tranTypeDto.AutoHandleRequest;
entity.DirectCreateNote = tranTypeDto.DirectCreateNote;
await _countPlanManager.CreateWithConditionAsync(entity, input.PartCondition, input.LocCondition, input.LocCondition, input.StatusList).ConfigureAwait(false);
@ -185,6 +188,7 @@ public class CountPlanAppService :
foreach (var detail in request.Details)
{
var note = new CountPlanForNoteExportDTO();
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
note.CountPlanNumber = request.Number;
note.LocationCode = detail.LocationCode;
@ -192,6 +196,9 @@ public class CountPlanAppService :
note.ItemName = detail.ItemName;
note.PackingCode = detail.PackingCode;
note.ContainerCode = detail.ContainerCode;
note.ItemDesc1=detail.ItemDesc1;
note.ItemDesc2 = detail.ItemDesc1;
note.Configuration = itemBasicDto.Configuration;
note.Lot = detail.Lot;
note.InventoryQty = detail.InventoryQty;
note.FirstCountQty = detail.FirstCountQty;

18
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs

@ -132,6 +132,24 @@ public class CountPlanManager : SfsStoreRequestManagerBase<CountPlan, CountPlanD
//库位列表
selectLocationCodes = locList.Select(p => p.Code).Distinct().ToList();
//同一个库位不能同时盘点
var countPlans=await _repository.GetListAsync(p =>
p.RequestStatus != EnumRequestStatus.Abort &&
p.RequestStatus != EnumRequestStatus.Refused&&
p.RequestStatus !=EnumRequestStatus.None&&
p.RequestStatus !=EnumRequestStatus.Completed&&
p.RequestStatus !=EnumRequestStatus.Cancelled,true
).ConfigureAwait(false);
foreach (var countPlan in countPlans)
{
var countPlanDetails = countPlan.Details.Where(p => selectLocationCodes.Contains(p.LocationCode)).ToList();
if (countPlanDetails != null && countPlanDetails.Count() > 0)
{
throw new UserFriendlyException($"库位只能存在于一个盘点计划中,盘点计划号【{countPlan.Number}】中已包含【{countPlanDetails.First().LocationCode}】库位。");
}
}
}
//状态查询
var statusStr = System.Text.Json.JsonSerializer.Serialize(selectStatusList.Select(p => (int)p).ToList());

Loading…
Cancel
Save