郑渤旭[Irelia] 2 years ago
parent
commit
610b198a73
  1. 44
      README.md
  2. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Eos/Plans/PlanManager.cs
  3. 9
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/Backflu.cs
  4. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/BackfluManager.cs
  5. 3
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/MesOut/MesOut.cs
  6. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Scraps/IScrapRepository.cs
  7. 11
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Scraps/Scrap.cs
  8. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Scraps/ScrapManager.cs
  9. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp/ProductReceiptNotes/ProductReceiptNote.cs
  10. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Backflus/BackflusDbContextModelCreatingExtensions.cs
  11. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesOut/MesOutDbContextModelCreatingExtensions.cs
  12. 5
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Scrap/ScrapDbContextModelCreatingExtensions.cs
  13. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Scrap/ScrapEfCoreRepository.cs
  14. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Tyrp/ProductReceiptNote/ProductReceiptNoteDbContextModelCreatingExtensions.cs
  15. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs
  16. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/FawtygAutoMapperProfile.cs
  17. 28
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs
  18. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ProductReader.cs
  19. 20
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ShipConverter.cs
  20. 6
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Outgoing/ArriveConverter.cs
  21. 12
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json
  22. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs
  23. 54
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluConverter.cs
  24. 12
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluReader.cs
  25. 28
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs
  26. 30
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs
  27. 12
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapConverter.cs
  28. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapReader.cs
  29. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/MesAgentModule.cs
  30. 14
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json
  31. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/DictConverter.cs
  32. 1
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/SupplierConverter.cs
  33. 31
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs
  34. 6
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductReceiptNoteConverter.cs
  35. 9
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs
  36. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/TyrpAgentModule.cs
  37. 18
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/appsettings.json
  38. 4
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs
  39. 40
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs
  40. 32
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs
  41. 14
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json
  42. 48
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/TokenService.cs
  43. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs
  44. 79
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
  45. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs
  46. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Orders/PurchaseOrders/PurchaseOrderManager.cs
  47. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/MaterialRequestManager.cs
  48. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Bases/StoreDataExchangeEventHandlerBase.cs
  49. 25
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs
  50. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/BackFlushNoteEventHandler.cs
  51. 4
      build/src/docker/publish/conf/nginx/nginx.conf

44
README.md

@ -1,42 +1,23 @@
# 开发和部署方式 # 开发和部署方式
## windows x64 下本地开发 ## 开发环境配置
当前项目基于 .net 6 sdk,安装 visual studio 2022 时通常会自带 ### 软件安装
### supervisor 方式开发 1. visual studio 2022(.net 6 sdk)
1. Docker Desktop(wsl2)
1. 根据项目需求,安装 SQL Server 或 MySQL ### 配置文件
2. 使用 build/src/win-x64/publish/ 目录下的 dev.start.cmd 和 dev.stop.cmd 管理非数据库依赖
配置文件 配置文件存储在build\src\docker\publish\conf 目录下,settings 目录存放程序配置文件,其他目录存放依赖配置文件
1. supervisor: `build\src\win-x64\publish\supervisord\supervisor.dev.conf` ### 依赖管理
1. nginx: `build\src\win-x64\publish\nginx\conf\nginx.conf`
1. gateway: `build\src\win-x64\publish\gateway\appsettings.json`
1. config: `build\src\win-x64\publish\gateway\wwwroot\settings\appsettings.json`
1. config: `build\src\win-x64\publish\gateway\wwwroot\settings\appsettings.Development.json`
```mermaid 使用 build/src/docker/publish/ 目录下的 dev.start.cmd 和 dev.stop.cmd 管理依赖的停止启动,可以在Docker Desktop中查看和管理启动的服务
flowchart LR
nginx --localhost:21093--> gateway--localhost:59092--> api:59092
api:59092 --localhost:6379--> redis:6379
api:59092 --localhost:13319--> database:13319
gateway --localhost:8086--> influxdb:8086
```
### Docker Desktop 方式开发
1. 无需按照数据库
2. 使用 build/src/docker/publish/ 目录下的 dev.start.cmd 和 dev.stop.cmd 管理依赖
## 部署 ## 部署
### windows x64 supervisor 方式部署 Docker 和 Windows 部署两种方式只需要按需修改配置文件中的主机名和端口,windows单机部署时使用localhost作为主机名,docker compose单机部署时使用service name 作为主机名
1. 执行: `build\src\win-x64\build.cmd`
2. 上传: `build\dist\win-x64\publish` 目录到服务器
3. 修改配置,执行 publish 目录下的 start.cmd
### docker compose 方式部署 ### docker compose 方式部署
@ -44,7 +25,8 @@ gateway --localhost:8086--> influxdb:8086
2. 上传: `build\dist\win-x64\publish` 目录到服务器 2. 上传: `build\dist\win-x64\publish` 目录到服务器
3. 修改配置,执行 publish 目录下的 start.sh 或 start.cmd 3. 修改配置,执行 publish 目录下的 start.sh 或 start.cmd
构建时的处理: ### windows x64 方式部署
1. 复制并重命名 build\src\win-x64\publish\nginx\conf 到 build\dist\docker\publish\conf\nginx,保持nginx的配置文件统一在 build\src\win-x64\publish\nginx\conf 目录维护 1. 执行: `build\src\win-x64\build.cmd`
1. 复制 build\src\win-x64\publish\gateway 到 build\dist\docker\publish\gateway,保持网关的配置和应用的配置统一在 build\src\win-x64\publish\gateway 目录维护 2. 上传: `build\dist\win-x64\publish` 目录到服务器
3. 修改配置,执行 publish 目录下的 start.cmd

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Eos/Plans/PlanManager.cs

@ -32,6 +32,8 @@ public class PlanManager : DomainService, IPlanManager
p.WmsState = 1; p.WmsState = 1;
p.WmsDate = Clock.Now; p.WmsDate = Clock.Now;
}); });
await _repository.BulkUpdateAsync(plans).ConfigureAwait(false); //await _repository.BulkUpdateAsync(plans).ConfigureAwait(false);
await _repository.UpdateManyAsync(plans).ConfigureAwait(false);
} }
} }

9
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/Backflu.cs

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes;
public class Backflu : Entity public class Backflu : Entity
{ {
@ -12,11 +12,12 @@ public class Backflu : Entity
/// <summary> /// <summary>
/// 单据类型 /// 单据类型
/// </summary> /// </summary>
public string scmout_type { get; set; } public string scmout_type { get; set; }
/// <summary> /// <summary>
/// TYRP单号 /// TYRP单号
/// </summary> /// </summary>
[Key]
public string scmout_nbr { get; set; } public string scmout_nbr { get; set; }
/// <summary> /// <summary>
/// 料号 /// 料号
@ -50,9 +51,11 @@ public class Backflu : Entity
/// 有效码 /// 有效码
/// </summary> /// </summary>
public string scmout_stat { get; set; } public string scmout_stat { get; set; }
//Bom版本
public string BOMVer { get; set; }
public override object[] GetKeys() public override object[] GetKeys()
{ {
return new object[] { scmout_nbr }; return new object[] { scmout_type + scmout_nbr + scmout_part + scmout_no };
} }
} }

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/BackfluManager.cs

@ -13,7 +13,7 @@ public class BackfluManager : DomainService, IBackfluManager
} }
public async Task<List<Backflu>> GetToBeProcessedListAsync() public async Task<List<Backflu>> GetToBeProcessedListAsync()
{ {
var Backflu = await _repository.GetListAsync().ConfigureAwait(false); var Backflu = await _repository.GetListAsync(p=>p.scmout_stat=="Y").ConfigureAwait(false);
return Backflu.ToList(); return Backflu.ToList();
} }

3
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/MesOut/MesOut.cs

@ -50,6 +50,7 @@ public class MesOut : Entity
/// 返线数量 /// 返线数量
/// </summary> /// </summary>
public decimal Mesout_bad { get; set; } public decimal Mesout_bad { get; set; }
//public string Mes_Barcode { get; set; }
public override object[] GetKeys() public override object[] GetKeys()
{ {
@ -59,5 +60,5 @@ public class MesOut : Entity
/// <summary> /// <summary>
/// 是否读取(0,1) /// 是否读取(0,1)
/// </summary> /// </summary>
public int Yl1 { get; set; } public long Yl1 { get; set; }
} }

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Scraps/IScrapRepository.cs

@ -2,7 +2,7 @@ using Volo.Abp.Domain.Repositories;
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes;
public interface IScrapRepository : IRepository<Scrap, long> public interface IScrapRepository : IRepository<Scrap>
{ {
} }

11
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Scraps/Scrap.cs

@ -1,3 +1,4 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes;
@ -5,8 +6,10 @@ namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes;
/// <summary> /// <summary>
/// 报废补缴(mesout_asd) /// 报废补缴(mesout_asd)
/// </summary> /// </summary>
public class Scrap : Entity<long> public class Scrap : Entity
{ {
[Key]
public decimal mesout_asd_id { get; set; }
/// <summary> /// <summary>
/// ERP接收时间 /// ERP接收时间
/// </summary> /// </summary>
@ -59,6 +62,10 @@ public class Scrap : Entity<long>
/// <summary> /// <summary>
/// 是否读取(0,1) /// 是否读取(0,1)
/// </summary> /// </summary>
public int Yl1 { get; set; } public long Yl1 { get; set; }
public override object[] GetKeys()
{
return new object[] { mesout_asd_id };
}
} }

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Scraps/ScrapManager.cs

@ -23,8 +23,8 @@ public class ScrapManager : DomainService, IScrapManager
public virtual async Task UpdateProcessedListAsync(List<Scrap> entities) public virtual async Task UpdateProcessedListAsync(List<Scrap> entities)
{ {
var ids = entities.Select(p => p.Id); var ids = entities.Select(p => p.mesout_asd_id);
var plans = await _repository.GetListAsync(p => ids.Contains(p.Id)).ConfigureAwait(false); var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_asd_id)).ConfigureAwait(false);
plans.ForEach(p => plans.ForEach(p =>
{ {
p.Yl1 = 1; p.Yl1 = 1;

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp/ProductReceiptNotes/ProductReceiptNote.cs

@ -15,7 +15,7 @@ public class ProductReceiptNote : Entity
/// <summary> /// <summary>
/// 物料 /// 物料
/// </summary> /// </summary>
public string mesout_patr { get; set; } public string mesout_part { get; set; }
/// <summary> /// <summary>
/// 日期 /// 日期
/// </summary> /// </summary>
@ -51,6 +51,6 @@ public class ProductReceiptNote : Entity
public override object[] GetKeys() public override object[] GetKeys()
{ {
return new object[] { mesout_ref_nbr + mesout_patr }; return new object[] { mesout_ref_nbr + mesout_part };
} }
} }

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Backflus/BackflusDbContextModelCreatingExtensions.cs

@ -16,7 +16,7 @@ public static class BackfluDbContextModelCreatingExtensions
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(q => q.scmout_dt_w).HasMaxLength(20); b.Property(q => q.scmout_dt_w).HasMaxLength(20);
b.Property(q => q.scmout_type).HasMaxLength(6); b.Property(q => q.scmout_type).HasMaxLength(6);
b.Property(q => q.scmout_nbr).HasMaxLength(12); b.Property(q => q.scmout_nbr).HasMaxLength(20);
b.Property(q => q.scmout_part).HasMaxLength(20); b.Property(q => q.scmout_part).HasMaxLength(20);
b.Property(q => q.scmout_no).HasMaxLength(10); b.Property(q => q.scmout_no).HasMaxLength(10);
b.Property(q => q.scmout_loc).HasMaxLength(10); b.Property(q => q.scmout_loc).HasMaxLength(10);
@ -25,6 +25,8 @@ public static class BackfluDbContextModelCreatingExtensions
b.Property(q => q.scmout_qty).HasPrecision(10, 2); b.Property(q => q.scmout_qty).HasPrecision(10, 2);
b.Property(q => q.scmout_in_loc).HasMaxLength(10); b.Property(q => q.scmout_in_loc).HasMaxLength(10);
b.Property(q => q.scmout_stat).HasMaxLength(1); b.Property(q => q.scmout_stat).HasMaxLength(1);
b.Property(q => q.BOMVer).HasMaxLength(50);
b.HasKey(x => new { x.scmout_type,x.scmout_nbr,x.scmout_part,x.scmout_no });
}); });
} }

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesOut/MesOutDbContextModelCreatingExtensions.cs

@ -16,7 +16,7 @@ public static class MesOutDbContextModelCreatingExtensions
b.ConfigureByConvention(); b.ConfigureByConvention();
//Properties //Properties
b.Property(q => q.Mesout_ref_nbr).HasMaxLength(20); b.Property(q => q.Mesout_ref_nbr).HasMaxLength(36);
b.Property(q => q.Mesout_id).HasMaxLength(1); b.Property(q => q.Mesout_id).HasMaxLength(1);
b.Property(q => q.Mesout_part).HasMaxLength(20); b.Property(q => q.Mesout_part).HasMaxLength(20);
b.Property(q => q.Mesout_date).HasMaxLength(8); b.Property(q => q.Mesout_date).HasMaxLength(8);
@ -28,7 +28,7 @@ public static class MesOutDbContextModelCreatingExtensions
b.Property(q => q.refno).HasMaxLength(45); b.Property(q => q.refno).HasMaxLength(45);
b.Property(q => q.Mesout_bad).HasPrecision(18, 2); b.Property(q => q.Mesout_bad).HasPrecision(18, 2);
b.Property(q => q.Yl1); b.Property(q => q.Yl1);
//b.Property(q => q.Mes_Barcode).HasMaxLength(50);
}); });
} }

5
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Scrap/ScrapDbContextModelCreatingExtensions.cs

@ -11,12 +11,12 @@ public static class ScrapDbContextModelCreatingExtensions
builder.Entity<Scrap>(b => builder.Entity<Scrap>(b =>
{ {
//Configure table & schema Name //Configure table & schema Name
b.ToTable(options.TablePrefix + "mesout_asdwms", options.Schema); b.ToTable(options.TablePrefix + "mesout_asd", options.Schema);
//Configure ABP properties //Configure ABP properties
b.ConfigureByConvention(); b.ConfigureByConvention();
//Properties //Properties
b.Property(q => q.Id).UseMySqlIdentityColumn().ValueGeneratedOnAdd().HasColumnName("mesout_asd_id"); b.Property(q => q.mesout_asd_id).HasPrecision(20);
b.Property(q => q.mesout_asd_dt_w).HasMaxLength(20); b.Property(q => q.mesout_asd_dt_w).HasMaxLength(20);
b.Property(q => q.mesout_asd_type).HasMaxLength(5); b.Property(q => q.mesout_asd_type).HasMaxLength(5);
b.Property(q => q.Mesout_asd_part).HasMaxLength(20); b.Property(q => q.Mesout_asd_part).HasMaxLength(20);
@ -30,7 +30,6 @@ public static class ScrapDbContextModelCreatingExtensions
b.Property(q => q.mesout_asd_stat).HasMaxLength(1); b.Property(q => q.mesout_asd_stat).HasMaxLength(1);
b.Property(q => q.SCN).HasMaxLength(45); b.Property(q => q.SCN).HasMaxLength(45);
b.Property(q => q.Yl1); b.Property(q => q.Yl1);
}); });
} }

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Scrap/ScrapEfCoreRepository.cs

@ -4,7 +4,7 @@ using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes;
namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes;
public class ScrapEfCoreRepository : EfCoreRepository<MesDbContext, Scrap, long>, IScrapRepository public class ScrapEfCoreRepository : EfCoreRepository<MesDbContext, Scrap>, IScrapRepository
{ {
public ScrapEfCoreRepository(IDbContextProvider<MesDbContext> dbContextProvider) public ScrapEfCoreRepository(IDbContextProvider<MesDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Tyrp/ProductReceiptNote/ProductReceiptNoteDbContextModelCreatingExtensions.cs

@ -19,7 +19,7 @@ public static class ProductReceiptNoteDbContextModelCreatingExtensions
//b.Property(q => q.Id).HasColumnName("Mesout_ref_nbr").HasMaxLength(20); //b.Property(q => q.Id).HasColumnName("Mesout_ref_nbr").HasMaxLength(20);
b.Property(q => q.mesout_ref_nbr).HasMaxLength(20); b.Property(q => q.mesout_ref_nbr).HasMaxLength(20);
b.Property(q => q.mesout_id).HasMaxLength(1); b.Property(q => q.mesout_id).HasMaxLength(1);
b.Property(q => q.mesout_patr).HasMaxLength(20); b.Property(q => q.mesout_part).HasMaxLength(20);
b.Property(q => q.mesout_date).HasMaxLength(8); b.Property(q => q.mesout_date).HasMaxLength(8);
b.Property(q => q.mesout_move).HasPrecision(18, 2); b.Property(q => q.mesout_move).HasPrecision(18, 2);
b.Property(q => q.mesout_unable).HasPrecision(18, 2); b.Property(q => q.mesout_unable).HasPrecision(18, 2);
@ -28,7 +28,7 @@ public static class ProductReceiptNoteDbContextModelCreatingExtensions
b.Property(q => q.memo).HasMaxLength(45); b.Property(q => q.memo).HasMaxLength(45);
b.Property(q => q.refno).HasMaxLength(45); b.Property(q => q.refno).HasMaxLength(45);
b.Property(q => q.mesout_bad).HasPrecision(18, 2); b.Property(q => q.mesout_bad).HasPrecision(18, 2);
b.HasKey(x => new { x.mesout_ref_nbr, x.mesout_patr }); b.HasKey(x => new { x.mesout_ref_nbr, x.mesout_part });
}); });
} }

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs

@ -165,7 +165,7 @@ public class EosAgentModule : AbpModule
ApplicationInitializationContext context) ApplicationInitializationContext context)
{ {
// context.AddBackgroundWorkerAsync<EosIncomingBackgroundWorker>(); context.AddBackgroundWorkerAsync<EosIncomingBackgroundWorker>();
context.AddBackgroundWorkerAsync<EosOutgoingBackgroundWorker>(); context.AddBackgroundWorkerAsync<EosOutgoingBackgroundWorker>();
} }

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/FawtygAutoMapperProfile.cs

@ -60,7 +60,6 @@ public class FawtygAutoMapperProfile : Profile
.Ignore(x => x.Details) .Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties) .Ignore(x => x.ExtraProperties)
.Ignore(x => x.Status) .Ignore(x => x.Status)
.Ignore(x => x.RpNumber) .Ignore(x => x.RpNumber)
.Ignore(x => x.DockCode) .Ignore(x => x.DockCode)
.Ignore(x => x.Remark) .Ignore(x => x.Remark)
@ -69,6 +68,7 @@ public class FawtygAutoMapperProfile : Profile
; ;
CreateMap<SupplierAsnDetailExchangeDto, SupplierAsnDetailInput>() CreateMap<SupplierAsnDetailExchangeDto, SupplierAsnDetailInput>()
.ForMember(x => x.RecommendErpCode, y => y.MapFrom(d => d.LocationErpCode))
.Ignore(x => x.ItemName) .Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1) .Ignore(x => x.ItemDesc1)
.Ignore(x => x.ItemDesc2) .Ignore(x => x.ItemDesc2)

28
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs

@ -43,21 +43,21 @@ public class EosIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
//转换Plan //转换Plan
await planConverter.ConvertAsync(plansFromExternalList).ConfigureAwait(false); await planConverter.ConvertAsync(plansFromExternalList).ConfigureAwait(false);
// Logger.LogInformation($"Read Ship"); Logger.LogInformation($"Read Ship");
// var shipHandleService = workerContext.ServiceProvider.GetRequiredService<ShipReader>(); var shipHandleService = workerContext.ServiceProvider.GetRequiredService<ShipReader>();
// var shipConverter = workerContext.ServiceProvider.GetRequiredService<ShipConverter>(); var shipConverter = workerContext.ServiceProvider.GetRequiredService<ShipConverter>();
// //读取并保持Ship //读取并保持Ship
// var shipsFromExternalList = await shipHandleService.ReadAsync().ConfigureAwait(false); var shipsFromExternalList = await shipHandleService.ReadAsync().ConfigureAwait(false);
// //转换Ship //转换Ship
// await shipConverter.ConvertAsync(shipsFromExternalList).ConfigureAwait(false); await shipConverter.ConvertAsync(shipsFromExternalList).ConfigureAwait(false);
// Logger.LogInformation($"Read Product"); Logger.LogInformation($"Read Product");
// var productHandleService = workerContext.ServiceProvider.GetRequiredService<ProductReader>(); var productHandleService = workerContext.ServiceProvider.GetRequiredService<ProductReader>();
// var productConverter = workerContext.ServiceProvider.GetRequiredService<ProductConverter>(); var productConverter = workerContext.ServiceProvider.GetRequiredService<ProductConverter>();
// //读取并保持Product //读取并保持Product
// var productsFromExternalList = await productHandleService.ReadAsync().ConfigureAwait(false); var productsFromExternalList = await productHandleService.ReadAsync().ConfigureAwait(false);
//// 转换Product // 转换Product
// await productConverter.ConvertAsync(productsFromExternalList).ConfigureAwait(false); await productConverter.ConvertAsync(productsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Completed: Handling {Incoming}"); Logger.LogInformation($"Completed: Handling {Incoming}");
} }

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ProductReader.cs

@ -45,7 +45,7 @@ public class ProductReader : IReader
return new List<IncomingFromExternal>(); return new List<IncomingFromExternal>();
} }
//Product逐一转换为ItemPack //Product逐一转换为ItemPack
var incomingDataList = BuildIncomingFromExternalFromProductAsync(toBeProcessedProducts.Where(r => string.IsNullOrWhiteSpace(r.Code)).ToList()); var incomingDataList = BuildIncomingFromExternalFromProductAsync(toBeProcessedProducts.Where(r => !string.IsNullOrWhiteSpace(r.Code)).ToList());
await _incomingFromExternalManager.CreateBulkAsync(incomingDataList).ConfigureAwait(false); await _incomingFromExternalManager.CreateBulkAsync(incomingDataList).ConfigureAwait(false);
return incomingDataList; return incomingDataList;

20
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ShipConverter.cs

@ -55,13 +55,13 @@ public class ShipConverter : IIncomingConverter
var supplierAsnList = await BuildIncomingToWmsOfSupplierAsnAsync(incomingFromExternalList).ConfigureAwait(false); var supplierAsnList = await BuildIncomingToWmsOfSupplierAsnAsync(incomingFromExternalList).ConfigureAwait(false);
await _incomingToWmsManager.CreateManyAsync(supplierAsnList).ConfigureAwait(false); await _incomingToWmsManager.CreateManyAsync(supplierAsnList).ConfigureAwait(false);
var purchaseLabelList = BuildIncomingToWmsOfPurchaseLabelAsync(incomingFromExternalList); var purchaseLabelList = await BuildIncomingToWmsOfPurchaseLabelAsync(incomingFromExternalList).ConfigureAwait(false);
await _incomingToWmsManager.CreateManyAsync(purchaseLabelList).ConfigureAwait(false); await _incomingToWmsManager.CreateManyAsync(purchaseLabelList).ConfigureAwait(false);
//归档 //归档
await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false); await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false);
} }
private List<IncomingToWms> BuildIncomingToWmsOfPurchaseLabelAsync(List<IncomingFromExternal> incomingFromExternalList) private async Task<List<IncomingToWms>> BuildIncomingToWmsOfPurchaseLabelAsync(List<IncomingFromExternal> incomingFromExternalList)
{ {
var incomingToWmsList = new List<IncomingToWms>(); var incomingToWmsList = new List<IncomingToWms>();
@ -76,7 +76,7 @@ public class ShipConverter : IIncomingConverter
}; };
incomingToWms.SetEffectiveDate(incomingFromExternal.EffectiveDate); incomingToWms.SetEffectiveDate(incomingFromExternal.EffectiveDate);
var exchangeAsn = JsonSerializer.Deserialize<SupplierAsnExchangeDto>(incomingFromExternal.DestinationDataContent); var exchangeAsn = JsonSerializer.Deserialize<SupplierAsnExchangeDto>(incomingFromExternal.DestinationDataContent);
var purchaseLabel = BuildPurchaseLabelCreateDto(exchangeAsn); var purchaseLabel = await BuildPurchaseLabelCreateDto(exchangeAsn).ConfigureAwait(false);
incomingToWms.DataContent = JsonSerializer.Serialize(purchaseLabel); incomingToWms.DataContent = JsonSerializer.Serialize(purchaseLabel);
incomingToWmsList.Add(incomingToWms); incomingToWmsList.Add(incomingToWms);
@ -85,11 +85,23 @@ public class ShipConverter : IIncomingConverter
return incomingToWmsList; return incomingToWmsList;
} }
private InventoryLabelEditInput BuildPurchaseLabelCreateDto(SupplierAsnExchangeDto exchangeAsn) private async Task<InventoryLabelEditInput> BuildPurchaseLabelCreateDto(SupplierAsnExchangeDto exchangeAsn)
{ {
var purchaseLabel = _objectMapper.Map<SupplierAsnDetailExchangeDto, InventoryLabelEditInput>(exchangeAsn.Detail); var purchaseLabel = _objectMapper.Map<SupplierAsnDetailExchangeDto, InventoryLabelEditInput>(exchangeAsn.Detail);
purchaseLabel.AsnNumber = exchangeAsn.Number; purchaseLabel.AsnNumber = exchangeAsn.Number;
purchaseLabel.RpNumber = ""; purchaseLabel.RpNumber = "";
var item = await _itemBasicAppService.GetByCodeAsync(purchaseLabel.ItemCode).ConfigureAwait(false);
if (item != null)
{
purchaseLabel.ItemName = item.Name;
purchaseLabel.ItemDesc1 = item.Desc1;
}
else
{
purchaseLabel.ItemName = "";
purchaseLabel.ItemDesc1 = "";
}
return purchaseLabel; return purchaseLabel;
} }

6
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Outgoing/ArriveConverter.cs

@ -6,7 +6,6 @@ using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS;
using Win_in.Sfs.Wms.DataExchange.Domain.Shared; using Win_in.Sfs.Wms.DataExchange.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseReceipt;
using Win_in.Sfs.Wms.DataExchange.WMS.PutawayNote; using Win_in.Sfs.Wms.DataExchange.WMS.PutawayNote;
using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts;
@ -76,6 +75,11 @@ public class ArriveConverter : IOutgoingConverter
private ArriveNote BuildArrive(PutawayNoteExchangeDto exchangeReceipt) private ArriveNote BuildArrive(PutawayNoteExchangeDto exchangeReceipt)
{ {
var detail = exchangeReceipt.Detail; var detail = exchangeReceipt.Detail;
var nulltime = Convert.ToDateTime("0001/01/01 00:00:00");
if (detail.ShipDate == nulltime)
{
detail.ShipDate = null;
}
var arrive = new ArriveNote() var arrive = new ArriveNote()
{ {
PlanBillNo = detail.PoNumber, PlanBillNo = detail.PoNumber,

12
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json

@ -1,12 +1,12 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=Wms_Dy_ShangHai;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True", "Default": "Server=10.164.113.32,1818\\SHDB;Database=Wms_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True",
"DataExchange": "Server=dev.ccwin-in.com,13319;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True", "DataExchange": "Server=10.164.113.32,1818\\SHDB;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True",
"EOS": "Server=61.139.155.47;Database=EOSSH;Uid=wms;Pwd=1;TrustServerCertificate=True" "EOS": "Server=61.139.155.47;Database=EOSSH;Uid=wms;Pwd=1;TrustServerCertificate=True"
}, },
"AuthServer": { "AuthServer": {
"Authority": "http://dev.ccwin-in.com:60083/", "Authority": "http://10.164.113.31:60083/",
"RequireHttpsMetadata": "false", "RequireHttpsMetadata": "false",
"SwaggerClientId": "admin", "SwaggerClientId": "admin",
"SwaggerClientSecret": "1q2w3E*", "SwaggerClientSecret": "1q2w3E*",
@ -25,13 +25,13 @@
"RemoteServices": { "RemoteServices": {
"BaseData": { "BaseData": {
"BaseUrl": "http://dev.ccwin-in.com:60084/" "BaseUrl": "http://10.164.113.31:60084/"
}, },
"Store": { "Store": {
"BaseUrl": "http://dev.ccwin-in.com:60085/" "BaseUrl": "http://10.164.113.31:60085/"
}, },
"Label": { "Label": {
"BaseUrl": "http://dev.ccwin-in.com:60082/" "BaseUrl": "http://10.164.113.31:60082/"
} }
}, },
"EosOptions": { "EosOptions": {

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs

@ -2,6 +2,7 @@ using AutoMapper;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Win_in.Sfs.Shared.Application; using Win_in.Sfs.Shared.Application;
using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.WMS.BackFlushNote;
using Win_in.Sfs.Wms.DataExchange.WMS.MaterialRequest; using Win_in.Sfs.Wms.DataExchange.WMS.MaterialRequest;
using Win_in.Sfs.Wms.DataExchange.WMS.PCK; using Win_in.Sfs.Wms.DataExchange.WMS.PCK;
using Win_in.Sfs.Wms.DataExchange.WMS.ProductReceiptNote; using Win_in.Sfs.Wms.DataExchange.WMS.ProductReceiptNote;
@ -18,7 +19,8 @@ public class FawtygAutoMapperProfile : Profile
CreateMap<IncomingFromExternal, ArchivedIncomingFromExternal>(); CreateMap<IncomingFromExternal, ArchivedIncomingFromExternal>();
CreateMap<OutgoingFromWms, ArchivedOutgoingFromWms>(); CreateMap<OutgoingFromWms, ArchivedOutgoingFromWms>();
CreateMap<OutgoingToExternal, ArchivedOutgoingToExternal>(); CreateMap<OutgoingToExternal, ArchivedOutgoingToExternal>();
CreateMap<BackFlushNoteExchangeDto, BackFlushNoteEditInput>();
CreateMap<BackFlushNoteDetailExchangeDto, BackFlushNoteDetailInput>();
CreateMap<ProductReceiptNoteExchangeDto, ProductReceiptNoteEditInput>() CreateMap<ProductReceiptNoteExchangeDto, ProductReceiptNoteEditInput>()
.Ignore(x => x.Number) .Ignore(x => x.Number)

54
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluConverter.cs

@ -1,13 +1,17 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Volo.Abp.ObjectMapping; using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.WMS.BackFlushNote; using Win_in.Sfs.Wms.DataExchange.WMS.BackFlushNote;
using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming;
@ -18,13 +22,14 @@ public class BackFluConverter : IIncomingConverter
private readonly IItemBasicAppService _itemBasicAppService; private readonly IItemBasicAppService _itemBasicAppService;
private readonly IObjectMapper _objectMapper; private readonly IObjectMapper _objectMapper;
private readonly ILogger<BackFluConverter> _logger; private readonly ILogger<BackFluConverter> _logger;
private readonly ILocationAppService _locationAppService;
public BackFluConverter( public BackFluConverter(
IIncomingToWmsManager incomingToWmsManager, IIncomingToWmsManager incomingToWmsManager,
IItemBasicAppService itemBasicAppService, IItemBasicAppService itemBasicAppService,
IObjectMapper objectMapper, IObjectMapper objectMapper,
ILogger<BackFluConverter> logger ILogger<BackFluConverter> logger,
, IIncomingFromExternalManager incomingFromExternalManager,
IIncomingFromExternalManager incomingFromExternalManager ILocationAppService locationAppService
) )
{ {
@ -33,6 +38,7 @@ public class BackFluConverter : IIncomingConverter
_objectMapper = objectMapper; _objectMapper = objectMapper;
_logger = logger; _logger = logger;
_incomingFromExternalManager = incomingFromExternalManager; _incomingFromExternalManager = incomingFromExternalManager;
_locationAppService = locationAppService;
} }
public virtual async Task ConvertAsync(List<IncomingFromExternal> incomingFromExternalList) public virtual async Task ConvertAsync(List<IncomingFromExternal> incomingFromExternalList)
{ {
@ -66,12 +72,54 @@ public class BackFluConverter : IIncomingConverter
incomingToWms.SetEffectiveDate(first.EffectiveDate); incomingToWms.SetEffectiveDate(first.EffectiveDate);
var exchangeBack = JsonSerializer.Deserialize<BackFlushNoteExchangeDto>(first.DestinationDataContent); var exchangeBack = JsonSerializer.Deserialize<BackFlushNoteExchangeDto>(first.DestinationDataContent);
var wmsBack = _objectMapper.Map<BackFlushNoteExchangeDto, BackFlushNoteEditInput>(exchangeBack); var wmsBack = _objectMapper.Map<BackFlushNoteExchangeDto, BackFlushNoteEditInput>(exchangeBack);
var item1 = await _itemBasicAppService.GetByCodeAsync(wmsBack.ItemCode).ConfigureAwait(false);
wmsBack.ProductReceiptNumber = DateTime.Now.ToShortDateString().Replace("/","").Trim();
if (item1 != null)
{
wmsBack.ItemName = item1.Name;
wmsBack.Uom = item1.BasicUom;
}
else
{
wmsBack.ItemName = "";
wmsBack.Uom = "";
}
wmsBack.PackingCode = "jiekou";
wmsBack.LocationCode = "jiekou";
wmsBack.LocationArea = "jiekou";
wmsBack.LocationGroup = "jiekou";
wmsBack.LocationErpCode = "jiekou";
wmsBack.ProductionPlanNumber = "jiekou";
wmsBack.Workshop = "jiekou";
wmsBack.ProdLine = "jiekou";
wmsBack.WarehouseCode = "jiekou";
wmsBack.Lot = "jiekou";
wmsBack.Details = new List<BackFlushNoteDetailInput>(); wmsBack.Details = new List<BackFlushNoteDetailInput>();
foreach (var incomingFromExternal in group.ToList()) foreach (var incomingFromExternal in group.ToList())
{ {
var back = JsonSerializer.Deserialize<BackFlushNoteExchangeDto>(incomingFromExternal.DestinationDataContent); var back = JsonSerializer.Deserialize<BackFlushNoteExchangeDto>(incomingFromExternal.DestinationDataContent);
var wmsBackDetail = _objectMapper.Map<BackFlushNoteDetailExchangeDto, BackFlushNoteDetailInput>(back.Detail); var wmsBackDetail = _objectMapper.Map<BackFlushNoteDetailExchangeDto, BackFlushNoteDetailInput>(back.Detail);
wmsBackDetail.Lot = "";
var item = await _itemBasicAppService.GetByCodeAsync(wmsBackDetail.ItemCode).ConfigureAwait(false);
if (item != null)
{
wmsBackDetail.ItemName = item.Name;
wmsBackDetail.Uom = item.BasicUom;
}
else
{
wmsBackDetail.ItemName = "";
wmsBackDetail.Uom = "";
}
var typesAndErpCodeAsync = await _locationAppService.GetListByTypesAndErpCodeAsync(new EditableList<EnumLocationType>() { EnumLocationType.WIP }, wmsBackDetail.LocationErpCode).ConfigureAwait(false);
var loctioncode = typesAndErpCodeAsync.First();
wmsBackDetail.LocationCode = loctioncode.Code;
wmsBackDetail.WarehouseCode = loctioncode.WarehouseCode;
wmsBackDetail.LocationArea = loctioncode.AreaCode;
wmsBackDetail.LocationGroup = loctioncode.LocationGroupCode;
wmsBackDetail.PackingCode = "jiekou";
wmsBack.Details.Add(wmsBackDetail); wmsBack.Details.Add(wmsBackDetail);
} }
incomingToWms.DataContent = JsonSerializer.Serialize(wmsBack); incomingToWms.DataContent = JsonSerializer.Serialize(wmsBack);

12
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluReader.cs

@ -34,8 +34,7 @@ public class BackFluReader : IReader
public virtual async Task<List<IncomingFromExternal>> ReadAsync() public virtual async Task<List<IncomingFromExternal>> ReadAsync()
{ {
//从Tyrp读取待处理bom //从Tyrp读取待处理bom
var BackFull = await _ibackfluManager.GetToBeProcessedListAsync().ConfigureAwait(false); var toBeProcessedBack = await _ibackfluManager.GetToBeProcessedListAsync().ConfigureAwait(false);
var toBeProcessedBack = BackFull.Where(p => p.scmout_stat == "Y").ToList();
if (!toBeProcessedBack.Any()) if (!toBeProcessedBack.Any())
{ {
_logger.LogInformation("no backflus"); _logger.LogInformation("no backflus");
@ -59,7 +58,7 @@ public class BackFluReader : IReader
try try
{ {
var bm = BuildScrapNoteOrderExchangeMes(backflu); var bm = BuildScrapNoteOrderExchangeMes(backflu);
incomingData.DestinationDataContent = JsonSerializer.Serialize(backflu); incomingData.DestinationDataContent = JsonSerializer.Serialize(bm);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -77,14 +76,14 @@ public class BackFluReader : IReader
{ {
DataType = EnumIncomingDataType.BackFlush.ToString(), DataType = EnumIncomingDataType.BackFlush.ToString(),
DataAction = EnumExchangeDataAction.Add, DataAction = EnumExchangeDataAction.Add,
SourceSystem = EnumSystemType.ERP.ToString(), SourceSystem = EnumSystemType.MES.ToString(),
SourceDataId = backflu.scmout_type, SourceDataId = backflu.scmout_type,
SourceDataGroupCode = backflu.scmout_nbr, SourceDataGroupCode = backflu.scmout_nbr,
SourceDataDetailCode = backflu.scmout_part, SourceDataDetailCode = backflu.scmout_part,
SourceDataContent = JsonSerializer.Serialize(backflu), SourceDataContent = JsonSerializer.Serialize(backflu),
WriteTime = DateTime.Now, WriteTime = DateTime.Now,
Writer = nameof(MesIncomingBackgroundWorker), Writer = nameof(MesIncomingBackgroundWorker),
DestinationSystem = EnumSystemType.ERP.ToString(), DestinationSystem = EnumSystemType.MES.ToString(),
}; };
return incomingData; return incomingData;
} }
@ -95,7 +94,8 @@ public class BackFluReader : IReader
var back = new BackFlushNoteExchangeDto() var back = new BackFlushNoteExchangeDto()
{ {
ActiveDate = DateTime.ParseExact(backflu.scmout_dt_w, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture), // ActiveDate = DateTime.ParseExact(backflu.scmout_dt_w, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture),
ActiveDate = Convert.ToDateTime(backflu.scmout_dt_w.Substring(0, 4) + "-" + backflu.scmout_dt_w.Substring(4, 2) + "-" + backflu.scmout_dt_w.Substring(6, 2)),
ItemCode = backflu.scmout_part, ItemCode = backflu.scmout_part,
Number = backflu.scmout_nbr Number = backflu.scmout_nbr
}; };

28
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs

@ -34,13 +34,13 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
Logger.LogInformation($"{Incoming} is not active!"); Logger.LogInformation($"{Incoming} is not active!");
return; return;
} }
//Logger.LogInformation($"Read MesOut");//缴库 Logger.LogInformation($"Read MesOut");//缴库
//var mesOutReader = workerContext.ServiceProvider.GetRequiredService<MesOutReader>(); var mesOutReader = workerContext.ServiceProvider.GetRequiredService<MesOutReader>();
//var mesOutConverter = workerContext.ServiceProvider.GetRequiredService<MesOutConverter>(); var mesOutConverter = workerContext.ServiceProvider.GetRequiredService<MesOutConverter>();
////读取并保存MesOut //读取并保存MesOut
//var mesOutsFromExternalList = await mesOutReader.ReadAsync().ConfigureAwait(false); var mesOutsFromExternalList = await mesOutReader.ReadAsync().ConfigureAwait(false);
////转换MesOut //转换MesOut
//await mesOutConverter.ConvertAsync(mesOutsFromExternalList).ConfigureAwait(false); await mesOutConverter.ConvertAsync(mesOutsFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read PullTask");//拉动任务 //Logger.LogInformation($"Read PullTask");//拉动任务
//var pullTaskReader = workerContext.ServiceProvider.GetRequiredService<PullTaskReader>(); //var pullTaskReader = workerContext.ServiceProvider.GetRequiredService<PullTaskReader>();
@ -66,13 +66,13 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
////转换Pck ////转换Pck
//await pckConverter.ConvertAsync(pcksFromExternalList).ConfigureAwait(false); //await pckConverter.ConvertAsync(pcksFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read BackFlush");//耗用单 Logger.LogInformation($"Read BackFlush");//耗用单
//var BackFlushReader = workerContext.ServiceProvider.GetRequiredService<BackFluReader>(); var BackFlushReader = workerContext.ServiceProvider.GetRequiredService<BackFluReader>();
//var BackFlushConverter = workerContext.ServiceProvider.GetRequiredService<BackFluConverter>(); var BackFlushConverter = workerContext.ServiceProvider.GetRequiredService<BackFluConverter>();
////读取并保存Customer //读取并保存BackFlush
//var backFlushsFromExternalList = await BackFlushReader.ReadAsync().ConfigureAwait(false); var backFlushsFromExternalList = await BackFlushReader.ReadAsync().ConfigureAwait(false);
////转换Customer //转换BackFlush
//await BackFlushConverter.ConvertAsync(backFlushsFromExternalList).ConfigureAwait(false); await BackFlushConverter.ConvertAsync(backFlushsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Completed: Handling {Incoming}"); Logger.LogInformation($"Completed: Handling {Incoming}");
} }

30
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs

@ -75,10 +75,9 @@ public class MesOutConverter : IIncomingConverter
incomingToWms.SetEffectiveDate(first.EffectiveDate); incomingToWms.SetEffectiveDate(first.EffectiveDate);
var exchangeProductReceiptNote = JsonSerializer.Deserialize<ProductReceiptNoteExchangeDto>(first.DestinationDataContent); var exchangeProductReceiptNote = JsonSerializer.Deserialize<ProductReceiptNoteExchangeDto>(first.DestinationDataContent);
var wmsProductReceiptNote = _objectMapper.Map<ProductReceiptNoteExchangeDto, ProductReceiptNoteEditInput>(exchangeProductReceiptNote); var wmsProductReceiptNote = _objectMapper.Map<ProductReceiptNoteExchangeDto, ProductReceiptNoteEditInput>(exchangeProductReceiptNote);
wmsProductReceiptNote.WorkShop = "";//车间 wmsProductReceiptNote.WorkShop = "";//车间
wmsProductReceiptNote.Worker = _configuration["Authentication:username"];//操作人 wmsProductReceiptNote.Worker = _configuration["Authentication:username"];//操作人
wmsProductReceiptNote.ReceiptType = EnumReceiptType.MesScanReceipt;//完工收货方式 wmsProductReceiptNote.ReceiptType = EnumReceiptType.MesScanReceipt;//完工收货方式
wmsProductReceiptNote.WarehouseCode = "";
wmsProductReceiptNote.Details = new List<ProductReceiptNoteDetailInput>(); wmsProductReceiptNote.Details = new List<ProductReceiptNoteDetailInput>();
foreach (var incomingFromExternal in group.ToList()) foreach (var incomingFromExternal in group.ToList())
@ -88,7 +87,7 @@ public class MesOutConverter : IIncomingConverter
wmsProductReceiptNoteDetail.Lot = ""; //排序批次 wmsProductReceiptNoteDetail.Lot = ""; //排序批次
wmsProductReceiptNoteDetail.PackingCode = "";//箱标签 wmsProductReceiptNoteDetail.PackingCode = "";//箱标签
wmsProductReceiptNoteDetail.Status = EnumInventoryStatus.OK; wmsProductReceiptNoteDetail.Status = EnumInventoryStatus.OK;
wmsProductReceiptNoteDetail.WarehouseCode = ""; wmsProductReceiptNoteDetail.WarehouseCode = "T8";
wmsProductReceiptNoteDetail.LocationArea = ""; wmsProductReceiptNoteDetail.LocationArea = "";
wmsProductReceiptNoteDetail.LocationGroup = ""; wmsProductReceiptNoteDetail.LocationGroup = "";
var loc = await _locationAppService.GetListByTypesAndErpCodeAsync(types, wmsProductReceiptNoteDetail.LocationErpCode).ConfigureAwait(false); var loc = await _locationAppService.GetListByTypesAndErpCodeAsync(types, wmsProductReceiptNoteDetail.LocationErpCode).ConfigureAwait(false);
@ -96,27 +95,24 @@ public class MesOutConverter : IIncomingConverter
{ {
wmsProductReceiptNoteDetail.LocationCode = loc[0].Code; wmsProductReceiptNoteDetail.LocationCode = loc[0].Code;
} }
try
{
var item = await _itemBasicAppService.GetByCodeAsync(wmsProductReceiptNoteDetail.ItemCode).ConfigureAwait(false); var item = await _itemBasicAppService.GetByCodeAsync(wmsProductReceiptNoteDetail.ItemCode).ConfigureAwait(false);
if (item != null) if (item != null)
{ {
wmsProductReceiptNoteDetail.ItemName = item.Name; wmsProductReceiptNoteDetail.ItemName = !string.IsNullOrEmpty(item.Name) ? item.Name : "";
wmsProductReceiptNoteDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : ""; wmsProductReceiptNoteDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : "";
wmsProductReceiptNoteDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : ""; wmsProductReceiptNoteDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : "";
wmsProductReceiptNoteDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : ""; wmsProductReceiptNoteDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : "";
} }
} else
catch (Exception) {
{
wmsProductReceiptNoteDetail.ItemName = ""; wmsProductReceiptNoteDetail.ItemName = "";
wmsProductReceiptNoteDetail.ItemDesc1 = ""; wmsProductReceiptNoteDetail.ItemDesc1 = "";
wmsProductReceiptNoteDetail.ItemDesc2 = ""; wmsProductReceiptNoteDetail.ItemDesc2 = "";
wmsProductReceiptNoteDetail.Uom = ""; wmsProductReceiptNoteDetail.Uom = "";
}
} wmsProductReceiptNote.Details.Add(wmsProductReceiptNoteDetail);
wmsProductReceiptNote.Details.Add(wmsProductReceiptNoteDetail);
} }
incomingToWms.DataContent = JsonSerializer.Serialize(wmsProductReceiptNote); incomingToWms.DataContent = JsonSerializer.Serialize(wmsProductReceiptNote);
incomingToWmsList.Add(incomingToWms); incomingToWmsList.Add(incomingToWms);

12
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapConverter.cs

@ -80,8 +80,7 @@ public class ScrapConverter : IIncomingConverter
var scrap = JsonSerializer.Deserialize<ScrapNoteExchangeDto>(incomingFromExternal.DestinationDataContent); var scrap = JsonSerializer.Deserialize<ScrapNoteExchangeDto>(incomingFromExternal.DestinationDataContent);
var wmsScrapDetail = _objectMapper.Map<ScrapNoteDetailExchangeDto, ScrapNoteDetailInput>(scrap.Detail); var wmsScrapDetail = _objectMapper.Map<ScrapNoteDetailExchangeDto, ScrapNoteDetailInput>(scrap.Detail);
wmsScrapDetail.ToPackingCode = ""; wmsScrapDetail.ToPackingCode = "";
wmsScrapDetail.ToLot = ""; wmsScrapDetail.ToLot = "";
//wmsScrapDetail.ToStatus = EnumInventoryStatus.OK;
wmsScrapDetail.FromPackingCode = ""; wmsScrapDetail.FromPackingCode = "";
wmsScrapDetail.FromLot = ""; wmsScrapDetail.FromLot = "";
wmsScrapDetail.FromWarehouseCode = ""; wmsScrapDetail.FromWarehouseCode = "";
@ -92,11 +91,18 @@ public class ScrapConverter : IIncomingConverter
var item = await _itemBasicAppService.GetByCodeAsync(wmsScrapDetail.ItemCode).ConfigureAwait(false); var item = await _itemBasicAppService.GetByCodeAsync(wmsScrapDetail.ItemCode).ConfigureAwait(false);
if (item != null) if (item != null)
{ {
wmsScrapDetail.ItemName = item.Name; wmsScrapDetail.ItemName =!string.IsNullOrEmpty(item.Name) ? item.Name : "";
wmsScrapDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : ""; wmsScrapDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : "";
wmsScrapDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : ""; wmsScrapDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : "";
wmsScrapDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : ""; wmsScrapDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : "";
} }
else
{
wmsScrapDetail.ItemName = "";
wmsScrapDetail.ItemDesc1 = "";
wmsScrapDetail.ItemDesc2 = "";
wmsScrapDetail.Uom ="";
}
wmsScarp.Details.Add(wmsScrapDetail); wmsScarp.Details.Add(wmsScrapDetail);
} }

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapReader.cs

@ -80,8 +80,8 @@ public class ScrapReader : IReader
DataType = EnumIncomingDataType.Scrap.ToString(), DataType = EnumIncomingDataType.Scrap.ToString(),
DataAction = EnumExchangeDataAction.Add, DataAction = EnumExchangeDataAction.Add,
SourceSystem = EnumSystemType.MES.ToString(), SourceSystem = EnumSystemType.MES.ToString(),
SourceDataId = scrap.Id.ToString(), SourceDataId = scrap.mesout_asd_id.ToString(),
SourceDataGroupCode = scrap.Id.ToString(), SourceDataGroupCode = scrap.mesout_asd_id.ToString(),
SourceDataDetailCode = scrap.Mesout_asd_part, SourceDataDetailCode = scrap.Mesout_asd_part,
SourceDataContent = JsonSerializer.Serialize(scrap), SourceDataContent = JsonSerializer.Serialize(scrap),
WriteTime = DateTime.Now, WriteTime = DateTime.Now,

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/MesAgentModule.cs

@ -100,7 +100,7 @@ public class MesAgentModule : AbpModule
Configure<AbpDbContextOptions>(options => Configure<AbpDbContextOptions>(options =>
{ {
options.UseSqlServer(); options.UseSqlServer();
options.UseMySQL<MesDbContext>(); options.UseSqlServer<MesDbContext>();
}); });
} }

14
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json

@ -1,12 +1,12 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=Wms_Dy_ShangHai;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True", "Default": "Server=10.164.113.32,1818\\SHDB;Database=Wms_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True",
"DataExchange": "Server=dev.ccwin-in.com,13319;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True", "DataExchange": "Server=10.164.113.32,1818\\SHDB;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True",
"MES": "Server=10.164.1.12;Port=3306;Database=erp;Uid=wms;Pwd=123456;" "MES": "Server=10.164.113.32,1818\\SHDB;Database=MES_SH;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True"
}, },
"AuthServer": { "AuthServer": {
"Authority": "http://dev.ccwin-in.com:60083/", "Authority": "http://10.164.113.31:60083/",
"RequireHttpsMetadata": "false", "RequireHttpsMetadata": "false",
"SwaggerClientId": "admin", "SwaggerClientId": "admin",
"SwaggerClientSecret": "1q2w3E*", "SwaggerClientSecret": "1q2w3E*",
@ -24,13 +24,13 @@
"RemoteServices": { "RemoteServices": {
"BaseData": { "BaseData": {
"BaseUrl": "http://dev.ccwin-in.com:60084/" "BaseUrl": "http://10.164.113.31:60084/"
}, },
"Store": { "Store": {
"BaseUrl": "http://dev.ccwin-in.com:60085/" "BaseUrl": "http://10.164.113.31:60085/"
}, },
"Label": { "Label": {
"BaseUrl": "http://dev.ccwin-in.com:60082/" "BaseUrl": "http://10.164.113.31:60082/"
} }
}, },

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/DictConverter.cs

@ -8,6 +8,7 @@ using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.WMS.Dict; using Win_in.Sfs.Wms.DataExchange.WMS.Dict;
using static StackExchange.Redis.Role;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming;
@ -68,10 +69,13 @@ public class DictConverter : IIncomingConverter
var exchangeDictRequest = JsonSerializer.Deserialize<DictExchangeDto>(first.DestinationDataContent); var exchangeDictRequest = JsonSerializer.Deserialize<DictExchangeDto>(first.DestinationDataContent);
var wmsDictRequest = _objectMapper.Map<DictExchangeDto, DictEditInput>(exchangeDictRequest); var wmsDictRequest = _objectMapper.Map<DictExchangeDto, DictEditInput>(exchangeDictRequest);
wmsDictRequest.Items = new List<DictItemInput>(); wmsDictRequest.Items = new List<DictItemInput>();
var masterId = _guidGenerator.Create();
foreach (var incomingFromExternal in group.ToList()) foreach (var incomingFromExternal in group.ToList())
{ {
var dictlRequest = JsonSerializer.Deserialize<DictExchangeDto>(incomingFromExternal.DestinationDataContent); var dictlRequest = JsonSerializer.Deserialize<DictExchangeDto>(incomingFromExternal.DestinationDataContent);
var wmsDictItemRequest = _objectMapper.Map<DictItemExchangeDto, DictItemInput>(exchangeDictRequest.Detail); var wmsDictItemRequest = _objectMapper.Map<DictItemExchangeDto, DictItemInput>(exchangeDictRequest.Detail);
wmsDictItemRequest.Id = _guidGenerator.Create();
wmsDictItemRequest.MasterId = masterId;
wmsDictItemRequest.Enabled = true; wmsDictItemRequest.Enabled = true;
wmsDictRequest.Items.Add(wmsDictItemRequest); wmsDictRequest.Items.Add(wmsDictItemRequest);
} }

1
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/SupplierConverter.cs

@ -27,6 +27,7 @@ public class SupplierConverter : IIncomingConverter
) )
{ {
_incomingFromExternalManager = incomingFromExternalManage;
_incomingToWmsManager = incomingToWmsManager; _incomingToWmsManager = incomingToWmsManager;
_objectMapper = objectMapper; _objectMapper = objectMapper;
_logger = logger; _logger = logger;

31
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs

@ -59,13 +59,13 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
common.updatedt = DateTime.Now; common.updatedt = DateTime.Now;
common.isupdate = false; common.isupdate = false;
//Logger.LogInformation($"Read ItemBasic");//零件 Logger.LogInformation($"Read ItemBasic");//零件
//var itemBasicReader = workerContext.ServiceProvider.GetRequiredService<ItemBasicReader>(); var itemBasicReader = workerContext.ServiceProvider.GetRequiredService<ItemBasicReader>();
//var itemBasicConverter = workerContext.ServiceProvider.GetRequiredService<ItemBasicConverter>(); var itemBasicConverter = workerContext.ServiceProvider.GetRequiredService<ItemBasicConverter>();
////读取并保存itemBasic //读取并保存itemBasic
//var itemBasicOutsFromExternalList = await itemBasicReader.ReadAsync().ConfigureAwait(false); var itemBasicOutsFromExternalList = await itemBasicReader.ReadAsync().ConfigureAwait(false);
////转换itemBasic //转换itemBasic
//await itemBasicConverter.ConvertAsync(itemBasicOutsFromExternalList).ConfigureAwait(false); await itemBasicConverter.ConvertAsync(itemBasicOutsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Read User");//用户和部门 Logger.LogInformation($"Read User");//用户和部门
var userReader = workerContext.ServiceProvider.GetRequiredService<UserReader>(); var userReader = workerContext.ServiceProvider.GetRequiredService<UserReader>();
@ -96,13 +96,13 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
//转换Dict //转换Dict
await dictConverter.ConvertAsync(dictOutsFromExternalList).ConfigureAwait(false); await dictConverter.ConvertAsync(dictOutsFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read Bom"); Logger.LogInformation($"Read Bom");
//var BomReader = workerContext.ServiceProvider.GetRequiredService<BomReader>(); var BomReader = workerContext.ServiceProvider.GetRequiredService<BomReader>();
//var BomConverter = workerContext.ServiceProvider.GetRequiredService<BomConverter>(); var BomConverter = workerContext.ServiceProvider.GetRequiredService<BomConverter>();
////读取并保存Bom //读取并保存Bom
//var bomsFromExternalList = await BomReader.ReadAsync().ConfigureAwait(false); var bomsFromExternalList = await BomReader.ReadAsync().ConfigureAwait(false);
////转换Bom //转换Bom
//await BomConverter.ConvertAsync(bomsFromExternalList).ConfigureAwait(false); await BomConverter.ConvertAsync(bomsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Read Supplier");//供应商 Logger.LogInformation($"Read Supplier");//供应商
var SupplierReader = workerContext.ServiceProvider.GetRequiredService<SupplierReader>(); var SupplierReader = workerContext.ServiceProvider.GetRequiredService<SupplierReader>();
@ -117,7 +117,7 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
//读取并保存Dictpj //读取并保存Dictpj
var dictpjOutsFromExternalList = await DictpjReader.ReadAsync().ConfigureAwait(false); var dictpjOutsFromExternalList = await DictpjReader.ReadAsync().ConfigureAwait(false);
//转换Dictpj //转换Dictpj
await dictConverter.ConvertAsync(dictOutsFromExternalList).ConfigureAwait(false); await dictConverter.ConvertAsync(dictpjOutsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Read Customer");//客户资料 Logger.LogInformation($"Read Customer");//客户资料
var CustomerReader = workerContext.ServiceProvider.GetRequiredService<CustomerReader>(); var CustomerReader = workerContext.ServiceProvider.GetRequiredService<CustomerReader>();
@ -132,6 +132,7 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
common.isupdate = true; common.isupdate = true;
} }
} }
//已经挪至MES接口,tyrp暂不启动这个接口20230424(上海东阳改)
//Logger.LogInformation($"Read BackFlush");//耗用单 //Logger.LogInformation($"Read BackFlush");//耗用单
//var BackFlushReader = workerContext.ServiceProvider.GetRequiredService<BackFluReader>(); //var BackFlushReader = workerContext.ServiceProvider.GetRequiredService<BackFluReader>();
//var BackFlushConverter = workerContext.ServiceProvider.GetRequiredService<BackFluConverter>(); //var BackFlushConverter = workerContext.ServiceProvider.GetRequiredService<BackFluConverter>();

6
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductReceiptNoteConverter.cs

@ -75,15 +75,15 @@ public class ProductReceiptNoteConverter : IOutgoingConverter
var ret = new ProductReceiptNote() var ret = new ProductReceiptNote()
{ {
mesout_ref_nbr = exchangeProductReceiptNote.Number, mesout_ref_nbr = exchangeProductReceiptNote.Number,
mesout_id = detail.RawLocationCode, mesout_id = string.IsNullOrEmpty(detail.RawLocationCode)?"": detail.RawLocationCode,
mesout_patr = detail.ItemCode, mesout_part = detail.ItemCode,
mesout_date = exchangeProductReceiptNote.ActiveDate.ToString("yyyyMMdd"), mesout_date = exchangeProductReceiptNote.ActiveDate.ToString("yyyyMMdd"),
mesout_bad = detail.ReturnQty, mesout_bad = detail.ReturnQty,
mesout_move = detail.ReturnQty != 0 ? 0 : detail.Qty, mesout_move = detail.ReturnQty != 0 ? 0 : detail.Qty,
mesout_unable = 0, mesout_unable = 0,
mesout_loc = detail.LocationErpCode, mesout_loc = detail.LocationErpCode,
mesout_dt = exchangeProductReceiptNote.ActiveDate.ToString("yyyyMMdd"), mesout_dt = exchangeProductReceiptNote.ActiveDate.ToString("yyyyMMdd"),
memo = detail.Remark, memo = string.IsNullOrEmpty(detail.Remark)?"": detail.Remark,
refno = "", refno = "",
}; };

9
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs

@ -85,10 +85,11 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
var deliverNoteList = await deliverNoteConvert.ConvertAsync().ConfigureAwait(false); var deliverNoteList = await deliverNoteConvert.ConvertAsync().ConfigureAwait(false);
await wmsoutmWriter.WriteAsync(deliverNoteList).ConfigureAwait(false); await wmsoutmWriter.WriteAsync(deliverNoteList).ConfigureAwait(false);
Logger.LogInformation($"Write CustomerReturnNote");//退货单 //暂无此接口
var customerReturnNoteConvert = workerContext.ServiceProvider.GetRequiredService<CustomerReturnNoteConverter>(); //Logger.LogInformation($"Write CustomerReturnNote");//退货单
var customerReturnNoteList = await customerReturnNoteConvert.ConvertAsync().ConfigureAwait(false); //var customerReturnNoteConvert = workerContext.ServiceProvider.GetRequiredService<CustomerReturnNoteConverter>();
await wmsoutmWriter.WriteAsync(customerReturnNoteList).ConfigureAwait(false); //var customerReturnNoteList = await customerReturnNoteConvert.ConvertAsync().ConfigureAwait(false);
//await wmsoutmWriter.WriteAsync(customerReturnNoteList).ConfigureAwait(false);
Logger.LogInformation($"Write UnplannedIssueNote");//非生产领料单 Logger.LogInformation($"Write UnplannedIssueNote");//非生产领料单
var unplannedIssueNoteConvert = workerContext.ServiceProvider.GetRequiredService<UnplannedIssueNoteConverter>(); var unplannedIssueNoteConvert = workerContext.ServiceProvider.GetRequiredService<UnplannedIssueNoteConverter>();

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/TyrpAgentModule.cs

@ -172,7 +172,7 @@ public class TyrpAgentModule : AbpModule
ApplicationInitializationContext context) ApplicationInitializationContext context)
{ {
// context.AddBackgroundWorkerAsync<TyrpIncomingBackgroundWorker>(); context.AddBackgroundWorkerAsync<TyrpIncomingBackgroundWorker>();
context.AddBackgroundWorkerAsync<TyrpOutgoingBackgroundWorker>(); context.AddBackgroundWorkerAsync<TyrpOutgoingBackgroundWorker>();
} }

18
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/appsettings.json

@ -1,13 +1,13 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=Wms_Dy_ShangHai;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True", "Default": "Server=10.164.113.32,1818\\SHDB;Database=Wms_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True",
"DataExchange": "Server=dev.ccwin-in.com,13319;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True", "DataExchange": "Server=10.164.113.32,1818\\SHDB;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True",
"TYRP": "Server=dev.ccwin-in.com,13319;Database=Wms_TYRP_Dy_ShangHai;Uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True", "TYRP": "Server=10.164.113.32,1818\\SHDB;Database=TYRP;Uid=ShWmsUser;Pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True",
"SYBASE_TYRP": "Data Source=10.164.115.137; Port=5000; Database=mesdb; Uid=mesuser; Pwd=mesuser1234;Charset=cp850;" //iso_1 "SYBASE_TYRP": "Data Source=10.164.115.137; Port=5000; Database=mesdb; Uid=sa; Pwd=dawning;Charset=cp850;" //iso_1
}, },
"AuthServer": { "AuthServer": {
"Authority": "http://dev.ccwin-in.com:60083/", "Authority": "http://10.164.113.31:60083/",
"RequireHttpsMetadata": "false", "RequireHttpsMetadata": "false",
"SwaggerClientId": "admin", "SwaggerClientId": "admin",
"SwaggerClientSecret": "1q2w3E*", "SwaggerClientSecret": "1q2w3E*",
@ -26,16 +26,16 @@
"RemoteServices": { "RemoteServices": {
"BaseData": { "BaseData": {
"BaseUrl": "http://dev.ccwin-in.com:60084/" "BaseUrl": "http://10.164.113.31:60084/"
}, },
"Store": { "Store": {
"BaseUrl": "http://dev.ccwin-in.com:60085/" "BaseUrl": "http://10.164.113.31:60085/"
}, },
"Label": { "Label": {
"BaseUrl": "http://dev.ccwin-in.com:60082/" "BaseUrl": "http://10.164.113.31:60082/"
}, },
"Auth": { "Auth": {
"BaseUrl": "http://dev.ccwin-in.com:60083/" "BaseUrl": "http://10.164.113.31:60083/"
} }
}, },
"TyrpOptions": { "TyrpOptions": {

4
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs

@ -149,7 +149,7 @@ public class AgentModule : AbpModule
public override void OnApplicationInitialization( public override void OnApplicationInitialization(
ApplicationInitializationContext context) ApplicationInitializationContext context)
{ {
// context.AddBackgroundWorkerAsync<IncomingToWmsWorker>(); context.AddBackgroundWorkerAsync<IncomingToWmsWorker>();
context.AddBackgroundWorkerAsync<OutgoingFromWmsWorker>(); //context.AddBackgroundWorkerAsync<OutgoingFromWmsWorker>();
} }
} }

40
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs

@ -155,43 +155,9 @@ public static class IncomingToWmsExtensions
public static async Task HandleBackFlushsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) public static async Task HandleBackFlushsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{ {
var backFlush = JsonSerializer.Deserialize<BackFlushNoteEditInput>(incomingConverted.DataContent); var backFlush = JsonSerializer.Deserialize<BackFlushNoteEditInput>(incomingConverted.DataContent);
var balanceAppService = workerContext.ServiceProvider.GetRequiredService<IBalanceAppService>();
var balanceDtos = await balanceAppService.GetRecommendBalancesAsync(new RecommendBalanceRequestInput()
{
Qty = backFlush.Qty,
ItemCode = backFlush.ItemCode,
LocationAreas = new List<string>() { backFlush.LocationArea },
LocationTypes = new List<EnumLocationType>()
{
EnumLocationType.WIP,
},
Statuses = new List<EnumInventoryStatus>()
{
EnumInventoryStatus.OK,
}
}).ConfigureAwait(false);
foreach (var balanceDto in balanceDtos)
{
backFlush.Details.Add(new BackFlushNoteDetailInput()
{
Qty = balanceDto.Qty,
ItemCode = balanceDto.ItemCode,
ArriveDate = balanceDto.ArriveDate,
BomVersion = string.Empty,
ContainerCode = string.Empty,
ExpireDate = balanceDto.ExpireDate,
Lot = balanceDto.Lot,
LocationCode = balanceDto.LocationCode,
LocationErpCode = balanceDto.LocationErpCode,
LocationArea = balanceDto.LocationArea,
LocationGroup = balanceDto.LocationGroup
});
}
var backFlushAppService = workerContext.ServiceProvider.GetRequiredService<IBackFlushNoteAppService>(); var backFlushAppService = workerContext.ServiceProvider.GetRequiredService<IBackFlushNoteAppService>();
// await backFlushAppService.CreateAsync(backFlush); List<BackFlushNoteEditInput> back = new List<BackFlushNoteEditInput>();
back.Add(backFlush);
await backFlushAppService.CreateManyAsync(back).ConfigureAwait(false);
} }
} }

32
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs

