113 changed files with 4164 additions and 164 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,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<ProductReceiptNoteDetailDTO, SfsStoreRequestInputBase, ProductReceiptNoteDetailInput> |
||||
|
{ |
||||
|
Task<ProductReceiptNoteDetailDTO> GetItemCodeByMesBarCode(string mesBarCode); |
||||
|
} |
@ -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))); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,413 @@ |
|||||
|
//----------------------
|
||||
|
// <auto-generated>
|
||||
|
// Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
|
||||
|
// </auto-generated>
|
||||
|
//----------------------
|
||||
|
|
||||
|
#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<System.Text.Json.JsonSerializerOptions> _settings = new System.Lazy<System.Text.Json.JsonSerializerOptions>(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); |
||||
|
|
||||
|
/// <returns>Success</returns>
|
||||
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||||
|
public virtual System.Threading.Tasks.Task<ReusltObject> SyncCoatingJobStereoAsync(CoatingIssueJobToRestoDTO body) |
||||
|
{ |
||||
|
return SyncCoatingJobStereoAsync(body, System.Threading.CancellationToken.None); |
||||
|
} |
||||
|
|
||||
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||||
|
/// <returns>Success</returns>
|
||||
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||||
|
public virtual async System.Threading.Tasks.Task<ReusltObject> 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<string, System.Collections.Generic.IEnumerable<string>>(); |
||||
|
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<ReusltObject>(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<RemoteServiceErrorResponse>(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<RemoteServiceErrorResponse>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); |
||||
|
} |
||||
|
else |
||||
|
if (status_ == 401) |
||||
|
{ |
||||
|
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(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<RemoteServiceErrorResponse>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); |
||||
|
} |
||||
|
else |
||||
|
if (status_ == 400) |
||||
|
{ |
||||
|
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(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<RemoteServiceErrorResponse>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); |
||||
|
} |
||||
|
else |
||||
|
if (status_ == 404) |
||||
|
{ |
||||
|
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(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<RemoteServiceErrorResponse>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); |
||||
|
} |
||||
|
else |
||||
|
if (status_ == 501) |
||||
|
{ |
||||
|
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(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<RemoteServiceErrorResponse>("Server Error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); |
||||
|
} |
||||
|
else |
||||
|
if (status_ == 500) |
||||
|
{ |
||||
|
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(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<RemoteServiceErrorResponse>("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<T> |
||||
|
{ |
||||
|
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<ObjectResponseResult<T>> ReadObjectResponseAsync<T>(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> headers, System.Threading.CancellationToken cancellationToken) |
||||
|
{ |
||||
|
if (response == null || response.Content == null) |
||||
|
{ |
||||
|
return new ObjectResponseResult<T>(default(T), string.Empty); |
||||
|
} |
||||
|
|
||||
|
if (ReadResponseAsString) |
||||
|
{ |
||||
|
var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); |
||||
|
try |
||||
|
{ |
||||
|
var typedBody = System.Text.Json.JsonSerializer.Deserialize<T>(responseText, JsonSerializerSettings); |
||||
|
return new ObjectResponseResult<T>(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<T>(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); |
||||
|
return new ObjectResponseResult<T>(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<string, object> Data { get; set; } |
||||
|
|
||||
|
[System.Text.Json.Serialization.JsonPropertyName("validationErrors")] |
||||
|
public System.Collections.Generic.ICollection<RemoteServiceValidationErrorInfo> 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<string> 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<string, System.Collections.Generic.IEnumerable<string>> Headers { get; private set; } |
||||
|
|
||||
|
public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> 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<TResult> : ApiException |
||||
|
{ |
||||
|
public TResult Result { get; private set; } |
||||
|
|
||||
|
public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> 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
|
@ -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<ProductReceiptNoteDetail, ProductReceiptNoteDetailDTO, SfsStoreRequestInputBase, ProductReceiptNoteDetailInput, ProductReceiptNoteImportInput>, IProductReceiptNoteDetailAppService |
||||
|
{ |
||||
|
private readonly IProductReceiptNoteDetailRepository _productReceiptNoteDetailRepository; |
||||
|
public ProductReceiptNoteDetailAppService( |
||||
|
IProductReceiptNoteDetailRepository repository |
||||
|
) : base(repository) |
||||
|
{ |
||||
|
_productReceiptNoteDetailRepository = repository; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
[HttpGet("get-itemcode-by-mesbarcode")] |
||||
|
public virtual async Task<ProductReceiptNoteDetailDTO> GetItemCodeByMesBarCode(string mesBarCode) |
||||
|
{ |
||||
|
var entity = await _productReceiptNoteDetailRepository.FirstOrDefaultAsync(r => r.MesBarCode == mesBarCode).ConfigureAwait(false); |
||||
|
var dto = ObjectMapper.Map<ProductReceiptNoteDetail, ProductReceiptNoteDetailDTO>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,4 @@ |
|||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
public interface IProductReceiptNoteDetailRepository : ISfsStoreRepositoryBase<ProductReceiptNoteDetail> |
||||
|
{ |
||||
|
} |
@ -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; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue