Browse Source

[fix]增加批次信息

master
贾荣国 3 years ago
parent
commit
ab87ae2ea5
  1. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/AsnFactory.cs
  2. 23
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/Item.cs
  3. 26
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/ItemExtentions.cs
  4. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/ShipmentExtensions.cs
  5. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Tares/TareExtensions.cs
  6. 11
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnFactory.cs
  7. 31
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Program.cs
  8. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj
  9. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.Development.json
  10. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.Production.Development.json
  11. 38
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.Production.json
  12. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.Production.secrets.json
  13. 46
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.json
  14. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.secrets.json
  15. 2
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TS_BARCODE.cs

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/AsnFactory.cs

@ -176,7 +176,7 @@ namespace Win_in.Sfs.Scp.WebApi.Console
} }
private Item CreateItem(string itemCode, decimal qty, string uom, int accumQty, private Item CreateItem(string itemCode, decimal qty, string uom, int accumQty,
string poNumber, int loadQty, decimal unitQty, List<string> itemLabelCodes) string poNumber, int loadQty, decimal unitQty, Dictionary<string,string> itemLabelCodes)
{ {
var item = new Item(); var item = new Item();
@ -185,7 +185,7 @@ namespace Win_in.Sfs.Scp.WebApi.Console
.SetSN1(qty, uom, accumQty) .SetSN1(qty, uom, accumQty)
.SetPRF(poNumber) .SetPRF(poNumber)
.SetCLD(loadQty, unitQty) .SetCLD(loadQty, unitQty)
.SetREF_LSs(itemLabelCodes); .SetREF_LS_LTs(itemLabelCodes);
return item; return item;
} }

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

@ -40,7 +40,7 @@ public class Item
/// REFERENCE IDENTIFICATION /// REFERENCE IDENTIFICATION
/// 箱标签列表 /// 箱标签列表
/// </summary> /// </summary>
public List<REF> REF_LSs { get; set; } public List<REF_LS_LT> REF_LS_LTs { get; set; }
public override string ToString() public override string ToString()
{ {
@ -50,10 +50,27 @@ 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 refLS in REF_LSs) foreach (var ref_LS_LT in REF_LS_LTs)
{ {
sb.AppendLine(refLS.ToString()); sb.AppendLine(ref_LS_LT.REF_LS.ToString());
sb.AppendLine(ref_LS_LT.REF_LT.ToString());
} }
return sb.ToString().Trim(); return sb.ToString().Trim();
} }
} }
public class REF_LS_LT
{
public REF_LS_LT()
{
}
public REF_LS_LT(BarcodeAndBatch itemLabelCode)
{
REF_LS = new REF(REF.RefType.LS, itemLabelCode.Barcode);
REF_LT = new REF(REF.RefType.LT, itemLabelCode.Batch);
}
public REF REF_LS { get; }
public REF REF_LT { get; }
}

26
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/ItemExtentions.cs

@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
namespace Win_in.Sfs.Scp.WebApi.Asns; namespace Win_in.Sfs.Scp.WebApi.Asns;
@ -35,13 +36,30 @@ public static class ItemExtentions
return item; return item;
} }
public static Item SetREF_LSs(this Item item, List<string> itemLabelCodes) public static Item SetREF_LS_LTs(this Item item, List<BarcodeAndBatch> itemLabelCodes)
{ {
item.REF_LSs = new List<REF>(); item.REF_LS_LTs = new List<REF_LS_LT>();
foreach (var refLs in itemLabelCodes.Select(labelCode => new REF(REF.RefType.LS, labelCode)))
foreach (var ref_LS_LT in itemLabelCodes.Select(itemLabelCode => new REF_LS_LT(itemLabelCode)))
{ {
item.REF_LSs.Add(refLs); item.REF_LS_LTs.Add(ref_LS_LT);
} }
return item; return item;
} }
} }
public class BarcodeAndBatch
{
public BarcodeAndBatch()
{
}
public BarcodeAndBatch(string barcode, string batch)
{
Barcode = barcode;
Batch = batch;
}
public string Barcode { get; set; }
public string Batch { get; set; }
}

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/ShipmentExtensions.cs

@ -77,7 +77,7 @@ public static class ShipmentExtensions
orphanItem.HL.HL01 = shipNotice.GetNextHl(orphanItem.SN1.Qty); orphanItem.HL.HL01 = shipNotice.GetNextHl(orphanItem.SN1.Qty);
orphanItem.HL.HL02 = shipment.HL.HL01; orphanItem.HL.HL02 = shipment.HL.HL01;
shipment.OrphanItems.Add(orphanItem); shipment.OrphanItems.Add(orphanItem);
shipNotice.AddSegment(5+orphanItem.REF_LSs.Count); shipNotice.AddSegment(5+orphanItem.REF_LS_LTs.Count);
return shipment; return shipment;
} }

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Tares/TareExtensions.cs

@ -23,7 +23,7 @@ public static class TareExtensions
item.HL.HL01 = shipNotice.GetNextHl(item.SN1.Qty); item.HL.HL01 = shipNotice.GetNextHl(item.SN1.Qty);
item.HL.HL02 = tare.HL.HL01; item.HL.HL02 = tare.HL.HL01;
tare.Items.Add(item); tare.Items.Add(item);
shipNotice.AddSegment(5+item.REF_LSs.Count); shipNotice.AddSegment(5+item.REF_LS_LTs.Count);
return tare; return tare;
} }

11
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnFactory.cs

@ -76,16 +76,17 @@ namespace Win_in.Sfs.Scp.WebApi
p.Key.PoUnit, p.Key.PoUnit,
p.Key.PoBillNum, p.Key.PoBillNum,
p.Key.PackQty, p.Key.PackQty,
Labels = p.Select(p=>p.BarCode).ToList() BarcodeAndBatchs = p.Select(p =>new BarcodeAndBatch ( p.BarCode, p.Batch)).ToList(),
}) })
.ToList(); .ToList();
foreach (var b in group) foreach (var b in group)
{ {
var accumQty = 0;//TODO 如何计算 var accumQty = 0;//TODO 如何计算
var loadQty = b.Labels.Count; var loadQty = b.BarcodeAndBatchs.Count;
var unitQty = b.PackQty; var unitQty = b.PackQty;
var item = CreateItem(b.PartCode, loadQty * unitQty, b.PoUnit, accumQty, b.PoBillNum, loadQty, unitQty,b.Labels); var item = CreateItem(b.PartCode, loadQty * unitQty, b.PoUnit, accumQty,
b.PoBillNum, loadQty, unitQty, b.BarcodeAndBatchs);
items.Add(item); items.Add(item);
} }
@ -190,7 +191,7 @@ namespace Win_in.Sfs.Scp.WebApi
} }
private Item CreateItem(string itemCode, decimal qty, string uom, int accumQty, private Item CreateItem(string itemCode, decimal qty, string uom, int accumQty,
string poNumber, int loadQty, decimal unitQty, List<string> itemLabelCodes) string poNumber, int loadQty, decimal unitQty, List<BarcodeAndBatch> itemLabelCodes)
{ {
var item = new Item(); var item = new Item();
@ -199,7 +200,7 @@ namespace Win_in.Sfs.Scp.WebApi
.SetSN1(qty, uom, accumQty) .SetSN1(qty, uom, accumQty)
.SetPRF(poNumber) .SetPRF(poNumber)
.SetCLD(loadQty, unitQty) .SetCLD(loadQty, unitQty)
.SetREF_LSs(itemLabelCodes); .SetREF_LS_LTs(itemLabelCodes);
return item; return item;
} }

31
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Program.cs

@ -4,26 +4,35 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Serilog; using Serilog;
using Serilog.Events; using Serilog.Events;
using Serilog.Sinks.MSSqlServer;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
{ {
public class Program public class Program
{ {
public static int Main(string[] args) public static int Main(string[] args)
{ {
IConfigurationRoot configuration =
new ConfigurationBuilder()
.AddJsonFile("serilogsettings.json", false, true)
.Build();
Log.Logger = new LoggerConfiguration() Log.Logger = new LoggerConfiguration()
#if DEBUG .ReadFrom.Configuration(configuration)
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt",rollingInterval:RollingInterval.Day))
.WriteTo.Async(c => c.Console())
.CreateLogger(); .CreateLogger();
// Log.Logger = new LoggerConfiguration()
// #if DEBUG
// .MinimumLevel.Debug()
// #else
// .MinimumLevel.Information()
// #endif
// .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
// .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
// .Enrich.FromLogContext()
// .WriteTo.Async(c => c.File("Logs/logs.txt",rollingInterval:RollingInterval.Day))
// .WriteTo.Async(c => c.Console())
// .CreateLogger();
try try
{ {
Log.Information("Starting Win_in.Sfs.Scp.WebApi.HttpApi.Host."); Log.Information("Starting Win_in.Sfs.Scp.WebApi.HttpApi.Host.");

1
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj

@ -14,6 +14,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" /> <PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" /> <PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.7.0" />
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="4.4.2" /> <PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="4.4.2" />
<PackageReference Include="Volo.Abp.Autofac" Version="4.4.2" /> <PackageReference Include="Volo.Abp.Autofac" Version="4.4.2" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="4.4.2" /> <PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="4.4.2" />

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.Development.json

@ -0,0 +1,2 @@
{
}

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.Production.Development.json

@ -0,0 +1,2 @@
{
}

38
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.Production.json

@ -0,0 +1,38 @@
{
"App": {
"SelfUrl": "https://scp.iacchina.net:9988",
"CorsOrigins": "https://scp.iacchina.net:9977,https://scp.iacchina.net:9988,https://localhost:9977,https://localhost:9988",
"RedirectAllowedUrls": "https://scp.iacchina.net:9977,https://scp.iacchina.net:9988"
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1,13314;Database=Scp_WebApi;User ID=superadmin;Password=Microsoft@2021;connection timeout=600;",
"WebApi": "Server=127.0.0.1,13314;Database=Scp_WebApi;User ID=superadmin;Password=Microsoft@2021;connection timeout=600;",
"V1Scp": "Server=127.0.0.1£º13314;Database=Scp_AC;User ID=sa;Password=Microsoft2008;connection timeout=600;"
},
"AuthServer": {
"Authority": "https://scp.iacchina.net:9988",
"RequireHttpsMetadata": "false",
"SwaggerClientId": "WebApi_Swagger",
"SwaggerClientSecret": "1q2w3e*"
},
"IdentityServer": {
"Clients": {
"WebApi_Web": {
"ClientId": "WebApi_Web",
"ClientSecret": "1q2w3e*",
"RootUrl": "https://scp.iacchina.net:9988"
},
"WebApi_App": {
"ClientId": "WebApi_App",
"ClientSecret": "1q2w3e*",
"RootUrl": "https://scp.iacchina.net:9988"
},
"WebApi_Swagger": {
"ClientId": "WebApi_Swagger",
"ClientSecret": "1q2w3e*",
"RootUrl": "https://scp.iacchina.net:9988"
}
}
},
"AlwaysAllowAuthorization": false
}

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.Production.secrets.json

@ -0,0 +1,2 @@
{
}

46
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.json

@ -0,0 +1,46 @@
{
"Serilog": {
"Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Async", "Serilog.Sinks.Console", "Serilog.Sinks.MSSqlServer" ],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Information",
"Microsoft.EntityFrameworkCore": "Warning"
}
},
"WriteTo": [
{
"Name": "Async",
"Args": {
"configure": [
{
"Name": "File",
"Args": {
"path": "Logs\\log.txt",
"rollingInterval": "Day",
"restrictedToMinimumLevel": "Debug"
}
}
]
}
},
{
"Name": "Console",
"Args": {
"restrictedToMinimumLevel": "Debug",
"outputTemplate": "{Timestamp:HH:mm:ss.fff zzz} [{Level}] {Message} {NewLine}{Exception}"
}
},
{
"Name": "MSSqlServer",
"Args": {
"connectionString": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;",
"tableName": "AppLogs",
"autoCreateSqlTable": true
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId" ]
}
}

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/serilogsettings.secrets.json

@ -0,0 +1,2 @@
{
}

2
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TS_BARCODE.cs

@ -89,4 +89,6 @@ namespace Win_in.Sfs.Scp.v1.Domain.Asns
public Guid? TenantId { get; } public Guid? TenantId { get; }
} }
} }
Loading…
Cancel
Save