@ -79,49 +79,49 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase
switch (dataType) switch (dataType)
{ {
case EnumIncomingDataType.Department: case EnumIncomingDataType.Department:
//await incomingToWms.HandleDepartmentsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleDepartmentsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.User: case EnumIncomingDataType.User:
//await incomingToWms.HandleUsersAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleUsersAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.Item: case EnumIncomingDataType.Item:
//await incomingToWms.HandleItemsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleItemsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.Location: case EnumIncomingDataType.Location:
await incomingToWms.HandleErpLocationsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleErpLocationsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.Bom: case EnumIncomingDataType.Bom:
//await incomingToWms.HandleBomsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleBomsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.Dict: case EnumIncomingDataType.Dict:
await incomingToWms.HandleDictsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleDictsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.Supplier: case EnumIncomingDataType.Supplier:
//await incomingToWms.HandleSuppliersAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleSuppliersAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.SupplierItem: case EnumIncomingDataType.SupplierItem:
//await incomingToWms.HandleSupplierItemsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleSupplierItemsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.ItemPack: case EnumIncomingDataType.ItemPack:
//await incomingToWms.HandleItemPacksAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleItemPacksAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.Customer: case EnumIncomingDataType.Customer:
//await incomingToWms.HandleCustomersAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleCustomersAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.CustomerItem: case EnumIncomingDataType.CustomerItem:
//await incomingToWms.HandleCustomerItemsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleCustomerItemsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.InterfaceCalendar: case EnumIncomingDataType.InterfaceCalendar:
//await incomingToWms.HandleInterfaceCalendarsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleInterfaceCalendarsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.PurchaseOrder: case EnumIncomingDataType.PurchaseOrder:
//await incomingToWms.HandlePurchaseOrdersAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandlePurchaseOrdersAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.SaleOrder: case EnumIncomingDataType.SaleOrder:
//await incomingToWms.HandleSaleOrdersAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleSaleOrdersAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.SupplierAsn: case EnumIncomingDataType.SupplierAsn:
//await incomingToWms.HandleAsnsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleAsnsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.ProductReceipt: case EnumIncomingDataType.ProductReceipt:
await incomingToWms.HandleProductReceiptsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleProductReceiptsAsync(workerContext).ConfigureAwait(false);
@ -130,13 +130,13 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase
await incomingToWms.HandleMaterialRequestsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleMaterialRequestsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.Scrap: case EnumIncomingDataType.Scrap:
//await incomingToWms.HandleScrapsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleScrapsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.IssueConfirm: case EnumIncomingDataType.IssueConfirm:
//await incomingToWms.HandleIssueNoteConfirmAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleIssueNoteConfirmAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.PurchaseLabel: case EnumIncomingDataType.PurchaseLabel:
//await incomingToWms.HandleInventoryLabelsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleInventoryLabelsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.BackFlush: case EnumIncomingDataType.BackFlush:
await incomingToWms.HandleBackFlushsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleBackFlushsAsync(workerContext).ConfigureAwait(false);

14
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json

@ -1,13 +1,13 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True", "Default": "Server=10.164.113.32,1818\\SHDB;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True",
"DataExchange": "Server=dev.ccwin-in.com,13319;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True" "DataExchange": "Server=10.164.113.32,1818\\SHDB;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True"
}, },
"AuthServer": { "AuthServer": {
"Authority": "http://dev.ccwin-in.com:60083/", "Authority": "http://10.164.113.31:60083/",
"RequireHttpsMetadata": "false", "RequireHttpsMetadata": "false",
"SwaggerClientId": "admin", "SwaggerClientId": "admin",
"SwaggerClientSecret": "1q2w3E*", "SwaggerClientSecret": "1q2w3E*",
@ -26,16 +26,16 @@
"RemoteServices": { "RemoteServices": {
"BaseData": { "BaseData": {
"BaseUrl": "http://dev.ccwin-in.com:60084/" "BaseUrl": "http://10.164.113.31:60084/"
}, },
"Store": { "Store": {
"BaseUrl": "http://dev.ccwin-in.com:60085/" "BaseUrl": "http://10.164.113.31:60085/"
}, },
"Label": { "Label": {
"BaseUrl": "http://dev.ccwin-in.com:60082/" "BaseUrl": "http://10.164.113.31:60082/"
}, },
"Auth": { "Auth": {
"BaseUrl": "http://dev.ccwin-in.com:60083/" "BaseUrl": "http://10.164.113.31:60083/"
} }
}, },
"DataExchangeOptions": { "DataExchangeOptions": {

48
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/TokenService.cs

@ -1,9 +1,10 @@
using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks; using System.Threading.Tasks;
using IdentityModel.Client; using IdentityModel.Client;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -11,35 +12,31 @@ using Volo.Abp.Application.Services;
namespace Win_in.Sfs.Auth.Tokens; namespace Win_in.Sfs.Auth.Tokens;
[Route($"api/token")] [Route($"api")]
[Authorize]
public class TokenService : ApplicationService public class TokenService : ApplicationService
{ {
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IHttpClientFactory _httpClientFactory; private readonly IHttpClientFactory _httpClientFactory;
private readonly ILogger<TokenService> _logger; private readonly ILogger<TokenService> _logger;
private readonly IConfiguration _configuration; private readonly IConfiguration _configuration;
public TokenService(IHttpClientFactory httpClientFactory, IConfiguration configuration, ILogger<TokenService> logger) public TokenService(IHttpContextAccessor httpContextAccessor, IHttpClientFactory httpClientFactory, IConfiguration configuration, ILogger<TokenService> logger)
{ {
this._httpContextAccessor = httpContextAccessor;
this._httpClientFactory = httpClientFactory; this._httpClientFactory = httpClientFactory;
this._configuration = configuration; this._configuration = configuration;
this._logger = logger; this._logger = logger;
} }
[HttpPost] [HttpPost("token")]
[AllowAnonymous] [AllowAnonymous]
public async Task<IActionResult> CreateAsync(LoginModel model) public async Task<IActionResult> CreateAsync(LoginModel model)
{ {
var address = _configuration["AuthServer:Authority"]; var address = _configuration["AuthServer:Authority"];
var request = new DiscoveryDocumentRequest
{
Address = address,
Policy = new DiscoveryPolicy { RequireHttps = false }
};
var discovery = await _httpClientFactory.CreateClient().GetDiscoveryDocumentAsync(request).ConfigureAwait(false);
var clientId = _configuration["AuthServer:ClientId"]; var clientId = _configuration["AuthServer:ClientId"];
var clientSecret = _configuration["AuthServer:ClientSecret"]; var clientSecret = _configuration["AuthServer:ClientSecret"];
this._logger.LogInformation($"address:{address},TokenEndpoint:{discovery.TokenEndpoint},clientId:{clientId},clientSecret:{clientSecret}");
var result = await _httpClientFactory.CreateClient().RequestPasswordTokenAsync(new PasswordTokenRequest var result = await _httpClientFactory.CreateClient().RequestPasswordTokenAsync(new PasswordTokenRequest
{ {
Address = $"{address.TrimEnd('/')}/connect/token", Address = $"{address.TrimEnd('/')}/connect/token",
@ -49,11 +46,6 @@ public class TokenService : ApplicationService
UserName = model.UserName, UserName = model.UserName,
Password = model.Password Password = model.Password
}).ConfigureAwait(false); }).ConfigureAwait(false);
Console.WriteLine($"Result:${(result.IsError ? result.ErrorDescription : result.AccessToken)}");
//if (result.RefreshToken == null)
//{
// throw new UserFriendlyException("用户名或密码错误");
//}
return new JsonResult(new return new JsonResult(new
{ {
@ -72,18 +64,26 @@ public class TokenService : ApplicationService
}); });
} }
[HttpGet("[action]")] [HttpGet("token/application-configuration")]
[AllowAnonymous] public async Task<IActionResult> ApplicationConfiguration()
public string Test()
{ {
return "Test"; var address = _configuration["AuthServer:Authority"];
var url = $"{address.TrimEnd('/')}/api/abp/application-configuration";
var httpClient = _httpClientFactory.CreateClient();
var token = this._httpContextAccessor.HttpContext.Request.Headers.Authorization.ToString();
httpClient.DefaultRequestHeaders.Authorization = AuthenticationHeaderValue.Parse(token);
var response = await httpClient.GetAsync(url).ConfigureAwait(false);
var result = new ContentResult();
result.ContentType = "application/json";
result.Content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
return result;
} }
[HttpGet("/token/test")] [HttpGet("token/test")]
[AllowAnonymous] [AllowAnonymous]
public string Test1() public string Test()
{ {
return "Test"; return "test";
} }
} }

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs

@ -43,5 +43,4 @@ public class BackFlushNoteAppService :
return ObjectMapper.Map<List<BackFlushNote>, List<BackFlushNoteDTO>>(entities); return ObjectMapper.Map<List<BackFlushNote>, List<BackFlushNoteDTO>>(entities);
} }
} }

79
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
@ -53,34 +54,50 @@ public class PurchaseOrderAppService :
protected override async Task<Dictionary<PurchaseOrder, EntityState>> ImportProcessingEntityAsync( protected override async Task<Dictionary<PurchaseOrder, EntityState>> ImportProcessingEntityAsync(
Dictionary<PurchaseOrder, EntityState> dictionary) Dictionary<PurchaseOrder, EntityState> dictionary)
{ {
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); var ImportData = dictionary.Select(p => p.Key);
foreach (var purchaseOrder in addList) var supplierDtos = new List<SupplierDTO>();
#region 校验供应商
var allSupplierCode = ImportData.Select(p => p.SupplierCode).ToList();//所有供应商编号
supplierDtos = await CheckSupplierCodeAsync(allSupplierCode).ConfigureAwait(false);
#endregion
var itemBasicDtos = new List<ItemBasicDTO>();
#region 校验物品
var allTempItemCode = ImportData.Select(p => p.Details.Select(p => p.ItemCode).ToList()).ToList();
var allItemCode = new List<string>();
allTempItemCode.ForEach(p => { allItemCode.AddRange(p); });
itemBasicDtos = await CheckItemCodeAsync(allItemCode).ConfigureAwait(false);
#endregion
foreach (var purchaseOrder in ImportData)
{ {
purchaseOrder.CreatorId = CurrentUser.Id; purchaseOrder.CreatorId = CurrentUser.Id;
purchaseOrder.Worker = CurrentUser.GetName(); purchaseOrder.Worker = CurrentUser.GetName();
var supplierDto = var supplierDto = supplierDtos.First(p => p.Code == purchaseOrder.SupplierCode);
await _supplierAppService.GetByCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false);
purchaseOrder.SupplierCode = supplierDto.Code; purchaseOrder.SupplierCode = supplierDto.Code;
purchaseOrder.SupplierAddress = supplierDto.Address; purchaseOrder.SupplierAddress = supplierDto.Address;
purchaseOrder.SupplierName = supplierDto.Name; purchaseOrder.SupplierName = supplierDto.Name;
foreach (var detail in purchaseOrder.Details) foreach (var detail in purchaseOrder.Details)
{ {
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); var itemBasicDto = itemBasicDtos.First(p => p.Code == detail.ItemCode);
detail.ItemName = itemBasicDto.Name; detail.ItemName = itemBasicDto.Name;
detail.ItemDesc1 = itemBasicDto.Desc1; detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2 = itemBasicDto.Desc2; detail.ItemDesc2 = itemBasicDto.Desc2;
detail.StdPackQty=itemBasicDto.StdPackQty;
} }
} }
return dictionary; return dictionary;
} }
#endregion
/// <summary> /// <summary>
/// 【创建】采购订单 /// 【创建】采购订单
/// </summary> /// </summary>
@ -102,6 +119,48 @@ public class PurchaseOrderAppService :
return ObjectMapper.Map<PurchaseOrder, PurchaseOrderDTO>(entity); return ObjectMapper.Map<PurchaseOrder, PurchaseOrderDTO>(entity);
} }
#region 校验
/// <summary>
/// 校验所有供应商是否存在
/// </summary>
/// <returns></returns>
private async Task<List<SupplierDTO>> CheckSupplierCodeAsync(List<string> supplierCodes)
{
supplierCodes = supplierCodes.Distinct().ToList();
var result = await _supplierAppService.GetByCodesAsync(supplierCodes).ConfigureAwait(false);
foreach (var supplierCode in supplierCodes)
{
if (result.All(p => p.Code != supplierCode))
{
throw new UserFriendlyException($"供应商代码【{supplierCode}】不存在");
}
}
return result;
}
private async Task<List<ItemBasicDTO>> CheckItemCodeAsync(List<string> itemCodes)
{
itemCodes = itemCodes.Distinct().ToList();
var result = await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false);
foreach (var itemCode in itemCodes)
{
if (result.All(p => p.Code != itemCode))
{
throw new UserFriendlyException($"供应商代码【{itemCode}】不存在");
}
}
return result;
}
#endregion
#endregion
/// <summary> /// <summary>
/// 【批量创建】采购订单 /// 【批量创建】采购订单
/// </summary> /// </summary>
@ -237,12 +296,12 @@ public class PurchaseOrderAppService :
[HttpGet("get-list-by-supplier-code-and-item-code")] [HttpGet("get-list-by-supplier-code-and-item-code")]
public virtual async Task<List<PurchaseOrderDTO>> GetListBySupplierCodeAsync(string supplierCode, string itemCode) public virtual async Task<List<PurchaseOrderDTO>> GetListBySupplierCodeAsync(string supplierCode, string itemCode)
{ {
var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode).ConfigureAwait(false); var entitys = await _repository
.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode)
.ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(entitys); var dtos = ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(entitys);
return dtos; return dtos;
} }
} }

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs

