279 changed files with 38566 additions and 2200 deletions
@ -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 |
|||
{ |
|||
/// <summary>
|
|||
/// 序号
|
|||
/// </summary>
|
|||
[Key] |
|||
public string mesout_callmtl_id { get; set; } |
|||
/// <summary>
|
|||
/// 物料
|
|||
/// </summary>
|
|||
public string mesout_callmtl_erpno { get; set; } |
|||
/// <summary>
|
|||
/// 库位
|
|||
/// </summary>
|
|||
public string mesout_callmtl_loc { get; set; } |
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public decimal mesout_callmtl_num { get; set; } |
|||
/// <summary>
|
|||
/// 时间
|
|||
/// </summary>
|
|||
public string mesout_callmtl_wt { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否读取(0,1)
|
|||
/// </summary>
|
|||
public long Yl1 { get; set; } |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] { mesout_callmtl_id }; |
|||
} |
|||
|
|||
} |
@ -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<List<CallMtl>> GetToBeProcessedListAsync() |
|||
{ |
|||
var plans = await _repository.GetListAsync(p => p.Yl1 == 0).ConfigureAwait(false); |
|||
return plans; |
|||
} |
|||
public virtual async Task UpdateProcesseErrordListAsync(List<CallMtl> 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<CallMtl> 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); |
|||
} |
|||
} |
@ -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<List<CallMtl>> GetToBeProcessedListAsync(); |
|||
Task UpdateProcessedListAsync(List<CallMtl> entities); |
|||
Task UpdateProcesseErrordListAsync(List<CallMtl> entities); |
|||
} |
@ -0,0 +1,7 @@ |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl; |
|||
public interface ICallMtlRepository : IRepository<CallMtl> |
|||
{ |
|||
|
|||
} |
@ -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 |
|||
{ |
|||
/// <summary>
|
|||
/// 序号
|
|||
/// </summary>
|
|||
[Key] |
|||
public string mesout_delivery_id { get; set; } |
|||
/// <summary>
|
|||
/// 类型
|
|||
/// </summary>
|
|||
public string mesout_delivery_type { get; set; } |
|||
/// <summary>
|
|||
/// 物料
|
|||
/// </summary>
|
|||
public string mesout_delivery_part { get; set; } |
|||
/// <summary>
|
|||
/// 底盘号
|
|||
/// </summary>
|
|||
public string mesout_delivery_identity_no { get; set; } |
|||
/// <summary>
|
|||
/// 发红储位
|
|||
/// </summary>
|
|||
public string mesout_delivery_loc { get; set; } |
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public decimal mesout_delivery_num { get; set; } |
|||
/// <summary>
|
|||
/// 客户代码
|
|||
/// </summary>
|
|||
public string mesout_delivery_customer { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 车牌号
|
|||
/// </summary>
|
|||
public string mesout_delivery_carno { get; set; } |
|||
/// <summary>
|
|||
/// 写入时间
|
|||
/// </summary>
|
|||
public string mesout_delivery_wt { get; set; } |
|||
/// <summary>
|
|||
/// 发货单号
|
|||
/// </summary>
|
|||
public string mesout_delivery_no { get; set; } |
|||
/// <summary>
|
|||
/// 器具号
|
|||
/// </summary>
|
|||
public string mesout_delivery_container { get; set; } |
|||
/// <summary>
|
|||
/// 发货计划号
|
|||
/// </summary>
|
|||
public string mesout_delivery_plan { get; set; } |
|||
/// <summary>
|
|||
/// 是否读取(0,1)
|
|||
/// </summary>
|
|||
public long Yl1 { get; set; } |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] { mesout_delivery_id }; |
|||
} |
|||
} |
@ -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<List<Delivery>> GetToBeProcessedListAsync() |
|||
{ |
|||
var plans = await _repository.GetListAsync(p => p.Yl1 == 0).ConfigureAwait(false); |
|||
return plans; |
|||
|
|||
} |
|||
public virtual async Task UpdateProcesseErrordListAsync(List<Delivery> 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<Delivery> 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); |
|||
} |
|||
} |
@ -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<List<Delivery>> GetToBeProcessedListAsync(); |
|||
Task UpdateProcessedListAsync(List<Delivery> entities); |
|||
Task UpdateProcesseErrordListAsync(List<Delivery> entities); |
|||
} |
@ -0,0 +1,8 @@ |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery; |
|||
|
|||
public interface IDeliveryRepository : IRepository<Delivery> |
|||
{ |
|||
|
|||
} |
@ -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 |
|||
{ |
|||
/// <summary>
|
|||
/// 序号
|
|||
/// </summary>
|
|||
[Key] |
|||
public string mesout_frozen_id { get; set; } |
|||
/// <summary>
|
|||
/// 类型
|
|||
/// </summary>
|
|||
public string mesout_frozen_type { get; set; } |
|||
/// <summary>
|
|||
/// 物料
|
|||
/// </summary>
|
|||
public string mesout_frozen_part { get; set; } |
|||
/// <summary>
|
|||
/// 日期
|
|||
/// </summary>
|
|||
public string mesout_frozen_date { get; set; } |
|||
/// <summary>
|
|||
/// 来源库位
|
|||
/// </summary>
|
|||
public string mesout_frozen_loc { get; set; } |
|||
/// <summary>
|
|||
/// 冻结原因
|
|||
/// </summary>
|
|||
public string mesout_frozen_reason { get; set; } |
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public decimal mesout_frozen_num { get; set; } |
|||
/// <summary>
|
|||
/// 冻结用户
|
|||
/// </summary>
|
|||
public string mesout_frozen_user { get; set; } |
|||
/// <summary>
|
|||
/// 是否读取(0,1)
|
|||
/// </summary>
|
|||
public long Yl1 { get; set; } |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] { mesout_frozen_id }; |
|||
} |
|||
} |
@ -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<List<Frozen>> GetToBeProcessedListAsync() |
|||
{ |
|||
var plans = await _repository.GetListAsync(p => p.Yl1 == 0).ConfigureAwait(false); |
|||
return plans; |
|||
|
|||
} |
|||
public virtual async Task UpdateProcesseErrordListAsync(List<Frozen> 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<Frozen> 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); |
|||
} |
|||
} |
@ -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<List<Frozen>> GetToBeProcessedListAsync(); |
|||
Task UpdateProcessedListAsync(List<Frozen> entities); |
|||
Task UpdateProcesseErrordListAsync(List<Frozen> entities); |
|||
} |
@ -0,0 +1,7 @@ |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen; |
|||
public interface IFrozenRepository : IRepository<Frozen> |
|||
{ |
|||
|
|||
} |
@ -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<List<Qtyrfe>> GetToBeProcessedListAsync(); |
|||
Task UpdateProcessedListAsync(List<Qtyrfe> entities); |
|||
Task UpdateProcesseErrordListAsync(List<Qtyrfe> entities); |
|||
} |
@ -0,0 +1,7 @@ |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Qtyrfe; |
|||
public interface IQtyrfeRepository : IRepository<Qtyrfe> |
|||
{ |
|||
|
|||
} |
@ -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 |
|||
{ |
|||
/// <summary>
|
|||
/// 序号
|
|||
/// </summary>
|
|||
[Key] |
|||
public string mesout_qtyrfe_id { get; set; } |
|||
/// <summary>
|
|||
/// 物料
|
|||
/// </summary>
|
|||
public string mesout_qtyrfe_part { get; set; } |
|||
/// <summary>
|
|||
/// 调出储位
|
|||
/// </summary>
|
|||
public string mesout_qtyrfe_loc_from { get; set; } |
|||
/// <summary>
|
|||
/// 调入储位
|
|||
/// </summary>
|
|||
public string mesout_qtyrfe_loc_to { get; set; } |
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public decimal mesout_qtyrfe_num { get; set; } |
|||
/// <summary>
|
|||
/// 调拨用户
|
|||
/// </summary>
|
|||
public string mesout_qtyrfe_user { get; set; } |
|||
/// <summary>
|
|||
/// 写入时间
|
|||
/// </summary>
|
|||
public string mesout_qtyrfe_wt { get; set; } |
|||
/// <summary>
|
|||
/// 类型(1为质量补)
|
|||
/// </summary>
|
|||
public string mesout_qtyrfe_type { get; set; } |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] { mesout_qtyrfe_id }; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 是否读取(0,1)
|
|||
/// </summary>
|
|||
public long Yl1 { get; set; } |
|||
} |
@ -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<List<Qtyrfe>> GetToBeProcessedListAsync() |
|||
{ |
|||
var plans = await _repository.GetListAsync(p => p.Yl1 == 0).ConfigureAwait(false); |
|||
return plans; |
|||
|
|||
} |
|||
public virtual async Task UpdateProcesseErrordListAsync(List<Qtyrfe> 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<Qtyrfe> 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); |
|||
} |
|||
} |
@ -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<CallMtl>(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); |
|||
}); |
|||
|
|||
} |
|||
} |
@ -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<MesDbContext, CallMtl>, ICallMtlRepository |
|||
{ |
|||
public CallMtlEfCoreRepository(IDbContextProvider<MesDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
} |
@ -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<Delivery>(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); |
|||
}); |
|||
|
|||
} |
|||
} |
@ -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<MesDbContext, Delivery>,IDeliveryRepository |
|||
{ |
|||
public DeliveryEfCoreRepository(IDbContextProvider<MesDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
} |
@ -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<Frozen>(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); |
|||
}); |
|||
|
|||
} |
|||
} |
@ -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<MesDbContext, Frozen>, IFrozenRepository |
|||
{ |
|||
public FrozenEfCoreRepository(IDbContextProvider<MesDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
} |
@ -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<Qtyrfe>(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); |
|||
}); |
|||
|
|||
} |
|||
} |
@ -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<MesDbContext, Qtyrfe>, IQtyrfeRepository |
|||
{ |
|||
public QtyrfeEfCoreRepository(IDbContextProvider<MesDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
} |
@ -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<CallMtlConverter> _logger; |
|||
|
|||
public CallMtlConverter( |
|||
IIncomingToWmsManager incomingToWmsManager |
|||
, IObjectMapper objectMapper |
|||
, IItemBasicAppService itemBasicAppService |
|||
, ILogger<CallMtlConverter> logger, |
|||
ILocationAppService locationAppService, |
|||
IIncomingFromExternalManager incomingFromExternalManager) |
|||
{ |
|||
_incomingToWmsManager = incomingToWmsManager; |
|||
_objectMapper = objectMapper; |
|||
_itemBasicAppService = itemBasicAppService; |
|||
_logger = logger; |
|||
_locationAppService = locationAppService; |
|||
_incomingFromExternalManager = incomingFromExternalManager; |
|||
} |
|||
|
|||
public virtual async Task ConvertAsync(List<IncomingFromExternal> 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<List<IncomingToWms>> BuildIncomingToWmsOfInjectionIssueAsync(List<IncomingFromExternal> incomingDataList) |
|||
{ |
|||
var incomingToWmsList = new List<IncomingToWms>(); |
|||
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<InjectionIssueRequestExchangeDto>(incomingData.DestinationDataContent); |
|||
var wmsInjectionIssueDetail = _objectMapper.Map<InjectionIssueRequestDetailExchangeDto, InjectionIssueRequestDetailInput>(exchangeInjectionIssue.Detail); |
|||
var wmsInjectionIssue = _objectMapper.Map<InjectionIssueRequestExchangeDto, InjectionIssueRequestEditInput>(exchangeInjectionIssue); |
|||
wmsInjectionIssue.Details = new List<InjectionIssueRequestDetailInput>(); |
|||
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; |
|||
} |
|||
|
|||
} |
@ -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<CallMtlReader> _logger; |
|||
private readonly ILocationAppService _locationAppService; |
|||
|
|||
public CallMtlReader( |
|||
ICallMtlManager pillTaskManager |
|||
, IIncomingFromExternalManager incomingFromExternalManager |
|||
, ILogger<CallMtlReader> logger |
|||
, ILocationAppService locationAppService |
|||
) |
|||
{ |
|||
_CallMtlManager = pillTaskManager; |
|||
_incomingFromExternalManager = incomingFromExternalManager; |
|||
_logger = logger; |
|||
_locationAppService = locationAppService; |
|||
} |
|||
|
|||
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
|||
|
|||
{ |
|||
//从MES读取待处理CallMtl
|
|||
var toBeProcessedPillTasks = await _CallMtlManager.GetToBeProcessedListAsync().ConfigureAwait(false); |
|||
if (!toBeProcessedPillTasks.Any()) |
|||
{ |
|||
_logger.LogInformation("no CallMtls"); |
|||
return new List<IncomingFromExternal>(); |
|||
} |
|||
//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<IncomingFromExternal> BuildIncomingFromExternalFromPillTaskAsync(List<CallMtl> toBeProcessedCallMtls, string holdLocationCode) |
|||
{ |
|||
var incomingDataList = new List<IncomingFromExternal>(); |
|||
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; |
|||
} |
|||
|
|||
} |
@ -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<DeliveryConverter> _logger; |
|||
|
|||
public DeliveryConverter( |
|||
IIncomingToWmsManager incomingToWmsManager |
|||
, IObjectMapper objectMapper |
|||
, IItemBasicAppService itemBasicAppService |
|||
, ILogger<DeliveryConverter> logger, |
|||
ICustomerAppService customerAppService, |
|||
IIncomingFromExternalManager incomingFromExternalManager) |
|||
{ |
|||
_incomingToWmsManager = incomingToWmsManager; |
|||
_objectMapper = objectMapper; |
|||
_itemBasicAppService = itemBasicAppService; |
|||
_logger = logger; |
|||
_customerAppService = customerAppService; |
|||
_incomingFromExternalManager = incomingFromExternalManager; |
|||
} |
|||
|
|||
public virtual async Task ConvertAsync(List<IncomingFromExternal> 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<List<IncomingToWms>> BuildIncomingToWmsOfDeliveryRequestAsync(List<IncomingFromExternal> incomingDataList) |
|||
{ |
|||
var incomingToWmsList = new List<IncomingToWms>(); |
|||
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<DeliverRequestExchangeDto>(first.DestinationDataContent); |
|||
var wmsDeliveryRequest = _objectMapper.Map<DeliverRequestExchangeDto, DeliverRequestEditInput>(exchangeDeliveryRequest); |
|||
wmsDeliveryRequest.Details = new List<DeliverRequestDetailInput>(); |
|||
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<DeliverRequestExchangeDto>(incomingFromExternal.DestinationDataContent); |
|||
var wmsDeliveryRequestDetail = _objectMapper.Map<DeliverRequestDetailExchangeDto, DeliverRequestDetailInput>(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; |
|||
} |
|||
|
|||
} |
@ -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<DeliveryReader> _logger; |
|||
|
|||
public DeliveryReader( |
|||
IDeliveryManager pillTaskManager |
|||
, IIncomingFromExternalManager incomingFromExternalManager |
|||
, ILogger<DeliveryReader> logger |
|||
) |
|||
{ |
|||
_DeliveryManager = pillTaskManager; |
|||
_incomingFromExternalManager = incomingFromExternalManager; |
|||
_logger = logger; |
|||
} |
|||
|
|||
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
|||
|
|||
{ |
|||
//从MES读取待处理Delivery
|
|||
var toBeProcessedPillTasks = await _DeliveryManager.GetToBeProcessedListAsync().ConfigureAwait(false); |
|||
if (!toBeProcessedPillTasks.Any()) |
|||
{ |
|||
_logger.LogInformation("no Deliverys"); |
|||
return new List<IncomingFromExternal>(); |
|||
} |
|||
//Delivery逐一转换为MaterialRequest
|
|||
var incomingDataList = BuildIncomingFromExternalFromPillTaskAsync(toBeProcessedPillTasks); |
|||
await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); |
|||
//更新MES数据状态
|
|||
await _DeliveryManager.UpdateProcessedListAsync(toBeProcessedPillTasks).ConfigureAwait(false); |
|||
|
|||
return incomingDataList; |
|||
} |
|||
|
|||
private static List<IncomingFromExternal> BuildIncomingFromExternalFromPillTaskAsync(List<Delivery> toBeProcessedDeliverys) |
|||
{ |
|||
var incomingDataList = new List<IncomingFromExternal>(); |
|||
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; |
|||
} |
|||
|
|||
} |
@ -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<FrozenConverter> _logger; |
|||
|
|||
public FrozenConverter( |
|||
IIncomingToWmsManager incomingToWmsManager |
|||
, IObjectMapper objectMapper |
|||
, IItemBasicAppService itemBasicAppService |
|||
, ILogger<FrozenConverter> logger, |
|||
ILocationAppService locationAppService, |
|||
IIncomingFromExternalManager incomingFromExternalManager) |
|||
{ |
|||
_incomingToWmsManager = incomingToWmsManager; |
|||
_objectMapper = objectMapper; |
|||
_itemBasicAppService = itemBasicAppService; |
|||
_logger = logger; |
|||
_locationAppService = locationAppService; |
|||
_incomingFromExternalManager = incomingFromExternalManager; |
|||
} |
|||
|
|||
public virtual async Task ConvertAsync(List<IncomingFromExternal> 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<List<IncomingToWms>> BuildIncomingToWmsOfMesNoteAsync(List<IncomingFromExternal> incomingDataList) |
|||
{ |
|||
var incomingToWmsList = new List<IncomingToWms>(); |
|||
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<MesNoteExchangeDto>(incomingData.DestinationDataContent); |
|||
var wmsMesNoteDetail = _objectMapper.Map<MesNoteDetailExchangeDto, MesNoteDetailInput>(exchangeMesNote.Detail); |
|||
var wmsMesNote = _objectMapper.Map<MesNoteExchangeDto, MesNoteEditInput>(exchangeMesNote); |
|||
wmsMesNote.Details = new List<MesNoteDetailInput>(); |
|||
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; |
|||
} |
|||
|
|||
} |
@ -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<FrozenReader> _logger; |
|||
private readonly ILocationAppService _locationAppService; |
|||
|
|||
public FrozenReader( |
|||
IFrozenManager pillTaskManager |
|||
, IIncomingFromExternalManager incomingFromExternalManager |
|||
, ILogger<FrozenReader> logger |
|||
, ILocationAppService locationAppService |
|||
) |
|||
{ |
|||
_FrozenManager = pillTaskManager; |
|||
_incomingFromExternalManager = incomingFromExternalManager; |
|||
_logger = logger; |
|||
_locationAppService = locationAppService; |
|||
} |
|||
|
|||
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
|||
|
|||
{ |
|||
//从MES读取待处理Frozen
|
|||
var toBeProcessedPillTasks = await _FrozenManager.GetToBeProcessedListAsync().ConfigureAwait(false); |
|||
if (!toBeProcessedPillTasks.Any()) |
|||
{ |
|||
_logger.LogInformation("no Frozens"); |
|||
return new List<IncomingFromExternal>(); |
|||
} |
|||
//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<IncomingFromExternal> BuildIncomingFromExternalFromPillTaskAsync(List<Frozen> toBeProcessedFrozens,string holdLocationCode) |
|||
{ |
|||
var incomingDataList = new List<IncomingFromExternal>(); |
|||
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; |
|||
} |
|||
|
|||
} |
@ -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<QtyrfeConverter> _logger; |
|||
|
|||
public QtyrfeConverter( |
|||
IIncomingToWmsManager incomingToWmsManager |
|||
, IObjectMapper objectMapper |
|||
, IItemBasicAppService itemBasicAppService |
|||
, ILogger<QtyrfeConverter> logger, |
|||
ILocationAppService locationAppService, |
|||
IIncomingFromExternalManager incomingFromExternalManager) |
|||
{ |
|||
_incomingToWmsManager = incomingToWmsManager; |
|||
_objectMapper = objectMapper; |
|||
_itemBasicAppService = itemBasicAppService; |
|||
_logger = logger; |
|||
_locationAppService = locationAppService; |
|||
_incomingFromExternalManager = incomingFromExternalManager; |
|||
} |
|||
|
|||
public virtual async Task ConvertAsync(List<IncomingFromExternal> 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<List<IncomingToWms>> BuildIncomingToWmsOfTransferNoteAsync(List<IncomingFromExternal> incomingDataList) |
|||
{ |
|||
var incomingToWmsList = new List<IncomingToWms>(); |
|||
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<TransferNoteExchangeDto>(first.DestinationDataContent); |
|||
var wmsTransferNote = _objectMapper.Map<TransferNoteExchangeDto, TransferNoteEditInput>(exchangeTransferNote); |
|||
wmsTransferNote.Type = EnumTransSubType.Transfer_Area.ToString();//客户储位调拨
|
|||
wmsTransferNote.Details = new List<TransferNoteDetailInput>(); |
|||
foreach (var incomingFromExternal in group.ToList()) |
|||
{ |
|||
var transferNote = JsonSerializer.Deserialize<TransferNoteExchangeDto>(incomingFromExternal.DestinationDataContent); |
|||
var wmsTransferNoteDetail = _objectMapper.Map<TransferNoteDetailExchangeDto, TransferNoteDetailInput>(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; |
|||
} |
|||
|
|||
} |
@ -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<QtyrfeReader> _logger; |
|||
|
|||
public QtyrfeReader( |
|||
IQtyrfeManager pillTaskManager |
|||
, IIncomingFromExternalManager incomingFromExternalManager |
|||
, ILogger<QtyrfeReader> logger |
|||
) |
|||
{ |
|||
_QtyrfeManager = pillTaskManager; |
|||
_incomingFromExternalManager = incomingFromExternalManager; |
|||
_logger = logger; |
|||
} |
|||
|
|||
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
|||
|
|||
{ |
|||
//从MES读取待处理Qtyrfe
|
|||
var toBeProcessedPillTasks = await _QtyrfeManager.GetToBeProcessedListAsync().ConfigureAwait(false); |
|||
if (!toBeProcessedPillTasks.Any()) |
|||
{ |
|||
_logger.LogInformation("no Qtyrfes"); |
|||
return new List<IncomingFromExternal>(); |
|||
} |
|||
//Qtyrfe逐一转换为MaterialRequest
|
|||
var incomingDataList = BuildIncomingFromExternalFromPillTaskAsync(toBeProcessedPillTasks); |
|||
await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); |
|||
//更新MES数据状态
|
|||
await _QtyrfeManager.UpdateProcessedListAsync(toBeProcessedPillTasks).ConfigureAwait(false); |
|||
|
|||
return incomingDataList; |
|||
} |
|||
|
|||
private static List<IncomingFromExternal> BuildIncomingFromExternalFromPillTaskAsync(List<Qtyrfe> toBeProcessedQtyrfes) |
|||
{ |
|||
var incomingDataList = new List<IncomingFromExternal>(); |
|||
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; |
|||
} |
|||
|
|||
} |
@ -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<List<OutgoingToExternal>> ConvertAsync() |
|||
{ |
|||
var outgoingToExternalList = new List<OutgoingToExternal>(); |
|||
//获取要同步得数据
|
|||
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<AssembleIssueNoteDTO>(outgoingFromWms.DataContent); |
|||
var exchangeReceipt = _objectMapper.Map<AssembleIssueNoteDTO, AssembleIssueNoteExchangeDto>(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<AssembleIssueNoteDetailDTO, AssembleIssueNoteDetailExchangeDto>(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; |
|||
} |
|||
/// <summary>
|
|||
/// 构建主表
|
|||
/// </summary>
|
|||
/// <param name="exchangeOrder"></param>
|
|||
/// <returns></returns>
|
|||
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; |
|||
} |
|||
/// <summary>
|
|||
/// 构建明细
|
|||
/// </summary>
|
|||
/// <param name="exchangeOrder"></param>
|
|||
/// <param name="exchangeDetailOrder"></param>
|
|||
/// <returns></returns>
|
|||
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; |
|||
} |
|||
} |
@ -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 |
|||
{ |
|||
/// <summary>
|
|||
/// 单据号
|
|||
/// </summary>
|
|||
[Display(Name = "单据号")] |
|||
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string Number { get; set; } |
|||
/// <summary>
|
|||
/// 物品代码
|
|||
/// </summary>
|
|||
[Display(Name = "物品代码")] |
|||
public string ItemCode { get; set; } |
|||
/// <summary>
|
|||
/// 来源库区
|
|||
/// </summary>
|
|||
[Display(Name = "来源库区")] |
|||
public string AreaCode { get; set; } |
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
[Display(Name = "数量")] |
|||
public decimal Qty { get; set; } |
|||
/// <summary>
|
|||
/// Mes发货单号
|
|||
/// </summary>
|
|||
[Display(Name = "Mes发货单号")] |
|||
public string MesDeliveryNo { get; set; } |
|||
/// <summary>
|
|||
/// Mes发货计划号
|
|||
/// </summary>
|
|||
[Display(Name = "Mes发货计划号")] |
|||
public string MesDeliveryPlan { get; set; } |
|||
/// <summary>
|
|||
/// 底盘号
|
|||
/// </summary>
|
|||
[Display(Name = "底盘号")] |
|||
public string IdentityNo { get; set; } |
|||
} |
@ -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 |
|||
{ |
|||
/// <summary>
|
|||
/// 单据号
|
|||
/// </summary>
|
|||
public string Number { get; set; } |
|||
/// <summary>
|
|||
/// 操作员
|
|||
/// </summary>
|
|||
public string Worker { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生效日期
|
|||
/// </summary>
|
|||
public DateTime ActiveDate { get; set; } = DateTime.Now.Date; |
|||
/// <summary>
|
|||
/// 发货时间
|
|||
/// </summary>
|
|||
public DateTime DeliverTime { get; set; } = DateTime.Now.Date; |
|||
/// <summary>
|
|||
/// 发货类型
|
|||
/// </summary>
|
|||
public EnumDeliverRequestType DeliverRequestType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 客户
|
|||
/// </summary>
|
|||
[Display(Name = "客户")] |
|||
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string CustomerCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 明细列表
|
|||
/// </summary>
|
|||
[Display(Name = "明细列表")] |
|||
public DeliverRequestDetailExchangeDto Detail { get; set; } = new(); |
|||
} |
@ -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 |
|||
{ |
|||
/// <summary>
|
|||
/// 目标ERP储位
|
|||
/// </summary>
|
|||
[Display(Name = "目标储位")] |
|||
public string ToLocationCode { get; set; } |
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
[Display(Name = "数量")] |
|||
public decimal Qty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 需求箱数量
|
|||
/// </summary>
|
|||
[Display(Name = "需求箱数量")] |
|||
public decimal BoxQty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 物品代码
|
|||
/// </summary>
|
|||
[Display(Name = "物品代码")] |
|||
public string ItemCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 推荐类型
|
|||
/// </summary>
|
|||
public EnumRecommendType RecommendType { get; set; } |
|||
} |
@ -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 |
|||
{ |
|||
/// <summary>
|
|||
/// 叫料类型
|
|||
/// </summary>
|
|||
[Display(Name = "叫料类型")] |
|||
public EnumIssueRequestType IssueRequestType { get; set; } |
|||
/// <summary>
|
|||
/// 操作员
|
|||
/// </summary>
|
|||
[Display(Name = "操作员")] |
|||
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string Worker { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生效日期
|
|||
/// </summary>
|
|||
[Display(Name = "生效日期")] |
|||
public DateTime ActiveDate { get; set; } = DateTime.Now.Date; |
|||
|
|||
/// <summary>
|
|||
/// 明细
|
|||
/// </summary>
|
|||
[Display(Name = "明细")] |
|||
public InjectionIssueRequestDetailExchangeDto Detail { get; set; } = new(); |
|||
} |
@ -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 |
|||
|
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 目标ERP库位
|
|||
/// </summary>
|
|||
[Display(Name = "目标ERP库位")] |
|||
public string ToLocationErpCode { get; set; } |
|||
|
|||
public string FromPackingCode { get; set; } |
|||
/// <summary>
|
|||
/// 来源ERP库位
|
|||
/// </summary>
|
|||
public string FromLocationErpCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
[Display(Name = "数量")] |
|||
public decimal Qty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 物品代码
|
|||
/// </summary>
|
|||
[Display(Name = "物品代码")] |
|||
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string ItemCode { get; set; } |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Win_in.Sfs.Wms.DataExchange.WMS.PCK; |
|||
|
|||
public class AssembleIssueNoteExchangeDto |
|||
{ |
|||
/// <summary>
|
|||
/// 发料记录号
|
|||
/// </summary>
|
|||
[Display(Name = "发料记录号")] |
|||
public string Number { get; set; } |
|||
/// <summary>
|
|||
/// 生效日期
|
|||
/// </summary>
|
|||
[Display(Name = "生效日期")] |
|||
public DateTime ActiveDate { get; set; } = DateTime.Now.Date; |
|||
|
|||
/// <summary>
|
|||
/// 操作员
|
|||
/// </summary>
|
|||
[Display(Name = "操作员")] |
|||
public string Worker { get; set; } |
|||
/// <summary>
|
|||
/// 明细
|
|||
/// </summary>
|
|||
[Display(Name = "明细")] |
|||
public AssembleIssueNoteDetailExchangeDto Detail { get; set; } = new(); |
|||
} |
@ -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 |
|||
{ |
|||
/// <summary>
|
|||
/// 上架单号
|
|||
/// </summary>
|
|||
[Display(Name = "移库单号")] |
|||
public string Number { get; set; } |
|||
/// <summary>
|
|||
/// 物品代码
|
|||
/// </summary>
|
|||
[Display(Name = "物品代码")] |
|||
public string ItemCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 目标ERP库位
|
|||
/// </summary>
|
|||
[Display(Name = "目标ERP库位")] |
|||
public string ToLocationErpCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 来源ERP库位
|
|||
/// </summary>
|
|||
[Display(Name = "来源ERP库位")] |
|||
public string FromLocationErpCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 目标ERP库位
|
|||
/// </summary>
|
|||
[Display(Name = "来源库位状态")] |
|||
public EnumInventoryStatus FromStatus { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 来源ERP库位
|
|||
/// </summary>
|
|||
[Display(Name = "目标库位状态")] |
|||
public EnumInventoryStatus ToStatus { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
[Display(Name = "数量")] |
|||
public decimal Qty { get; set; } |
|||
} |
@ -0,0 +1,47 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Win_in.Sfs.Wms.DataExchange.WMS.MesNote; |
|||
public class MesNoteExchangeDto |
|||
{ |
|||
/// <summary>
|
|||
/// 上架单号
|
|||
/// </summary>
|
|||
[Display(Name = "移库单号")] |
|||
public string Number { get; set; } |
|||
/// <summary>
|
|||
/// MES请求单号
|
|||
/// </summary>
|
|||
[Display(Name = "MES请求单号")] |
|||
public string MesRequestNumber { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 生效日期
|
|||
/// </summary>
|
|||
[Display(Name = "生效日期")] |
|||
public DateTime ActiveDate { get; set; } = DateTime.Now.Date; |
|||
|
|||
/// <summary>
|
|||
/// 操作员
|
|||
/// </summary>
|
|||
[Display(Name = "操作员")] |
|||
public string Worker { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调拨类型
|
|||
/// </summary>
|
|||
[Display(Name = "调拨类型")] |
|||
public string Type { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 备注
|
|||
/// </summary>
|
|||
[Display(Name = "备注")] |
|||
public string Remark { get; set; } |
|||
/// <summary>
|
|||
/// 明细列表
|
|||
/// </summary>
|
|||
[Display(Name = "明细列表")] |
|||
public MesNoteDetailExchangeDto Detail { get; set; } = new(); |
|||
} |
@ -0,0 +1,33 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
namespace Win_in.Sfs.Wms.Pda.Controllers.BaseDatas; |
|||
|
|||
/// <summary>
|
|||
/// </summary>
|
|||
[ApiController] |
|||
[Route($"{PdaHostConst.ROOT_ROUTE}item-container")] |
|||
public class ItemContainerController : AbpController |
|||
{ |
|||
private readonly IItemContainerAppService _itemContainerAppService; |
|||
|
|||
public ItemContainerController(IItemContainerAppService itemContainerAppService) |
|||
{ |
|||
_itemContainerAppService = itemContainerAppService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 根据名称获取物品
|
|||
/// </summary>
|
|||
/// <param name="itemCode"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("by-item")] |
|||
public virtual async Task<ItemContainerDTO> GetListByItemNameAsync(string itemCode) |
|||
{ |
|||
var dto = await _itemContainerAppService.GetByItemCodeAsync(itemCode).ConfigureAwait(false); |
|||
|
|||
return dto; |
|||
} |
|||
} |
@ -0,0 +1,176 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Win_in.Sfs.Auth.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
namespace Win_in.Sfs.Wms.Pda.Controllers.Jobs.IssueJobs; |
|||
|
|||
/// <summary>
|
|||
/// </summary>
|
|||
[ApiController] |
|||
[Route($"{PdaHostConst.ROOT_ROUTE}job/kitting-issue")] |
|||
public class KittingIssueJobsController : AbpController |
|||
{ |
|||
private readonly IKittingIssueJobAppService _kittingIssueJobAppService; |
|||
|
|||
private readonly IUserWorkGroupAppService _userWorkGroupAppService; |
|||
|
|||
public KittingIssueJobsController(IKittingIssueJobAppService kittingIssueJobAppService, IUserWorkGroupAppService userWorkGroupAppService) |
|||
{ |
|||
_kittingIssueJobAppService = kittingIssueJobAppService; |
|||
_userWorkGroupAppService = userWorkGroupAppService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取列表
|
|||
/// </summary>
|
|||
/// <param name="pageSize"></param>
|
|||
/// <param name="pageIndex"></param>
|
|||
/// <param name="isFinished"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("list")] |
|||
public virtual async Task<PagedResultDto<KittingIssueJobDTO>> GetListAsync(int pageSize, int pageIndex, |
|||
bool isFinished) |
|||
{ |
|||
var status = new List<int>(); |
|||
if (isFinished) |
|||
{ |
|||
status.Add((int)EnumJobStatus.Done); |
|||
} |
|||
else |
|||
{ |
|||
status.Add((int)EnumJobStatus.Open); |
|||
status.Add((int)EnumJobStatus.Wait); |
|||
status.Add((int)EnumJobStatus.Doing); |
|||
status.Add((int)EnumJobStatus.Partial); |
|||
} |
|||
|
|||
var jsonStatus = JsonSerializer.Serialize(status); |
|||
|
|||
var request = new SfsJobRequestInputBase |
|||
{ |
|||
MaxResultCount = pageSize, |
|||
SkipCount = (pageIndex - 1) * pageSize, |
|||
Sorting = $"{nameof(ContainerJobDTO.CreationTime)} ASC", |
|||
Condition = new Condition |
|||
{ |
|||
Filters = new List<Filter> { new(nameof(ContainerJobDTO.JobStatus), jsonStatus, "In") } |
|||
} |
|||
}; |
|||
|
|||
var list = await _kittingIssueJobAppService.GetPagedListByFilterAsync(request, true).ConfigureAwait(false); |
|||
|
|||
return list; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 承接任务
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("take/{id}")] |
|||
public virtual async Task TakeAsync(Guid id) |
|||
{ |
|||
await _kittingIssueJobAppService.AcceptAsync(id).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 取消承接任务
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("cancel-take/{id}")] |
|||
public virtual async Task CancelTakeAsync(Guid id) |
|||
{ |
|||
await _kittingIssueJobAppService.CancelAcceptAsync(id).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行任务明细
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpPost("ExecuteDetail/{masterId}")] |
|||
public async Task ExecuteDetailAsync(Guid masterId, Guid detailId, KittingIssueJobDetailDTO issueJobDetailDto) |
|||
{ |
|||
await _kittingIssueJobAppService.ExecuteDetailAsync(masterId,detailId,issueJobDetailDto).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取任务数量
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpGet("count")] |
|||
public virtual async Task<ActionResult<long>> CountAsync() |
|||
{ |
|||
var status = new List<int> |
|||
{ |
|||
(int)EnumJobStatus.Open, (int)EnumJobStatus.Doing, (int)EnumJobStatus.Partial, (int)EnumJobStatus.Wait |
|||
}; |
|||
var jsonStatus = JsonSerializer.Serialize(status); |
|||
|
|||
var request = new SfsJobRequestInputBase |
|||
{ |
|||
Sorting = $"{nameof(InspectJobDTO.Priority)} ASC", |
|||
Condition = new Condition |
|||
{ |
|||
Filters = new List<Filter> |
|||
{ |
|||
//new(nameof(InspectJobDTO.WorkGroupCode),jsonCodes,"In"),
|
|||
new(nameof(InspectJobDTO.JobStatus), jsonStatus, "In") |
|||
} |
|||
} |
|||
}; |
|||
|
|||
var count = await _kittingIssueJobAppService.GetCountByFilterAsync(request).ConfigureAwait(false); |
|||
|
|||
return Ok(count); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取任务详情
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("{id}")] |
|||
public virtual async Task<ActionResult<KittingIssueJobDTO>> GetAsync(Guid id) |
|||
{ |
|||
var result = await _kittingIssueJobAppService.GetAsync(id).ConfigureAwait(false); |
|||
return Ok(result); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 根据Job Number 获取盘点任务列表
|
|||
/// </summary>
|
|||
/// <param name="jobNumber"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("by-number/{jobNumber}")] |
|||
public virtual async Task<ActionResult<KittingIssueJobDTO>> GetByNumberAsync(string jobNumber) |
|||
{ |
|||
var jobDto = await _kittingIssueJobAppService.GetByNumberAsync(jobNumber).ConfigureAwait(false); |
|||
if (jobDto == null) |
|||
{ |
|||
throw new UserFriendlyException($"未找到编号为 {jobNumber} 的任务"); |
|||
} |
|||
|
|||
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); |
|||
if (!wlgCodes.Contains(jobDto.WorkGroupCode)) |
|||
{ |
|||
return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}"); |
|||
} |
|||
|
|||
if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id) |
|||
{ |
|||
return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理"); |
|||
} |
|||
|
|||
return jobDto; |
|||
} |
|||
} |
@ -0,0 +1,125 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Win_in.Sfs.Auth.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; |
|||
|
|||
/// <summary>
|
|||
/// Kitting叫料请求
|
|||
/// </summary>
|
|||
[ApiController] |
|||
[Route($"{PdaHostConst.ROOT_ROUTE}store/kitting-request")] |
|||
public class KittingRequestController : AbpController |
|||
{ |
|||
private readonly IKittingIssueRequestAppService _kittingIssueRequestAppService; |
|||
|
|||
private readonly IUserWorkGroupAppService _userWorkGroupAppService; |
|||
|
|||
/// <summary>
|
|||
/// </summary>
|
|||
/// <param name="kittingIssueRequestAppService"></param>
|
|||
public KittingRequestController(IKittingIssueRequestAppService kittingIssueRequestAppService, |
|||
IUserWorkGroupAppService userWorkGroupAppService) |
|||
{ |
|||
_kittingIssueRequestAppService = kittingIssueRequestAppService; |
|||
_userWorkGroupAppService = userWorkGroupAppService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Kitting叫料申请
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("")] |
|||
public virtual async Task CreateAsync(KittingIssueRequestEditInput input) |
|||
{ |
|||
await _kittingIssueRequestAppService.CreateAndHandleAsync(input).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// </summary>
|
|||
/// <param name="pageSize"></param>
|
|||
/// <param name="pageIndex"></param>
|
|||
/// <param name="isFinished"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("list")] |
|||
public virtual async Task<PagedResultDto<KittingIssueRequestDTO>> GetListAsync(int pageSize, int pageIndex, |
|||
bool isFinished) |
|||
{ |
|||
var status = new List<int>(); |
|||
if (isFinished) |
|||
{ |
|||
status.Add((int)EnumRequestStatus.Completed); |
|||
} |
|||
else |
|||
{ |
|||
status.Add((int)EnumRequestStatus.Partial); |
|||
status.Add((int)EnumRequestStatus.Handling); |
|||
status.Add((int)EnumRequestStatus.New); |
|||
} |
|||
|
|||
var jsonStatus = JsonSerializer.Serialize(status); |
|||
|
|||
var request = new SfsStoreRequestInputBase |
|||
{ |
|||
MaxResultCount = pageSize, |
|||
SkipCount = (pageIndex - 1) * pageSize, |
|||
Sorting = $"{nameof(ContainerJobDTO.CreationTime)} ASC", |
|||
Condition = new Condition |
|||
{ |
|||
Filters = new List<Filter> { new(nameof(ContainerJobDTO.JobStatus), jsonStatus, "In") } |
|||
} |
|||
}; |
|||
|
|||
var list = await _kittingIssueRequestAppService.GetPagedListByFilterAsync(request, true).ConfigureAwait(false); |
|||
|
|||
return list; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
[HttpPost("handle/{id}")] |
|||
public virtual async Task HandleAsync(Guid id) |
|||
{ |
|||
await _kittingIssueRequestAppService.HandleAsync(id).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 根据Job Number 获取盘点任务列表
|
|||
/// </summary>
|
|||
/// <param name="jobNumber"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("by-number/{requestNumber}")] |
|||
public virtual async Task<ActionResult<KittingIssueRequestDTO>> GetByNumberAsync(string requestNumber) |
|||
{ |
|||
var jobDto = await _kittingIssueRequestAppService.GetByNumberAsync(requestNumber).ConfigureAwait(false); |
|||
if (jobDto == null) |
|||
{ |
|||
throw new UserFriendlyException($"未找到编号为 {requestNumber} 的请求"); |
|||
} |
|||
|
|||
return jobDto; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取任务详情
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("{id}")] |
|||
public virtual async Task<ActionResult<KittingIssueRequestDTO>> GetAsync(Guid id) |
|||
{ |
|||
var result = await _kittingIssueRequestAppService.GetAsync(id).ConfigureAwait(false); |
|||
return Ok(result); |
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace Win_in.Sfs.Basedata.tests; |
|||
[Serializable] |
|||
public class ErpCodeRequest |
|||
{ |
|||
public string ErpCode { set; get; } |
|||
public string ProductType { set; get; } |
|||
|
|||
|
|||
public string ProductColor { set; get; } |
|||
|
|||
public string ProductState { set; get; } |
|||
|
|||
public string ProductProperty { set; get; } |
|||
|
|||
public string From { set; get; } |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue