Browse Source

[fix]EDI去除箱的LT,LS

全部ASN全部发给WMS
master
贾荣国 2 years ago
parent
commit
b78edd51bf
  1. 20
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AsnBackgroundWorker/AsnBackgroundWorker.cs
  2. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/Win_in.Sfs.Scp.WebApi.Agent.csproj
  3. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/appsettings.json
  4. 14
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/Item.cs
  5. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/AsnOptions.cs

20
WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AsnBackgroundWorker/AsnBackgroundWorker.cs

@ -30,7 +30,7 @@ namespace Win_in.Sfs.Scp.WebApi
{ {
public class AsnBackgroundWorker : AsyncPeriodicBackgroundWorkerBase public class AsnBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
{ {
private readonly IOptions<AsnOptions> _options; private readonly AsnOptions _options;
private readonly IObjectMapper _objectMapper; private readonly IObjectMapper _objectMapper;
public AsnBackgroundWorker( public AsnBackgroundWorker(
@ -40,7 +40,7 @@ namespace Win_in.Sfs.Scp.WebApi
IObjectMapper objectMapper IObjectMapper objectMapper
) : base(timer, serviceScopeFactory) ) : base(timer, serviceScopeFactory)
{ {
_options = options; _options = options.Value;
_objectMapper = objectMapper; _objectMapper = objectMapper;
Timer.Period = options.Value.PeriodSeconds * 1000; //default 5 minutes Timer.Period = options.Value.PeriodSeconds * 1000; //default 5 minutes
} }
@ -49,7 +49,7 @@ namespace Win_in.Sfs.Scp.WebApi
protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
{ {
Logger.LogInformation("Get ASN from SCP: Start"); Logger.LogInformation("Get ASN from SCP: Start");
if (!_options.Value.Active) if (!_options.Active)
{ {
Logger.LogInformation("Get ASN from SCP: Switch is closed!"); Logger.LogInformation("Get ASN from SCP: Switch is closed!");
return; return;
@ -64,7 +64,7 @@ namespace Win_in.Sfs.Scp.WebApi
var dataFilter = workerContext.ServiceProvider.GetRequiredService<IDataFilter>(); var dataFilter = workerContext.ServiceProvider.GetRequiredService<IDataFilter>();
//Do the work //Do the work
foreach (var site in _options.Value.Sites) foreach (var site in _options.Sites)
{ {
var asnX12List = new List<X12Asn>(); var asnX12List = new List<X12Asn>();
// var noPoAsnList = new List<AsnMstr>(); // var noPoAsnList = new List<AsnMstr>();
@ -93,7 +93,7 @@ namespace Win_in.Sfs.Scp.WebApi
Logger.LogInformation($"{siteCode}: Last UID is {lastUid}"); Logger.LogInformation($"{siteCode}: Last UID is {lastUid}");
var scpAsns = var scpAsns =
await scpAsnManager.GetUnreadAsnsAsync(siteCode, lastUid, _options.Value.BatchSize); await scpAsnManager.GetUnreadAsnsAsync(siteCode, lastUid, _options.BatchSize);
Logger.LogInformation($"{siteCode}: {scpAsns.Count} ASNs were Found"); Logger.LogInformation($"{siteCode}: {scpAsns.Count} ASNs were Found");
@ -101,16 +101,14 @@ namespace Win_in.Sfs.Scp.WebApi
{ {
var barcodes = await scpAsnManager.GetBarcodesAsync(siteCode, asn.AsnBillNum); var barcodes = await scpAsnManager.GetBarcodesAsync(siteCode, asn.AsnBillNum);
if (string.IsNullOrEmpty(asn.PoBillNum)) //without PO if (asn.AsnBillNum.StartsWith(_options.QadAsnPrefix))//ASN to QAD
{
var noPoAsn = CreateNoPoAsn(asn, barcodes);
asnX12List.Add(noPoAsn);
}
else //with PO
{ {
var asnX12 = CreateX12Asn(site, asn, barcodes); var asnX12 = CreateX12Asn(site, asn, barcodes);
asnX12List.Add(asnX12); asnX12List.Add(asnX12);
} }
var noPoAsn = CreateNoPoAsn(asn, barcodes);
asnX12List.Add(noPoAsn);
Logger.LogInformation($"{siteCode}:{asn.Id} {asn.AsnBillNum} was loaded"); Logger.LogInformation($"{siteCode}:{asn.Id} {asn.AsnBillNum} was loaded");
} }
} }

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/Win_in.Sfs.Scp.WebApi.Agent.csproj

@ -3,8 +3,8 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<AssemblyVersion>1.22.0810.1</AssemblyVersion> <AssemblyVersion>1.22.0820.1</AssemblyVersion>
<FileVersion>1.22.0810.1</FileVersion> <FileVersion>1.22.0820.1</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/appsettings.json

@ -52,6 +52,8 @@
"RetryTimes": 3, "RetryTimes": 3,
"BatchSize": 20, "BatchSize": 20,
"MaxCount": 100, "MaxCount": 100,
"QadAsnPrefix": "B",
"NoPoAsnPrefix": "T",
"Sites": [ "Sites": [
{ {
"Code": "T8", "Code": "T8",

14
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/Item.cs

@ -50,11 +50,15 @@ public class Item
sb.AppendLine(SN1.ToString()); sb.AppendLine(SN1.ToString());
sb.AppendLine(PRF.ToString()); sb.AppendLine(PRF.ToString());
sb.AppendLine(CLD.ToString()); sb.AppendLine(CLD.ToString());
foreach (var ref_LS_LT in REF_LS_LTs)
{ // 北美提出不要标签号和批次信息 @20220820
sb.AppendLine(ref_LS_LT.REF_LS.ToString()); // foreach (var ref_LS_LT in REF_LS_LTs)
sb.AppendLine(ref_LS_LT.REF_LT.ToString()); // {
} // sb.AppendLine(ref_LS_LT.REF_LS.ToString());
// sb.AppendLine(ref_LS_LT.REF_LT.ToString());
// }
// 北美提出不要标签号和批次信息 @20220820
return sb.ToString().Trim(); return sb.ToString().Trim();
} }
} }

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/AsnOptions.cs

@ -10,6 +10,9 @@ public class AsnOptions
public int BatchSize { get; set; } = 10; public int BatchSize { get; set; } = 10;
public int MaxCount { get; set; } = 100; public int MaxCount { get; set; } = 100;
public string ValidPoPre { get; set; } = "PO"; public string ValidPoPre { get; set; } = "PO";
public string QadAsnPrefix { get; set; } = "B";
public string NoPoAsnPrefix { get; set; } = "T";
public List<Site> Sites { get; set; } =new() ; public List<Site> Sites { get; set; } =new() ;
public class Site public class Site

Loading…
Cancel
Save