diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs new file mode 100644 index 000000000..7b9b122ee --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs @@ -0,0 +1,39 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Domain.Entities; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; +public class CallMtl : Entity +{ + /// + /// 序号 + /// + [Key] + public string mesout_callmtl_id { get; set; } + /// + /// 物料 + /// + public string mesout_callmtl_erpno { get; set; } + /// + /// 库位 + /// + public string mesout_callmtl_loc { get; set; } + /// + /// 数量 + /// + public decimal mesout_callmtl_num { get; set; } + /// + /// 时间 + /// + public string mesout_callmtl_wt { get; set; } + + /// + /// 是否读取(0,1) + /// + public long Yl1 { get; set; } + + public override object[] GetKeys() + { + return new object[] { mesout_callmtl_id }; + } + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs new file mode 100644 index 000000000..d48c9e68e --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; +public class CallMtlManager : DomainService, ICallMtlManager +{ + private readonly ICallMtlRepository _repository; + + public CallMtlManager(ICallMtlRepository repository) + { + _repository = repository; + } + public virtual async Task> GetToBeProcessedListAsync() + { + var plans = await _repository.GetListAsync(p => p.Yl1 == 0).ConfigureAwait(false); + return plans; + } + public virtual async Task UpdateProcesseErrordListAsync(List entities) + { + var ids = entities.Select(p => p.mesout_callmtl_id); + var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_callmtl_id)).ConfigureAwait(false); + plans.ForEach(p => + { + p.Yl1 = 2; + // p.WmsDate = Clock.Now; + }); + await _repository.UpdateManyAsync(plans).ConfigureAwait(false); + } + public virtual async Task UpdateProcessedListAsync(List entities) + { + var ids = entities.Select(p => p.mesout_callmtl_id); + var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_callmtl_id)).ConfigureAwait(false); + plans.ForEach(p => + { + p.Yl1 = 1; + + // p.WmsDate = Clock.Now; + }); + await _repository.UpdateManyAsync(plans).ConfigureAwait(false); + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlManager.cs new file mode 100644 index 000000000..7a8ffab76 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlManager.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; +public interface ICallMtlManager +{ + Task> GetToBeProcessedListAsync(); + Task UpdateProcessedListAsync(List entities); + Task UpdateProcesseErrordListAsync(List entities); +} \ No newline at end of file diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlRepository.cs new file mode 100644 index 000000000..7ea7c5a79 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlRepository.cs @@ -0,0 +1,7 @@ +using Volo.Abp.Domain.Repositories; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; +public interface ICallMtlRepository : IRepository +{ + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/Delivery.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/Delivery.cs new file mode 100644 index 000000000..85f87fca3 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/Delivery.cs @@ -0,0 +1,66 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Domain.Entities; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; +public class Delivery : Entity +{ + /// + /// 序号 + /// + [Key] + public string mesout_delivery_id { get; set; } + /// + /// 类型 + /// + public string mesout_delivery_type { get; set; } + /// + /// 物料 + /// + public string mesout_delivery_part { get; set; } + /// + /// 底盘号 + /// + public string mesout_delivery_identity_no { get; set; } + /// + /// 发红储位 + /// + public string mesout_delivery_loc { get; set; } + /// + /// 数量 + /// + public decimal mesout_delivery_num { get; set; } + /// + /// 客户代码 + /// + public string mesout_delivery_customer { get; set; } + + /// + /// 车牌号 + /// + public string mesout_delivery_carno { get; set; } + /// + /// 写入时间 + /// + public string mesout_delivery_wt { get; set; } + /// + /// 发货单号 + /// + public string mesout_delivery_no { get; set; } + /// + /// 器具号 + /// + public string mesout_delivery_container { get; set; } + /// + /// 发货计划号 + /// + public string mesout_delivery_plan { get; set; } + /// + /// 是否读取(0,1) + /// + public long Yl1 { get; set; } + + public override object[] GetKeys() + { + return new object[] { mesout_delivery_id }; + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/DeliveryManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/DeliveryManager.cs new file mode 100644 index 000000000..c5788df2c --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/DeliveryManager.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; +public class DeliveryManager : DomainService, IDeliveryManager +{ + private readonly IDeliveryRepository _repository; + + public DeliveryManager(IDeliveryRepository repository) + { + _repository = repository; + } + public virtual async Task> GetToBeProcessedListAsync() + { + var plans = await _repository.GetListAsync(p => p.Yl1 == 0).ConfigureAwait(false); + return plans; + + } + public virtual async Task UpdateProcesseErrordListAsync(List entities) + { + var ids = entities.Select(p => p.mesout_delivery_id); + var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_delivery_id)).ConfigureAwait(false); + plans.ForEach(p => + { + p.Yl1 = 2; + // p.WmsDate = Clock.Now; + }); + await _repository.UpdateManyAsync(plans).ConfigureAwait(false); + } + public virtual async Task UpdateProcessedListAsync(List entities) + { + var ids = entities.Select(p => p.mesout_delivery_id); + var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_delivery_id)).ConfigureAwait(false); + plans.ForEach(p => + { + p.Yl1 = 1; + + // p.WmsDate = Clock.Now; + }); + await _repository.UpdateManyAsync(plans).ConfigureAwait(false); + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/IDeliveryManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/IDeliveryManager.cs new file mode 100644 index 000000000..222614bc1 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/IDeliveryManager.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; +public interface IDeliveryManager +{ + Task> GetToBeProcessedListAsync(); + Task UpdateProcessedListAsync(List entities); + Task UpdateProcesseErrordListAsync(List entities); +} \ No newline at end of file diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/IDeliveryRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/IDeliveryRepository.cs new file mode 100644 index 000000000..77310f439 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Delivery/IDeliveryRepository.cs @@ -0,0 +1,8 @@ +using Volo.Abp.Domain.Repositories; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; + +public interface IDeliveryRepository : IRepository +{ + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/Frozen.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/Frozen.cs new file mode 100644 index 000000000..9ae130400 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/Frozen.cs @@ -0,0 +1,49 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Domain.Entities; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; +public class Frozen : Entity +{ + /// + /// 序号 + /// + [Key] + public string mesout_frozen_id { get; set; } + /// + /// 类型 + /// + public string mesout_frozen_type { get; set; } + /// + /// 物料 + /// + public string mesout_frozen_part { get; set; } + /// + /// 日期 + /// + public string mesout_frozen_date { get; set; } + /// + /// 来源库位 + /// + public string mesout_frozen_loc { get; set; } + /// + /// 冻结原因 + /// + public string mesout_frozen_reason { get; set; } + /// + /// 数量 + /// + public decimal mesout_frozen_num { get; set; } + /// + /// 冻结用户 + /// + public string mesout_frozen_user { get; set; } + /// + /// 是否读取(0,1) + /// + public long Yl1 { get; set; } + + public override object[] GetKeys() + { + return new object[] { mesout_frozen_id }; + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/FrozenManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/FrozenManager.cs new file mode 100644 index 000000000..e0f15b29c --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/FrozenManager.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; +public class FrozenManager : DomainService, IFrozenManager +{ + private readonly IFrozenRepository _repository; + + public FrozenManager(IFrozenRepository repository) + { + _repository = repository; + } + public virtual async Task> GetToBeProcessedListAsync() + { + var plans = await _repository.GetListAsync(p => p.Yl1 == 0).ConfigureAwait(false); + return plans; + + } + public virtual async Task UpdateProcesseErrordListAsync(List entities) + { + var ids = entities.Select(p => p.mesout_frozen_id); + var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_frozen_id)).ConfigureAwait(false); + plans.ForEach(p => + { + p.Yl1 = 2; + // p.WmsDate = Clock.Now; + }); + await _repository.UpdateManyAsync(plans).ConfigureAwait(false); + } + public virtual async Task UpdateProcessedListAsync(List entities) + { + var ids = entities.Select(p => p.mesout_frozen_id); + var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_frozen_id)).ConfigureAwait(false); + plans.ForEach(p => + { + p.Yl1 = 1; + + // p.WmsDate = Clock.Now; + }); + await _repository.UpdateManyAsync(plans).ConfigureAwait(false); + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/IFrozenManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/IFrozenManager.cs new file mode 100644 index 000000000..ce90eb038 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/IFrozenManager.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; +public interface IFrozenManager +{ + Task> GetToBeProcessedListAsync(); + Task UpdateProcessedListAsync(List entities); + Task UpdateProcesseErrordListAsync(List entities); +} \ No newline at end of file diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/IFrozenRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/IFrozenRepository.cs new file mode 100644 index 000000000..0cde2a7a6 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Frozen/IFrozenRepository.cs @@ -0,0 +1,7 @@ +using Volo.Abp.Domain.Repositories; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; +public interface IFrozenRepository : IRepository +{ + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/IQtyrfeManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/IQtyrfeManager.cs new file mode 100644 index 000000000..474e56296 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/IQtyrfeManager.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; +public interface IQtyrfeManager : IDomainService +{ + Task> GetToBeProcessedListAsync(); + Task UpdateProcessedListAsync(List entities); + Task UpdateProcesseErrordListAsync(List entities); +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/IQtyrfeRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/IQtyrfeRepository.cs new file mode 100644 index 000000000..8535022a2 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/IQtyrfeRepository.cs @@ -0,0 +1,7 @@ +using Volo.Abp.Domain.Repositories; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; +public interface IQtyrfeRepository : IRepository +{ + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/Qtyrfe.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/Qtyrfe.cs new file mode 100644 index 000000000..b2110b82f --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/Qtyrfe.cs @@ -0,0 +1,50 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Domain.Entities; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; +public class Qtyrfe : Entity +{ + /// + /// 序号 + /// + [Key] + public string mesout_qtyrfe_id { get; set; } + /// + /// 物料 + /// + public string mesout_qtyrfe_part { get; set; } + /// + /// 调出储位 + /// + public string mesout_qtyrfe_loc_from { get; set; } + /// + /// 调入储位 + /// + public string mesout_qtyrfe_loc_to { get; set; } + /// + /// 数量 + /// + public decimal mesout_qtyrfe_num { get; set; } + /// + /// 调拨用户 + /// + public string mesout_qtyrfe_user { get; set; } + /// + /// 写入时间 + /// + public string mesout_qtyrfe_wt { get; set; } + /// + /// 类型(1为质量补) + /// + public string mesout_qtyrfe_type { get; set; } + + public override object[] GetKeys() + { + return new object[] { mesout_qtyrfe_id }; + } + + /// + /// 是否读取(0,1) + /// + public long Yl1 { get; set; } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/QtyrfeManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/QtyrfeManager.cs new file mode 100644 index 000000000..9b1147dcb --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Qtyrfe/QtyrfeManager.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; +public class QtyrfeManager : DomainService, IQtyrfeManager +{ + private readonly IQtyrfeRepository _repository; + + public QtyrfeManager(IQtyrfeRepository repository) + { + _repository = repository; + } + public virtual async Task> GetToBeProcessedListAsync() + { + var plans = await _repository.GetListAsync(p => p.Yl1 == 0).ConfigureAwait(false); + return plans; + + } + public virtual async Task UpdateProcesseErrordListAsync(List entities) + { + var ids = entities.Select(p => p.mesout_qtyrfe_id); + var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_qtyrfe_id)).ConfigureAwait(false); + plans.ForEach(p => + { + p.Yl1 = 2; + // p.WmsDate = Clock.Now; + }); + await _repository.UpdateManyAsync(plans).ConfigureAwait(false); + } + public virtual async Task UpdateProcessedListAsync(List entities) + { + var ids = entities.Select(p => p.mesout_qtyrfe_id); + var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_qtyrfe_id)).ConfigureAwait(false); + plans.ForEach(p => + { + p.Yl1 = 1; + + // p.WmsDate = Clock.Now; + }); + await _repository.UpdateManyAsync(plans).ConfigureAwait(false); + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..9a28e7a47 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; + +namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; +public static class CallMtlDbContextModelCreatingExtensions +{ + public static void ConfigureCallMtl(this ModelBuilder builder, MesModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema Name + b.ToTable(options.TablePrefix + "mesout_callmtl", options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + + //Properties + b.Property(q => q.mesout_callmtl_id).HasMaxLength(20); + b.Property(q => q.mesout_callmtl_erpno).HasMaxLength(20); + b.Property(q => q.mesout_callmtl_loc).HasMaxLength(10); + b.Property(q => q.mesout_callmtl_num).HasPrecision(10, 2); + b.Property(q => q.mesout_callmtl_wt).HasMaxLength(20); + b.Property(q => q.Yl1); + }); + + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlEfCoreRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlEfCoreRepository.cs new file mode 100644 index 000000000..945973e60 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlEfCoreRepository.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; + +namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; +public class CallMtlEfCoreRepository : EfCoreRepository, ICallMtlRepository +{ + public CallMtlEfCoreRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeDbContextModelCreatingExtensions.cs index 3d5d56d79..85ed867b5 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeDbContextModelCreatingExtensions.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeDbContextModelCreatingExtensions.cs @@ -27,5 +27,9 @@ public static class DataExchangeDbContextModelCreatingExtensions builder.ConfigureScrap(options); builder.ConfigurePck(options); builder.ConfigureBackflu(options); + builder.ConfigureQtyrfe(options); + builder.ConfigureFrozen(options); + builder.ConfigureDelivery(options); + builder.ConfigureCallMtl(options); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeEntityFrameworkCoreFawtygModule.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeEntityFrameworkCoreFawtygModule.cs index ea5d271be..192205bbc 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeEntityFrameworkCoreFawtygModule.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeEntityFrameworkCoreFawtygModule.cs @@ -3,9 +3,13 @@ using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.MySQL; using Volo.Abp.Modularity; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.MesOut; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.PullTask; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; @@ -32,5 +36,9 @@ public class DataExchangeEntityFrameworkCoreFawtygModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); + context.Services.AddTransient(); + context.Services.AddTransient(); + context.Services.AddTransient(); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Delivery/DeliveryDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Delivery/DeliveryDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..4ae9db369 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Delivery/DeliveryDbContextModelCreatingExtensions.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; + +namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; + +public static class DeliveryDbContextModelCreatingExtensions +{ + public static void ConfigureDelivery(this ModelBuilder builder, MesModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema Name + b.ToTable(options.TablePrefix + "mesout_delivery", options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + + //Properties + b.Property(q => q.mesout_delivery_id).HasMaxLength(20); + b.Property(q => q.mesout_delivery_type).HasMaxLength(1); + b.Property(q => q.mesout_delivery_part).HasMaxLength(20); + b.Property(q => q.mesout_delivery_identity_no).HasMaxLength(20); + b.Property(q => q.mesout_delivery_loc).HasMaxLength(10); + b.Property(q => q.mesout_delivery_num).HasPrecision(10, 2); + b.Property(q => q.mesout_delivery_customer).HasMaxLength(10); + b.Property(q => q.mesout_delivery_carno).HasMaxLength(10); + b.Property(q => q.mesout_delivery_wt).HasMaxLength(20); + b.Property(q => q.mesout_delivery_no).HasMaxLength(20); + b.Property(q => q.mesout_delivery_container).HasMaxLength(20); + b.Property(q => q.mesout_delivery_plan).HasMaxLength(20); + b.Property(q => q.Yl1); + }); + + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Delivery/DeliveryEfCoreRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Delivery/DeliveryEfCoreRepository.cs new file mode 100644 index 000000000..ef2c6e155 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Delivery/DeliveryEfCoreRepository.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; + +namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; + +public class DeliveryEfCoreRepository : EfCoreRepository,IDeliveryRepository +{ + public DeliveryEfCoreRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Frozen/FrozenDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Frozen/FrozenDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..35103288d --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Frozen/FrozenDbContextModelCreatingExtensions.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; + +namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; +public static class FrozenDbContextModelCreatingExtensions +{ + public static void ConfigureFrozen(this ModelBuilder builder, MesModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema Name + b.ToTable(options.TablePrefix + "mesout_frozen", options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + + //Properties + b.Property(q => q.mesout_frozen_id).HasMaxLength(20); + b.Property(q => q.mesout_frozen_type).HasMaxLength(1); + b.Property(q => q.mesout_frozen_part).HasMaxLength(20); + b.Property(q => q.mesout_frozen_date).HasMaxLength(20); + b.Property(q => q.mesout_frozen_loc).HasMaxLength(10); + b.Property(q => q.mesout_frozen_reason).HasMaxLength(500); + b.Property(q => q.mesout_frozen_num).HasPrecision(10, 2); + b.Property(q => q.mesout_frozen_user).HasMaxLength(20); + b.Property(q => q.Yl1); + }); + + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Frozen/FrozenEfCoreRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Frozen/FrozenEfCoreRepository.cs new file mode 100644 index 000000000..e9dc87935 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Frozen/FrozenEfCoreRepository.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; + +namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; +public class FrozenEfCoreRepository : EfCoreRepository, IFrozenRepository +{ + public FrozenEfCoreRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/IMesDbContext.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/IMesDbContext.cs index 60810373f..a93053241 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/IMesDbContext.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/IMesDbContext.cs @@ -1,9 +1,13 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.MesOut; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.PullTask; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; @@ -20,4 +24,11 @@ public interface IMesDbContext : IEfCoreDbContext DbSet MesOuts { get; } DbSet PullTasks { get; } DbSet Backflu { get; } + + DbSet Qtyrfe { get; } + + DbSet Frozen { get; } + + DbSet Delivery { get; } + DbSet CallMtl { get; } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesDbContext.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesDbContext.cs index 775047674..c4efc833b 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesDbContext.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesDbContext.cs @@ -1,9 +1,13 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.MesOut; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.PullTask; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; @@ -22,6 +26,13 @@ public class MesDbContext : public virtual DbSet Issue { get; } public virtual DbSet Backflu { get; } + public virtual DbSet Qtyrfe { get; } + + public virtual DbSet Frozen { get; } + + public virtual DbSet Delivery { get; } + + public virtual DbSet CallMtl { get; } public MesDbContext(DbContextOptions options) : base(options) { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Qtyrfe/QtyrfeDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Qtyrfe/QtyrfeDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..1950bfa30 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Qtyrfe/QtyrfeDbContextModelCreatingExtensions.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; + +namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; +public static class QtyrfeDbContextModelCreatingExtensions +{ + public static void ConfigureQtyrfe(this ModelBuilder builder, MesModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema Name + b.ToTable(options.TablePrefix + "mesout_qtyrfe", options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + + //Properties + b.Property(q => q.mesout_qtyrfe_id).HasMaxLength(20); + b.Property(q => q.mesout_qtyrfe_part).HasMaxLength(20); + b.Property(q => q.mesout_qtyrfe_loc_from).HasMaxLength(10); + b.Property(q => q.mesout_qtyrfe_loc_to).HasMaxLength(10); + b.Property(q => q.mesout_qtyrfe_num).HasPrecision(10, 2); + b.Property(q => q.mesout_qtyrfe_user).HasMaxLength(20); + b.Property(q => q.mesout_qtyrfe_wt).HasMaxLength(20); + b.Property(q => q.mesout_qtyrfe_type).HasMaxLength(2); + b.Property(q => q.Yl1); + }); + + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Qtyrfe/QtyrfeEfCoreRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Qtyrfe/QtyrfeEfCoreRepository.cs new file mode 100644 index 000000000..81886dcaa --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Qtyrfe/QtyrfeEfCoreRepository.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; + +namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; + +public class QtyrfeEfCoreRepository : EfCoreRepository, IQtyrfeRepository +{ + public QtyrfeEfCoreRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes.csproj b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes.csproj index 89ae346ea..4f26ffa5b 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes.csproj +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes.csproj @@ -1,4 +1,4 @@ - + net6.0 diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs index 0f32b55f7..7f5cc4065 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs @@ -3,10 +3,15 @@ using Volo.Abp.AutoMapper; using Win_in.Sfs.Shared.Application; using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.WMS.BackFlushNote; +using Win_in.Sfs.Wms.DataExchange.WMS.DeliverNote; +using Win_in.Sfs.Wms.DataExchange.WMS.DeliverRequest; +using Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest; using Win_in.Sfs.Wms.DataExchange.WMS.MaterialRequest; +using Win_in.Sfs.Wms.DataExchange.WMS.MesNote; using Win_in.Sfs.Wms.DataExchange.WMS.PCK; using Win_in.Sfs.Wms.DataExchange.WMS.ProductReceiptNote; using Win_in.Sfs.Wms.DataExchange.WMS.ScrapNote; +using Win_in.Sfs.Wms.DataExchange.WMS.TransferNote; using Win_in.Sfs.Wms.Store.Application.Contracts; namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent; @@ -148,16 +153,14 @@ public class FawtygAutoMapperProfile : Profile .IgnoreIHasRecommendAndHandledFrom(); CreateMap() - .Ignore(x => x.Detail) - ; + .Ignore(x => x.Detail); CreateMap(); CreateMap() .Ignore(x => x.Details) .Ignore(x => x.ExtraProperties) .Ignore(x => x.Number) - .Ignore(x => x.JobNumber) - ; + .Ignore(x => x.JobNumber); CreateMap() .Ignore(x => x.ItemName) .Ignore(x => x.ItemDesc1) @@ -174,8 +177,122 @@ public class FawtygAutoMapperProfile : Profile .Ignore(x => x.ExpireDate) .Ignore(x => x.ToWarehouseCode) .Ignore(x => x.ToWarehouseCode) + .Ignore(x => x.Uom) + .Ignore(x => x.StdPackQty); + + CreateMap() + .Ignore(x => x.Details) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.RequestNumber) + .Ignore(x => x.JobNumber) + .Ignore(x => x.CallRequestNumber) + .Ignore(x => x.CallJobNumber) + .Ignore(x => x.CallBusinessType) + .Ignore(x => x.CallServerName) + .Ignore(x => x.UseOnTheWayLocation) + .Ignore(x => x.Confirmed) + .Ignore(x => x.ConfirmTime) + .Ignore(x => x.Details) + .Ignore(x => x.ExtraProperties); + CreateMap() + .Ignore(x => x.ItemName) + .Ignore(x => x.ItemDesc1) + .Ignore(x => x.ItemDesc2) + .Ignore(x => x.FromLocationCode) + .Ignore(x => x.FromLocationArea) + .Ignore(x => x.FromLocationGroup) + .Ignore(x => x.FromContainerCode) + .Ignore(x => x.FromWarehouseCode) + .Ignore(x => x.FromLot) + .Ignore(x => x.FromPackingCode) + .Ignore(x => x.ToPackingCode) + .Ignore(x => x.ToContainerCode) + .Ignore(x => x.ToLocationCode) + .Ignore(x => x.ToLocationArea) + .Ignore(x => x.ToLocationGroup) + .Ignore(x => x.ToWarehouseCode) + .Ignore(x => x.ToLot) + .Ignore(x => x.SupplierBatch) + .Ignore(x => x.ArriveDate) + .Ignore(x => x.ProduceDate) + .Ignore(x => x.ExpireDate) + .Ignore(x => x.Uom) + .Ignore(x => x.StdPackQty); + + CreateMap() + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.JobNumber) + .Ignore(x => x.Details) + .Ignore(x => x.ExtraProperties); + CreateMap() + .ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.FromLocationErpCode)) + .ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.ToLocationErpCode)) + .Ignore(x => x.ItemName) + .Ignore(x => x.ItemDesc1) + .Ignore(x => x.ItemDesc2) + .Ignore(x => x.FromLocationArea) + .Ignore(x => x.FromLocationGroup) + .Ignore(x => x.FromContainerCode) + .Ignore(x => x.FromWarehouseCode) + .Ignore(x => x.FromLot) + .Ignore(x => x.FromPackingCode) + .Ignore(x => x.ToPackingCode) + .Ignore(x => x.ToContainerCode) + .Ignore(x => x.ToLocationArea) + .Ignore(x => x.ToLocationGroup) + .Ignore(x => x.ToWarehouseCode) + .Ignore(x => x.ToLot) + .Ignore(x => x.SupplierBatch) + .Ignore(x => x.ArriveDate) + .Ignore(x => x.ProduceDate) + .Ignore(x => x.ExpireDate) + .Ignore(x => x.Uom) + .Ignore(x => x.StdPackQty); + + CreateMap() + .Ignore(x => x.DeliverPlanNumber) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Details) + .Ignore(x => x.CustomerAddressCode) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.AutoSubmit) + .Ignore(x => x.AutoAgree) + .Ignore(x => x.AutoHandle) + .Ignore(x => x.AutoCompleteJob) + .Ignore(x => x.DirectCreateNote); + CreateMap() .Ignore(x => x.Uom) .Ignore(x => x.StdPackQty) - ; + .Ignore(x => x.Remark) + .Ignore(x => x.ItemName) + .Ignore(x => x.ItemDesc1) + .Ignore(x => x.ItemDesc2); + + CreateMap() + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Details) + .Ignore(x => x.AutoSubmit) + .Ignore(x => x.AutoAgree) + .Ignore(x => x.AutoHandle) + .Ignore(x => x.AutoCompleteJob) + .Ignore(x => x.DirectCreateNote) + .Ignore(x => x.UseOnTheWayLocation); + CreateMap() + .Ignore(x => x.Uom) + .Ignore(x => x.StdPackQty) + .Ignore(x => x.Remark) + .Ignore(x => x.ItemName) + .Ignore(x => x.ItemDesc1) + .Ignore(x => x.ItemDesc2) + .Ignore(x => x.ProdLine) + .Ignore(x => x.ToLocationErpCode) + .Ignore(x => x.ToLocationArea) + .Ignore(x => x.ToLocationGroup) + .Ignore(x => x.ToWarehouseCode) + .Ignore(x => x.RequestStatus) + .Ignore(x => x.IssuedQty) + .Ignore(x => x.ReceivedQty) + .Ignore(x => x.Status) + .Ignore(x => x.PositionCode); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlConverter.cs new file mode 100644 index 000000000..a3b56ccb0 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlConverter.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Wms.DataExchange.Domain; +using Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest; +using Win_in.Sfs.Wms.Store.Application.Contracts; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; +public class CallMtlConverter : IIncomingConverter +{ + private readonly IIncomingFromExternalManager _incomingFromExternalManager; + private readonly IIncomingToWmsManager _incomingToWmsManager; + private readonly IObjectMapper _objectMapper; + private readonly IItemBasicAppService _itemBasicAppService; + private readonly ILocationAppService _locationAppService; + private readonly ILogger _logger; + + public CallMtlConverter( + IIncomingToWmsManager incomingToWmsManager + , IObjectMapper objectMapper + , IItemBasicAppService itemBasicAppService + , ILogger logger, + ILocationAppService locationAppService, + IIncomingFromExternalManager incomingFromExternalManager) + { + _incomingToWmsManager = incomingToWmsManager; + _objectMapper = objectMapper; + _itemBasicAppService = itemBasicAppService; + _logger = logger; + _locationAppService = locationAppService; + _incomingFromExternalManager = incomingFromExternalManager; + } + + public virtual async Task ConvertAsync(List incomingFromExternalList) + { + if (!incomingFromExternalList.Any()) + { + _logger.LogInformation("no CallMtls"); + return; + } + + //按Number合并InjectionIssue单据 + var transferNoteList = await BuildIncomingToWmsOfInjectionIssueAsync(incomingFromExternalList).ConfigureAwait(false); + await _incomingToWmsManager.CreateManyAsync(transferNoteList).ConfigureAwait(false); + //归档 + await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false); + } + + private async Task> BuildIncomingToWmsOfInjectionIssueAsync(List incomingDataList) + { + var incomingToWmsList = new List(); + foreach (var incomingData in incomingDataList) + { + var incomingToWms = new IncomingToWms() + { + DataType = incomingData.DataType, + DataAction = incomingData.DataAction, + SourceSystem = incomingData.SourceSystem, + DataIdentityCode = incomingData.SourceDataGroupCode, + }; + incomingToWms.SetEffectiveDate(incomingData.EffectiveDate); + var exchangeInjectionIssue = JsonSerializer.Deserialize(incomingData.DestinationDataContent); + var wmsInjectionIssueDetail = _objectMapper.Map(exchangeInjectionIssue.Detail); + var wmsInjectionIssue = _objectMapper.Map(exchangeInjectionIssue); + wmsInjectionIssue.Details = new List(); + var item = await _itemBasicAppService.GetByCodeAsync(wmsInjectionIssueDetail.ItemCode).ConfigureAwait(false); + try + { + + if (item != null) + { + wmsInjectionIssueDetail.ItemName = item.Name; + wmsInjectionIssueDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : ""; + wmsInjectionIssueDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : ""; + wmsInjectionIssueDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : ""; + wmsInjectionIssueDetail.StdPackQty = item.StdPackQty; + } + } + catch (Exception) + { + wmsInjectionIssueDetail.ItemName = ""; + wmsInjectionIssueDetail.ItemDesc1 = ""; + wmsInjectionIssueDetail.ItemDesc2 = ""; + wmsInjectionIssueDetail.Uom = ""; + } + + wmsInjectionIssue.Details.Add(wmsInjectionIssueDetail); + + incomingToWms.DataContent = JsonSerializer.Serialize(wmsInjectionIssue); + incomingToWmsList.Add(incomingToWms); + } + return incomingToWmsList; + } + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs new file mode 100644 index 000000000..7bc6dd95a --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Win_in.Sfs.Wms.DataExchange.Domain.Shared; +using Win_in.Sfs.Wms.DataExchange.Domain; +using System.Text.Json; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; +using Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest; +using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; +public class CallMtlReader : IReader +{ + private readonly ICallMtlManager _CallMtlManager; + private readonly IIncomingFromExternalManager _incomingFromExternalManager; + private readonly ILogger _logger; + private readonly ILocationAppService _locationAppService; + + public CallMtlReader( + ICallMtlManager pillTaskManager + , IIncomingFromExternalManager incomingFromExternalManager + , ILogger logger + , ILocationAppService locationAppService + ) + { + _CallMtlManager = pillTaskManager; + _incomingFromExternalManager = incomingFromExternalManager; + _logger = logger; + _locationAppService = locationAppService; + } + + public virtual async Task> ReadAsync() + + { + //从MES读取待处理CallMtl + var toBeProcessedPillTasks = await _CallMtlManager.GetToBeProcessedListAsync().ConfigureAwait(false); + if (!toBeProcessedPillTasks.Any()) + { + _logger.LogInformation("no CallMtls"); + return new List(); + } + //CallMtl逐一转换为MaterialRequest + var holdLocation = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.HOLD).ConfigureAwait(false); + var incomingDataList = BuildIncomingFromExternalFromPillTaskAsync(toBeProcessedPillTasks, holdLocation == null ? "" : holdLocation.Code); + await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); + //更新MES数据状态 + await _CallMtlManager.UpdateProcessedListAsync(toBeProcessedPillTasks).ConfigureAwait(false); + + return incomingDataList; + } + + private static List BuildIncomingFromExternalFromPillTaskAsync(List toBeProcessedCallMtls, string holdLocationCode) + { + var incomingDataList = new List(); + foreach (var CallMtl in toBeProcessedCallMtls) + { + var incomingData = BuildIncomingFromExternal(CallMtl); + + incomingData.SetEffectiveDate(DateTime.Now); + incomingData.SetSuccess(); + try + { + var MaterialRequest = BuildMesNoteCreateInput(CallMtl, holdLocationCode); + incomingData.DestinationDataContent = JsonSerializer.Serialize(MaterialRequest); + } + catch (Exception ex) + { + incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); + } + + incomingDataList.Add(incomingData); + + } + + return incomingDataList; + } + + private static IncomingFromExternal BuildIncomingFromExternal(CallMtl CallMtl) + { + var incomingData = new IncomingFromExternal() + { + DataType = EnumIncomingDataType.CallMtl.ToString(), + DataAction = EnumExchangeDataAction.Add, + SourceSystem = EnumSystemType.MES.ToString(), + SourceDataId = CallMtl.mesout_callmtl_id.ToString(), + SourceDataGroupCode = CallMtl.mesout_callmtl_id, + SourceDataDetailCode = CallMtl.mesout_callmtl_erpno, + SourceDataContent = JsonSerializer.Serialize(CallMtl), + WriteTime = DateTime.Now, + Writer = nameof(MesIncomingBackgroundWorker), + + DestinationSystem = EnumSystemType.WMS.ToString(), + }; + return incomingData; + } + + private static InjectionIssueRequestExchangeDto BuildMesNoteCreateInput(CallMtl CallMtl, string holdLocationCode) + { + var request = new InjectionIssueRequestExchangeDto() + { + IssueRequestType = EnumIssueRequestType.Mes, + Worker = "MesZDJL", + ActiveDate = DateTime.TryParse(CallMtl.mesout_callmtl_wt, out DateTime dateTime) ? dateTime : DateTime.Now + }; + var detail = new InjectionIssueRequestDetailExchangeDto() + { + ItemCode = CallMtl.mesout_callmtl_erpno, + Qty = CallMtl.mesout_callmtl_num, + BoxQty = CallMtl.mesout_callmtl_num, + ToLocationCode = CallMtl.mesout_callmtl_loc, + RecommendType = EnumRecommendType.RAW, + }; + request.Detail = detail; + return request; + } + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/DeliveryConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/DeliveryConverter.cs new file mode 100644 index 000000000..2f321ce47 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/DeliveryConverter.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Wms.DataExchange.Domain; +using Win_in.Sfs.Wms.DataExchange.WMS.DeliverRequest; +using Win_in.Sfs.Wms.Store.Application.Contracts; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; +public class DeliveryConverter : IIncomingConverter +{ + private readonly IIncomingFromExternalManager _incomingFromExternalManager; + private readonly IIncomingToWmsManager _incomingToWmsManager; + private readonly IObjectMapper _objectMapper; + private readonly IItemBasicAppService _itemBasicAppService; + private readonly ICustomerAppService _customerAppService; + private readonly ILogger _logger; + + public DeliveryConverter( + IIncomingToWmsManager incomingToWmsManager + , IObjectMapper objectMapper + , IItemBasicAppService itemBasicAppService + , ILogger logger, + ICustomerAppService customerAppService, + IIncomingFromExternalManager incomingFromExternalManager) + { + _incomingToWmsManager = incomingToWmsManager; + _objectMapper = objectMapper; + _itemBasicAppService = itemBasicAppService; + _logger = logger; + _customerAppService = customerAppService; + _incomingFromExternalManager = incomingFromExternalManager; + } + + public virtual async Task ConvertAsync(List incomingFromExternalList) + { + if (!incomingFromExternalList.Any()) + { + _logger.LogInformation("no Deliverys"); + return; + } + + //按Number合并DeliveryRequest单据 + var transferRequestList = await BuildIncomingToWmsOfDeliveryRequestAsync(incomingFromExternalList).ConfigureAwait(false); + await _incomingToWmsManager.CreateManyAsync(transferRequestList).ConfigureAwait(false); + //归档 + await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false); + } + + private async Task> BuildIncomingToWmsOfDeliveryRequestAsync(List incomingDataList) + { + var incomingToWmsList = new List(); + var groups = incomingDataList.GroupBy(p => new { p.SourceDataGroupCode ,p.SourceDataDetailCode}); + foreach (var group in groups) + { + var first = group.First(); + var incomingToWms = new IncomingToWms() + { + DataType = first.DataType, + DataAction = first.DataAction, + SourceSystem = first.SourceSystem, + DataIdentityCode = first.SourceDataGroupCode, + }; + incomingToWms.SetEffectiveDate(first.EffectiveDate); + var exchangeDeliveryRequest = JsonSerializer.Deserialize(first.DestinationDataContent); + var wmsDeliveryRequest = _objectMapper.Map(exchangeDeliveryRequest); + wmsDeliveryRequest.Details = new List(); + var cust= await _customerAppService.GetByCodeAsync(wmsDeliveryRequest.CustomerCode).ConfigureAwait(false); + wmsDeliveryRequest.CustomerAddressCode = String.IsNullOrEmpty( cust?.Address)?"无": cust.Address; + foreach (var incomingFromExternal in group.ToList()) + { + var transferRequest = JsonSerializer.Deserialize(incomingFromExternal.DestinationDataContent); + var wmsDeliveryRequestDetail = _objectMapper.Map(transferRequest.Detail); + var item = await _itemBasicAppService.GetByCodeAsync(wmsDeliveryRequestDetail.ItemCode).ConfigureAwait(false); + try + { + if (item != null) + { + wmsDeliveryRequestDetail.ItemName = item.Name; + wmsDeliveryRequestDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : ""; + wmsDeliveryRequestDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : ""; + wmsDeliveryRequestDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : ""; + wmsDeliveryRequestDetail.StdPackQty = item.StdPackQty; + } + } + catch (Exception) + { + wmsDeliveryRequestDetail.ItemName = ""; + wmsDeliveryRequestDetail.ItemDesc1 = ""; + wmsDeliveryRequestDetail.ItemDesc2 = ""; + wmsDeliveryRequestDetail.Uom = ""; + } + + wmsDeliveryRequest.Details.Add(wmsDeliveryRequestDetail); + } + incomingToWms.DataContent = JsonSerializer.Serialize(wmsDeliveryRequest); + incomingToWmsList.Add(incomingToWms); + } + return incomingToWmsList; + } + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/DeliveryReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/DeliveryReader.cs new file mode 100644 index 000000000..6a5238413 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/DeliveryReader.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; +using Win_in.Sfs.Wms.DataExchange.Domain.Shared; +using Win_in.Sfs.Wms.DataExchange.Domain; +using System.Text.Json; +using Win_in.Sfs.Wms.DataExchange.WMS.DeliverRequest; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; + +public class DeliveryReader : IReader +{ + private readonly IDeliveryManager _DeliveryManager; + private readonly IIncomingFromExternalManager _incomingFromExternalManager; + private readonly ILogger _logger; + + public DeliveryReader( + IDeliveryManager pillTaskManager + , IIncomingFromExternalManager incomingFromExternalManager + , ILogger logger + ) + { + _DeliveryManager = pillTaskManager; + _incomingFromExternalManager = incomingFromExternalManager; + _logger = logger; + } + + public virtual async Task> ReadAsync() + + { + //从MES读取待处理Delivery + var toBeProcessedPillTasks = await _DeliveryManager.GetToBeProcessedListAsync().ConfigureAwait(false); + if (!toBeProcessedPillTasks.Any()) + { + _logger.LogInformation("no Deliverys"); + return new List(); + } + //Delivery逐一转换为MaterialRequest + var incomingDataList = BuildIncomingFromExternalFromPillTaskAsync(toBeProcessedPillTasks); + await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); + //更新MES数据状态 + await _DeliveryManager.UpdateProcessedListAsync(toBeProcessedPillTasks).ConfigureAwait(false); + + return incomingDataList; + } + + private static List BuildIncomingFromExternalFromPillTaskAsync(List toBeProcessedDeliverys) + { + var incomingDataList = new List(); + foreach (var Delivery in toBeProcessedDeliverys) + { + var incomingData = BuildIncomingFromExternal(Delivery); + + incomingData.SetEffectiveDate(DateTime.Now); + incomingData.SetSuccess(); + try + { + var DetilveryRequest = BuildDeliverRequestCreateInput(Delivery); + incomingData.DestinationDataContent = JsonSerializer.Serialize(DetilveryRequest); + } + catch (Exception ex) + { + incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); + } + + incomingDataList.Add(incomingData); + + } + + return incomingDataList; + } + + private static IncomingFromExternal BuildIncomingFromExternal(Delivery Delivery) + { + var incomingData = new IncomingFromExternal() + { + DataType = EnumIncomingDataType.Delivery.ToString(), + DataAction = EnumExchangeDataAction.Add, + SourceSystem = EnumSystemType.MES.ToString(), + SourceDataId = Delivery.mesout_delivery_id.ToString(), + SourceDataGroupCode =Delivery.mesout_delivery_type=="0"? Delivery.mesout_delivery_no : Delivery.mesout_delivery_plan, + SourceDataDetailCode = Delivery.mesout_delivery_customer, + SourceDataContent = JsonSerializer.Serialize(Delivery), + WriteTime = DateTime.Now, + Writer = nameof(MesIncomingBackgroundWorker), + + DestinationSystem = EnumSystemType.WMS.ToString(), + }; + return incomingData; + } + + private static DeliverRequestExchangeDto BuildDeliverRequestCreateInput(Delivery Delivery) + { + var mesRequest = new DeliverRequestExchangeDto() + { + DeliverRequestType = Delivery.mesout_delivery_type == "0" ? EnumDeliverRequestType.FIS : EnumDeliverRequestType.Normal, + CustomerCode = Delivery.mesout_delivery_customer, + Number = Delivery.mesout_delivery_no, + Worker = "MESFY", + ActiveDate = DateTime.TryParse(Delivery.mesout_delivery_wt, out DateTime dateTime) ? dateTime : DateTime.Now, + DeliverTime = DateTime.TryParse(Delivery.mesout_delivery_wt, out DateTime dateTime1) ? dateTime1 : DateTime.Now + }; + var mesRequestDetail = new DeliverRequestDetailExchangeDto() + { + ItemCode = Delivery.mesout_delivery_part, + Qty = Delivery.mesout_delivery_num, + AreaCode = Delivery.mesout_delivery_loc, + MesDeliveryNo=Delivery.mesout_delivery_no, + MesDeliveryPlan = Delivery.mesout_delivery_plan, + IdentityNo =Delivery.mesout_delivery_identity_no + }; + mesRequest.Detail = mesRequestDetail; + return mesRequest; + } + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/FrozenConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/FrozenConverter.cs new file mode 100644 index 000000000..378067647 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/FrozenConverter.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +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.WMS.MesNote; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Wms.DataExchange.WMS.MesNote; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; + +public class FrozenConverter : IIncomingConverter +{ + private readonly IIncomingFromExternalManager _incomingFromExternalManager; + private readonly IIncomingToWmsManager _incomingToWmsManager; + private readonly IObjectMapper _objectMapper; + private readonly IItemBasicAppService _itemBasicAppService; + private readonly ILocationAppService _locationAppService; + private readonly ILogger _logger; + + public FrozenConverter( + IIncomingToWmsManager incomingToWmsManager + , IObjectMapper objectMapper + , IItemBasicAppService itemBasicAppService + , ILogger logger, + ILocationAppService locationAppService, + IIncomingFromExternalManager incomingFromExternalManager) + { + _incomingToWmsManager = incomingToWmsManager; + _objectMapper = objectMapper; + _itemBasicAppService = itemBasicAppService; + _logger = logger; + _locationAppService = locationAppService; + _incomingFromExternalManager = incomingFromExternalManager; + } + + public virtual async Task ConvertAsync(List incomingFromExternalList) + { + if (!incomingFromExternalList.Any()) + { + _logger.LogInformation("no Frozens"); + return; + } + + //按Number合并MesNote单据 + var transferNoteList = await BuildIncomingToWmsOfMesNoteAsync(incomingFromExternalList).ConfigureAwait(false); + await _incomingToWmsManager.CreateManyAsync(transferNoteList).ConfigureAwait(false); + //归档 + await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false); + } + + private async Task> BuildIncomingToWmsOfMesNoteAsync(List incomingDataList) + { + var incomingToWmsList = new List(); + foreach (var incomingData in incomingDataList) + { + var incomingToWms = new IncomingToWms() + { + DataType = incomingData.DataType, + DataAction = incomingData.DataAction, + SourceSystem = incomingData.SourceSystem, + DataIdentityCode = incomingData.SourceDataGroupCode, + }; + incomingToWms.SetEffectiveDate(incomingData.EffectiveDate); + var exchangeMesNote = JsonSerializer.Deserialize(incomingData.DestinationDataContent); + var wmsMesNoteDetail = _objectMapper.Map(exchangeMesNote.Detail); + var wmsMesNote = _objectMapper.Map(exchangeMesNote); + wmsMesNote.Details = new List(); + var item = await _itemBasicAppService.GetByCodeAsync(wmsMesNoteDetail.ItemCode).ConfigureAwait(false); + try + { + wmsMesNoteDetail.FromPackingCode = ""; + wmsMesNoteDetail.ToPackingCode = ""; + wmsMesNoteDetail.FromLot = ""; + wmsMesNoteDetail.ToLot = ""; + wmsMesNoteDetail.FromWarehouseCode = ""; + wmsMesNoteDetail.ToWarehouseCode = ""; + //if (transferNote.Remark.Contains("质量补移库"))//质量补 + //{ + // wmsMesNoteDetail.FromPackingCode = "RFE"; //质量补排序批次 + // wmsMesNoteDetail.FromLot = "RFE";//质量补箱标签 + // wmsMesNoteDetail.ToPackingCode = "RFE"; //质量补排序批次 + // wmsMesNoteDetail.ToLot = "RFE";//质量补箱标签 + //} + if (item != null) + { + wmsMesNoteDetail.ItemName = item.Name; + wmsMesNoteDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : ""; + wmsMesNoteDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : ""; + wmsMesNoteDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : ""; + wmsMesNoteDetail.StdPackQty = item.StdPackQty; + } + //if (tolocation != null) + //{ + // wmsMesNoteDetail.ToLocationCode = tolocation.Code; + // wmsMesNoteDetail.ToLocationArea = tolocation.AreaCode; + // wmsMesNoteDetail.ToLocationGroup = tolocation.LocationGroupCode; + // wmsMesNoteDetail.ToWarehouseCode = tolocation.WarehouseCode; + // if (tolocation.Type == EnumLocationType.CUST) + // { + // wmsMesNote.Type = EnumTransSubType.Mes_Customer.ToString();//客户储位调拨 + // } + //} + //if (fromlocation != null) + //{ + // wmsMesNoteDetail.FromLocationCode = fromlocation.Code; + // wmsMesNoteDetail.FromLocationArea = fromlocation.AreaCode; + // wmsMesNoteDetail.FromLocationGroup = fromlocation.LocationGroupCode; + // wmsMesNoteDetail.FromWarehouseCode = fromlocation.WarehouseCode; + //} + } + catch (Exception) + { + wmsMesNoteDetail.ItemName = ""; + wmsMesNoteDetail.ItemDesc1 = ""; + wmsMesNoteDetail.ItemDesc2 = ""; + wmsMesNoteDetail.Uom = ""; + } + + wmsMesNote.Details.Add(wmsMesNoteDetail); + + incomingToWms.DataContent = JsonSerializer.Serialize(wmsMesNote); + incomingToWmsList.Add(incomingToWms); + } + return incomingToWmsList; + } + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/FrozenReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/FrozenReader.cs new file mode 100644 index 000000000..75b4f9ba5 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/FrozenReader.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; +using Win_in.Sfs.Wms.DataExchange.Domain.Shared; +using Win_in.Sfs.Wms.DataExchange.Domain; +using System.Text.Json; +using Win_in.Sfs.Wms.DataExchange.WMS.MesNote; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; +public class FrozenReader : IReader +{ + private readonly IFrozenManager _FrozenManager; + private readonly IIncomingFromExternalManager _incomingFromExternalManager; + private readonly ILogger _logger; + private readonly ILocationAppService _locationAppService; + + public FrozenReader( + IFrozenManager pillTaskManager + , IIncomingFromExternalManager incomingFromExternalManager + , ILogger logger + , ILocationAppService locationAppService + ) + { + _FrozenManager = pillTaskManager; + _incomingFromExternalManager = incomingFromExternalManager; + _logger = logger; + _locationAppService = locationAppService; + } + + public virtual async Task> ReadAsync() + + { + //从MES读取待处理Frozen + var toBeProcessedPillTasks = await _FrozenManager.GetToBeProcessedListAsync().ConfigureAwait(false); + if (!toBeProcessedPillTasks.Any()) + { + _logger.LogInformation("no Frozens"); + return new List(); + } + //Frozen逐一转换为MaterialRequest + var holdLocation = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.HOLD).ConfigureAwait(false); + var incomingDataList = BuildIncomingFromExternalFromPillTaskAsync(toBeProcessedPillTasks, holdLocation==null?"": holdLocation.Code); + await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); + //更新MES数据状态 + await _FrozenManager.UpdateProcessedListAsync(toBeProcessedPillTasks).ConfigureAwait(false); + + return incomingDataList; + } + + private static List BuildIncomingFromExternalFromPillTaskAsync(List toBeProcessedFrozens,string holdLocationCode) + { + var incomingDataList = new List(); + foreach (var Frozen in toBeProcessedFrozens) + { + var incomingData = BuildIncomingFromExternal(Frozen); + + incomingData.SetEffectiveDate(DateTime.Now); + incomingData.SetSuccess(); + try + { + var MaterialRequest = BuildMesNoteCreateInput(Frozen, holdLocationCode); + incomingData.DestinationDataContent = JsonSerializer.Serialize(MaterialRequest); + } + catch (Exception ex) + { + incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); + } + + incomingDataList.Add(incomingData); + + } + + return incomingDataList; + } + + private static IncomingFromExternal BuildIncomingFromExternal(Frozen Frozen) + { + var incomingData = new IncomingFromExternal() + { + DataType = EnumIncomingDataType.MesNote.ToString(), + DataAction = EnumExchangeDataAction.Add, + SourceSystem = EnumSystemType.MES.ToString(), + SourceDataId = Frozen.mesout_frozen_id.ToString(), + SourceDataGroupCode = Frozen.mesout_frozen_id, + SourceDataDetailCode = Frozen.mesout_frozen_part, + SourceDataContent = JsonSerializer.Serialize(Frozen), + WriteTime = DateTime.Now, + Writer = nameof(MesIncomingBackgroundWorker), + + DestinationSystem = EnumSystemType.WMS.ToString(), + }; + return incomingData; + } + + private static MesNoteExchangeDto BuildMesNoteCreateInput(Frozen Frozen, string holdLocationCode) + { + var mesNote = new MesNoteExchangeDto() + { + MesRequestNumber=Frozen.mesout_frozen_id, + Worker = Frozen.mesout_frozen_user, + Remark = Frozen.mesout_frozen_reason, + Type = Frozen.mesout_frozen_type == "0" ? EnumTransType.MesFreezed.ToString() : EnumTransType.MesUnFreezed.ToString(), + ActiveDate = DateTime.TryParse(Frozen.mesout_frozen_date, out DateTime dateTime) ? dateTime : DateTime.Now + }; + var mesNoteDetail = new MesNoteDetailExchangeDto() + { + ItemCode = Frozen.mesout_frozen_part, + Qty = Frozen.mesout_frozen_num, + ToLocationErpCode = Frozen.mesout_frozen_type == "0"? holdLocationCode : Frozen.mesout_frozen_loc, + FromLocationErpCode = Frozen.mesout_frozen_type != "0"? holdLocationCode:Frozen.mesout_frozen_loc, + ToStatus= Frozen.mesout_frozen_type == "0"? EnumInventoryStatus.HOLD: EnumInventoryStatus.OK, + FromStatus = Frozen.mesout_frozen_type != "0" ? EnumInventoryStatus.HOLD : EnumInventoryStatus.OK, + }; + mesNote.Detail = mesNoteDetail; + return mesNote; + } + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs index 87b487f78..950c015b9 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -6,6 +7,7 @@ using Microsoft.Extensions.Options; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Threading; using Volo.Abp.Uow; +using Win_in.Sfs.Wms.DataExchange.Domain.Shared; using Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent; @@ -46,10 +48,18 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase Logger.LogInformation($"Read MesOut");//缴库 var mesOutReader = workerContext.ServiceProvider.GetRequiredService(); var mesOutConverter = workerContext.ServiceProvider.GetRequiredService(); - //读取并保存MesOut + var TransferNoteConverter = workerContext.ServiceProvider.GetRequiredService(); + //读取mes缴库 var mesOutsFromExternalList = await mesOutReader.ReadAsync().ConfigureAwait(false); - //转换MesOut - await mesOutConverter.ConvertAsync(mesOutsFromExternalList).ConfigureAwait(false); + var mesOutsFromExternalList_ProductReceipt = mesOutsFromExternalList.Where(r => r.DataType == EnumIncomingDataType.ProductReceipt.ToString()).ToList(); + var mesOutsFromExternalList_TransferNote = mesOutsFromExternalList.Where(r => r.DataType == EnumIncomingDataType.TransferNote.ToString()).ToList(); + //转换缴库数据(如果有质量补得数据直接生产移库数据移到客户库位) + await mesOutConverter.ConvertAsync(mesOutsFromExternalList_ProductReceipt).ConfigureAwait(false); + if (mesOutsFromExternalList_TransferNote.Count > 0)//如果有质量补则生产储位调拨任务 + { + await TransferNoteConverter.ConvertAsync(mesOutsFromExternalList_TransferNote).ConfigureAwait(false); + } + //上海和安徽无此接口 //Logger.LogInformation($"Read PullTask");//拉动任务 @@ -59,7 +69,7 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase //var pullTaskFromExternalList = await pullTaskReader.ReadAsync().ConfigureAwait(false); ////转换PullTask //await pullTaskConverter.ConvertAsync(pullTaskFromExternalList).ConfigureAwait(false); - Logger.LogInformation($"Read Scrap"); + Logger.LogInformation($"Read Scrap");//报废 var scrapReader = workerContext.ServiceProvider.GetRequiredService(); var scrapConverter = workerContext.ServiceProvider.GetRequiredService(); @@ -84,6 +94,42 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase var backFlushsFromExternalList = await BackFlushReader.ReadAsync().ConfigureAwait(false); //转换BackFlush await BackFlushConverter.ConvertAsync(backFlushsFromExternalList).ConfigureAwait(false); + + + Logger.LogInformation($"Read TransferNote");//储位调拨 + var TransferNoteReader = workerContext.ServiceProvider.GetRequiredService(); + // var TransferNoteConverter = workerContext.ServiceProvider.GetRequiredService(); + //读取并保存TransferNote + var transferNoteFromExternalList = await TransferNoteReader.ReadAsync().ConfigureAwait(false); + //转换TransferNote + await TransferNoteConverter.ConvertAsync(transferNoteFromExternalList).ConfigureAwait(false); + + Logger.LogInformation($"Read Frozen");//冻结解冻 + var FrozenReader = workerContext.ServiceProvider.GetRequiredService(); + var FrozenConverter = workerContext.ServiceProvider.GetRequiredService(); + //读取并保存Frozen + var mesNoteFromExternalList = await FrozenReader.ReadAsync().ConfigureAwait(false); + //转换Frozen + await FrozenConverter.ConvertAsync(mesNoteFromExternalList).ConfigureAwait(false); + + + Logger.LogInformation($"Read Delivery");//成品发运 + var DeliveryReader = workerContext.ServiceProvider.GetRequiredService(); + var DeliveryConverter = workerContext.ServiceProvider.GetRequiredService(); + //读取并保存Delivery + var deliveryNoteFromExternalList = await DeliveryReader.ReadAsync().ConfigureAwait(false); + //转换Delivery + await DeliveryConverter.ConvertAsync(deliveryNoteFromExternalList).ConfigureAwait(false); + + + + Logger.LogInformation($"Read CallMtl");//自动叫料 + var CallMtlReader = workerContext.ServiceProvider.GetRequiredService(); + var CallMtlConverter = workerContext.ServiceProvider.GetRequiredService(); + //读取并保存Delivery + var callMtlFromExternalList = await CallMtlReader.ReadAsync().ConfigureAwait(false); + //转换Delivery + await CallMtlConverter.ConvertAsync(callMtlFromExternalList).ConfigureAwait(false); Logger.LogInformation($"Completed: Handling {Incoming}"); } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs index 941cc6cb4..5ede235e6 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs @@ -89,7 +89,7 @@ public class MesOutConverter : IIncomingConverter var productReceiptNote = JsonSerializer.Deserialize(incomingFromExternal.DestinationDataContent); var wmsProductReceiptNoteDetail = _objectMapper.Map(productReceiptNote.Detail); - var oldNoteDetail = wmsProductReceiptNote.Details.FirstOrDefault(r => r.ItemCode == wmsProductReceiptNoteDetail.ItemCode && r.LocationErpCode == wmsProductReceiptNoteDetail.LocationErpCode && (first.TableType != EnumExchangeTableType.MainTable ? true : r.ReturnQty != 0)); + var oldNoteDetail = wmsProductReceiptNote.Details.FirstOrDefault(r =>r.MesQuality== wmsProductReceiptNoteDetail.MesQuality&& r.ItemCode == wmsProductReceiptNoteDetail.ItemCode && r.LocationErpCode == wmsProductReceiptNoteDetail.LocationErpCode && (first.TableType != EnumExchangeTableType.MainTable ? true : r.ReturnQty != 0)); sumdetail.itemCode = wmsProductReceiptNoteDetail.ItemCode; sumdetail.locationCode = wmsProductReceiptNoteDetail.LocationErpCode; @@ -111,6 +111,11 @@ public class MesOutConverter : IIncomingConverter wmsProductReceiptNoteDetail.WarehouseCode = "T8"; wmsProductReceiptNoteDetail.LocationArea = ""; wmsProductReceiptNoteDetail.LocationGroup = ""; + if (wmsProductReceiptNoteDetail.MesQuality=="1")//质量补 + { + wmsProductReceiptNoteDetail.Lot = "RFE"; //质量补排序批次 + wmsProductReceiptNoteDetail.PackingCode = "RFE";//质量补箱标签 + } var loc = await _locationAppService.GetListByTypesAndErpCodeAsync(types, wmsProductReceiptNoteDetail.LocationErpCode, wmsProductReceiptNoteDetail.LocationErpCode).ConfigureAwait(false); if (loc != null) { @@ -123,13 +128,16 @@ public class MesOutConverter : IIncomingConverter wmsProductReceiptNoteDetail.HandledToLocationArea = loc[0].AreaCode; wmsProductReceiptNoteDetail.HandledToLocationGroup = loc[0].LocationGroupCode; wmsProductReceiptNoteDetail.HandledToLocationErpCode = loc[0].ErpLocationCode; + wmsProductReceiptNoteDetail.HandledPackingCode = wmsProductReceiptNoteDetail.PackingCode; + wmsProductReceiptNoteDetail.HandledLot = wmsProductReceiptNoteDetail.Lot; wmsProductReceiptNoteDetail.RecommendToLocationCode = loc[0].Code; wmsProductReceiptNoteDetail.RecommendToLocationArea = loc[0].AreaCode; wmsProductReceiptNoteDetail.RecommendToLocationGroup = loc[0].LocationGroupCode; wmsProductReceiptNoteDetail.RecommendToLocationErpCode = loc[0].ErpLocationCode; + wmsProductReceiptNoteDetail.RecommendPackingCode = wmsProductReceiptNoteDetail.PackingCode; + wmsProductReceiptNoteDetail.RecommendLot = wmsProductReceiptNoteDetail.Lot; } - var item = await _itemBasicAppService.GetByCodeAsync(wmsProductReceiptNoteDetail.ItemCode).ConfigureAwait(false); if (item != null) { @@ -137,7 +145,7 @@ public class MesOutConverter : IIncomingConverter wmsProductReceiptNoteDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : ""; wmsProductReceiptNoteDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : ""; wmsProductReceiptNoteDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : ""; - + wmsProductReceiptNoteDetail.StdPackQty = item.StdPackQty; wmsProductReceiptNoteDetail.ProduceDate = incomingFromExternal.EffectiveDate; wmsProductReceiptNoteDetail.ArriveDate = incomingFromExternal.EffectiveDate; wmsProductReceiptNoteDetail.ExpireDate = wmsProductReceiptNoteDetail.ProduceDate.AddDays(item.GetValidateDays()); diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutReader.cs index f0171be9c..958d8eeba 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutReader.cs @@ -8,8 +8,10 @@ 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.MesOut; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; using Win_in.Sfs.Wms.DataExchange.Domain.Shared; using Win_in.Sfs.Wms.DataExchange.WMS.ProductReceiptNote; +using Win_in.Sfs.Wms.DataExchange.WMS.TransferNote; namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent; @@ -19,17 +21,20 @@ public class MesOutReader : IReader private readonly IIncomingFromExternalManager _incomingFromExternalManager; private readonly ILogger _logger; private readonly ILocationAppService _locationAppService; + private readonly ICustomerItemAppService _customerItemAppService; public MesOutReader( IMesOutManager mesOutManager , IIncomingFromExternalManager incomingFromExternalManager , ILogger logger , ILocationAppService locationAppService + , ICustomerItemAppService customerItemAppService ) { _mesOutManager = mesOutManager; _incomingFromExternalManager = incomingFromExternalManager; _logger = logger; _locationAppService = locationAppService; + _customerItemAppService = customerItemAppService; } public virtual async Task> ReadAsync() @@ -51,7 +56,7 @@ public class MesOutReader : IReader await _mesOutManager.UpdateProcesseErrordListAsync(toBeProcessedEroMwsOuts).ConfigureAwait(false); } //MesOut逐一转换为ProductReceiptNote - var incomingDataList = BuildIncomingFromExternalFromShipAsync(toBeProcessedMwsOuts); + var incomingDataList =await BuildIncomingFromExternalFromShipAsync(toBeProcessedMwsOuts).ConfigureAwait(false); await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); //更新MES数据状态 await _mesOutManager.UpdateProcessedListAsync(toBeProcessedMwsOuts).ConfigureAwait(false); @@ -59,13 +64,12 @@ public class MesOutReader : IReader return incomingDataList; } - private static List BuildIncomingFromExternalFromShipAsync(List toBeProcessedMesOuts) + private async Task> BuildIncomingFromExternalFromShipAsync(List toBeProcessedMesOuts) { var incomingDataList = new List(); foreach (var mesOut in toBeProcessedMesOuts) { var incomingData = BuildIncomingFromExternal(mesOut); - incomingData.SetEffectiveDate(DateTime.ParseExact(mesOut.Mesout_date, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture)); incomingData.SetSuccess(); try @@ -79,7 +83,29 @@ public class MesOutReader : IReader } incomingDataList.Add(incomingData); + if (mesOut.Mesout_quality == "1") + { + //查询零件对应的客户库位 + string locationCode = await _customerItemAppService.GetFirstLocationCodeByItemCode(mesOut.Mesout_part).ConfigureAwait(false); + if (!string.IsNullOrEmpty(locationCode)) + { + var incomingData_TransferNote = BuildIncomingFromExternal_TransferNote(mesOut); + incomingData_TransferNote.SetEffectiveDate(DateTime.ParseExact(mesOut.Mesout_date, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture)); + incomingData_TransferNote.SetSuccess(); + try + { + + var transferNote = BuildTransferNoteCreateInput(mesOut, locationCode); + incomingData_TransferNote.DestinationDataContent = JsonSerializer.Serialize(transferNote); + } + catch (Exception ex) + { + incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); + } + incomingDataList.Add(incomingData_TransferNote); + } + } } return incomingDataList; @@ -126,7 +152,6 @@ public class MesOutReader : IReader } return incomingData; } - private static ProductReceiptNoteExchangeDto BuildProductReceiptNoteCreateInput(MesOut mesOut) { var productReceiptNote = new ProductReceiptNoteExchangeDto() @@ -141,10 +166,53 @@ public class MesOutReader : IReader Qty = mesOut.Mesout_move, LocationErpCode = mesOut.Mesout_loc, Remark = mesOut.memo, - ReturnQty = mesOut.Mesout_bad + ReturnQty = mesOut.Mesout_bad, + MesBarCode = mesOut.Mesout_barcode, + MesQuality = mesOut.Mesout_quality + }; productReceiptNote.Detail = productReceiptNoteDetail; return productReceiptNote; } + private static IncomingFromExternal BuildIncomingFromExternal_TransferNote(MesOut mesOut) + { + var incomingData = new IncomingFromExternal() + { + DataType = EnumIncomingDataType.TransferNote.ToString(), + DataAction = EnumExchangeDataAction.Add, + SourceSystem = EnumSystemType.MES.ToString(), + SourceDataId = mesOut.Mesout_ref_nbr.ToString(), + SourceDataGroupCode = mesOut.Mesout_ref_nbr, + SourceDataDetailCode = mesOut.Mesout_part, + SourceDataContent = JsonSerializer.Serialize(mesOut), + WriteTime = DateTime.Now, + Writer = nameof(MesIncomingBackgroundWorker), + + DestinationSystem = EnumSystemType.WMS.ToString(), + }; + return incomingData; + } + + private static TransferNoteExchangeDto BuildTransferNoteCreateInput(MesOut mesOut,string toLocationCode) + { + var transferNote = new TransferNoteExchangeDto() + { + Worker = "MesJK", + Remark="质量补移库" + }; + var transferNoteDetail = new TransferNoteDetailExchangeDto() + { + ItemCode = mesOut.Mesout_part, + Qty = mesOut.Mesout_move, + ToLocationErpCode = toLocationCode, + FromLocationErpCode = mesOut.Mesout_loc, + PackingCode="RFE", + Lot = "RFE", + }; + transferNote.Detail = transferNoteDetail; + return transferNote; + } + + } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/QtyrfeConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/QtyrfeConverter.cs new file mode 100644 index 000000000..91f9e3f6c --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/QtyrfeConverter.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +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.WMS.TransferNote; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; +public class QtyrfeConverter : IIncomingConverter +{ + private readonly IIncomingFromExternalManager _incomingFromExternalManager; + private readonly IIncomingToWmsManager _incomingToWmsManager; + private readonly IObjectMapper _objectMapper; + private readonly IItemBasicAppService _itemBasicAppService; + private readonly ILocationAppService _locationAppService; + private readonly ILogger _logger; + + public QtyrfeConverter( + IIncomingToWmsManager incomingToWmsManager + , IObjectMapper objectMapper + , IItemBasicAppService itemBasicAppService + , ILogger logger, + ILocationAppService locationAppService, + IIncomingFromExternalManager incomingFromExternalManager) + { + _incomingToWmsManager = incomingToWmsManager; + _objectMapper = objectMapper; + _itemBasicAppService = itemBasicAppService; + _logger = logger; + _locationAppService = locationAppService; + _incomingFromExternalManager = incomingFromExternalManager; + } + + public virtual async Task ConvertAsync(List incomingFromExternalList) + { + if (!incomingFromExternalList.Any()) + { + _logger.LogInformation("no Qtyrfes"); + return; + } + + //按Number合并TransferNote单据 + var transferNoteList = await BuildIncomingToWmsOfTransferNoteAsync(incomingFromExternalList).ConfigureAwait(false); + await _incomingToWmsManager.CreateManyAsync(transferNoteList).ConfigureAwait(false); + //归档 + await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false); + } + + private async Task> BuildIncomingToWmsOfTransferNoteAsync(List incomingDataList) + { + var incomingToWmsList = new List(); + var groups = incomingDataList.GroupBy(p => p.SourceDataGroupCode); + foreach (var group in groups) + { + var first = group.First(); + var incomingToWms = new IncomingToWms() + { + DataType = first.DataType, + DataAction = first.DataAction, + SourceSystem = first.SourceSystem, + DataIdentityCode = first.SourceDataGroupCode, + }; + incomingToWms.SetEffectiveDate(first.EffectiveDate); + var exchangeTransferNote = JsonSerializer.Deserialize(first.DestinationDataContent); + var wmsTransferNote = _objectMapper.Map(exchangeTransferNote); + wmsTransferNote.Type = EnumTransSubType.Transfer_Area.ToString();//客户储位调拨 + wmsTransferNote.Details = new List(); + foreach (var incomingFromExternal in group.ToList()) + { + var transferNote = JsonSerializer.Deserialize(incomingFromExternal.DestinationDataContent); + var wmsTransferNoteDetail = _objectMapper.Map(transferNote.Detail); + var item = await _itemBasicAppService.GetByCodeAsync(wmsTransferNoteDetail.ItemCode).ConfigureAwait(false); + var tolocation=await _locationAppService.GetByCodeAsync(wmsTransferNoteDetail.ToLocationErpCode).ConfigureAwait(false); + var fromlocation = await _locationAppService.GetByCodeAsync(wmsTransferNoteDetail.FromLocationErpCode).ConfigureAwait(false); + try + { + wmsTransferNoteDetail.FromPackingCode = ""; + wmsTransferNoteDetail.ToPackingCode = ""; + wmsTransferNoteDetail.FromLot = ""; + wmsTransferNoteDetail.ToLot = ""; + wmsTransferNoteDetail.FromStatus = EnumInventoryStatus.OK; + wmsTransferNoteDetail.ToStatus = EnumInventoryStatus.OK; + if (transferNote.Remark.Contains("质量补移库"))//质量补 + { + wmsTransferNoteDetail.FromPackingCode = "RFE"; //质量补排序批次 + wmsTransferNoteDetail.FromLot = "RFE";//质量补箱标签 + wmsTransferNoteDetail.ToPackingCode = "RFE"; //质量补排序批次 + wmsTransferNoteDetail.ToLot = "RFE";//质量补箱标签 + } + if (item != null) + { + wmsTransferNoteDetail.ItemName = item.Name; + wmsTransferNoteDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : ""; + wmsTransferNoteDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : ""; + wmsTransferNoteDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : ""; + wmsTransferNoteDetail.StdPackQty = item.StdPackQty; + } + if (tolocation != null) + { + wmsTransferNoteDetail.ToLocationCode = tolocation.Code; + wmsTransferNoteDetail.ToLocationArea = tolocation.AreaCode; + wmsTransferNoteDetail.ToLocationGroup = tolocation.LocationGroupCode; + wmsTransferNoteDetail.ToWarehouseCode = tolocation.WarehouseCode; + if (tolocation.Type== EnumLocationType.CUST) + { + wmsTransferNote.Type = EnumTransSubType.Transfer_Customer.ToString();//客户储位调拨 + } + } + if (fromlocation!=null) + { + wmsTransferNoteDetail.FromLocationCode = fromlocation.Code; + wmsTransferNoteDetail.FromLocationArea = fromlocation.AreaCode; + wmsTransferNoteDetail.FromLocationGroup = fromlocation.LocationGroupCode; + wmsTransferNoteDetail.FromWarehouseCode = fromlocation.WarehouseCode; + } + } + catch (Exception) + { + wmsTransferNoteDetail.ItemName = ""; + wmsTransferNoteDetail.ItemDesc1 = ""; + wmsTransferNoteDetail.ItemDesc2 = ""; + wmsTransferNoteDetail.Uom = ""; + } + + wmsTransferNote.Details.Add(wmsTransferNoteDetail); + } + incomingToWms.DataContent = JsonSerializer.Serialize(wmsTransferNote); + incomingToWmsList.Add(incomingToWms); + } + return incomingToWmsList; + } + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/QtyrfeReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/QtyrfeReader.cs new file mode 100644 index 000000000..a2e2e22d9 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/QtyrfeReader.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; +using Win_in.Sfs.Wms.DataExchange.Domain.Shared; +using Win_in.Sfs.Wms.DataExchange.Domain; +using Win_in.Sfs.Wms.DataExchange.WMS.MaterialRequest; +using Win_in.Sfs.Wms.DataExchange.WMS.TransferNote; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; +public class QtyrfeReader : IReader +{ + private readonly IQtyrfeManager _QtyrfeManager; + private readonly IIncomingFromExternalManager _incomingFromExternalManager; + private readonly ILogger _logger; + + public QtyrfeReader( + IQtyrfeManager pillTaskManager + , IIncomingFromExternalManager incomingFromExternalManager + , ILogger logger + ) + { + _QtyrfeManager = pillTaskManager; + _incomingFromExternalManager = incomingFromExternalManager; + _logger = logger; + } + + public virtual async Task> ReadAsync() + + { + //从MES读取待处理Qtyrfe + var toBeProcessedPillTasks = await _QtyrfeManager.GetToBeProcessedListAsync().ConfigureAwait(false); + if (!toBeProcessedPillTasks.Any()) + { + _logger.LogInformation("no Qtyrfes"); + return new List(); + } + //Qtyrfe逐一转换为MaterialRequest + var incomingDataList = BuildIncomingFromExternalFromPillTaskAsync(toBeProcessedPillTasks); + await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); + //更新MES数据状态 + await _QtyrfeManager.UpdateProcessedListAsync(toBeProcessedPillTasks).ConfigureAwait(false); + + return incomingDataList; + } + + private static List BuildIncomingFromExternalFromPillTaskAsync(List toBeProcessedQtyrfes) + { + var incomingDataList = new List(); + foreach (var Qtyrfe in toBeProcessedQtyrfes) + { + var incomingData = BuildIncomingFromExternal(Qtyrfe); + + incomingData.SetEffectiveDate(DateTime.Now); + incomingData.SetSuccess(); + try + { + var MaterialRequest = BuildTransferNoteCreateInput(Qtyrfe); + incomingData.DestinationDataContent = JsonSerializer.Serialize(MaterialRequest); + } + catch (Exception ex) + { + incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); + } + + incomingDataList.Add(incomingData); + + } + + return incomingDataList; + } + + private static IncomingFromExternal BuildIncomingFromExternal(Qtyrfe Qtyrfe) + { + var incomingData = new IncomingFromExternal() + { + DataType = EnumIncomingDataType.TransferNote.ToString(), + DataAction = EnumExchangeDataAction.Add, + SourceSystem = EnumSystemType.MES.ToString(), + SourceDataId = Qtyrfe.mesout_qtyrfe_id.ToString(), + SourceDataGroupCode = Qtyrfe.mesout_qtyrfe_id, + SourceDataDetailCode = Qtyrfe.mesout_qtyrfe_part, + SourceDataContent = JsonSerializer.Serialize(Qtyrfe), + WriteTime = DateTime.Now, + Writer = nameof(MesIncomingBackgroundWorker), + + DestinationSystem = EnumSystemType.WMS.ToString(), + }; + return incomingData; + } + + private static TransferNoteExchangeDto BuildTransferNoteCreateInput(Qtyrfe Qtyrfe) + { + var transferNote = new TransferNoteExchangeDto() + { + Worker = Qtyrfe.mesout_qtyrfe_user, + Remark = "" + }; + if (Qtyrfe.mesout_qtyrfe_type == "1") + { + transferNote.Remark = "质量补移库"; + } + var transferNoteDetail = new TransferNoteDetailExchangeDto() + { + ItemCode = Qtyrfe.mesout_qtyrfe_part, + Qty =Qtyrfe.mesout_qtyrfe_num, + ToLocationErpCode = Qtyrfe.mesout_qtyrfe_loc_to, + FromLocationErpCode = Qtyrfe.mesout_qtyrfe_loc_from, + }; + transferNote.Detail = transferNoteDetail; + return transferNote; + } + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json index a5a6cb1d9..b3b640492 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json @@ -1,12 +1,12 @@ { "ConnectionStrings": { - "Default": "Server=10.164.113.32,1818\\SHDB;Database=Wms_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True;Encrypt=false", - "DataExchange": "Server=10.164.113.32,1818\\SHDB;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True;Encrypt=false", - "MES": "Server=10.164.113.32,1818\\SHDB;Database=MES_SH;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True;Encrypt=false" + "Default": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True;Encrypt=false", + "DataExchange": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_DataExchange_CC;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True;Encrypt=false", + "MES": "Server=dev.ccwin-in.com,13319;Database=MES_SH;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True;Encrypt=false" }, "AuthServer": { - "Authority": "http://10.164.113.31:60083/", + "Authority": "http://dev.ccwin-in.com:60083/", "RequireHttpsMetadata": "false", "SwaggerClientId": "admin", "SwaggerClientSecret": "1q2w3E*", @@ -24,13 +24,13 @@ "RemoteServices": { "BaseData": { - "BaseUrl": "http://10.164.113.31:60084/" + "BaseUrl": "http://dev.ccwin-in.com:60084/" }, "Store": { - "BaseUrl": "http://10.164.113.31:60085/" + "BaseUrl": "http://dev.ccwin-in.com:60085/" }, "Label": { - "BaseUrl": "http://10.164.113.31:60082/" + "BaseUrl": "http://dev.ccwin-in.com:60082/" } }, diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/AssembleIssueNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/AssembleIssueNoteConverter.cs new file mode 100644 index 000000000..375faace0 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/AssembleIssueNoteConverter.cs @@ -0,0 +1,142 @@ +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.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.PCK; +using Win_in.Sfs.Wms.Store.Application.Contracts; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Outgoing; + +public class AssembleIssueNoteConverter : IOutgoingConverter +{ + private readonly string billtype = "4026"; + private readonly IOutgoingFromWmsManager _outgoingFromWmsManager; + private readonly IOutgoingToExternalManager _outgoingToExternalManager; + private readonly IObjectMapper _objectMapper; + + public AssembleIssueNoteConverter( + IOutgoingFromWmsManager outgoingFromWmsManager + , IOutgoingToExternalManager outgoingToExternalManager + , IObjectMapper objectMapper + ) + { + _outgoingFromWmsManager = outgoingFromWmsManager; + _outgoingToExternalManager = outgoingToExternalManager; + _objectMapper = objectMapper; + } + + public virtual async Task> ConvertAsync() + { + var outgoingToExternalList = new List(); + //获取要同步得数据 + var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.AssembleIssue, EnumSystemType.ERP).ConfigureAwait(false); + foreach (var outgoingFromWms in outgoingFromWmsList) + { + string tyrpNumber = outgoingFromWms.TyrpNumber; + #region 主表 + var wmsReceipt = JsonSerializer.Deserialize(outgoingFromWms.DataContent); + var exchangeReceipt = _objectMapper.Map(wmsReceipt); + var putawayNote = BuildDataInterface(exchangeReceipt); + var outgoingToExternal = new OutgoingToExternal() + { + DataType = EnumOutgoingDataType.Issue.ToString(), + TableType = EnumExchangeTableType.MainTable, + DataAction = outgoingFromWms.DataAction, + SerialNumber = tyrpNumber, + SourceSystem = EnumSystemType.WMS.ToString(), + SourceDataId = wmsReceipt.Id.ToString(), + SourceDataGroupCode = wmsReceipt.Number, + SourceDataDetailCode = wmsReceipt.Number, + Writer = nameof(TyrpOutgoingBackgroundWorker), + DestinationSystem = EnumSystemType.ERP.ToString(), + DestinationDataId = "", + }; + outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); + outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceipt); + outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNote); + outgoingToExternalList.Add(outgoingToExternal); + #endregion + var sumDetails = wmsReceipt.Details.GroupBy(r => new { r.ItemCode, r.HandledFromLocationErpCode, r.HandledToLocationErpCode }).Select(p => new AssembleIssueNoteDetailDTO { ItemCode = p.Key.ItemCode, HandledFromLocationErpCode = p.Key.HandledFromLocationErpCode, HandledToLocationErpCode = p.Key.HandledToLocationErpCode, HandledToQty = p.Sum(x => x.HandledToQty) }).ToList(); + #region 明细 + foreach (var detail in sumDetails) + { + var outgoingDetailToExternal = new OutgoingToExternal() + { + DataType = EnumOutgoingDataType.Issue.ToString(), + TableType = EnumExchangeTableType.DetailTable, + DataAction = outgoingFromWms.DataAction, + SerialNumber = tyrpNumber, + SourceSystem = EnumSystemType.WMS.ToString(), + SourceDataId = detail.Id.ToString(), + SourceDataGroupCode = wmsReceipt.Number, + SourceDataDetailCode = detail.ItemCode, + Writer = nameof(TyrpOutgoingBackgroundWorker), + DestinationSystem = EnumSystemType.ERP.ToString(), + DestinationDataId = "", + }; + outgoingDetailToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); + var exchangeReceiptDetail = _objectMapper.Map(detail); + outgoingDetailToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceiptDetail); + var putawayNoteDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail, putawayNote.scontrol_dt_w); + outgoingDetailToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNoteDetail); + outgoingToExternalList.Add(outgoingDetailToExternal); + } + #endregion + } + //插入到中间表OutgoingToExternal + await _outgoingToExternalManager.CreateManyAsync(outgoingToExternalList).ConfigureAwait(false); + //将outgoingFromWms数据归档 + await _outgoingFromWmsManager.ArchiveManyAsync(outgoingFromWmsList).ConfigureAwait(false); + + return outgoingToExternalList; + } + /// + /// 构建主表 + /// + /// + /// + private Scontrol BuildDataInterface(AssembleIssueNoteExchangeDto exchangeOrder) + { + var ret = new Scontrol() + { + scontrol_nbr = exchangeOrder.Number, + scontrol_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + scontrol_stat = "Y", + scontrol_dt_k = "", + scontrol_type = billtype, + scontrol_id = 0,//明细中最大scmsend_id + }; + return ret; + } + /// + /// 构建明细 + /// + /// + /// + /// + private Scmsend BuildDataInterfaceDetail(AssembleIssueNoteExchangeDto exchangeOrder, AssembleIssueNoteDetailExchangeDto exchangeDetailOrder, string dt_w) + { + var ret = new Scmsend() + { + scmsend_type = billtype, + scmsend_dt_w = dt_w, + scmsend_nbr = exchangeOrder.Number, + scmsend_stat1 = "1", + scmsend_part = exchangeDetailOrder.ItemCode, + scmsend_delv_date = "", + scmsend_orderno = "", + scmsend_loc = exchangeDetailOrder.FromLocationErpCode, + //scmsend_date = exchangeOrder.ActiveDate.ToString("yyyyMMdd"), + scmsend_date = DateTime.Now.ToString("yyyyMMdd"), + scmsend_qty = exchangeDetailOrder.Qty, + scmsend_wipd_loc = exchangeDetailOrder.ToLocationErpCode, + scmsend_userid = "WMS" + }; + return ret; + } +} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs index 3b181f817..6c7ca0d7a 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs @@ -171,10 +171,15 @@ public static class IncomingToWmsExtensions public static async Task HandleProductReceiptsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) { - var productReceipt = JsonSerializer.Deserialize(incomingConverted.DataContent); - var productReceiptAppService = workerContext.ServiceProvider.GetRequiredService(); - - await productReceiptAppService.CreateAsync(productReceipt).ConfigureAwait(false); + //var productReceipt = JsonSerializer.Deserialize(incomingConverted.DataContent); + //var productReceiptAppService = workerContext.ServiceProvider.GetRequiredService(); + + //await productReceiptAppService.CreateAsync(productReceipt).ConfigureAwait(false); + var productReceipt = JsonSerializer.Deserialize(incomingConverted.DataContent); + var productReceiptAppService = workerContext.ServiceProvider.GetRequiredService(); + List list = new List(); + list.Add(productReceipt); + await productReceiptAppService.CreateManyAsync(list).ConfigureAwait(false); } public static async Task HandleMaterialRequestsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) @@ -183,7 +188,30 @@ public static class IncomingToWmsExtensions var materialRequestAppService = workerContext.ServiceProvider.GetRequiredService(); await materialRequestAppService.CreateAndHandleByAPIAsync(materialRequest).ConfigureAwait(false); } - + public static async Task HandleTransferNoteAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) + { + var transferNote = JsonSerializer.Deserialize(incomingConverted.DataContent); + var transferNoteAppService = workerContext.ServiceProvider.GetRequiredService(); + await transferNoteAppService.CreateAsync(transferNote).ConfigureAwait(false); + } + public static async Task HandleMesNoteAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) + { + var mesNote = JsonSerializer.Deserialize(incomingConverted.DataContent); + var mesNoteAppService = workerContext.ServiceProvider.GetRequiredService(); + await mesNoteAppService.CreateAsync(mesNote).ConfigureAwait(false); + } + public static async Task HandleDeliveryRequestAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) + { + var deliverRequest = JsonSerializer.Deserialize(incomingConverted.DataContent); + var deliverRequestAppService = workerContext.ServiceProvider.GetRequiredService(); + await deliverRequestAppService.CreateAsync(deliverRequest).ConfigureAwait(false); + } + public static async Task HandleInjectionIssueRequestAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) + { + var injectionIssueRequest = JsonSerializer.Deserialize(incomingConverted.DataContent); + var injectionIssueRequestAppService = workerContext.ServiceProvider.GetRequiredService(); + await injectionIssueRequestAppService.CreateAsync(injectionIssueRequest).ConfigureAwait(false); + } public static async Task HandleScrapsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) { var scrap = JsonSerializer.Deserialize(incomingConverted.DataContent); diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs index 6a6071789..8d93ccf90 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs @@ -68,7 +68,7 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase //Do the work var incomingToWmsList = await incomingToWmsManager.GetToBeProcessedListAsync().ConfigureAwait(false); - foreach (var incomingToWms in incomingToWmsList) + foreach (var incomingToWms in incomingToWmsList.OrderBy(r=>r.CreationTime)) { try { @@ -184,8 +184,20 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase await incomingToWms.HandleInventoryLabelsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.BackFlush: - // await incomingToWms.HandleBackFlushsAsync(workerContext).ConfigureAwait(false); - await SendBackFlush(workerContext, incomingToWms).ConfigureAwait(false); + await incomingToWms.HandleBackFlushsAsync(workerContext).ConfigureAwait(false); + // await SendBackFlush(workerContext, incomingToWms).ConfigureAwait(false); + break; + case EnumIncomingDataType.TransferNote: + await incomingToWms.HandleTransferNoteAsync(workerContext).ConfigureAwait(false); + break; + case EnumIncomingDataType.MesNote: + await incomingToWms.HandleMesNoteAsync(workerContext).ConfigureAwait(false); + break; + case EnumIncomingDataType.Delivery: + await incomingToWms.HandleDeliveryRequestAsync(workerContext).ConfigureAwait(false); + break; + case EnumIncomingDataType.CallMtl: + await incomingToWms.HandleInjectionIssueRequestAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.None: default: diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json index 156e965e2..7b848b1b8 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json @@ -1,13 +1,13 @@ { "ConnectionStrings": { - "Default": "Server=10.164.113.32,1818\\SHDB;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True", - "DataExchange": "Server=10.164.113.32,1818\\SHDB;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True" + "Default": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True", + "DataExchange": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_DataExchange_CC;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True" }, "AuthServer": { - "Authority": "http://10.164.113.31:60083/", + "Authority": "http://dev.ccwin-in.com:60083/", "RequireHttpsMetadata": "false", "SwaggerClientId": "admin", "SwaggerClientSecret": "1q2w3E*", @@ -26,16 +26,16 @@ "RemoteServices": { "BaseData": { - "BaseUrl": "http://10.164.113.31:60084/" + "BaseUrl": "http://dev.ccwin-in.com:60084/" }, "Store": { - "BaseUrl": "http://10.164.113.31:60085/" + "BaseUrl": "http://localhost:59095/" }, "Label": { - "BaseUrl": "http://10.164.113.31:60082/" + "BaseUrl": "http://dev.ccwin-in.com:60082/" }, "Auth": { - "BaseUrl": "http://10.164.113.31:60083/" + "BaseUrl": "http://dev.ccwin-in.com:60083/" } }, "DataExchangeOptions": { @@ -44,7 +44,7 @@ "PeriodSeconds": 10, "RetryTimes": 1, "BatchSize": 100, - "apiUrl": "http://10.164.113.31:60085/" + "apiUrl": "http://dev.ccwin-in.com:60085/" }, "OutgoingOptions": { "Active": false, diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/DeliverNote/DeliverNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/DeliverNote/DeliverNoteDetailExchangeDto.cs index 306172f7e..e0b3bb7d6 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/DeliverNote/DeliverNoteDetailExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/DeliverNote/DeliverNoteDetailExchangeDto.cs @@ -26,4 +26,19 @@ public class DeliverNoteDetailExchangeDto /// [Display(Name = "数量")] public decimal Qty { get; set; } + /// + /// Mes发货单号 + /// + [Display(Name = "Mes发货单号")] + public string MesDeliveryNo { get; set; } + /// + /// Mes发货计划号 + /// + [Display(Name = "Mes发货计划号")] + public string MesDeliveryPlan { get; set; } + /// + /// 底盘号 + /// + [Display(Name = "底盘号")] + public string IdentityNo { get; set; } } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/DeliverRequest/DeliverRequestDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/DeliverRequest/DeliverRequestDetailExchangeDto.cs new file mode 100644 index 000000000..f46e0d787 --- /dev/null +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/DeliverRequest/DeliverRequestDetailExchangeDto.cs @@ -0,0 +1,43 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.DataExchange.WMS.DeliverRequest; +public class DeliverRequestDetailExchangeDto +{ + /// + /// 单据号 + /// + [Display(Name = "单据号")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Number { get; set; } + /// + /// 物品代码 + /// + [Display(Name = "物品代码")] + public string ItemCode { get; set; } + /// + /// 来源库区 + /// + [Display(Name = "来源库区")] + public string AreaCode { get; set; } + /// + /// 数量 + /// + [Display(Name = "数量")] + public decimal Qty { get; set; } + /// + /// Mes发货单号 + /// + [Display(Name = "Mes发货单号")] + public string MesDeliveryNo { get; set; } + /// + /// Mes发货计划号 + /// + [Display(Name = "Mes发货计划号")] + public string MesDeliveryPlan { get; set; } + /// + /// 底盘号 + /// + [Display(Name = "底盘号")] + public string IdentityNo { get; set; } +} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/DeliverRequest/DeliverRequestExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/DeliverRequest/DeliverRequestExchangeDto.cs new file mode 100644 index 000000000..7273c7ce0 --- /dev/null +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/DeliverRequest/DeliverRequestExchangeDto.cs @@ -0,0 +1,43 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.DataExchange.WMS.DeliverRequest; +public class DeliverRequestExchangeDto +{ + /// + /// 单据号 + /// + public string Number { get; set; } + /// + /// 操作员 + /// + public string Worker { get; set; } + + /// + /// 生效日期 + /// + public DateTime ActiveDate { get; set; } = DateTime.Now.Date; + /// + /// 发货时间 + /// + public DateTime DeliverTime { get; set; } = DateTime.Now.Date; + /// + /// 发货类型 + /// + public EnumDeliverRequestType DeliverRequestType { get; set; } + + /// + /// 客户 + /// + [Display(Name = "客户")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string CustomerCode { get; set; } + + /// + /// 明细列表 + /// + [Display(Name = "明细列表")] + public DeliverRequestDetailExchangeDto Detail { get; set; } = new(); +} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestDetailExchangeDto.cs new file mode 100644 index 000000000..273fcf2f5 --- /dev/null +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestDetailExchangeDto.cs @@ -0,0 +1,34 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest; +public class InjectionIssueRequestDetailExchangeDto +{ + /// + /// 目标ERP储位 + /// + [Display(Name = "目标储位")] + public string ToLocationCode { get; set; } + /// + /// 数量 + /// + [Display(Name = "数量")] + public decimal Qty { get; set; } + + /// + /// 需求箱数量 + /// + [Display(Name = "需求箱数量")] + public decimal BoxQty { get; set; } + + /// + /// 物品代码 + /// + [Display(Name = "物品代码")] + public string ItemCode { get; set; } + + /// + /// 推荐类型 + /// + public EnumRecommendType RecommendType { get; set; } +} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestExchangeDto.cs new file mode 100644 index 000000000..123972c0e --- /dev/null +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestExchangeDto.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; +using Win_in.Sfs.Wms.DataExchange.WMS.MesNote; +using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseOrder; + +namespace Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest; +public class InjectionIssueRequestExchangeDto +{ + /// + /// 叫料类型 + /// + [Display(Name = "叫料类型")] + public EnumIssueRequestType IssueRequestType { get; set; } + /// + /// 操作员 + /// + [Display(Name = "操作员")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Worker { get; set; } + + /// + /// 生效日期 + /// + [Display(Name = "生效日期")] + public DateTime ActiveDate { get; set; } = DateTime.Now.Date; + + /// + /// 明细 + /// + [Display(Name = "明细")] + public InjectionIssueRequestDetailExchangeDto Detail { get; set; } = new(); +} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteDetailExchangeDto.cs new file mode 100644 index 000000000..c58436b83 --- /dev/null +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteDetailExchangeDto.cs @@ -0,0 +1,36 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.DataExchange.WMS.PCK; + +public class AssembleIssueNoteDetailExchangeDto + +{ + + /// + /// 目标ERP库位 + /// + [Display(Name = "目标ERP库位")] + public string ToLocationErpCode { get; set; } + + public string FromPackingCode { get; set; } + /// + /// 来源ERP库位 + /// + public string FromLocationErpCode { get; set; } + + /// + /// 数量 + /// + [Display(Name = "数量")] + public decimal Qty { get; set; } + + /// + /// 物品代码 + /// + [Display(Name = "物品代码")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + [Required(ErrorMessage = "{0}是必填项")] + public string ItemCode { get; set; } + +} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteExchangeDto.cs new file mode 100644 index 000000000..22ff4899e --- /dev/null +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteExchangeDto.cs @@ -0,0 +1,29 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.DataExchange.WMS.PCK; + +public class AssembleIssueNoteExchangeDto +{ + /// + /// 发料记录号 + /// + [Display(Name = "发料记录号")] + public string Number { get; set; } + /// + /// 生效日期 + /// + [Display(Name = "生效日期")] + public DateTime ActiveDate { get; set; } = DateTime.Now.Date; + + /// + /// 操作员 + /// + [Display(Name = "操作员")] + public string Worker { get; set; } + /// + /// 明细 + /// + [Display(Name = "明细")] + public AssembleIssueNoteDetailExchangeDto Detail { get; set; } = new(); +} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/MesNote/MesNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/MesNote/MesNoteDetailExchangeDto.cs new file mode 100644 index 000000000..4283d490f --- /dev/null +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/MesNote/MesNoteDetailExchangeDto.cs @@ -0,0 +1,48 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.DataExchange.WMS.MesNote; + +public class MesNoteDetailExchangeDto +{ + /// + /// 上架单号 + /// + [Display(Name = "移库单号")] + public string Number { get; set; } + /// + /// 物品代码 + /// + [Display(Name = "物品代码")] + public string ItemCode { get; set; } + + /// + /// 目标ERP库位 + /// + [Display(Name = "目标ERP库位")] + public string ToLocationErpCode { get; set; } + + /// + /// 来源ERP库位 + /// + [Display(Name = "来源ERP库位")] + public string FromLocationErpCode { get; set; } + + /// + /// 目标ERP库位 + /// + [Display(Name = "来源库位状态")] + public EnumInventoryStatus FromStatus { get; set; } + + /// + /// 来源ERP库位 + /// + [Display(Name = "目标库位状态")] + public EnumInventoryStatus ToStatus { get; set; } + + /// + /// 数量 + /// + [Display(Name = "数量")] + public decimal Qty { get; set; } +} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/MesNote/MesNoteExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/MesNote/MesNoteExchangeDto.cs new file mode 100644 index 000000000..3aa64c617 --- /dev/null +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/MesNote/MesNoteExchangeDto.cs @@ -0,0 +1,47 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.DataExchange.WMS.MesNote; +public class MesNoteExchangeDto +{ + /// + /// 上架单号 + /// + [Display(Name = "移库单号")] + public string Number { get; set; } + /// + /// MES请求单号 + /// + [Display(Name = "MES请求单号")] + public string MesRequestNumber { get; set; } + + + /// + /// 生效日期 + /// + [Display(Name = "生效日期")] + public DateTime ActiveDate { get; set; } = DateTime.Now.Date; + + /// + /// 操作员 + /// + [Display(Name = "操作员")] + public string Worker { get; set; } + + /// + /// 调拨类型 + /// + [Display(Name = "调拨类型")] + public string Type { get; set; } + + /// + /// 备注 + /// + [Display(Name = "备注")] + public string Remark { get; set; } + /// + /// 明细列表 + /// + [Display(Name = "明细列表")] + public MesNoteDetailExchangeDto Detail { get; set; } = new(); +} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/TransferNote/TransferNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/TransferNote/TransferNoteDetailExchangeDto.cs index 1ea1ca327..b50be31b2 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/TransferNote/TransferNoteDetailExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/TransferNote/TransferNoteDetailExchangeDto.cs @@ -32,4 +32,17 @@ public class TransferNoteDetailExchangeDto /// [Display(Name = "数量")] public decimal Qty { get; set; } + + + /// + /// 批次 + /// + [Display(Name = "批次")] + public string Lot { get; set; } = ""; + + /// + /// 箱码 + /// + [Display(Name = "箱码")] + public string PackingCode { get; set; } = ""; } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/TransferNote/TransferNoteExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/TransferNote/TransferNoteExchangeDto.cs index 2b84dcc42..65c93c570 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/TransferNote/TransferNoteExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/TransferNote/TransferNoteExchangeDto.cs @@ -29,4 +29,14 @@ public class TransferNoteExchangeDto [Display(Name = "调拨类型")] public string Type { get; set; } + /// + /// 备注 + /// + [Display(Name = "备注")] + public string Remark { get; set; } + /// + /// 明细列表 + /// + [Display(Name = "明细列表")] + public TransferNoteDetailExchangeDto Detail { get; set; } = new(); } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml index e614f4317..7e651153f 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml @@ -531,6 +531,21 @@ 数量 + + + Mes发货单号 + + + + + Mes发货计划号 + + + + + 底盘号 + + 单据号 @@ -551,6 +566,76 @@ 客户 + + + 单据号 + + + + + 物品代码 + + + + + 来源库区 + + + + + 数量 + + + + + Mes发货单号 + + + + + Mes发货计划号 + + + + + 底盘号 + + + + + 单据号 + + + + + 操作员 + + + + + 生效日期 + + + + + 发货时间 + + + + + 发货类型 + + + + + 客户 + + + + + 明细列表 + + 代码 @@ -631,6 +716,51 @@ 仓库代码 + + + 目标ERP储位 + + + + + 数量 + + + + + 需求箱数量 + + + + + 物品代码 + + + + + 推荐类型 + + + + + 叫料类型 + + + + + 操作员 + + + + + 生效日期 + + + + + 明细 + + 是否可用 @@ -641,6 +771,46 @@ 最后修改时间 + + + 目标ERP库位 + + + + + 来源ERP库位 + + + + + 数量 + + + + + 物品代码 + + + + + 发料记录号 + + + + + 生效日期 + + + + + 操作员 + + + + + 明细 + + 目标ERP库位 @@ -771,6 +941,76 @@ 明细列表 + + + 上架单号 + + + + + 物品代码 + + + + + 目标ERP库位 + + + + + 来源ERP库位 + + + + + 目标ERP库位 + + + + + 来源ERP库位 + + + + + 数量 + + + + + 上架单号 + + + + + MES请求单号 + + + + + 生效日期 + + + + + 操作员 + + + + + 调拨类型 + + + + + 备注 + + + + + 明细列表 + + 上架单号 @@ -1731,6 +1971,16 @@ 数量 + + + 批次 + + + + + 箱码 + + 上架单号 @@ -1751,6 +2001,16 @@ 调拨类型 + + + 备注 + + + + + 明细列表 + + 单据号 diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumIncomingDataType.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumIncomingDataType.cs index 4042cb1de..824808a90 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumIncomingDataType.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumIncomingDataType.cs @@ -114,4 +114,20 @@ public enum EnumIncomingDataType /// Erp库位零件(开账) /// ErpLocationItem = 27, + /// + /// 储位调拨 + /// + TransferNote=28, + /// + /// 储位调拨 + /// + MesNote = 29, + /// + /// 发货单 + /// + Delivery=30, + /// + /// 自动叫料 + /// + CallMtl=31, } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs index 985dfb465..a2fdb0412 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs @@ -32,7 +32,20 @@ public enum EnumOutgoingDataType ProductRecycle = 24, Item_Transform = 25,//线边仓调整单 WIPAdjust = 26,//回收料调整单 - SemiPutaway=27//半成品上架 + SemiPutaway=27,//半成品上架 + /// + /// 注塑发料 + /// + InjectionIssue = 30, + /// + /// 涂装发料 + /// + CoatingIssue = 31, + /// + /// 装配发料 + /// + AssembleIssue = 32, + } public enum EnumExchangeTableType { diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedIssueJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedIssueJobController.cs index f886d53df..e0d88fdc3 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedIssueJobController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedIssueJobController.cs @@ -10,6 +10,7 @@ using Win_in.Sfs.Shared.Domain.Shared; using System.Text.Json; using Win_in.Sfs.Shared.Domain; using Volo.Abp; +using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; namespace Win_in.Sfs.Wms.Pda.Controllers.Jobs; @@ -51,14 +52,15 @@ public class UnplannedIssueJobController : AbpController /// /// [HttpGet("list")] - public virtual async Task> GetListAsync(int pageSize, int pageIndex, bool isCreationTimeSorting, bool isToday) + public virtual async Task> GetListAsync(int pageSize, int pageIndex, bool isCreationTimeSorting, bool isToday, EnumUnplannedIssueType enumUnplannedIssueType) { - var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); - var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); + //var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); + //var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); var status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; var jsonStatus = JsonSerializer.Serialize(status); - + var issueType = new List() { (int)enumUnplannedIssueType }; + var jsonIssueType = JsonSerializer.Serialize(issueType); var request = new SfsJobRequestInputBase { MaxResultCount = pageSize, @@ -68,7 +70,7 @@ public class UnplannedIssueJobController : AbpController { Filters = new List { - // new(nameof(UnplannedIssueJobDTO.WorkGroupCode),jsonWlgCodes,"In"), + new(nameof(UnplannedIssueJobDTO.UnplannedIssueType),jsonIssueType,"In"), new(nameof(UnplannedIssueJobDTO.JobStatus),jsonStatus,"In") } } @@ -81,7 +83,6 @@ public class UnplannedIssueJobController : AbpController { request.Sorting = $"{nameof(UnplannedIssueJobDTO.CreationTime)} ASC"; } - var list = await _unplannedIssueJobAppService.GetPagedListByFilterAsync(request, true).ConfigureAwait(false); return list; } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedReceiptJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedReceiptJobController.cs index 601cde5f7..22bf2370e 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedReceiptJobController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedReceiptJobController.cs @@ -10,6 +10,7 @@ using Win_in.Sfs.Shared.Domain.Shared; using System.Text.Json; using Win_in.Sfs.Shared.Domain; using Volo.Abp; +using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; namespace Win_in.Sfs.Wms.Pda.Controllers.Jobs; @@ -50,14 +51,15 @@ public class UnplannedReceiptJobController : AbpController /// /// [HttpGet("list")] - public virtual async Task> GetListAsync(int pageSize, int pageIndex, bool isCreationTimeSorting, bool isToday) + public virtual async Task> GetListAsync(int pageSize, int pageIndex, bool isCreationTimeSorting, bool isToday, EnumUnplannedReceiptType enumUnplannedReceiptType) { - var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); - var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); + //var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); + //var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); var status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + var receiptType = new List() { (int)enumUnplannedReceiptType }; var jsonStatus = JsonSerializer.Serialize(status); - + var jsonreceiptType = JsonSerializer.Serialize(receiptType); var request = new SfsJobRequestInputBase { MaxResultCount = pageSize, @@ -67,7 +69,7 @@ public class UnplannedReceiptJobController : AbpController { Filters = new List { - // new(nameof(UnplannedReceiptJobDTO.WorkGroupCode),jsonWlgCodes,"In"), + new(nameof(UnplannedReceiptJobDTO.UnplannedReceiptType),jsonreceiptType,"In"), new(nameof(UnplannedReceiptJobDTO.JobStatus),jsonStatus,"In") } } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ProductReceiptNoteController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ProductReceiptNoteController.cs index 256241889..945b6ca4f 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ProductReceiptNoteController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ProductReceiptNoteController.cs @@ -6,7 +6,7 @@ using Win_in.Sfs.Wms.Store.Application.Contracts; namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; /// -/// +///缴库 /// [ApiController] [Route($"{PdaHostConst.ROOT_ROUTE}store/product-receipt")] @@ -14,14 +14,16 @@ namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; public class ProductReceiptNoteController : AbpController { private readonly IProductReceiptNoteAppService _productReceiptNoteAppService; - + private readonly IProductReceiptNoteDetailAppService _productReceiptNoteDetailAppService; /// - /// + /// 缴库 /// /// - public ProductReceiptNoteController(IProductReceiptNoteAppService productReceiptNoteAppService) + /// + public ProductReceiptNoteController(IProductReceiptNoteAppService productReceiptNoteAppService, IProductReceiptNoteDetailAppService productReceiptNoteDetailAppService) { _productReceiptNoteAppService = productReceiptNoteAppService; + _productReceiptNoteDetailAppService = productReceiptNoteDetailAppService; } /// @@ -34,5 +36,15 @@ public class ProductReceiptNoteController : AbpController { await _productReceiptNoteAppService.CreateAsync(input).ConfigureAwait(false); } + /// + /// 单件码获取方法 + /// + /// + /// + [HttpPost("get-itemcode-by-mesbarcode")] + public virtual async Task GetItemCodeByMesBarCode(string mesBarCode) + { + return await _productReceiptNoteDetailAppService.GetItemCodeByMesBarCode(mesBarCode).ConfigureAwait(false); + } } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/DTOs/CustomerItemDTO.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/DTOs/CustomerItemDTO.cs index 946e15d81..a9b783f32 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/DTOs/CustomerItemDTO.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/DTOs/CustomerItemDTO.cs @@ -61,4 +61,11 @@ public class CustomerItemDTO : SfsBaseDataDTOBase [Display(Name = "结束时间")] public DateTime? EndTime { get; set; } + /// + /// 客户零件库位 + /// + [Display(Name = "客户零件库位")] + public string LocationCode { get; set; } + + } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/ICustomerItemAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/ICustomerItemAppService.cs index ef35579a0..8e721681c 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/ICustomerItemAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/ICustomerItemAppService.cs @@ -10,5 +10,6 @@ public interface ICustomerItemAppService , ISfsUpsertAppService { + Task GetFirstLocationCodeByItemCode(string itemCode); Task> GetListByPartsAsync(List inputs); } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/Inputs/CustomerItemEditInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/Inputs/CustomerItemEditInput.cs index 8ed4c0988..f6719dd70 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/Inputs/CustomerItemEditInput.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/Inputs/CustomerItemEditInput.cs @@ -45,6 +45,13 @@ public class CustomerItemEditInput : SfsBaseDataCreateOrUpdateInputBase /// [Display(Name = "结束时间")] public DateTime? EndTime { get; set; } + + /// + /// 客户零件库位 + /// + [Display(Name = "客户零件库位")] + public string LocationCode { get; set; } + #endregion #region Create diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/Inputs/CustomerItemImportInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/Inputs/CustomerItemImportInput.cs index 4b0880904..bb1f2b228 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/Inputs/CustomerItemImportInput.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/Inputs/CustomerItemImportInput.cs @@ -56,6 +56,14 @@ public class CustomerItemImportInput : SfsBaseDataImportInputBase [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string Version { get; set; } + /// + /// 客户零件库位 + /// + [Display(Name = "客户零件库位")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string LocationCode { get; set; } + + /// /// 开始时间 /// @@ -80,4 +88,6 @@ public class CustomerItemImportInput : SfsBaseDataImportInputBase [Display(Name = "备注")] [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] public string Remark { get; set; } + + } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Bases/SfsBaseDataAppServiceBase.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Bases/SfsBaseDataAppServiceBase.cs index e7183a1a2..89812ac99 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Bases/SfsBaseDataAppServiceBase.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Bases/SfsBaseDataAppServiceBase.cs @@ -178,7 +178,14 @@ public abstract class SfsBaseDataAppServiceBase validationRresult) + { + var item = await LocationAppService.GetByCodeAsync(defaultLocationCode).ConfigureAwait(false); + if (item == null&& item.Type != type) + { + validationRresult.Add(new ValidationResult($"库位代码{defaultLocationCode}库位类型{type.ToString()}不存在", new string[] { "默认库位代码" })); + } + } protected async Task CheckLocationGroupCodeAsync(string locationGroupCode, List validationRresult) { var item = await LocationGroupAppService.GetByCodeAsync(locationGroupCode).ConfigureAwait(false); diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/CustomerItems/CustomerItemAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/CustomerItems/CustomerItemAppService.cs index ce6566077..3f1400a4e 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/CustomerItems/CustomerItemAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/CustomerItems/CustomerItemAppService.cs @@ -10,6 +10,8 @@ using Volo.Abp.Caching; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Domain; using Win_in.Sfs.Basedata.Domain.Shared; +using Win_in.Sfs.Basedata.tests; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Basedata.Application; @@ -49,6 +51,10 @@ public class CustomerItemAppService : SfsBaseDataAppServiceBase> GetListByPartsAsync(List inputs) @@ -56,6 +62,17 @@ public class CustomerItemAppService : SfsBaseDataAppServiceBase inputs.Contains(p.ItemCode)).ToListAsync().ConfigureAwait(false); } + [HttpPost("get-first-location-code-by-item-code")] + public virtual async Task GetFirstLocationCodeByItemCode(string itemCode) + { + string code = ""; + var customerItems = await _repository.GetListAsync(p => p.ItemCode == itemCode).ConfigureAwait(false); + if (customerItems.Count > 0) + { + code = customerItems.First(r=>!string.IsNullOrEmpty(r.LocationCode)).LocationCode; + } + return code; + } } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs index 264c88719..d22d04418 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs @@ -36,36 +36,92 @@ public class TestService:ApplicationService _options = options; } - /// - /// 生命周期操作 - /// - [HttpPost("GetMacStatic")] - public async Task GetMacStatic() + ///// + ///// 生命周期操作 + ///// + //[HttpPost("GetMacStatic")] + //public async Task GetMacStatic() + //{ + // return 1; + //} + + + + //[HttpPost("GetCargoStatic")] + ///// + ///// 异步开始生命周期操作不能堵塞 + ///// + //public async Task> GetCargoStatic(string p_AreaID) + //{ + + // List result = new List(); + + // result.Add(new ResponCargoItem() { AreaID = "1", CargoID = "PTXB1", PartCode = "TMDLYA0A071AB", Flag = 0 }); + // result.Add(new ResponCargoItem() { AreaID = "1", CargoID = "PTXB2", PartCode = "TMDLYA0A061AB", Flag = 0 }); + // result.Add(new ResponCargoItem() { AreaID = "2", CargoID = "ZSXB2", PartCode = "TMDLYD0ABM5A", Flag = 0 }); + + // result = result.Where(p => p.AreaID == p_AreaID).ToList(); + + + // return result; + + //} + [HttpPost("SyncCoatingJobStereo")] + + public virtual async Task SyncCoatingJobStereoAsync(CoatingIssueJobToRestoDTO input) { - return 1; + + ReusltObject reuslt=new ReusltObject(); + reuslt.Code = "0"; + reuslt.Message = "操作成功"; + reuslt.OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + return reuslt; + + + + } - [HttpPost("GetCargoStatic")] - /// - /// 异步开始生命周期操作不能堵塞 - /// - public async Task> GetCargoStatic(string p_AreaID) - { - List result = new List(); - result.Add(new ResponCargoItem() { AreaID = "1", CargoID = "PTXB1", PartCode = "TMDLYA0A071AB", Flag = 0 }); - result.Add(new ResponCargoItem() { AreaID = "1", CargoID = "PTXB2", PartCode = "TMDLYA0A061AB", Flag = 0 }); - result.Add(new ResponCargoItem() { AreaID = "2", CargoID = "ZSXB2", PartCode = "TMDLYD0ABM5A", Flag = 0 }); - result = result.Where(p => p.AreaID == p_AreaID).ToList(); - - return result; + + + } +/// +/// 发给立体库主表 +/// +public class CoatingIssueJobToRestoDetailDTO +{ + public string WorkNo { set; get; } + public string TaskNo { set; get; } + public string NeedSite { set; get; } + public string ProductNo { set; get; } + public decimal Count { set; get; } +} +/// +/// 发给立体库子表 +/// +public class CoatingIssueJobToRestoDTO +{ + public Guid UUID { set; get; } + public string OperatorName { set; get; } + public List Details { set; get; } +} +/// +/// 返回结果 +/// +public class ReusltObject +{ + public string Code { set; get; } + public string Message { set; get; } + public string OperateTime { set; get; } } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/CustomerItems/CustomerItem.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/CustomerItems/CustomerItem.cs index f8fd1657e..d4745c9fb 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/CustomerItems/CustomerItem.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/CustomerItems/CustomerItem.cs @@ -56,6 +56,12 @@ public class CustomerItem : SfsBaseDataAggregateRootBase, IHasTimeRange /// 结束时间 /// public DateTime? EndTime { get; set; } + + /// + /// 客户零件库位 + /// + public string LocationCode { get; set; } + } ///// ///// 客户零件 diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/CustomerItems/CustomerItemDbContextModelCreatingExtensions.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/CustomerItems/CustomerItemDbContextModelCreatingExtensions.cs index acc82761a..39e474079 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/CustomerItems/CustomerItemDbContextModelCreatingExtensions.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/CustomerItems/CustomerItemDbContextModelCreatingExtensions.cs @@ -25,7 +25,7 @@ public static class CustomerItemDbContextModelCreatingExtensions b.Property(q => q.ItemCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.CustomerItemCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.Version).HasMaxLength(SfsPropertyConst.DescLength); - + b.Property(q => q.LocationCode).HasMaxLength(SfsPropertyConst.CodeLength); //Relations //None diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/DTOs/CoatingIssueJobDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/DTOs/CoatingIssueJobDTO.cs index e924db543..f8932caf1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/DTOs/CoatingIssueJobDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/DTOs/CoatingIssueJobDTO.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; @@ -38,3 +39,110 @@ public class CoatingIssueJobDTO : SfsJobDTOBase public bool UseOnTheWayLocation { get; set; } } +/// +/// 喷涂主表 +/// +public class CoatingIssueRequestFromRestoDTO +{ + public string RequestNumber { set; get; } + public List Jobs { set; get; } +} +/// +/// 立体库发给WMS明细 +/// +public class CoatingIssueJobFromRestoDetailDTO +{ + [Display(Name = "零件编号")] + public string ItemCode { set; get; } + [Display(Name = "目标库位")] + public string ToLocationCode { set; get; } + [Display(Name = "来源库位")] + public string FromLocationCode { set; get; } + [Display(Name = "数量")] + public decimal Qty { set; get; } +} +/// +/// 立体库发给立体库任务单号 +/// +public class CoatingIssueJobFromRestoDTO +{ + [Display(Name = "任务单号")] + public string JobNumber { set; get; } + [Display(Name = "明细")] + public List Details { set; get; } +} +/// +/// 发给立体库主表 +/// +/// +/// 发给立体库子表 +/// +[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] +public partial class CoatingIssueJobToRestoDTO +{ + + [System.Text.Json.Serialization.JsonPropertyName("uuid")] + public System.Guid Uuid { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("operatorName")] + public string OperatorName { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("details")] + public System.Collections.Generic.ICollection Details { get; set; } + +} + +/// +/// 发给立体库主表 +/// +[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] +public partial class CoatingIssueJobToRestoDetailDTO +{ + + [System.Text.Json.Serialization.JsonPropertyName("workNo")] + public string WorkNo { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("taskNo")] + public string TaskNo { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("needSite")] + public string NeedSite { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("productNo")] + public string ProductNo { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("count")] + public decimal Count { get; set; } + +} + +/// +/// 返回结果 +/// +[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] +public partial class ReusltObject +{ + + [System.Text.Json.Serialization.JsonPropertyName("code")] + public string Code { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("message")] + public string Message { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("operateTime")] + public string OperateTime { get; set; } + +} + + + + + + + + + + + + + diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/DTOs/DeliverNoteDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/DTOs/DeliverNoteDetailDTO.cs index 1f473504a..480978f89 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/DTOs/DeliverNoteDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/DTOs/DeliverNoteDetailDTO.cs @@ -10,4 +10,19 @@ public class DeliverNoteDetailDTO : SfsStoreRecommendFromDetailWithFromToDTOBase /// [Display(Name = "扩展属性")] public ExtraPropertyDictionary ExtraProperties { get; set; } = new ExtraPropertyDictionary(); + /// + /// Mes发货单号 + /// + [Display(Name = "Mes发货单号")] + public string MesDeliveryNo { get; set; } + /// + /// Mes发货计划号 + /// + [Display(Name = "Mes发货计划号")] + public string MesDeliveryPlan { get; set; } + /// + /// 底盘号 + /// + [Display(Name = "底盘号")] + public string IdentityNo { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/Inputs/DeliverNoteDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/Inputs/DeliverNoteDetailInput.cs index fb12f3ecf..e7957adc4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/Inputs/DeliverNoteDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/Inputs/DeliverNoteDetailInput.cs @@ -10,4 +10,19 @@ public class DeliverNoteDetailInput : SfsStoreRecommendFromDetailWithFromToInput /// [Display(Name = "扩展属性")] public ExtraPropertyDictionary ExtraProperties { get; set; } = new ExtraPropertyDictionary(); + /// + /// Mes发货单号 + /// + [Display(Name = "Mes发货单号")] + public string MesDeliveryNo { get; set; } + /// + /// Mes发货计划号 + /// + [Display(Name = "Mes发货计划号")] + public string MesDeliveryPlan { get; set; } + /// + /// 底盘号 + /// + [Display(Name = "底盘号")] + public string IdentityNo { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/IProductReceiptNoteDetailAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/IProductReceiptNoteDetailAppService.cs new file mode 100644 index 000000000..dc5d7250b --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/IProductReceiptNoteDetailAppService.cs @@ -0,0 +1,9 @@ +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Win_in.Sfs.Wms.Store.Application.Contracts; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; +public interface IProductReceiptNoteDetailAppService : ISfsStoreAppServiceBase +{ + Task GetItemCodeByMesBarCode(string mesBarCode); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/ProductReceiptNoteDetailPermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/ProductReceiptNoteDetailPermissions.cs new file mode 100644 index 000000000..07bbcd6c0 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/ProductReceiptNoteDetailPermissions.cs @@ -0,0 +1,25 @@ +using Volo.Abp.Authorization.Permissions; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; +public static class ProductReceiptNoteDetailPermissions +{ + public const string Default = StorePermissions.GroupName + "." + nameof(ProductReceiptNoteDetail); + public const string Create = Default + "." + StorePermissions.CreateStr; + public const string Update = Default + "." + StorePermissions.UpdateStr; + public const string Delete = Default + "." + StorePermissions.DeleteStr; + + //线边完工收货记录 + public const string WipProductReceiptNoteDetail = StorePermissions.GroupName + "." + nameof(WipProductReceiptNoteDetail); + + public static void AddProductReceiptNoteDetailPermission(this PermissionGroupDefinition permissionGroup) + { + var productReceiptNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(ProductReceiptNoteDetail))); + productReceiptNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); + productReceiptNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); + productReceiptNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); + + permissionGroup.AddPermission(WipProductReceiptNoteDetail, StorePermissionDefinitionProvider.L(nameof(WipProductReceiptNoteDetail))); + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs index 82e0f51b2..beeaa8c94 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs @@ -17,6 +17,7 @@ public class StorePermissionDefinitionProvider : PermissionDefinitionProvider storeGroup.AddProductionPlanPermission(); storeGroup.AddPreparationPlanPermission(); storeGroup.AddProductReceiptNotePermission(); + storeGroup.AddProductReceiptNoteDetailPermission(); storeGroup.AddOfflineSettlementNotePermission(); storeGroup.AddBackFlushNotePermission(); storeGroup.AddWorkOrderPermission(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/DTOs/DeliverRequestDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/DTOs/DeliverRequestDetailDTO.cs index 68b9e9482..48c2eb45f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/DTOs/DeliverRequestDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/DTOs/DeliverRequestDetailDTO.cs @@ -17,4 +17,20 @@ public class DeliverRequestDetailDTO : SfsStoreDetailWithQtyDTOBase, IHasExtraPr [Display(Name = "扩展属性")] public ExtraPropertyDictionary ExtraProperties { set; get; } = new ExtraPropertyDictionary(); + + /// + /// Mes发货单号 + /// + [Display(Name = "Mes发货单号")] + public string MesDeliveryNo { get; set; } + /// + /// Mes发货计划号 + /// + [Display(Name = "Mes发货计划号")] + public string MesDeliveryPlan { get; set; } + /// + /// 底盘号 + /// + [Display(Name = "底盘号")] + public string IdentityNo { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestDetailInput.cs index ab103e943..c472abe02 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestDetailInput.cs @@ -16,4 +16,19 @@ public class DeliverRequestDetailInput : SfsStoreDetailWithQtyInputBase, IHasExt /// [Display(Name = "扩展属性")] public ExtraPropertyDictionary ExtraProperties { set; get; } + /// + /// Mes发货单号 + /// + [Display(Name = "Mes发货单号")] + public string MesDeliveryNo { get; set; } + /// + /// Mes发货计划号 + /// + [Display(Name = "Mes发货计划号")] + public string MesDeliveryPlan { get; set; } + /// + /// 底盘号 + /// + [Display(Name = "底盘号")] + public string IdentityNo { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestImportInput.cs index 977870195..f70191045 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestImportInput.cs @@ -40,6 +40,22 @@ public class DeliverRequestImportInput : SfsStoreImportInputBase [Display(Name = "发货库区")] [Required] public string AreaCode { get; set; } + + /// + /// Mes发货单号 + /// + [Display(Name = "Mes发货单号")] + public string MesDeliveryNo { get; set; } + /// + /// Mes发货计划号 + /// + [Display(Name = "Mes发货计划号")] + public string MesDeliveryPlan { get; set; } + /// + /// 底盘号 + /// + [Display(Name = "底盘号")] + public string IdentityNo { get; set; } } [Display(Name = "FIS发货申请")] diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs index 3416299a8..50b06facf 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs @@ -3,13 +3,20 @@ using System.Collections.Generic; using System.Data; using System.Linq; using System.Linq.Expressions; +using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Castle.Components.DictionaryAdapter; +using DocumentFormat.OpenXml.Spreadsheet; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; +using MyNamespace; +using Omu.ValueInjecter; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.ObjectMapping; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Domain.Shared; using Win_in.Sfs.Shared.Domain; @@ -19,6 +26,7 @@ using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; using Win_in.Sfs.Wms.Store.Jobs.IssueJobs; using Win_in.Sfs.Wms.Store.Notes; +using Win_in.Sfs.Wms.Store.Options; namespace Win_in.Sfs.Wms.Store.Application; @@ -32,14 +40,20 @@ public class CoatingIssueJobAppService private readonly ICoatingIssueJobManager _coatingIssueJobManager; private readonly ILocationAppService _locationAppService; private readonly ITransferLibJobAppService _transferLibJobAppService; - + private readonly IHttpClientFactory _httpClientFactory; + private readonly IOptions _options; public CoatingIssueJobAppService( ICoatingIssueJobRepository repository, ICoatingIssueJobManager coatingIssueJobManager, - ILocationAppService locationAppService, ITransferLibJobAppService transferLibJobAppService) : base(repository, coatingIssueJobManager) + ILocationAppService locationAppService, ITransferLibJobAppService transferLibJobAppService + , IHttpClientFactory httpClientFactory + , IOptions options + ) : base(repository, coatingIssueJobManager) { _coatingIssueJobManager = coatingIssueJobManager; _locationAppService = locationAppService; _transferLibJobAppService = transferLibJobAppService; + _httpClientFactory = httpClientFactory; + _options=options; } [HttpPost("add-many")] @@ -185,10 +199,138 @@ public class CoatingIssueJobAppService return; } - [HttpPost("test")] - public virtual async Task Test() + + [HttpPost("sync-coating-stereo")] + public virtual async Task SyncCoatingJobStereoAsync(List input) { - Console.WriteLine("FuAZCZXVZXVXZVZ"); - await Task.CompletedTask; + + foreach (var itm in input) + { + + } + + + + + ReusltObject ret=new ReusltObject(); + ret.Code = "1"; + ret.Message = "操作成功"; + ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd"); + + List coatingIssueJobToRestoDetailDTOs = new List(); + CoatingIssueJobToRestoDTO main=new CoatingIssueJobToRestoDTO(); + main.OperatorName=CurrentUser.UserName; + foreach (var job in input) + { + foreach (var jobitem in job.Details) + { + coatingIssueJobToRestoDetailDTOs.Add(new CoatingIssueJobToRestoDetailDTO() + { + Count=jobitem.HandledToQty, + ProductNo=jobitem.ItemCode, + NeedSite=jobitem.HandledToLocationCode, + WorkNo=job.Number, + TaskNo=job.Number + }); + } + } + main.Details=coatingIssueJobToRestoDetailDTOs; + + #region + CoatingIssueJobToRestoClient client = new CoatingIssueJobToRestoClient(_options.Value.Address, _httpClientFactory.CreateClient()); + ret = await client.SyncCoatingJobStereoAsync(main).ConfigureAwait(false); + #endregion + return ret; + + + } + + + + + [HttpPost("receive-coating-job-stereo")] + public virtual async Task SyncReciveCoatingJobStereoAsync(CoatingIssueRequestFromRestoDTO input) + { + List errors = new List(); + var ret=new ReusltObject() + { + Code = "1", + OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), + Message = "操作成功" + }; + try + { + + if (input.Jobs.Count > 0) + { + var inputs = input.Jobs; + var numbers = inputs.Select(p => p.JobNumber); + var query = _repository.WithDetails() + .Where(p => numbers.Contains(p.Number)); + var entities = query.ToList(); + + if (input.Jobs.Count == entities.Count) { + errors.Add("出库任务和WMS出库任务不符,请核对! \n"); + } + var dtos = ObjectMapper.Map, List>(entities); + foreach (var itm in dtos) + { + var first = inputs.FirstOrDefault(p => p.JobNumber == itm.Number); + List details = new List(); + foreach (var detail in first.Details) + { + CoatingIssueJobDetailDTO dto = new CoatingIssueJobDetailDTO(); + dto.HandledFromLocationCode = detail.FromLocationCode; + dto.HandledToLocationCode = detail.ToLocationCode; + dto.ItemCode = detail.ItemCode; + dto.RecommendFromQty = detail.Qty; + dto.RecommendToQty = detail.Qty; + dto.HandledFromQty = detail.Qty; + dto.HandledToQty = detail.Qty; + details.Add(dto); + } + itm.Details = details; + } + } + else + { + errors.Add("立体库确认单据里无数据! \n"); + } + } + catch (Exception ex) + { + ret=new ReusltObject() + { + Code = "2", + OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), + Message = ex.Message + }; + return ret; + } + + if (errors.Count > 0) + { + + ret= new ReusltObject() + { + Code = "2", + OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), + Message = string.Join(",",errors.ToArray()) + }; + } + + + + return ret; + } + + + + + + + + + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/proxy/CoatingIssueJobToRestoClient.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/proxy/CoatingIssueJobToRestoClient.cs new file mode 100644 index 000000000..c86d91f04 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/proxy/CoatingIssueJobToRestoClient.cs @@ -0,0 +1,413 @@ +//---------------------- +// +// Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +//---------------------- + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" +#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" +#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" +#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" +#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes). + +namespace MyNamespace +{ + using Win_in.Sfs.Wms.Store.Jobs.IssueJobs; + using System = global::System; + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CoatingIssueJobToRestoClient + { +#pragma warning disable 8618 + private string _baseUrl; +#pragma warning restore 8618 + + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public CoatingIssueJobToRestoClient(string baseUrl, System.Net.Http.HttpClient httpClient) +#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + BaseUrl = baseUrl; + _httpClient = httpClient; + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + public string BaseUrl + { + get { return _baseUrl; } + set + { + _baseUrl = value; + if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/")) + _baseUrl += '/'; + } + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// Success + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SyncCoatingJobStereoAsync(CoatingIssueJobToRestoDTO body) + { + return SyncCoatingJobStereoAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Success + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SyncCoatingJobStereoAsync(CoatingIssueJobToRestoDTO body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, _settings.Value); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "CargoState/SyncCoatingJobStereo" + urlBuilder_.Append("CargoState/SyncCoatingJobStereo"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 401) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 501) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server Error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server Error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[])value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RemoteServiceErrorInfo + { + + [System.Text.Json.Serialization.JsonPropertyName("code")] + public string Code { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("message")] + public string Message { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("details")] + public string Details { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.IDictionary Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("validationErrors")] + public System.Collections.Generic.ICollection ValidationErrors { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RemoteServiceErrorResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("error")] + public RemoteServiceErrorInfo Error { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RemoteServiceValidationErrorInfo + { + + [System.Text.Json.Serialization.JsonPropertyName("message")] + public string Message { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("members")] + public System.Collections.Generic.ICollection Members { get; set; } + + } + + + + + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ApiException : System.Exception + { + public int StatusCode { get; private set; } + + public string Response { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) + : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) + { + StatusCode = statusCode; + Response = response; + Headers = headers; + } + + public override string ToString() + { + return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ApiException : ApiException + { + public TResult Result { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) + : base(message, statusCode, response, headers, innerException) + { + Result = result; + } + } + +} + +#pragma warning restore 108 +#pragma warning restore 114 +#pragma warning restore 472 +#pragma warning restore 612 +#pragma warning restore 1573 +#pragma warning restore 1591 +#pragma warning restore 8073 +#pragma warning restore 3016 +#pragma warning restore 8603 +#pragma warning restore 8604 +#pragma warning restore 8625 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs index ab918a9ec..7da94b615 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs @@ -63,7 +63,6 @@ public class MesNoteAppService : { var fromLocation=await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); var toLocation =await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); - var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); if (fromLocation == null) { throw new UserFriendlyException($"来源库位为空"); @@ -81,9 +80,6 @@ public class MesNoteAppService : detail.ToLocationErpCode = toLocation.ErpLocationCode; detail.ToLocationGroup = toLocation.LocationGroupCode; detail.ToWarehouseCode = toLocation.WarehouseCode; - detail.ToStatus = detail.FromStatus; - detail.Uom = itemBasicDto.BasicUom; - detail.StdPackQty = itemBasicDto.StdPackQty; #region 添加校验 @@ -91,7 +87,7 @@ public class MesNoteAppService : rInput.ItemCode = detail.ItemCode; rInput.Locations = new List() { detail.FromLocationCode }; rInput.Qty = detail.Qty; - rInput.Statuses = new List { EnumInventoryStatus.OK }; + rInput.Statuses = new List { detail.FromStatus }; var balanceLst = await _balanceAppService.GetRecommendBalancesByLocationsAsync(rInput).ConfigureAwait(false); var first = balanceLst.FirstOrDefault(); if (first != null) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteDetailAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteDetailAppService.cs new file mode 100644 index 000000000..ccacd5537 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteDetailAppService.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Volo.Abp.Application.Services; +using Microsoft.AspNetCore.Authorization; +using Win_in.Sfs.Wms.Store.Domain.Shared; +using Win_in.Sfs.Wms.Store.Application; +using Volo.Abp.Domain.Repositories; + +namespace Win_in.Sfs.Wms.Store.Notes.ProductReceiptNotes; +[Authorize] +[Route($"{StoreConsts.RootPath}product-receipt-note-detail")] + +public class ProductReceiptNoteDetailAppService : SfsStoreAppServiceBase, IProductReceiptNoteDetailAppService +{ + private readonly IProductReceiptNoteDetailRepository _productReceiptNoteDetailRepository; + public ProductReceiptNoteDetailAppService( + IProductReceiptNoteDetailRepository repository + ) : base(repository) + { + _productReceiptNoteDetailRepository = repository; + } + + + [HttpGet("get-itemcode-by-mesbarcode")] + public virtual async Task GetItemCodeByMesBarCode(string mesBarCode) + { + var entity = await _productReceiptNoteDetailRepository.FirstOrDefaultAsync(r => r.MesBarCode == mesBarCode).ConfigureAwait(false); + var dto = ObjectMapper.Map(entity); + return dto; + } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs index 0e2505fc9..9451fe2e9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs @@ -360,7 +360,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase /// [HttpPost("")] public override async Task CreateAsync(TransferNoteEditInput input) - { + { var entity = ObjectMapper.Map(input); entity=await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs index 1ecfa8ea9..ff890095c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs @@ -10,6 +10,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.ObjectMapping; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -32,7 +34,6 @@ public class DeliverRequestAppService : private readonly IAreaAppService _areaApp; private readonly ICustomerAppService _customerApp; private readonly ICustomerAddressAppService _customerAddressApp; - public DeliverRequestAppService( IDeliverRequestRepository repository , IDeliverRequestManager deliverRequestManager @@ -46,7 +47,25 @@ public class DeliverRequestAppService : _customerApp = customerApp; _customerAddressApp = customerAddressApp; } + /// + /// 处理请求 + /// + /// + /// + [HttpPost("handle-list")] + public virtual async Task> HandleListAsync(List ids) + { + var entitys = await _repository.GetListAsync(r=> ids.Contains(r.Id)).ConfigureAwait(false); + if (entitys.Select(r => r.CustomerCode).Distinct().Count()>1) + { + throw new UserFriendlyException($"所选申请涉及多个客户不能创建为一个发货单,请重新选择!"); + } + Check.NotNull(entitys, typeof(DeliverRequest).Name); + var result = await _deliverRequestManager.HandleListAsync(entitys).ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(entitys); + return dtos; + } [HttpPost("list")] public override Task> GetPagedListByFilterAsync( SfsStoreRequestInputBase sfsRequestInput, @@ -75,7 +94,30 @@ public class DeliverRequestAppService : var dto = ObjectMapper.Map(entity); return dto; } + private async Task SetRequestAutoPropertiesAsync(DeliverRequest entity) + { + //普通件 + var transType = EnumTransSubType.Deliver_Standard; + //jis件 + if (entity.DeliverRequestType == EnumDeliverRequestType.FIS) + { + transType = EnumTransSubType.Deliver_FIS; + } + else if (entity.DeliverRequestType == EnumDeliverRequestType.RAW) + { + transType = EnumTransSubType.Deliver_RAW; + } + var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, transType).ConfigureAwait(false); + + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + entity.DeliverRequestType = entity.DeliverRequestType; + } #region import protected virtual async Task CheckImportInputBusinessAsync( DeliverRequestImportInput importInput @@ -246,30 +288,7 @@ public class DeliverRequestAppService : await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); } - private async Task SetRequestAutoPropertiesAsync(DeliverRequest entity) - { - //普通件 - var transType = EnumTransSubType.Deliver_Standard; - //jis件 - if (entity.DeliverRequestType == EnumDeliverRequestType.FIS) - { - transType = EnumTransSubType.Deliver_FIS; - } - else if (entity.DeliverRequestType == EnumDeliverRequestType.RAW) - { - transType = EnumTransSubType.Deliver_RAW; - } - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, transType).ConfigureAwait(false); - Check.NotNull(tranType, "事务类型", "事务类型不存在"); - - entity.AutoCompleteJob = tranType.AutoCompleteJob; - entity.AutoSubmit = tranType.AutoSubmitRequest; - entity.AutoAgree = tranType.AutoAgreeRequest; - entity.AutoHandle = tranType.AutoHandleRequest; - entity.DirectCreateNote = tranType.DirectCreateNote; - entity.DeliverRequestType = entity.DeliverRequestType; - } private static void CheckTransactionType(TransactionTypeDTO transactionType, ItemBasicDTO item) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs index b88d2249a..6b40d01c6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs @@ -93,6 +93,9 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.Id) .Ignore(x => x.ExtraProperties) .Ignore(x => x.Remark) + .Ignore(x => x.IdentityNo) + .Ignore(x => x.MesDeliveryNo) + .Ignore(x => x.MesDeliveryPlan) .AfterMap((x, y) => y.SetProperty(nameof(x.FromVinCode), x.FromVinCode)) //.AfterMap((x, y) => y.SetProperty(nameof(x.ToVinCode), x.ToVinCode)) ; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs index 9e25e6475..2c872d3b5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs @@ -171,7 +171,7 @@ public class DeliverRequestFisAppService : CancellationToken cancellationToken = default) { sfsRequestInput.Condition.Filters.Add( - new Filter(nameof(DeliverRequest.DeliverRequestType), "FIS")); + new Filter(nameof(DeliverRequest.DeliverRequestType), "Normal")); return base.GetPagedListByFilterAsync(sfsRequestInput, includeDetails, cancellationToken); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs index a4c20f257..e31231106 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs @@ -61,14 +61,15 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA entity.AutoSubmit = true; entity.AutoAgree = true; entity.AutoHandle = true; - if (entity.UnplannedIssueType == EnumUnplannedIssueType.Wip) - { - entity.DirectCreateNote = true; - } - else - { - entity.DirectCreateNote = false; - } + entity.DirectCreateNote = false; + //if (entity.UnplannedIssueType == EnumUnplannedIssueType.Wip) + //{ + // entity.DirectCreateNote = true; + //} + //else + //{ + + //} await _unplannedIssueRequestManager.CreateAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(entity); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs index eb193e7f8..6f4d40782 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs @@ -65,14 +65,15 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ entity.AutoSubmit = true; entity.AutoAgree = true; entity.AutoHandle = true; - if (entity.UnplannedReceiptType == EnumUnplannedReceiptType.Wip) - { - entity.DirectCreateNote = true; //线边直接生成记录 - } - else - { - entity.DirectCreateNote = false; //原料先生成任务、再生成记录 - } + entity.DirectCreateNote = false; + //if (entity.UnplannedReceiptType == EnumUnplannedReceiptType.Wip) + //{ + // entity.DirectCreateNote = true; //线边直接生成记录 + //} + //else + //{ + // entity.DirectCreateNote = false; //原料先生成任务、再生成记录 + //} var res = await _unplannedReceiptRequestManager.CreateAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(entity); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationModule.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationModule.cs index e37b33f3d..a2edd768b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationModule.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationModule.cs @@ -6,6 +6,7 @@ using Volo.Abp.Modularity; using Volo.Abp.Settings; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Options; namespace Win_in.Sfs.Wms.Store.Application; @@ -19,12 +20,16 @@ public class StoreApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { + var configuration = context.Services.GetConfiguration(); context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddMaps(); }); + + Configure(configuration.GetSection("RestoOptions")); + context.Services.Replace(ServiceDescriptor.Transient()); context.Services.Replace(ServiceDescriptor.Transient()); context.Services.Replace(ServiceDescriptor.Transient()); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs index 09a3b16e9..cf50200fa 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs @@ -45,5 +45,9 @@ public enum EnumExchangeDataType /// 装配发料 /// AssembleIssue=32, + /// + /// 三方库 + /// + ThirdLocation = 33, } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs index 8c0958daa..5d16fbc0c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs @@ -96,6 +96,35 @@ public abstract class SfsJobManagerBase return entities; } + /// + /// + /// + /// + /// + public virtual async Task> AddManyNoPublishAsync(List entities) + { + foreach (var job in entities) + { + job.SetIdAndNumberWithDetails(GuidGenerator, await GetNumber().ConfigureAwait(false)); + await SendNotifyMessageAsync(job).ConfigureAwait(false); + } + + //await PublishCreatedAsync(entities).ConfigureAwait(false); + + await Repository.InsertManyAsync(entities).ConfigureAwait(false); + + return entities; + } + + + + + + + + + + public virtual async Task OpenAsync(TEntity entity) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/DeliverNotes/DeliverNoteDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/DeliverNotes/DeliverNoteDetail.cs index fff0e8fea..ae672d219 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/DeliverNotes/DeliverNoteDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/DeliverNotes/DeliverNoteDetail.cs @@ -8,4 +8,16 @@ public class DeliverNoteDetail : SfsStoreRecommendFromDetailWithFromToEntityBase /// 扩展属性 /// public ExtraPropertyDictionary ExtraProperties { get; set; } = new ExtraPropertyDictionary(); + /// + /// Mes发货单号 + /// + public string MesDeliveryNo { get; set; } + /// + /// Mes发货计划号 + /// + public string MesDeliveryPlan { get; set; } + /// + /// 底盘号 + /// + public string IdentityNo { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/IProductReceiptNoteDetailRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/IProductReceiptNoteDetailRepository.cs new file mode 100644 index 000000000..2e9b88d6a --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/IProductReceiptNoteDetailRepository.cs @@ -0,0 +1,4 @@ +namespace Win_in.Sfs.Wms.Store.Domain; +public interface IProductReceiptNoteDetailRepository : ISfsStoreRepositoryBase +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Options/RestoOptions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Options/RestoOptions.cs new file mode 100644 index 000000000..e6cf97d3c --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Options/RestoOptions.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Win_in.Sfs.Wms.Store.Options; +public class RestoOptions +{ + // IP 地址 + public string Address { set; get; } + // 用户名 + public string UserName { set; get; } + // 密码 + public string Password { set; get; } + // 令牌 + public string Token { set; get; } + + + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequest.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequest.cs index e8f647791..a7d5cd8d1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequest.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequest.cs @@ -38,7 +38,6 @@ public class DeliverRequest : SfsStoreRequestAggregateRootBase /// 发货类型 /// - [IgnoreUpdate] public EnumDeliverRequestType DeliverRequestType { get; set; } /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequestDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequestDetail.cs index 0d0890d61..4ef1869ee 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequestDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequestDetail.cs @@ -16,5 +16,16 @@ public class DeliverRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasExtraPr /// 扩展属性 /// public ExtraPropertyDictionary ExtraProperties { get; set; } = new ExtraPropertyDictionary(); - + /// + /// Mes发货单号 + /// + public string MesDeliveryNo { get; set; } + /// + /// Mes发货计划号 + /// + public string MesDeliveryPlan { get; set; } + /// + /// 底盘号 + /// + public string IdentityNo { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequestManager.cs index 01209e9f6..0457301bd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/DeliverRequestManager.cs @@ -1,7 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using IdentityModel; using Volo.Abp; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Event; namespace Win_in.Sfs.Wms.Store.Domain; @@ -67,4 +72,21 @@ public class DeliverRequestManager : SfsStoreRequestManagerBase + /// 执行 + /// + /// + /// + [UnitOfWork] + public async Task> HandleListAsync(List entitys) + { + foreach (var entity in entitys) + { + entity.Handle(); + await AddOrUpdateAsync(entity).ConfigureAwait(false); + } + await LocalEventBus.PublishAsync(new SfsHandledEntityEventData>(entitys), false).ConfigureAwait(false); + return entitys; + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/IDeliverRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/IDeliverRequestManager.cs index 49f0a28fa..0c5fc53c2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/IDeliverRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/DeliverRequests/IDeliverRequestManager.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Threading.Tasks; using Win_in.Sfs.Shared.Domain; @@ -7,4 +8,5 @@ public interface IDeliverRequestManager : ISfsStoreRequestManager { Task CompleteAsync(string number); + Task> HandleListAsync(List entitys); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs index 5fd1058d9..7038db0fd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs @@ -74,6 +74,8 @@ public interface IStoreDbContext : IEfCoreDbContext public DbSet JisProductReceiptNotes { get; } public DbSet ProductReceiptNotes { get; } + + public DbSet ProductReceiptNoteDetails { get; } public DbSet OfflineSettlementNotes { get; } public DbSet BackFlushNotes { get; } public DbSet ProductL7PartsNotes { get; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/DeliverNotes/DeliverNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/DeliverNotes/DeliverNoteDbContextModelCreatingExtensions.cs index 381ea2d2c..5d71253f9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/DeliverNotes/DeliverNoteDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/DeliverNotes/DeliverNoteDbContextModelCreatingExtensions.cs @@ -50,7 +50,9 @@ public static class DeliverNoteDbContextModelCreatingExtensions b.Property(q => q.ToPackingCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.FromLot).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ToLot).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); - + b.Property(q => q.IdentityNo).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.MesDeliveryPlan).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.MesDeliveryNo).HasMaxLength(SfsPropertyConst.CodeLength); //Indexes b.HasIndex(q => new { q.Number, q.ItemCode, q.FromPackingCode, q.FromLot, q.FromLocationCode, q.ToLocationCode }).IsUnique(); }); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ProductReceiptNotes/ProductReceiptNoteDetailEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ProductReceiptNotes/ProductReceiptNoteDetailEfCoreRepository.cs new file mode 100644 index 000000000..1f3c9d5b3 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ProductReceiptNotes/ProductReceiptNoteDetailEfCoreRepository.cs @@ -0,0 +1,10 @@ +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; +public class ProductReceiptNoteDetailEfCoreRepository : SfsStoreEfCoreRepositoryBase, IProductReceiptNoteDetailRepository +{ + public ProductReceiptNoteDetailEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/DeliverRequests/DeliverRequestDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/DeliverRequests/DeliverRequestDbContextModelCreatingExtensions.cs index 328fa0d71..b6530b9ff 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/DeliverRequests/DeliverRequestDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/DeliverRequests/DeliverRequestDbContextModelCreatingExtensions.cs @@ -42,7 +42,9 @@ public static class DeliverRequestDbContextModelCreatingExtensions b.ConfigureSfsStoreBase(); //Configure Sfs store detail properties b.ConfigureSfsStoreDetailBase(); - + b.Property(q => q.IdentityNo).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.MesDeliveryPlan).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.MesDeliveryNo).HasMaxLength(SfsPropertyConst.CodeLength); //Properties //Relations diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs index 5aca78453..8ef095cd4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs @@ -73,6 +73,8 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext public DbSet JisProductReceiptNotes { get; set; } public DbSet ProductReceiptNotes { get; set; } + + public DbSet ProductReceiptNoteDetails { get; set; } public DbSet OfflineSettlementNotes { get; set; } public DbSet BackFlushNotes { get; set; } public DbSet ProductL7PartsNotes { get; set; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs index a40b7bf6c..600f637f7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs @@ -95,6 +95,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); @@ -106,7 +107,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); - context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); + context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/DeliverJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/DeliverJobAutoMapperProfile.cs index 065cc9c81..416b5fb1d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/DeliverJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/DeliverJobAutoMapperProfile.cs @@ -46,6 +46,9 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.ToLocationArea) .Ignore(x => x.ToLocationGroup) .Ignore(x => x.ExtraProperties) + .Ignore(x => x.MesDeliveryNo) + .Ignore(x => x.IdentityNo) + .Ignore(x => x.MesDeliveryPlan) ; CreateMap() diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/DeliverRequestMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/DeliverRequestMapperProfile.cs index 5dbb2df1b..0d04d1a29 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/DeliverRequestMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/DeliverRequestMapperProfile.cs @@ -97,6 +97,9 @@ public partial class StoreEventAutoMapperProfile : Profile .ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status)) .ForMember(x => x.ToWarehouseCode, y => y.MapFrom(d => d.WarehouseCode)) .Ignore(t => t.StdPackQty) + .Ignore(t => t.MesDeliveryNo) + .Ignore(t => t.MesDeliveryPlan) + .Ignore(t => t.IdentityNo) .Ignore(x => x.ExtraProperties) .IgnoreIHasRecommendAndHandledFrom(); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/KittingIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/KittingIssueNoteEventHandler.cs new file mode 100644 index 000000000..8f4a54e09 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/KittingIssueNoteEventHandler.cs @@ -0,0 +1,107 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Notes.IssueNotes; + +namespace Win_in.Sfs.Wms.Store.Event.DataExchanges; + +/// +/// Kitting区=>装配线边库移记录传给TYRP(线边仓领料单) +/// +public class KittingIssueNoteEventHandler + : StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> +{ + + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Issue; + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity).ConfigureAwait(false); + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities).ConfigureAwait(false); + } + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) + { + var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); + if (location != null) + { + detail.HandledFromLocationErpCode = location.ErpLocationCode; + detail.HandledFromLocationGroup = location.LocationGroupCode; + detail.HandledFromLocationArea = location.AreaCode; + + if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) + { + detail.HandledFromWarehouseCode = location.WarehouseCode; + } + } + } + + if (string.IsNullOrEmpty(detail.HandledToLocationErpCode)) + { + var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); + if (location != null) + { + detail.HandledToLocationErpCode = location.ErpLocationCode; + detail.HandledToLocationGroup = location.LocationGroupCode; + detail.HandledToLocationArea = location.AreaCode; + + if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) + { + detail.HandledToWarehouseCode = location.WarehouseCode; + } + } + } + + } + + var toErpDto = new List(); + foreach (var item in dtos) + { + if (item.Details != null && item.Details.Count != 0) + { + toErpDto.Add(item); + } + } + + //2023-12-6要求同储位不传入接口 按历史规则 + var result = new List(); + foreach (var kittingIssueNoteDto in toErpDto) + { + kittingIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); + if (kittingIssueNoteDto.Details.Count > 0) + { + result.Add(kittingIssueNoteDto); + } + } + + if (result.Count > 0) + { + var exchangeDataerp = + await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result) + .ConfigureAwait(false); + await AddManyAsync(exchangeDataerp).ConfigureAwait(false); + } + } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs index 7adb5dde4..22374322d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs @@ -18,12 +18,8 @@ namespace Win_in.Sfs.Wms.Store.Event.DataExchanges StoreDataExchangeEventHandlerBase , ILocalEventHandler> { - private readonly Domain.Acl.Location.ILocationAclService _locationAclService; - - public ThirdLocationNoteEventHandler(ILocationAclService locationAclService) - { - _locationAclService = locationAclService; - } + + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.ThirdLocation; [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) @@ -32,11 +28,22 @@ namespace Win_in.Sfs.Wms.Store.Event.DataExchanges await AddExchangeDataAsync(entity).ConfigureAwait(false); } + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities).ConfigureAwait(false); + } + protected override async Task AddExchangeDataAsync(List entities) { var dtos = ObjectMapper.Map, List>(entities); - - var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.Transfer, dtos).ConfigureAwait(false); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false); + } + + var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos).ConfigureAwait(false); await AddManyAsync(exchangeData).ConfigureAwait(false); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs index 8ef9669ed..29c1e645d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp; +using Volo.Abp.Domain.Entities; using Volo.Abp.EventBus; +using Volo.Abp.ObjectMapping; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; @@ -17,6 +19,7 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; public class DeliverRequestEventHandler : StoreEventHandlerBase , ILocalEventHandler> + , ILocalEventHandler>> , ILocalEventHandler> , ILocalEventHandler> , ILocalEventHandler>> @@ -26,16 +29,19 @@ public class DeliverRequestEventHandler private readonly IDeliverJobAppService _deliverJobApp; private readonly ICustomerAddressAppService _customerAddressApp; private readonly IDeliverRequestManager _deliverRequestManager; - + private readonly IBalanceAppService _balanceAppService; + private readonly ILocationAppService _locationAppService; public DeliverRequestEventHandler( IDeliverJobAppService deliverJobApp , IDeliverNoteAppService deliverNoteApp - , ICustomerAddressAppService customerAddressApp, IDeliverRequestManager deliverRequestManager) + , ICustomerAddressAppService customerAddressApp, IDeliverRequestManager deliverRequestManager, IBalanceAppService balanceAppService, ILocationAppService locationAppService) { _deliverNoteApp = deliverNoteApp; _deliverJobApp = deliverJobApp; _customerAddressApp = customerAddressApp; _deliverRequestManager = deliverRequestManager; + _balanceAppService = balanceAppService; + _locationAppService = locationAppService; } @@ -46,11 +52,7 @@ public class DeliverRequestEventHandler [UnitOfWork] public async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { - var entity = eventData.Entity; - if (entity.AutoSubmit) - { - await _deliverRequestManager.SubmitAsync(entity).ConfigureAwait(false); - } + await Task.CompletedTask.ConfigureAwait(false); } /// @@ -60,14 +62,7 @@ public class DeliverRequestEventHandler [UnitOfWork] public async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) { - var entitys = eventData.Entity; - foreach (var entity in entitys) - { - if (entity.AutoSubmit) - { - await _deliverRequestManager.SubmitAsync(entity).ConfigureAwait(false); - } - } + await Task.CompletedTask.ConfigureAwait(false); } /// @@ -109,10 +104,110 @@ public class DeliverRequestEventHandler await _deliverJobApp.CreateManyAsync(deliverJobCreateInputs).ConfigureAwait(false); } } + /// + /// 执行后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsHandledEntityEventData> eventData) + { + var entitys = eventData.Entity; + //东阳特殊逻辑 + if (entitys.First().DirectCreateNote) + { + var noteCreateInput = await BuildDeliverNoteAsync(entitys).ConfigureAwait(false); + await _deliverNoteApp.CreateAsync(noteCreateInput).ConfigureAwait(false); + } + } #region 私有 + private async Task BuildDeliverNoteAsync(List requests) + { + var transactionType = await TransactionTypeAclService + .GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.None).ConfigureAwait(false); + + if (requests.First().DeliverRequestType == EnumDeliverRequestType.Normal) + { + transactionType = await TransactionTypeAclService.GetByTransTypeAsync( + EnumTransType.Deliver, + EnumTransSubType.Deliver_Standard).ConfigureAwait(false); + } + else if (requests.First().DeliverRequestType == EnumDeliverRequestType.FIS) + { + transactionType = await TransactionTypeAclService.GetByTransTypeAsync( + EnumTransType.Deliver, + EnumTransSubType.Deliver_FIS).ConfigureAwait(false); + } + + var createInput = ObjectMapper.Map(requests.First()); + + var customerAddress = + (await _customerAddressApp.GetByCustomerCodeAsync(createInput.CustomerCode).ConfigureAwait(false)) + .FirstOrDefault(); + + LocationDTO toLocation = null; + if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode)) + { + toLocation = await LocationAclService.GetByCodeAsync(customerAddress.LocationCode).ConfigureAwait(false); + + Check.NotNull(toLocation, $"客户库位 {customerAddress.LocationCode} 不存在"); + } + + createInput.Details = new List(); + foreach (var detail in requests.SelectMany(r=>r.Details)) + { + var locations = await _locationAppService.GetListByTypesAndErpCodeAsync(transactionType.OutLocationTypes, detail.AreaCode).ConfigureAwait(false); + if (locations.Count <= 0) + { + throw new UserFriendlyException($"储位 {detail.AreaCode} 未找到对应的成品库和半成品库。"); + } + + var balances = await _balanceAppService.GetRecommendBalancesByLocationsAsync( + new RecommendBalanceRequestInput + { + ItemCode = detail.ItemCode, + Qty = detail.Qty, + Locations = locations.Select(r => r.Code).ToList(), + Statuses = transactionType.OutInventoryStatuses + }).ConfigureAwait(false); + + var sumQty = balances.Sum(t => t.Qty); + + if (sumQty < detail.Qty) + { + throw new UserFriendlyException($"物料号 {detail.ItemCode} 库存余额 {sumQty} 小于 {detail.Qty}。"); + } + + foreach (var balance in balances) + { + var inputDetail = ObjectMapper.Map(balance); + + var item = await ItemBasicAclService.GetByCodeAsync(balance.ItemCode).ConfigureAwait(false); + + if (item != null) + { + inputDetail.StdPackQty = item.StdPackQty; + } + + if (toLocation != null) + { + inputDetail.ToLocationCode = toLocation.Code; + + inputDetail.ToLocationErpCode = toLocation.ErpLocationCode; + } + + inputDetail.ExtraProperties = detail.ExtraProperties; + inputDetail.MesDeliveryNo = detail.MesDeliveryNo; + inputDetail.IdentityNo = detail.IdentityNo; + inputDetail.MesDeliveryPlan = detail.MesDeliveryPlan; + createInput.Details.Add(inputDetail); + } + } + return createInput; + } private async Task BuildDeliverNoteAsync(DeliverRequest request) { var transactionType = await TransactionTypeAclService @@ -149,16 +244,21 @@ public class DeliverRequestEventHandler foreach (var detail in request.Details) { - var balances = await BalanceAclService.GetRecommendBalancesAsync( + var locations = await _locationAppService.GetListByTypesAndErpCodeAsync(transactionType.OutLocationTypes, detail.AreaCode).ConfigureAwait(false); + if (locations.Count<=0) + { + throw new UserFriendlyException($"储位 {detail.AreaCode} 未找到对应的成品库和半成品库。"); + } + + var balances = await _balanceAppService.GetRecommendBalancesByLocationsAsync( new RecommendBalanceRequestInput { ItemCode = detail.ItemCode, Qty = detail.Qty, - LocationTypes = transactionType.OutLocationTypes, - LocationAreas = new List { detail.AreaCode }, + Locations = locations.Select(r=>r.Code).ToList(), Statuses = transactionType.OutInventoryStatuses }).ConfigureAwait(false); - + var sumQty = balances.Sum(t => t.Qty); if (sumQty < detail.Qty) @@ -185,7 +285,9 @@ public class DeliverRequestEventHandler } inputDetail.ExtraProperties = detail.ExtraProperties; - + inputDetail.MesDeliveryNo = detail.MesDeliveryNo; + inputDetail.IdentityNo = detail.IdentityNo; + inputDetail.MesDeliveryPlan = detail.MesDeliveryPlan; createInput.Details.Add(inputDetail); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs index 8096320f7..80821e7f4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs @@ -161,6 +161,8 @@ public class InjectionIssueRequestEventHandler { for (var i = 0; i < sumBoxQty; i++) { + if(usableList.Any()) + { var firstUsable = usableList.First(); useBalanceList.Add(firstUsable.PackingCode); usableList.Remove(firstUsable); @@ -172,6 +174,7 @@ public class InjectionIssueRequestEventHandler .ConfigureAwait(false); inputJobs.Add(injectionJobEditInput); + } } } }