@ -79,6 +79,7 @@ public class ItemTransformRequestAppService :
var toItemBasicDto = await ItemBasicAclService.GetByCodeAsync(detail.ToItemCode).ConfigureAwait(false); var toItemBasicDto = await ItemBasicAclService.GetByCodeAsync(detail.ToItemCode).ConfigureAwait(false);
var balanceDto= await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, detail.ItemCode, var balanceDto= await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, detail.ItemCode,
detail.FromLocationCode).ConfigureAwait(false); detail.FromLocationCode).ConfigureAwait(false);
var inventoryLabelDto= await _inventoryLabelAppService.GetByCodeAsync(detail.ToPackingCode).ConfigureAwait(false);
detail.FromLocationArea = fromLocationDto.AreaCode; detail.FromLocationArea = fromLocationDto.AreaCode;
detail.FromLocationErpCode = fromLocationDto.ErpLocationCode; detail.FromLocationErpCode = fromLocationDto.ErpLocationCode;
@ -90,7 +91,7 @@ public class ItemTransformRequestAppService :
detail.FromStatus = balanceDto.Status; detail.FromStatus = balanceDto.Status;
detail.ToSupplierBatch = string.Empty; detail.ToSupplierBatch = string.Empty;
detail.ToLot = balanceDto.Lot; detail.ToLot = inventoryLabelDto.Lot;
detail.ToStatus = balanceDto.Status; detail.ToStatus = balanceDto.Status;
detail.ToLocationArea = toLocationDto.AreaCode; detail.ToLocationArea = toLocationDto.AreaCode;
@ -104,9 +105,9 @@ public class ItemTransformRequestAppService :
detail.Uom = fromItemBasicDto.BasicUom; detail.Uom = fromItemBasicDto.BasicUom;
detail.ToItemCode = toItemBasicDto.Code; detail.ToItemCode = toItemBasicDto.Code;
detail.ToItemDesc1 = toItemBasicDto.Desc2; detail.ToItemDesc1 = toItemBasicDto.Desc1;
detail.ToItemDesc2 = toItemBasicDto.Name; detail.ToItemDesc2 = toItemBasicDto.Desc2;
detail.ItemName = toItemBasicDto.BasicUom; detail.ToItemName = toItemBasicDto.Name;
} }
} }

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Orders/PurchaseOrders/PurchaseOrderManager.cs

@ -54,8 +54,8 @@ public class PurchaseOrderManager : SfsStoreManagerBase<PurchaseOrder, PurchaseO
purchaseOrder.SetIdAndNumberWithDetails(GuidGenerator, purchaseOrder.Number); purchaseOrder.SetIdAndNumberWithDetails(GuidGenerator, purchaseOrder.Number);
//await PublishCreatedAsync(purchaseOrder).ConfigureAwait(false); //await PublishCreatedAsync(purchaseOrder).ConfigureAwait(false);
//不要用base.create 要不会把number覆盖 //不要用base.create 要不会把number覆盖
await PublishCreatedAsync(purchaseOrder).ConfigureAwait(false);
return await Repository.InsertAsync(purchaseOrder).ConfigureAwait(false); return await Repository.InsertAsync(purchaseOrder).ConfigureAwait(false);
} }
/// <summary> /// <summary>

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/MaterialRequestManager.cs

@ -76,14 +76,25 @@ public class MaterialRequestManager
private async Task SetMaterialRequestStatus(MaterialRequest materialRequest) private async Task SetMaterialRequestStatus(MaterialRequest materialRequest)
{ {
if (!materialRequest.Details.All(p => p.Status == EnumStatus.Close)) if (materialRequest.Details.All(p => p.Status == EnumStatus.Close))
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{ {
var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false); var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
if (issueJobs.Count > 0) if (issueJobs.Count > 0)
{ {
if (issueJobs.All(t => t.JobStatus == EnumJobStatus.Done||t.JobStatus==EnumJobStatus.Closed||t.JobStatus==EnumJobStatus.Cancelled)) if (issueJobs.All(t => t.JobStatus == EnumJobStatus.Done || t.JobStatus == EnumJobStatus.Closed || t.JobStatus == EnumJobStatus.Cancelled))
{ {
materialRequest.RequestStatus = EnumRequestStatus.Completed; if (materialRequest.Details.All(p => p.ReceivedQty >= p.Qty))
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
} }
else else
{ {
@ -95,10 +106,6 @@ public class MaterialRequestManager
materialRequest.RequestStatus = EnumRequestStatus.Partial; materialRequest.RequestStatus = EnumRequestStatus.Partial;
} }
} }
else
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
} }
public virtual async Task CompleteAsync(string number) public virtual async Task CompleteAsync(string number)

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Bases/StoreDataExchangeEventHandlerBase.cs

@ -24,8 +24,11 @@ public abstract class StoreDataExchangeEventHandlerBase<T> : StoreEventHandlerBa
protected async Task<DateTime> GetActiveDateAsync() protected async Task<DateTime> GetActiveDateAsync()
{ {
var activeDate = await InterfaceCalendarAppService.GetActiveDateAsync(Clock.Now).ConfigureAwait(false); //todo 报错
return activeDate; //var activeDate = await InterfaceCalendarAppService.GetActiveDateAsync(Clock.Now).ConfigureAwait(false);
//return activeDate;
return DateTime.Now;
} }
protected async Task<List<ExchangeData>> BuildExchangeDataAsync<TEntity>(string sourceSystem, protected async Task<List<ExchangeData>> BuildExchangeDataAsync<TEntity>(string sourceSystem,

25
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs

@ -107,6 +107,10 @@ public class PurchaseOrderEventHandler
//供应商窗口 //供应商窗口
var supplierTimeWindowDtos = await _supplierTimeWindowAppService.GetListBySupplierCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false); var supplierTimeWindowDtos = await _supplierTimeWindowAppService.GetListBySupplierCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false);
if (!supplierTimeWindowDtos.Any())
{
throw new UserFriendlyException($"供应商窗口【{purchaseOrder.SupplierCode}】没设置");
}
//一次性返回所有物品信息 //一次性返回所有物品信息
var itemBasicDtos = await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false); var itemBasicDtos = await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false);
@ -173,13 +177,13 @@ public class PurchaseOrderEventHandler
//todo 一个物品多个包装?怎么取值 //todo 一个物品多个包装?怎么取值
//标包数 //标包数
var itemPackDto=ItemPacks.First(p => p.ItemCode == purchaseOrderDetaildetail.ItemCode); var itemPackDto = itemBasicDtos.First(p=>p.Code== purchaseOrderDetaildetail.ItemCode).StdPackQty;
//总箱数 //总箱数
var itemPackingCount = (int)(itemQty / itemPackDto.Qty); var itemPackingCount = (int)(itemQty / itemPackDto);
if (itemQty > itemPackDto.Qty) if (itemQty > itemPackDto)
{ {
if (itemQty % itemPackDto.Qty != 0) if (itemQty % itemPackDto != 0)
{ {
itemPackingCount++; itemPackingCount++;
} }
@ -214,7 +218,7 @@ public class PurchaseOrderEventHandler
supplierAsnDetailInput.ItemDesc2 = itemBasicDto.Desc2; supplierAsnDetailInput.ItemDesc2 = itemBasicDto.Desc2;
//标包 //标包
supplierAsnDetailInput.StdPackQty = itemPackDto.Qty; supplierAsnDetailInput.StdPackQty = itemPackDto;
supplierAsnDetailInput.SupplierPackQty = supplierItemDto.SupplierPackQty; supplierAsnDetailInput.SupplierPackQty = supplierItemDto.SupplierPackQty;
supplierAsnDetailInput.SupplierPackUom = supplierItemDto.SupplierPackUom; supplierAsnDetailInput.SupplierPackUom = supplierItemDto.SupplierPackUom;
@ -228,11 +232,11 @@ public class PurchaseOrderEventHandler
supplierAsnDetailInput.RecommendErpCode = purchaseOrderDetaildetail.LocationErpCode; supplierAsnDetailInput.RecommendErpCode = purchaseOrderDetaildetail.LocationErpCode;
supplierAsnDetailInput.PoNumber = purchaseOrder.Number; supplierAsnDetailInput.PoNumber = purchaseOrder.Number;
supplierAsnDetailInput.Qty = itemQty>itemPackDto.Qty ? itemPackDto.Qty : itemQty; supplierAsnDetailInput.Qty = itemQty>itemPackDto ? itemPackDto : itemQty;
itemQty-=itemPackDto.Qty; itemQty-=itemPackDto;
var InventoryLabelEditInput = await BuildInventoryLabelEditInputAsync(supplierAsnEditInput, supplierAsnDetailInput, supplierDto, itemBasicDto, supplierItemDto, itemPackDto).ConfigureAwait(false); var InventoryLabelEditInput = await BuildInventoryLabelEditInputAsync(supplierAsnEditInput, supplierAsnDetailInput, supplierDto, itemBasicDto, supplierItemDto).ConfigureAwait(false);
inventoryLabelEditInputs.Add(InventoryLabelEditInput); inventoryLabelEditInputs.Add(InventoryLabelEditInput);
supplierAsnEditInput.Details.Add(supplierAsnDetailInput); supplierAsnEditInput.Details.Add(supplierAsnDetailInput);
@ -260,8 +264,7 @@ public class PurchaseOrderEventHandler
SupplierAsnDetailInput supplierAsnDetail, SupplierAsnDetailInput supplierAsnDetail,
SupplierDTO supplierDto, SupplierDTO supplierDto,
ItemBasicDTO itemBasicDto, ItemBasicDTO itemBasicDto,
SupplierItemDTO supplierItemDto, SupplierItemDTO supplierItemDto)
ItemPackDTO itemPackDto)
{ {
if (itemBasicDto == null) if (itemBasicDto == null)
@ -308,7 +311,7 @@ public class PurchaseOrderEventHandler
inputLabel.LabelStatus = LabelStatus.Enable; inputLabel.LabelStatus = LabelStatus.Enable;
inputLabel.Specifications = itemBasicDto.Color; inputLabel.Specifications = itemBasicDto.Color;
inputLabel.StdPackQty = itemPackDto.Qty; inputLabel.StdPackQty = itemBasicDto.StdPackQty;
inputLabel.SupplierItemCode = supplierItemDto.SupplierItemCode; inputLabel.SupplierItemCode = supplierItemDto.SupplierItemCode;
inputLabel.SupplierItemName = supplierItemDto.ItemName; inputLabel.SupplierItemName = supplierItemDto.ItemName;

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/BackFlushNoteEventHandler.cs

@ -68,6 +68,11 @@ public class BackFlushNoteEventHandler
transaction.DocNumber = backFlushNote.Number; transaction.DocNumber = backFlushNote.Number;
transaction.JobNumber = backFlushNote.JobNumber; transaction.JobNumber = backFlushNote.JobNumber;
transaction.Status = detail.Status; transaction.Status = detail.Status;
transaction.LocationArea = detail.LocationArea;
transaction.LocationGroup=detail.LocationGroup;
transaction.LocationCode=detail.LocationCode;
transaction.LocationErpCode=detail.LocationErpCode;
transaction.WarehouseCode=detail.WarehouseCode;
transactions.Add(transaction); transactions.Add(transaction);
} }

4
build/src/docker/publish/conf/nginx/nginx.conf

@ -59,7 +59,7 @@ http {
index index.html; index index.html;
} }
location ^/api/ { location ~* ^/api/ {
proxy_pass http://proxy; proxy_pass http://proxy;
if ($http_upgrade ~* "close") { if ($http_upgrade ~* "close") {
break; break;
@ -81,7 +81,7 @@ http {
index index.html; index index.html;
} }
location ^/api/ { location ~* ^/api/ {
proxy_pass http://proxy; proxy_pass http://proxy;
if ($http_upgrade ~* "close") { if ($http_upgrade ~* "close") {
break; break;

Loading…
Cancel
Save