安虹睿 10 months ago
parent
commit
0facf74942
  1. 5
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/EdiReceive/Interfaces/IImportRecordAppService.cs
  2. 16
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/AssemblyCfgErpDto.cs
  3. 15
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/ExportErpAssemblyDto.cs
  4. 39
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/ImportErpAssemblyGroupDto.cs
  5. 11
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/QueryAssemblyCfgErpDto.cs
  6. 26
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/BaseConfig/Dto/BaseConfigCreateDto.cs
  7. 4
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/BaseConfig/Dto/BaseConfigDto.cs
  8. 27
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/BaseConfig/Dto/QueryBaseConfigDto.cs
  9. 14
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/BaseConfig/Interfaces/IBaseGonfigService.cs
  10. 49
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/MaterialExt/Dto/MaterialExtDto.cs
  11. 30
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/MaterialExt/Dto/QueryMaterialExtDto.cs
  12. 11
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/MaterialExt/Interfaces/IMaterialExtAppService.cs
  13. 4
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.csproj
  14. 140
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml
  15. 66
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs
  16. 175
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs
  17. 173
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/BaseConfig/BaseGonfigService.cs
  18. 11
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/MaterialExt/IMaterialExtAppService.cs
  19. 161
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/MaterialExt/MaterialExtAppService.cs
  20. 5
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/NewJitApplicationAutoMapperProfile.cs
  21. 11
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs
  22. 95
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml
  23. 2
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain.Shared/Common/ServerHelper.cs
  24. 4
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Entitys/LastImportHostSN.cs
  25. 460
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
  26. 239
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_CacheManagerDomainService.cs
  27. 209
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs
  28. 102
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/LastImportHostSNDomainService.cs
  29. 10
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Entitys/AssemblyCfgErp.cs
  30. 11
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Entitys/AssemblyCfgGroup.cs
  31. 17
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Entitys/BaseConfig.cs
  32. 52
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Entitys/Group_Assembly_Part.cs
  33. 23
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Services/BaseGonfigDomainService.cs
  34. 16
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillM100.cs
  35. 3
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs
  36. 5
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/CacheManagerDomainService.cs
  37. 345
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs
  38. 42
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/R100CheckDomainService.cs
  39. 1
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/WY.NewJit.Domain.csproj
  40. 6126
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240110033428_NewJitPG_HQ_0110.Designer.cs
  41. 41
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240110033428_NewJitPG_HQ_0110.cs
  42. 6132
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115023640_NewJitPG_HQ_Init.Designer.cs
  43. 33
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115023640_NewJitPG_HQ_Init.cs
  44. 6134
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115024450_NewJitPG_HQ_Init2.Designer.cs
  45. 53
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115024450_NewJitPG_HQ_Init2.cs
  46. 6142
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115055730_NewJitPG_HQ_Init3.Designer.cs
  47. 35
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115055730_NewJitPG_HQ_Init3.cs
  48. 57
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/NewJitMigrationsDbContextModelSnapshot.cs
  49. 8
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore/EntityFrameworkCore/NewJitDbContextModelCreatingExtensions.cs

5
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/EdiReceive/Interfaces/IImportRecordAppService.cs

@ -60,9 +60,10 @@ namespace WY.NewJit.EdiReceive.Interfaces
/// <summary>
/// 导入信息
/// </summary>
/// <param name="input">导入文件流</param>
/// <param name="files">导入文件流</param>
/// <param name="forceExecute">是否强制执行</param>
/// <returns>执行成功返回真</returns>
Task<ObjectResultDto> ImportAsync([FromForm] IFormFileCollection files);
Task<ObjectResultDto> ImportAsync([FromForm] IFormFileCollection files, bool forceExecute = false);
#endregion
}

16
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/AssemblyCfgErpDto.cs

@ -46,6 +46,22 @@ namespace WY.NewJit.MsgBaseData
[ImporterHeader(Name = "长描述")]
public virtual string GroupCode { get; set; }
/// <summary>
/// 规格说明
/// </summary>
[ExporterHeader(DisplayName = "规格说明")]
[ImporterHeader(Name = "规格说明")]
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明
/// </summary>
[ExporterHeader(DisplayName = "颜色说明")]
[ImporterHeader(Name = "颜色说明")]
public virtual string ColorExplain { get; set; }
/// <summary>
/// 车型
/// </summary>

15
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/ExportErpAssemblyDto.cs

@ -39,6 +39,21 @@ namespace WY.NewJit.MsgBaseData
[ImporterHeader(Name = "ERP总成名称")]
public string ErpAssemblyName { get; set; }
/// <summary>
/// 规格说明
/// </summary>
[ExporterHeader(DisplayName = "规格说明")]
[ImporterHeader(Name = "规格说明")]
public string SpecExplain { get; set; }
/// <summary>
/// 颜色说明
/// </summary>
[ExporterHeader(DisplayName = "颜色说明")]
[ImporterHeader(Name = "颜色说明")]
public string ColorExplain { get; set; }
/// <summary>
/// 客户零件代码
/// </summary>

39
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/ImportErpAssemblyGroupDto.cs

@ -0,0 +1,39 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace WY.NewJit.MsgBaseData
{
/// <summary>
/// 总成组
/// </summary>
[ExcelExporter(Name = "总成组表", AutoFitAllColumn = true, MaxRowNumberOnASheet = 50000)] //一个Sheet最大允许的行数,设置了之后将输出多个Sheet
[Serializable]
public class ImportErpAssemblyGroupDto
{
/// <summary>
/// 规格说明
/// </summary>
[ExporterHeader(DisplayName = "规格说明")]
[ImporterHeader(Name = "规格说明")]
[Required(ErrorMessage = "{0}是必填项")]
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明
/// </summary>
[ExporterHeader(DisplayName = "颜色说明")]
[ImporterHeader(Name = "颜色说明")]
[Required(ErrorMessage = "{0}是必填项")]
public virtual string ColorExplain { get; set; }
/// <summary>
/// 物料号
/// </summary>
[ExporterHeader(DisplayName = "物料号")]
[ImporterHeader(Name = "物料号")]
[Required(ErrorMessage = "{0}是必填项")]
public virtual string MaterialNum { get; set; }
}
}

11
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/QueryAssemblyCfgErpDto.cs

@ -18,12 +18,21 @@ namespace WY.NewJit.MsgBaseData
/// 总成名称
/// </summary>
public string ErpAssemblyName { get; set; }
/// <summary>
/// 车型代码
/// </summary>
public string VehicleModelCode { get; set; }
/// <summary>
/// 规格说明
/// </summary>
public string SpecExplain { get; set; }
/// <summary>
/// 颜色说明
/// </summary>
public string ColorExplain { get; set; }
public DateTime? BeginCreateTime { get; set; }
public DateTime? EndCreateTime { get; set; }

26
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/BaseConfig/Dto/BaseConfigCreateDto.cs

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WY.NewJit.MsgBaseData
{
public class BaseConfigCreateDto
{
/// <summary>
/// 参数名称
/// </summary>
public virtual string ParamName { get; set; }
/// <summary>
/// 参数值
/// </summary>
public virtual string ParamValue { get; set; }
/// <summary>
/// 状态
/// </summary>
public virtual bool State { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string Remark { get; set; }
}
}

4
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/BaseConfig/Dto/BaseConfigDto.cs

@ -22,10 +22,10 @@ namespace WY.NewJit.MsgBaseData
/// <summary>
/// 状态
/// </summary>
public virtual int State { get; set; }
public virtual bool State { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual int Remark { get; set; }
public virtual string Remark { get; set; }
}
}

27
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/BaseConfig/Dto/QueryBaseConfigDto.cs

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
using WY.NewJit.Common;
namespace WY.NewJit.MsgBaseData
{
public class QueryBaseConfigDto : PagedAndSortedBase
{
/// <summary>
/// 参数名称
/// </summary>
public virtual string ParamName { get; set; }
/// <summary>
/// 参数值
/// </summary>
public virtual string ParamValue { get; set; }
/// <summary>
/// 状态
/// </summary>
public virtual List<bool> State { get; set; } = new List<bool>();
/// <summary>
/// 备注
/// </summary>
public virtual string Remark { get; set; }
}
}

14
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/BaseConfig/Interfaces/IBaseGonfigService.cs

@ -0,0 +1,14 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace WY.NewJit.MsgBaseData
{
public interface IBaseGonfigService
{
Task<ObjectResultDto<Guid>> CreateAsync(BaseConfigCreateDto input);
Task<ObjectResultDto> DeleteAsync(string id);
Task<PagedResultDto<BaseConfigDto>> GetListAsync(QueryBaseConfigDto input);
Task<ObjectResultDto> UpdateAsync(Guid id, BaseConfigCreateDto input);
}
}

49
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/MaterialExt/Dto/MaterialExtDto.cs

@ -0,0 +1,49 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Application.Dtos;
namespace WY.NewJit.MsgBaseData
{
[ExcelExporter(Name = "物料信息", AutoFitAllColumn = true, MaxRowNumberOnASheet = 1000)] //一个Sheet最大允许的行数,设置了之后将输出多个Sheet
[Serializable]
public class MaterialExtDto : AuditedEntityDto<Guid>
{
/// <summary>
/// SAP物料号
/// </summary>
[ExporterHeader(DisplayName = "SAP物料号")]
[ImporterHeader(Name = "SAP物料号")]
public string MaterialNum { get; set; }
/// <summary>
/// 物料描述(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
/// </summary>
[ExporterHeader(DisplayName = "物料描述")]
[ImporterHeader(Name = "物料描述")]
public string MaterialDescription { get; set; }
/// <summary>
/// 大小量纲(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
/// </summary>
[ExporterHeader(DisplayName = "大小量纲")]
[ImporterHeader(Name = "大小量纲")]
public string MaterialDescription2 { get; set; }
/// <summary>
/// 补充备注(车型、门板代码)
/// </summary>
[ExporterHeader(DisplayName = "补充备注")]
[ImporterHeader(Name = "补充备注")]
public string MaterialMemo { get; set; }
/// <summary>
/// 物料组:例如 门板成品-C8
/// </summary>
[ExporterHeader(DisplayName = "物料组")]
[ImporterHeader(Name = "物料组")]
public string MaterialGroup { get; set; }
}
}

30
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/MaterialExt/Dto/QueryMaterialExtDto.cs

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Text;
using WY.NewJit.Common;
namespace WY.NewJit.MsgBaseData
{
[Serializable]
public class QueryMaterialExtDto : PagedAndSortedBase
{
/// <summary>
/// SAP物料号
/// </summary>
public string MaterialNum { get; set; }
/// <summary>
/// 物料描述(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
/// </summary>
public string MaterialDescription { get; set; }
/// <summary>
/// 物料组:例如 门板成品-C8
/// </summary>
public string MaterialGroup { get; set; }
/// <summary>
/// 物料类型 0 空 1 控制件 2 柱护板 3 门板
/// </summary>
public string MaterialType { get; set; }
}
}

11
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/MaterialExt/Interfaces/IMaterialExtAppService.cs

@ -0,0 +1,11 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace WY.NewJit.MsgBaseData
{
public interface IMaterialExtAppService
{
Task<ObjectResultDto<string>> ExportAsync(QueryMaterialExtDto input);
Task<PagedResultDto<MaterialExtDto>> GetListAsync(QueryMaterialExtDto input);
}
}

4
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.csproj

@ -32,8 +32,4 @@
<PackageReference Include="Volo.Abp.SettingManagement.Application.Contracts" Version="4.3.3" />
</ItemGroup>
<ItemGroup>
<Folder Include="MsgBaseData\BaseConfig\Interfaces\" />
</ItemGroup>
</Project>

140
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml

@ -556,11 +556,12 @@
<param name="input">导出查询条件</param>
<returns>执行成功返回真</returns>
</member>
<member name="M:WY.NewJit.EdiReceive.Interfaces.IImportRecordAppService.ImportAsync(Microsoft.AspNetCore.Http.IFormFileCollection)">
<member name="M:WY.NewJit.EdiReceive.Interfaces.IImportRecordAppService.ImportAsync(Microsoft.AspNetCore.Http.IFormFileCollection,System.Boolean)">
<summary>
导入信息
</summary>
<param name="input">导入文件流</param>
<param name="files">导入文件流</param>
<param name="forceExecute">是否强制执行</param>
<returns>执行成功返回真</returns>
</member>
<member name="T:WY.NewJit.Extends.MenBanPackingListDto">
@ -1252,6 +1253,16 @@
长描述
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.AssemblyCfgErpDto.SpecExplain">
<summary>
规格说明
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.AssemblyCfgErpDto.ColorExplain">
<summary>
颜色说明
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.AssemblyCfgErpDto.VehicleModel">
<summary>
车型
@ -1377,6 +1388,16 @@
ERP总成名称
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.ExportErpAssemblyDto.SpecExplain">
<summary>
规格说明
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.ExportErpAssemblyDto.ColorExplain">
<summary>
颜色说明
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.ExportErpAssemblyDto.PartCode">
<summary>
客户零件代码
@ -1402,6 +1423,26 @@
创建时间
</summary>
</member>
<member name="T:WY.NewJit.MsgBaseData.ImportErpAssemblyGroupDto">
<summary>
总成组
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.ImportErpAssemblyGroupDto.SpecExplain">
<summary>
规格说明
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.ImportErpAssemblyGroupDto.ColorExplain">
<summary>
颜色说明
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.ImportErpAssemblyGroupDto.MaterialNum">
<summary>
物料号
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryAssemblyCfgErpDto.ErpAssemblyCode">
<summary>
ERP总成编码
@ -1417,6 +1458,16 @@
车型代码
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryAssemblyCfgErpDto.SpecExplain">
<summary>
规格说明
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryAssemblyCfgErpDto.ColorExplain">
<summary>
颜色说明
</summary>
</member>
<member name="M:WY.NewJit.MsgBaseData.IAssemblyCfgErpAppService.GetErpAssemblyListAsync(WY.NewJit.MsgBaseData.QueryAssemblyCfgErpDto)">
<summary>
根据筛选条件获取分页实体列表
@ -1504,6 +1555,26 @@
<param name="vehicleAssemblyId">整车总成Id</param>
<returns>Erp总成列表</returns>
</member>
<member name="P:WY.NewJit.MsgBaseData.BaseConfigCreateDto.ParamName">
<summary>
参数名称
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.BaseConfigCreateDto.ParamValue">
<summary>
参数值
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.BaseConfigCreateDto.State">
<summary>
状态
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.BaseConfigCreateDto.Remark">
<summary>
备注
</summary>
</member>
<member name="T:WY.NewJit.MsgBaseData.BaseConfigDto">
<summary>
基础参数配置表
@ -1529,6 +1600,26 @@
备注
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryBaseConfigDto.ParamName">
<summary>
参数名称
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryBaseConfigDto.ParamValue">
<summary>
参数值
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryBaseConfigDto.State">
<summary>
状态
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryBaseConfigDto.Remark">
<summary>
备注
</summary>
</member>
<member name="T:WY.NewJit.MsgBaseData.DicItemDto">
<summary>
通用字典信息DTO
@ -1782,6 +1873,51 @@
<param name="id">主键</param>
<returns>执行成功返回真</returns>
</member>
<member name="P:WY.NewJit.MsgBaseData.MaterialExtDto.MaterialNum">
<summary>
SAP物料号
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.MaterialExtDto.MaterialDescription">
<summary>
物料描述(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.MaterialExtDto.MaterialDescription2">
<summary>
大小量纲(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.MaterialExtDto.MaterialMemo">
<summary>
补充备注(车型、门板代码)
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.MaterialExtDto.MaterialGroup">
<summary>
物料组:例如 门板成品-C8
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryMaterialExtDto.MaterialNum">
<summary>
SAP物料号
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryMaterialExtDto.MaterialDescription">
<summary>
物料描述(大小量纲、物料描述字段值同时存在时,优先显示大小量纲)
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryMaterialExtDto.MaterialGroup">
<summary>
物料组:例如 门板成品-C8
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryMaterialExtDto.MaterialType">
<summary>
物料类型 0 空 1 控制件 2 柱护板 3 门板
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.CreateUpdatePartCfgDto.PartCode">
<summary>
零件编码

66
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs

@ -20,8 +20,10 @@ using WY.NewJit.Common;
using WY.NewJit.EdiReceive.Dtos;
using WY.NewJit.EdiReceive.Entitys;
using WY.NewJit.EdiReceive.Interfaces;
using WY.NewJit.EdiReceive.Services;
using WY.NewJit.EntityFrameworkCore;
using WY.NewJit.MsgBaseData;
using WY.NewJit.MsgCheck;
namespace WY.NewJit.EdiReceive
{
@ -58,6 +60,13 @@ namespace WY.NewJit.EdiReceive
/// </summary>
private readonly DicDomainService _dicDomainService;
private readonly EdiParseDomainService _ediParseDomainService;
/// <summary>
/// 配置
/// </summary>
private readonly Microsoft.Extensions.Configuration.IConfiguration _configuration;
/// <summary>
/// 错误信息前缀
/// </summary>
@ -80,14 +89,17 @@ namespace WY.NewJit.EdiReceive
ILogger<ImportRecordAppService> logger,
NewJitDapperRepository newJitDapperRepository,
IBlobContainer<OurFileContainer> blobContainer,
DicDomainService dicDomainService
)
DicDomainService dicDomainService,
EdiParseDomainService ediParseDomainService,
Microsoft.Extensions.Configuration.IConfiguration configuration)
{
_importRecordRepository = importRecordRepository;
_logger = logger;
_newJitDapperRepository = newJitDapperRepository;
_blobContainer = blobContainer;
_dicDomainService = dicDomainService;
_ediParseDomainService = ediParseDomainService;
_configuration = configuration;
}
#region 私有方法
@ -257,8 +269,6 @@ namespace WY.NewJit.EdiReceive
}
}
/// <summary>
/// 按主键获取唯一实体
/// </summary>
@ -411,11 +421,13 @@ namespace WY.NewJit.EdiReceive
/// 导入
/// </summary>
/// <param name="files">导入文件</param>
/// <param name="forceExecute">校验出错时,是否强制执行</param>
/// <returns>执行成功返回真</returns>
[UnitOfWork]
[HttpPost]
[Route("import")]
[DisableRequestSizeLimit]
public virtual async Task<ObjectResultDto> ImportAsync([FromForm] IFormFileCollection files)
public virtual async Task<ObjectResultDto> ImportAsync([FromForm] IFormFileCollection files, bool forceExecute = false)
{
_logger.LogDebug(_errorMessagePrefix + "ImportAsync 进入");
@ -432,6 +444,8 @@ namespace WY.NewJit.EdiReceive
//StreamReader sr = new StreamReader(memoryStream, Encoding.Default);
IImporter importer = new ExcelImporter();
impResult = await importer.Import<ImportRecordDto>(memoryStream);
}
if (impResult.HasError)
{
string rowErrStr = "";
@ -450,16 +464,24 @@ namespace WY.NewJit.EdiReceive
ret.Status = false;
return ret;
}
}
var srcLst = impResult.Data.AsEnumerable().ToList();
var tarLst = ObjectMapper.Map<List<ImportRecordDto>, List<ImportRecord>>(srcLst);
foreach (var tar in tarLst)
{
tar.CreatePerson = "导入";
//tar.CreatePerson = "导入";
tar.CreateTime = ServerHelper.CurrentDateTime;
}
//插入“导入记录表”
await _importRecordRepository.InsertManyAsync(tarLst);
//报文解析
ObjectResultDto ret2 = await _ediParseDomainService.ParseEdi(tarLst, forceExecute);
if (ret2.Status == false)
{
return ret2;
}
if (ret2.Status == true && ret2.Message.HasValue())
{
return ret2;
}
ret.Status = true;
return ret;
}
@ -471,6 +493,32 @@ namespace WY.NewJit.EdiReceive
return ret;
}
}
/// <summary>
/// 打印时间提醒
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[UnitOfWork]
[HttpPost]
[Route("print-timeout-remind")]
public virtual async Task<TimeOutRemindResultDto> PrintTimeoutRemind()
{
TimeOutRemindResultDto retObj = new TimeOutRemindResultDto();
retObj.ConfigMinutes = _configuration[$"ConfigDic:ProductLineTimeoutRemind_New:{"Record"}"].TryToInt() ?? 40;
var qry = await _importRecordRepository.MaxAsync(itm => itm.CreateTime);
retObj.LastReceiveTime = qry != null ? Convert.ToDateTime(qry) : ServerHelper.CurrentDateTime;
retObj.TimeoutMinutes = MinuteDiff(retObj.LastReceiveTime, ServerHelper.CurrentDateTime);
return retObj;
}
private int MinuteDiff(DateTime beginTime, DateTime endTime)
{
TimeSpan beginSpan = new TimeSpan(beginTime.Ticks);
TimeSpan endSpan = new TimeSpan(endTime.Ticks);
TimeSpan diffSpan = endSpan.Subtract(beginSpan).Duration();
return (int)(diffSpan.TotalMinutes);
}
#endregion
}
}

175
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs

@ -23,6 +23,7 @@ using System.Data;
using Microsoft.AspNetCore.Authorization;
using WY.NewJit.Extends.PaiGe;
using Volo.Abp;
using Magicodes.ExporterAndImporter.Core.Models;
namespace WY.NewJit.MsgBaseData
{
@ -33,6 +34,10 @@ namespace WY.NewJit.MsgBaseData
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.基础数据)]
public class AssemblyCfgErpAppService : ApplicationService, IAssemblyCfgErpAppService
{
/// <summary>
/// 总成组
/// </summary>
private readonly IRepository<AssemblyCfgGroup, Guid> _assemblyCfgGroupRepository;
/// <summary>
/// ERP总成仓储
/// </summary>
@ -112,7 +117,8 @@ SELECT top 1 v.Id
AssemblyDomainService assemblyDomainService,
IRepository<PartCfg, Guid> partCfgRepository,
IRepository<MaterialExt, Guid> materialExtRepository,
GlobalSettingsDomainService globalSettingsDomainService
GlobalSettingsDomainService globalSettingsDomainService,
IRepository<AssemblyCfgGroup, Guid> assemblyCfgGroupRepository
)
{
_assemblyCfgErpRepository = assemblyCfgErpRepository;
@ -124,6 +130,7 @@ SELECT top 1 v.Id
_partCfgRepository = partCfgRepository;
_materialExtRepository = materialExtRepository;
_globalSettingsDomainService = globalSettingsDomainService;
_assemblyCfgGroupRepository = assemblyCfgGroupRepository;
}
@ -150,7 +157,7 @@ SELECT top 1 v.Id
(
select ROW_NUMBER() OVER(order by a.[CreationTime]) as row_number,
a.Id, a.ErpAssemblyCode, a.ErpAssemblyName, a.ErpAssemblyVersion,
g.GroupCode, g.VehicleModel, g.IsDisable, g.CreationTime
g.GroupCode, g.VehicleModel, g.IsDisable, g.CreationTime ,g.SpecExplain,g.ColorExplain
from FisAssemblyCfgErp a
join FisAssemblyCfgGroup g on g.Id = a.GroupId
where g.IsDeleted = 0 and g.IsDisable <> 1 {0}
@ -183,10 +190,10 @@ SELECT top 1 v.Id
select ROW_NUMBER() OVER(order by a.[CreationTime]) as row_number,
a.Id, g.GroupCode, a.ErpAssemblyCode, a.ErpAssemblyName,
p.PartCode, pc.PartName, p.PartNum,
g.VehicleModel, g.IsDisable, g.CreationTime
g.VehicleModel, g.IsDisable, g.CreationTime,g.SpecExplain,g.ColorExplain
from FisAssemblyCfgErp a
join FisAssemblyCfgGroup g on g.Id = a.GroupId
join FisAssemblyCfgPart p on a.Id = p.AssemblyCfgErpId
left join FisAssemblyCfgPart p on a.Id = p.AssemblyCfgErpId
left join FisPartCfg pc on p.PartCode = pc.PartCode
where g.IsDeleted = 0 and g.IsDisable <> 1 {0}
";
@ -211,6 +218,14 @@ SELECT top 1 v.Id
{
where += string.Format(" and g.VehicleModel = '{0}'", input.VehicleModelCode);
}
if (!string.IsNullOrEmpty(input.SpecExplain))
{
where += string.Format(" and g.SpecExplain = '{0}'", input.SpecExplain);
}
if (!string.IsNullOrEmpty(input.ColorExplain))
{
where += string.Format(" and g.ColorExplain = '{0}'", input.ColorExplain);
}
if (input.BeginCreateTime != null)
{
where += string.Format(" and g.CreationTime >= '{0}'", ((DateTime)input.BeginCreateTime).ToString("yyyy-MM-dd HH:mm:ss"));
@ -668,11 +683,159 @@ SELECT top 1 v.Id
}
}
/// <summary>
/// 校验ERP总成:是否版本覆盖
/// 总成组导入
/// </summary>
/// <param name="input"></param>
/// <param name="files"></param>
/// <returns></returns>
[HttpPost]
[Route("import-erp-assembly-group")]
[DisableRequestSizeLimit]
public virtual async Task<ObjectResultDto> ImportErpAssemblyGroupAsync([FromForm] IFormFileCollection files)
{
_logger.LogDebug(_errorMessagePrefix + "ImportErpAssemblyGroupAsync 进入");
ObjectResultDto ret = new ObjectResultDto();
try
{
#region 导入文件处理
ImportResult<ImportErpAssemblyGroupDto> impResult;
using (var memoryStream = new MemoryStream())
{
//保存到内存流
IFormFile file = files[0];
await file.CopyToAsync(memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
//StreamReader sr = new StreamReader(memoryStream, Encoding.Default);
IImporter importer = new ExcelImporter();
impResult = await importer.Import<ImportErpAssemblyGroupDto>(memoryStream);
if (impResult.HasError)
{
string rowErrStr = "";
foreach (var rowErr in impResult.RowErrors)
{
string fieldErr = string.Concat(rowErr.FieldErrors.Select(itm => $"字段:{itm.Key},错误信息:{itm.Value}"));
rowErrStr += $"行号:{rowErr.RowIndex},{fieldErr}\r\n";
}
string templateErrStr = "";
foreach (var templateErr in impResult.TemplateErrors)
{
string errorLevel = templateErr.ErrorLevel == ErrorLevels.Error ? "错误" : "警告";
templateErrStr += $"错误等级:{errorLevel},列名:{templateErr.ColumnName},需要列:{templateErr.RequireColumnName},错误消息:{templateErr.Message}\r\n";
}
ret.Message = rowErrStr + templateErrStr;
ret.Status = false;
return ret;
}
}
#endregion
#region 数据验证
var srcLst = impResult.Data.AsEnumerable().ToList();
List<MaterialExt> material3Lst = await _materialExtRepository.Where(itm => itm.MaterialType == "3").ToListAsync();
var error= CheckGroup(srcLst, material3Lst);
if (!string.IsNullOrEmpty(error))
{
ret.Message = error;
ret.Status = false;
return ret;
}
#endregion
#region 插入数据
List<AssemblyCfgGroup> assemblyCfgGroups = new List<AssemblyCfgGroup>();
List<AssemblyCfgGroup> deleteAssemblyCfgGroups = new List<AssemblyCfgGroup>();
List<AssemblyCfgErp> assemblyCfgErps = new List<AssemblyCfgErp>();
var groups = srcLst.GroupBy(r => new { r.SpecExplain, r.ColorExplain }).ToList();
foreach (var group in groups)
{
var olditem= await _assemblyCfgGroupRepository.FirstOrDefaultAsync(r=>r.IsDisable==false&&r.SpecExplain== group.Key.SpecExplain.Trim()&& r.ColorExplain == group.Key.ColorExplain.Trim());
if (olditem != null)
{
olditem.IsDisable = true;
deleteAssemblyCfgGroups.Add(olditem);
}
string groupCode = group.Key.SpecExplain + group.Key.ColorExplain;
AssemblyCfgGroup assemblyCfgGroup = new AssemblyCfgGroup(GuidGenerator.Create() , groupCode,"",true);
assemblyCfgGroup.SpecExplain = group.Key.SpecExplain.Trim();
assemblyCfgGroup.ColorExplain = group.Key.ColorExplain.Trim();
assemblyCfgGroup.IsDisable = false;
foreach (var item in group)
{
var material3 = material3Lst.FirstOrDefault(r => r.MaterialNum == item.MaterialNum.Trim());
AssemblyCfgErp assemblyCfgErp = new AssemblyCfgErp(GuidGenerator.Create());
assemblyCfgErp.ErpAssemblyCode = item.MaterialNum.Trim();
assemblyCfgErp.ErpAssemblyName = material3.MaterialDescription;
assemblyCfgErp.ErpAssemblyVersion = 1;
assemblyCfgErp.GroupCode = groupCode;
assemblyCfgErp.GroupId = assemblyCfgGroup.Id;
assemblyCfgErp.SpecExplain = item.SpecExplain.Trim();
assemblyCfgErp.ColorExplain = item.ColorExplain.Trim();
assemblyCfgErps.Add(assemblyCfgErp);
}
assemblyCfgGroups.Add(assemblyCfgGroup);
}
//插入“导入记录表”
await _assemblyCfgGroupRepository.UpdateManyAsync(deleteAssemblyCfgGroups);//更新总成组
await _assemblyCfgGroupRepository.InsertManyAsync(assemblyCfgGroups);
await _assemblyCfgErpRepository.InsertManyAsync(assemblyCfgErps);
#endregion
ret.Status = true;
return ret;
}
catch (Exception ex)
{
ret.Status = false;
ret.Message = _errorMessagePrefix + "ImportErpAssemblyGroupAsync 执行出错:" + ex.Message;
_logger.LogError(ret.Message);
return ret;
}
}
private string CheckGroup(List<ImportErpAssemblyGroupDto> srcLst, List<MaterialExt> material3Lst)
{
//验证是否有重复项
string error = "";
var disitem = srcLst.Distinct();
if (disitem.Count() != srcLst.Count())
{
error = "导入数据有重复项,检查后在导入!";
}
if (!string.IsNullOrEmpty(error)) return error;
#region 验证分组是否符合分组规
var checkGroups = srcLst.GroupBy(r => new { r.SpecExplain, r.ColorExplain }).Select(r => new { SpecExplain = r.Key.SpecExplain, ColorExplain = r.Key.ColorExplain, Count = r.Count() });
var errorgroups = checkGroups.Where(r => r.Count != 4).ToList();
foreach (var item in errorgroups)
{
error += $"规格说明【{item.SpecExplain}】,颜色说明【{item.ColorExplain}】,零件数【{item.Count}】不符合分组规则\r\n";
}
if (!string.IsNullOrEmpty(error)) return error;
#endregion
#region 验证零件是否存在(门板)
var partdists = srcLst.Select(r => r.MaterialNum).Distinct();
foreach (var material in partdists)
{
var material3 = material3Lst.FirstOrDefault(r => r.MaterialNum == material);
if (material3 == null)
{
error += $"零件编号【{material}】系统同不存在,请检查后再导入\r\n";
}
}
#endregion
return error;
}
//[UnitOfWork]
//[HttpPost]
//[Route("check")]

173
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/BaseConfig/BaseGonfigService.cs

@ -1,10 +1,13 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
@ -17,9 +20,11 @@ namespace WY.NewJit.MsgBaseData
/// </summary>
[Route("api/newjit/baseconfig")]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.基础数据)]
public class BaseGonfigService : ApplicationService
public class BaseGonfigService : ApplicationService, IBaseGonfigService
{
private readonly IRepository<BaseConfig, Guid> _repository;
public readonly IRepository<BaseConfig, Guid> _repository;
private readonly BaseGonfigDomainService _baseConfigDomainService;
/// <summary>
/// 日志
/// </summary>
@ -41,11 +46,13 @@ namespace WY.NewJit.MsgBaseData
/// </summary>
public BaseGonfigService(
IRepository<BaseConfig, Guid> repository,
ILogger<BaseGonfigService> logger
ILogger<BaseGonfigService> logger,
BaseGonfigDomainService baseConfigDomainService
)
{
_repository = repository;
_logger = logger;
_baseConfigDomainService = baseConfigDomainService;
}
@ -57,25 +64,171 @@ namespace WY.NewJit.MsgBaseData
[HttpGet]
[UnitOfWork(false)]
[Route("list")]
public virtual async Task<ListResultDto<BaseConfigDto>> GetBaseConfigListAsync()
public virtual async Task<PagedResultDto<BaseConfigDto>> GetListAsync(QueryBaseConfigDto input)
{
_logger.LogDebug(_errorMessagePrefix + "GetBaseConfigListAsync 进入");
_logger.LogDebug(_errorMessagePrefix + "GetListAsync 进入");
try
{
var lst = await _repository.GetListAsync();
var page = (PagedAndSortedBase)input;
IQueryable<BaseConfig> qry1 = QueryByCondition(input);
if (string.IsNullOrEmpty(page.Sorting))
{
page.Sorting = "ParamName";
}
int totalCount = await qry1.CountAsync(); //返回总记录数而不是当前页记录数
if (totalCount == 0)
{
return new PagedResultDto<BaseConfigDto>(0, new List<BaseConfigDto>());
}
var query = qry1.OrderBy(page.Sorting).Skip(page.SkipCount).Take(page.MaxResultCount);
List<BaseConfig> lst = await query.ToListAsync();
var items = ObjectMapper.Map<List<BaseConfig>, List<BaseConfigDto>>(lst);
return new ListResultDto<BaseConfigDto>(items);
return new PagedResultDto<BaseConfigDto>(totalCount, items);
}
catch (Exception ex)
{
string errMsg = _errorMessagePrefix + "GetBaseConfigListAsync 执行出错:" + ex.Message;
string errMsg = _errorMessagePrefix + "GetListAsync 执行出错:" + ex.Message;
_logger.LogError(errMsg);
return new ListResultDto<BaseConfigDto>(new List<BaseConfigDto>());
return new PagedResultDto<BaseConfigDto>(0, new List<BaseConfigDto>());
}
}
/// <summary>
/// 添加实体
/// </summary>
/// <param name="input">添加内容</param>
/// <returns>执行成功返回真</returns>
[HttpPost]
[UnitOfWork]
[Route("create")]
public async Task<ObjectResultDto<Guid>> CreateAsync(BaseConfigCreateDto input)
{
_logger.LogDebug(_errorMessagePrefix + "CreateAsync 进入");
ObjectResultDto<Guid> ret = new ObjectResultDto<Guid>();
try
{
var checkitem = await _repository.FirstOrDefaultAsync(r => r.ParamName == input.ParamName);
if (checkitem != null)
{
ret.Status = false;
ret.Message = $"参数名称【{input.ParamName}】已存,在无法添加!";
return ret;
}
BaseConfig obj = ObjectMapper.Map<BaseConfigCreateDto, BaseConfig>(input);
var obj2 = await _repository.InsertAsync(obj);
ret.Item = obj2.Id; //返回添加对象的主键
await _baseConfigDomainService.UpdateBaseConfigCache();
return ret;
}
catch (Exception ex)
{
ret.Status = false;
ret.Message = _errorMessagePrefix + "CreateAsync 执行出错:" + ex.Message;
_logger.LogError(ret.Message);
return ret;
}
}
#endregion
/// <summary>
/// 修改实体
/// </summary>
/// <param name="id">更新主键</param>
/// <param name="input">修改内容</param>
/// <returns>执行成功返回真</returns>
[HttpPut]
[UnitOfWork]
[Route("update/{id}")]
public async Task<ObjectResultDto> UpdateAsync(Guid id, BaseConfigCreateDto input)
{
_logger.LogDebug(_errorMessagePrefix + "UpdateAsync 进入");
ObjectResultDto ret = new ObjectResultDto();
try
{
var checkitem = await _repository.FirstOrDefaultAsync(r => r.ParamName == input.ParamName && r.Id != id);
if (checkitem != null)
{
ret.Status = false;
ret.Message = $"参数名称【{input.ParamName}】已存,在无法添加!";
return ret;
}
var item = await _repository.GetAsync(id);
ObjectMapper.Map<BaseConfigCreateDto, BaseConfig>(input, item);
await _repository.UpdateAsync(item);
await _baseConfigDomainService.UpdateBaseConfigCache();
return ret;
}
catch (Exception ex)
{
ret.Status = false;
ret.Message = _errorMessagePrefix + "UpdateAsync 执行出错:" + ex.Message;
_logger.LogError(ret.Message);
return ret;
}
}
/// <summary>
/// 删除实体
/// </summary>
/// <param name="id">删除主键</param>
/// <returns>执行成功返回真</returns>
[UnitOfWork]
[HttpDelete]
[Route("delete/{id}")]//delete/
public async Task<ObjectResultDto> DeleteAsync(string id)
{
_logger.LogDebug(_errorMessagePrefix + "DeleteAsync 进入");
ObjectResultDto ret = new ObjectResultDto();
try
{
Guid guid = Guid.Parse(id);
await _repository.DeleteAsync(guid);
await _baseConfigDomainService.UpdateBaseConfigCache();
return ret;
}
catch (Exception ex)
{
ret.Status = false;
ret.Message = _errorMessagePrefix + "DeleteAsync 执行出错:" + ex.Message;
_logger.LogError(ret.Message);
return ret;
}
}
#endregion
#region 私有方法
/// <summary>
/// 根据筛选条件获取实体列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
private IQueryable<BaseConfig> QueryByCondition(QueryBaseConfigDto input)
{
IQueryable<BaseConfig> ret = _repository.Where(itm => 1 == 1);
if (!string.IsNullOrEmpty(input.ParamName))
{
ret = ret.Where(itm => itm.ParamName.Contains(input.ParamName));
}
if (!string.IsNullOrEmpty(input.ParamValue))
{
ret = ret.Where(itm => itm.ParamValue.Contains(input.ParamValue));
}
if (input.State.Count > 0)
{
ret = ret.Where(itm => input.State.Contains(itm.State));
}
if (!string.IsNullOrEmpty(input.Remark))
{
ret = ret.Where(itm => itm.Remark.Contains(input.Remark));
}
return ret;
}
#endregion
}
}

11
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/MaterialExt/IMaterialExtAppService.cs

@ -0,0 +1,11 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace WY.NewJit.MsgBaseData
{
public interface IMaterialExtAppService
{
Task<ObjectResultDto<string>> ExportAsync(QueryMaterialExtDto input);
Task<PagedResultDto<MaterialExtDto>> GetListAsync(QueryMaterialExtDto input);
}
}

161
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/MaterialExt/MaterialExtAppService.cs

@ -0,0 +1,161 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.BlobStoring;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using WY.NewJit.Common;
using WY.NewJit.Extends.PaiGe;
namespace WY.NewJit.MsgBaseData
{
[Route("api/newjit/material")]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.基础数据)]
public class MaterialExtAppService : ApplicationService, IMaterialExtAppService
{
private readonly IRepository<MaterialExt, Guid> _materialExtRepository;
private ILogger<MaterialExtAppService> _logger;
/// <summary>
/// BLOB存储
/// </summary>
private readonly IBlobContainer<OurFileContainer> _blobContainer;
/// <summary>
/// 错误信息前缀
/// </summary>
private string _errorMessagePrefix
{
get
{
return System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + ".";
}
}
public MaterialExtAppService(IRepository<MaterialExt, Guid> materialExtRepository, ILogger<MaterialExtAppService> logger, IBlobContainer<OurFileContainer> blobContainer)
{
_materialExtRepository = materialExtRepository;
_logger = logger;
_blobContainer = blobContainer;
}
/// <summary>
/// 获取数据
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[UnitOfWork(false)]
[Route("list")]
public virtual async Task<PagedResultDto<MaterialExtDto>> GetListAsync(QueryMaterialExtDto input)
{
_logger.LogDebug(_errorMessagePrefix + "GetListAsync 进入");
try
{
var page = (PagedAndSortedBase)input;
IQueryable<MaterialExt> qry1 = QueryByCondition(input);
if (string.IsNullOrEmpty(page.Sorting))
{
page.Sorting = "MaterialNum";
}
int totalCount = await qry1.CountAsync(); //返回总记录数而不是当前页记录数
if (totalCount == 0)
{
return new PagedResultDto<MaterialExtDto>(0, new List<MaterialExtDto>());
}
var query = qry1
.OrderBy(page.Sorting)
.Skip(page.SkipCount)
.Take(page.MaxResultCount);
List<MaterialExt> lst = await query.ToListAsync();
List<MaterialExtDto> items =
ObjectMapper.Map<List<MaterialExt>, List<MaterialExtDto>>(lst);
return new PagedResultDto<MaterialExtDto>(totalCount, items);
}
catch (Exception ex)
{
string errMsg = _errorMessagePrefix + "GetListAsync 执行出错:" + ex.Message;
_logger.LogError(errMsg);
return new PagedResultDto<MaterialExtDto>(0, new List<MaterialExtDto>());
}
}
/// <summary>
/// 导出信息
/// </summary>
/// <param name="input">导出查询条件</param>
/// <returns>执行成功返回真</returns>
[UnitOfWork(false)]
[HttpPost]
[Route("export")]
public virtual async Task<ObjectResultDto<string>> ExportAsync(QueryMaterialExtDto input)
{
_logger.LogDebug(_errorMessagePrefix + "ExportAsync 进入");
ObjectResultDto<string> ret = new ObjectResultDto<string>();
try
{
IQueryable<MaterialExt> query = QueryByCondition(input);
List<MaterialExt> lst = await query.ToListAsync();
List<MaterialExtDto> items =
ObjectMapper.Map<List<MaterialExt>, List<MaterialExtDto>>(lst);
//将实体列表转换成excel文件流
IExporter exporter = new ExcelExporter();
byte[] byteArr = await exporter.ExportAsByteArray<MaterialExtDto>(items);
byteArr.ShouldNotBeNull();
//将excel文件流保存到服务器端文件系统
string fileName = string.Format("物料信息_{0}.xlsx", Guid.NewGuid().ToString());
await _blobContainer.SaveAsync(fileName, byteArr);
ret.Item = fileName;
return ret;
}
catch (Exception ex)
{
ret.Status = false;
ret.Message = _errorMessagePrefix + "ExportAsync 执行出错:" + ex.Message;
_logger.LogError(ret.Message);
return ret;
}
}
#region 私有方法
/// <summary>
/// 根据筛选条件获取实体列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
private IQueryable<MaterialExt> QueryByCondition(QueryMaterialExtDto input)
{
IQueryable<MaterialExt> ret = _materialExtRepository.Where(itm => 1 == 1);
if (!string.IsNullOrEmpty(input.MaterialNum))
{
ret = ret.Where(itm => itm.MaterialNum.Contains(input.MaterialNum));
}
if (!string.IsNullOrEmpty(input.MaterialDescription))
{
ret = ret.Where(itm => itm.MaterialDescription.Contains(input.MaterialDescription));
}
if (!string.IsNullOrEmpty(input.MaterialGroup))
{
ret = ret.Where(itm => itm.MaterialGroup == input.MaterialGroup);
}
if (!string.IsNullOrEmpty(input.MaterialType))
{
ret = ret.Where(itm => itm.MaterialType == input.MaterialType);
}
return ret;
}
#endregion
}
}

5
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/NewJitApplicationAutoMapperProfile.cs

@ -5,6 +5,7 @@ using WY.NewJit.Books;
using WY.NewJit.EdiReceive.Dtos;
using WY.NewJit.EdiReceive.Entitys;
using WY.NewJit.Extends;
using WY.NewJit.Extends.PaiGe;
using WY.NewJit.MsgBaseData;
using WY.NewJit.MsgCheck;
using WY.NewJit.MsgCheck.UnknownAssemblys;
@ -21,6 +22,7 @@ namespace WY.NewJit
CreateMap<CreateUpdateBookDto, Book>();
#region 基础数据
CreateMap<MaterialExt, MaterialExtDto>().ReverseMap();
CreateMap<PartCfg, PartCfgDto>().ReverseMap();
CreateMap<PartCfg, CreateUpdatePartCfgDto>().ReverseMap();
@ -46,6 +48,9 @@ namespace WY.NewJit
CreateMap<LogRemind, LogRemindDto>().ReverseMap();
CreateMap<LogRemind, CreateUpdateLogRemindDto>().ReverseMap();
CreateMap<BaseConfig, BaseConfigCreateDto>().ReverseMap();
CreateMap<BaseConfig, BaseConfigDto>().ReverseMap();
#endregion
#region 报文解析及校验

11
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs

@ -116,6 +116,9 @@ namespace WY.NewJit.PrintTable
/// BLOB存储
/// </summary>
private readonly IBlobContainer<OurFileContainer> _blobContainer;
private readonly BaseGonfigDomainService _baseConfigDomainService;
#endregion
public WaitPrintAppService(
@ -136,7 +139,8 @@ namespace WY.NewJit.PrintTable
IRepository<PrintTemplateConfiguration, Guid> printTemplateConfigurationRepository,
M100DomainService m100DomainService,
IBlobContainer<OurFileContainer> blobContainer,
IRepository<BillR100, Guid> billR100Repository
IRepository<BillR100, Guid> billR100Repository,
BaseGonfigDomainService baseConfigDomainService
)
{
_waitPrintRepository = waitPrintRepository;
@ -157,6 +161,7 @@ namespace WY.NewJit.PrintTable
_m100DomainService = m100DomainService;
_blobContainer = blobContainer;
_billR100Repository = billR100Repository;
_baseConfigDomainService = baseConfigDomainService;
}
#region 私有方法
@ -872,12 +877,14 @@ namespace WY.NewJit.PrintTable
Stopwatch sw = new Stopwatch();
sw.Start();
_logger.LogDebug(_errorMessagePrefix + "SaveMenBanReport 进入");
var baseConfigCache= _baseConfigDomainService.GetCachesByName("打印条数");
var printCount = baseConfigCache == null ? 10 : Convert.ToInt32(baseConfigCache.ParamValue);
MenBanPrintResultDto retObj = new MenBanPrintResultDto();
ObjectResultDto<MenBanPrintResultDto> ret = new ObjectResultDto<MenBanPrintResultDto>(retObj);
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true, isolationLevel: System.Data.IsolationLevel.Unspecified))
{
try
{
List<MenBanPackingList> reportMainLst = new List<MenBanPackingList>();

95
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml

@ -39,12 +39,17 @@
字典领域服务
</summary>
</member>
<member name="F:WY.NewJit.EdiReceive.ImportRecordAppService._configuration">
<summary>
配置
</summary>
</member>
<member name="P:WY.NewJit.EdiReceive.ImportRecordAppService._errorMessagePrefix">
<summary>
错误信息前缀
</summary>
</member>
<member name="M:WY.NewJit.EdiReceive.ImportRecordAppService.#ctor(Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.EdiReceive.Entitys.ImportRecord,System.Guid},Microsoft.Extensions.Logging.ILogger{WY.NewJit.EdiReceive.ImportRecordAppService},WY.NewJit.EntityFrameworkCore.NewJitDapperRepository,Volo.Abp.BlobStoring.IBlobContainer{WY.NewJit.Common.OurFileContainer},WY.NewJit.MsgBaseData.DicDomainService)">
<member name="M:WY.NewJit.EdiReceive.ImportRecordAppService.#ctor(Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.EdiReceive.Entitys.ImportRecord,System.Guid},Microsoft.Extensions.Logging.ILogger{WY.NewJit.EdiReceive.ImportRecordAppService},WY.NewJit.EntityFrameworkCore.NewJitDapperRepository,Volo.Abp.BlobStoring.IBlobContainer{WY.NewJit.Common.OurFileContainer},WY.NewJit.MsgBaseData.DicDomainService,WY.NewJit.EdiReceive.Services.EdiParseDomainService,Microsoft.Extensions.Configuration.IConfiguration)">
<summary>
构造函数
</summary>
@ -117,13 +122,21 @@
<param name="input">导出查询条件</param>
<returns>执行成功返回真</returns>
</member>
<member name="M:WY.NewJit.EdiReceive.ImportRecordAppService.ImportAsync(Microsoft.AspNetCore.Http.IFormFileCollection)">
<member name="M:WY.NewJit.EdiReceive.ImportRecordAppService.ImportAsync(Microsoft.AspNetCore.Http.IFormFileCollection,System.Boolean)">
<summary>
导入
</summary>
<param name="files">导入文件</param>
<param name="forceExecute">校验出错时,是否强制执行</param>
<returns>执行成功返回真</returns>
</member>
<member name="M:WY.NewJit.EdiReceive.ImportRecordAppService.PrintTimeoutRemind">
<summary>
打印时间提醒
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:WY.NewJit.Extends.ProductLineAuthorityAppService">
<summary>
生产线权限管理应用服务实现
@ -264,6 +277,11 @@
总成配置应用服务实现
</summary>
</member>
<member name="F:WY.NewJit.MsgBaseData.AssemblyCfgErpAppService._assemblyCfgGroupRepository">
<summary>
总成组
</summary>
</member>
<member name="F:WY.NewJit.MsgBaseData.AssemblyCfgErpAppService._assemblyCfgErpRepository">
<summary>
ERP总成仓储
@ -314,7 +332,7 @@
错误信息前缀
</summary>
</member>
<member name="M:WY.NewJit.MsgBaseData.AssemblyCfgErpAppService.#ctor(Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgErp,System.Guid},Microsoft.Extensions.Logging.ILogger{WY.NewJit.MsgBaseData.AssemblyCfgErpAppService},WY.NewJit.EntityFrameworkCore.NewJitDapperRepository,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgPart,System.Guid},Volo.Abp.BlobStoring.IBlobContainer{WY.NewJit.Common.OurFileContainer},WY.NewJit.MsgBaseData.AssemblyDomainService,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.PartCfg,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.MaterialExt,System.Guid},WY.NewJit.MsgBaseData.GlobalSettingsDomainService)">
<member name="M:WY.NewJit.MsgBaseData.AssemblyCfgErpAppService.#ctor(Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgErp,System.Guid},Microsoft.Extensions.Logging.ILogger{WY.NewJit.MsgBaseData.AssemblyCfgErpAppService},WY.NewJit.EntityFrameworkCore.NewJitDapperRepository,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgPart,System.Guid},Volo.Abp.BlobStoring.IBlobContainer{WY.NewJit.Common.OurFileContainer},WY.NewJit.MsgBaseData.AssemblyDomainService,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.PartCfg,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.MaterialExt,System.Guid},WY.NewJit.MsgBaseData.GlobalSettingsDomainService,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgGroup,System.Guid})">
<summary>
构造函数
</summary>
@ -389,6 +407,13 @@
<param name="files">导入文件</param>
<returns>执行成功返回真</returns>
</member>
<member name="M:WY.NewJit.MsgBaseData.AssemblyCfgErpAppService.ImportErpAssemblyGroupAsync(Microsoft.AspNetCore.Http.IFormFileCollection)">
<summary>
总成组导入
</summary>
<param name="files"></param>
<returns></returns>
</member>
<member name="M:WY.NewJit.MsgBaseData.AssemblyCfgErpAppService.RemoveRepeatErpAssembly(System.Int32)">
<summary>
系统初始化时使用,去掉重复的ERP总成
@ -544,17 +569,46 @@
错误信息前缀
</summary>
</member>
<member name="M:WY.NewJit.MsgBaseData.BaseGonfigService.#ctor(Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.BaseConfig,System.Guid},Microsoft.Extensions.Logging.ILogger{WY.NewJit.MsgBaseData.BaseGonfigService})">
<member name="M:WY.NewJit.MsgBaseData.BaseGonfigService.#ctor(Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.BaseConfig,System.Guid},Microsoft.Extensions.Logging.ILogger{WY.NewJit.MsgBaseData.BaseGonfigService},WY.NewJit.MsgBaseData.BaseGonfigDomainService)">
<summary>
构造函数
</summary>
</member>
<member name="M:WY.NewJit.MsgBaseData.BaseGonfigService.GetBaseConfigListAsync">
<member name="M:WY.NewJit.MsgBaseData.BaseGonfigService.GetListAsync(WY.NewJit.MsgBaseData.QueryBaseConfigDto)">
<summary>
获取所有基本参数数据
</summary>
<returns></returns>
</member>
<member name="M:WY.NewJit.MsgBaseData.BaseGonfigService.CreateAsync(WY.NewJit.MsgBaseData.BaseConfigCreateDto)">
<summary>
添加实体
</summary>
<param name="input">添加内容</param>
<returns>执行成功返回真</returns>
</member>
<member name="M:WY.NewJit.MsgBaseData.BaseGonfigService.UpdateAsync(System.Guid,WY.NewJit.MsgBaseData.BaseConfigCreateDto)">
<summary>
修改实体
</summary>
<param name="id">更新主键</param>
<param name="input">修改内容</param>
<returns>执行成功返回真</returns>
</member>
<member name="M:WY.NewJit.MsgBaseData.BaseGonfigService.DeleteAsync(System.String)">
<summary>
删除实体
</summary>
<param name="id">删除主键</param>
<returns>执行成功返回真</returns>
</member>
<member name="M:WY.NewJit.MsgBaseData.BaseGonfigService.QueryByCondition(WY.NewJit.MsgBaseData.QueryBaseConfigDto)">
<summary>
根据筛选条件获取实体列表
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:WY.NewJit.MsgBaseData.DicAppService">
<summary>
通用字典应用服务实现
@ -795,6 +849,37 @@
<param name="id">主键</param>
<returns>执行成功返回真</returns>
</member>
<member name="F:WY.NewJit.MsgBaseData.MaterialExtAppService._blobContainer">
<summary>
BLOB存储
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.MaterialExtAppService._errorMessagePrefix">
<summary>
错误信息前缀
</summary>
</member>
<member name="M:WY.NewJit.MsgBaseData.MaterialExtAppService.GetListAsync(WY.NewJit.MsgBaseData.QueryMaterialExtDto)">
<summary>
获取数据
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:WY.NewJit.MsgBaseData.MaterialExtAppService.ExportAsync(WY.NewJit.MsgBaseData.QueryMaterialExtDto)">
<summary>
导出信息
</summary>
<param name="input">导出查询条件</param>
<returns>执行成功返回真</returns>
</member>
<member name="M:WY.NewJit.MsgBaseData.MaterialExtAppService.QueryByCondition(WY.NewJit.MsgBaseData.QueryMaterialExtDto)">
<summary>
根据筛选条件获取实体列表
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:WY.NewJit.MsgBaseData.PartCfgAppService">
<summary>
零件管理应用服务实现

2
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain.Shared/Common/ServerHelper.cs

@ -146,7 +146,7 @@ namespace WY.NewJit
{
throw new Exception("ToSerialNumStr大众顺序号不能为空!");
}
return ((DateTime)onlineTime).ToString("yyyyMMddHHmm") + "00" + hostSN.ToString().PadLeft(5, '0');
return ((DateTime)onlineTime).ToString("yyyyMMddHHmmss") + hostSN.ToString().PadLeft(5, '0');
}
/// <summary>

4
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Entitys/LastImportHostSN.cs

@ -13,5 +13,9 @@ namespace WY.NewJit.EdiReceive.Entitys
public int HostSN { get; set; }
public LastImportHostSN(Guid id)
:base(id)
{
}
}
}

460
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs

@ -0,0 +1,460 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using WY.NewJit.EdiReceive.Entitys;
using WY.NewJit.IRepositories;
using WY.NewJit.MsgBaseData;
using WY.NewJit.MsgCheck;
using WY.NewJit.Common;
using WY.NewJit.MsgBaseData.Entitys;
namespace WY.NewJit.EdiReceive.Services
{
/// <summary>
/// 红旗报文接收
/// </summary>
public class EdiParseDomainService : DomainService
{
#region 成员
/// <summary>
/// 日志
/// </summary>
private readonly ILogger<EdiParseDomainService> _logger;
/// <summary>
/// Dapper仓储
/// </summary>
private readonly INewJitDapperRepository _newJitDapperRepository;
/// <summary>
/// 字典领域服务
/// </summary>
private readonly DicDomainService _dicDomainService;
/// <summary>
/// 导入记录仓储
/// </summary>
private readonly IRepository<ImportRecord, Guid> _importRecordRepository;
/// <summary>
/// M100单据
/// </summary>
private readonly IRepository<BillM100, Guid> _billM100Repository;
/// <summary>
/// ERP总成分组仓库
/// </summary>
//private readonly IRepository<AssemblyCfgGroup, Guid> _assemblyCfgGroupRepository;
/// <summary>
/// ERP总成仓储
/// </summary>
//private readonly IRepository<AssemblyCfgErp, Guid> _assemblyCfgErpRepository;
/// <summary>
/// 整车总成配置仓库
/// </summary>
private readonly IRepository<AssemblyCfgVehicle, Guid> _assemblyCfgVehicleRepository;
/// <summary>
/// 导入最大流水号 领域服务
/// </summary>
private readonly LastImportHostSNDomainService _lastImportHostSNDomainService;
/// <summary>
/// 缓存管理 领域服务
/// </summary>
private readonly HQ_CacheManagerDomainService _hqCacheManagerDomainService;
/// <summary>
/// 插入M100、未打印表 领域服务
/// </summary>
private readonly HQ_M100DomainService _hqM100DomainServie;
/// <summary>
/// 重复报文仓库
/// </summary>
private readonly IRepository<RepeatM100, Guid> _repeatM100Repository;
/// <summary>
/// 未知总成仓库
/// </summary>
private readonly IRepository<UnknownAssembly, Guid> _unknownAssemblyRepository;
/// <summary>
/// 报文车型对应零件生产工厂车型
/// </summary>
//private static List<DicItem> _msgToPaiGeVehicleModelList = new List<DicItem>();
/// <summary>
/// M100零件生产工厂车型对应生产线
/// </summary>
//private static List<DicItem> _m100VehicleModelProductLineList = new List<DicItem>();
/// <summary>
/// 根据车型代码中的前两位(HS),过滤属于派格的订单;只针对派格的订单进行报文解析
/// </summary>
private const string _vehicleModelPrefix = "HS";
/// <summary>
/// 错误信息前缀
/// </summary>
private string _errorMessagePrefix
{
get
{
return System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + ".";
}
}
#endregion
public EdiParseDomainService(ILogger<EdiParseDomainService> logger, INewJitDapperRepository newJitDapperRepository, DicDomainService dicDomainService, IRepository<ImportRecord, Guid> importRecordRepository, IRepository<BillM100, Guid> billM100Repository, LastImportHostSNDomainService lastImportHostSNDomainService, IRepository<AssemblyCfgGroup, Guid> assemblyCfgGroupRepository = null, IRepository<AssemblyCfgErp, Guid> assemblyCfgErpRepository = null, IRepository<AssemblyCfgVehicle, Guid> assemblyCfgVehicleRepository = null, HQ_CacheManagerDomainService hqCacheManagerDomainService = null, HQ_M100DomainService hqM100DomainServie = null, IRepository<RepeatM100, Guid> repeatM100Repository = null, IRepository<UnknownAssembly, Guid> unknownAssemblyRepository = null)
{
_logger = logger;
_newJitDapperRepository = newJitDapperRepository;
_dicDomainService = dicDomainService;
_importRecordRepository = importRecordRepository;
_billM100Repository = billM100Repository;
_lastImportHostSNDomainService = lastImportHostSNDomainService;
//_msgToPaiGeVehicleModelList = _dicDomainService.GetDicItems(DicTypeName.报文车型对应派格车型);
//_m100VehicleModelProductLineList = _dicDomainService.GetDicItems(DicTypeName.M100派格车型对应生产线);
//_assemblyCfgGroupRepository = assemblyCfgGroupRepository;
//_assemblyCfgErpRepository = assemblyCfgErpRepository;
_assemblyCfgVehicleRepository = assemblyCfgVehicleRepository;
_hqCacheManagerDomainService = hqCacheManagerDomainService;
_hqM100DomainServie = hqM100DomainServie;
_repeatM100Repository = repeatM100Repository;
_unknownAssemblyRepository = unknownAssemblyRepository;
}
/// <summary>
/// 解析报文
/// 一、导入记录表
/// 1. 从客户网站导出EXCEL格式的订单列表
/// 2. 校验 本次导入的最小HostSN必须<= 上次导入的最大HostSN + 1 (上次是10, 本次可以是 9 10 11,不能是12)
/// 3. 根据VIN和HostSN,扣除重复导入的记录
/// 4. 断号提醒:导入Excel时,如果系统中的流水号不能顺序连接,需要给出提醒,是否继续导入,如果选择继续导入,仍可以导入到系统中
/// 5. 最后导入到本系统中 impRecLst
///
/// 二、插入M100
/// 1. 根据车型代码中的前两位(HS),过滤属于派格的订单;只针对派格的订单进行报文解析
/// 2. 根据VIN判断是否重复报文,将重复报文放到“重复报文表”
/// 3. 通过车型描述中的颜色(条件一)和规格说明(条件二)两个字段能够定位到该底盘对应哪个总成组(4个总成一组)。如果匹配将订单和总成组进行绑定;如果不匹配将订单放入未知总成
/// 4. 插入M100 (更新派格车型、 生产线)
/// 5. 插入WaitPrint
/// </summary>
/// <param name="impRecLst">导入Excel内容</param>
/// <param name="forceExecute">校验不通过时,是否强制执行通过</param>
public async Task<ObjectResultDto> ParseEdi(List<ImportRecord> input, bool forceExecute = false)
{
ObjectResultDto ret = new ObjectResultDto();
//扣除重复导入的订单
List<ImportRecord> notRepeatOrder = await GetNotRepeatOrder(input);
if (notRepeatOrder.Count == 0)
{
ret.Status = true;
ret.Message = "根据Vin和HostSN,排除在数据库中重复的Excel订单后,已经没有不重复的订单!";
return ret;
}
#region 断号提醒
//校验两次导入之间是否断号
string betweenBreakNumMsg = await CheckBetweenBreakNum(input);
//校验本次导入数据是否断号
string breakNumMsg = CheckBreakNum(ref notRepeatOrder);
if (betweenBreakNumMsg.HasValue() || breakNumMsg.HasValue())
{
if (forceExecute == false)
{
//断号提醒
ret.Status = true;
ret.Message = betweenBreakNumMsg + breakNumMsg;
return ret;
}
}
#endregion
//初始化缓存
_hqCacheManagerDomainService.InitLoadCache();
//批量插入 导入记录
await _importRecordRepository.InsertManyAsync(notRepeatOrder);
//过滤掉其它厂家的订单,只取派格订单
var paigeOrderLst = notRepeatOrder.Where(itm => itm.VehicleModelCode.Substring(0, 2) == _vehicleModelPrefix).OrderBy(itm => itm.HostSN).ToList();
foreach (ImportRecord orderItem in paigeOrderLst)
{
//构建M100实体
BillM100 m100Obj = BuildM100Entity(orderItem);
//更新车型、产线
UpdateProductLine(m100Obj);
//重复报文
bool isRepeat = await _billM100Repository.AnyAsync(itm => itm.HostSN == orderItem.HostSN && itm.VIN == orderItem.Vin);
if (isRepeat == true)
{
#region 重复报文
var succObj = InsertM100RepeatBill(orderItem, m100Obj);
_logger.LogDebug(_errorMessagePrefix + $"流水号{orderItem.HostSN}是重复报文");
ret.Status = (succObj != null);
return ret;
#endregion
}
//绑定总成分组
string colorExplain = orderItem.VehicleModelDesc.Trim().Right(7);
Group_Assembly groupAssemblyObj = HQ_CacheManagerDomainService._groupAssemblyList.FirstOrDefault(itm => itm.SpecExplain == orderItem.SpecDesc && itm.ColorExplain == colorExplain);
if (groupAssemblyObj != null)
{
#region 插入整车总成
Guid vehicleAssemblyId = GuidGenerator.Create();
AssemblyCfgVehicle vehicleAssemblyCfgObj = new AssemblyCfgVehicle(vehicleAssemblyId, null, m100Obj.VehicleModelCode, null, true);
foreach (OnlyAssemblyInfo assemblyItem in groupAssemblyObj.AssemblyDetails) //插入子表
{
vehicleAssemblyCfgObj.AddChildObj(GuidGenerator.Create(), assemblyItem.Id);
}
var vehicleAssemblyResu = await _assemblyCfgVehicleRepository.InsertAsync(vehicleAssemblyCfgObj, true);
if (vehicleAssemblyResu == null)
{
throw new Exception("插入整车总成返回结果为空InsertAsync!");
}
#endregion
//插入M100、未打印表
m100Obj.SetAssemblyID(vehicleAssemblyResu.Id);
m100Obj.SetBillStatus(BillStatusEnum.Match);
var insM100Ret = await _hqM100DomainServie.InsertM100(m100Obj, true);
}
else
{
//未知总成
_logger.LogDebug(_errorMessagePrefix + $"未匹配总成,插入未知总成开始:{orderItem.HostSN}");
//更新单据表
m100Obj.SetAssemblyID(null);
m100Obj.SetBillStatus(BillStatusEnum.NotMatch);
var succObj1 = await _hqM100DomainServie.InsertM100(m100Obj, true);
//不匹配时,插入未知总成
var succObj2 = await InsertUnknownAssembly(m100Obj);
_logger.LogDebug(_errorMessagePrefix + $"未匹配总成,插入未知总成完成:{orderItem.HostSN}");
ret.Status = (succObj1 != null && succObj2 != null);
}
} //foreach
//更新本次导入的最大HostSN
int curMaxHostSN = input.Max(itm => itm.HostSN);
await _lastImportHostSNDomainService.SetCurrentImportMaxHostSN(curMaxHostSN);
ret.Status = true;
return ret;
}
/// <summary>
/// 上次导入和本次导入之间的流水号是否连续
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
private async Task<string> CheckBetweenBreakNum(List<ImportRecord> input)
{
string ret = "";
//取本次导入的最小HostSN
int curMinHostSN = input.Min(itm => itm.HostSN);
//上次导入的最大HostSN
int priorMaxHostSN = await _lastImportHostSNDomainService.GetLastImportMaxHostSN();
if (priorMaxHostSN > 0) //第一次导入时(priorMaxHostSN = 0),不需要校验两次导入之间的断号
{
if (curMinHostSN <= priorMaxHostSN + 1)
{
}
else
{
//两次导入断号提醒
ret = $"两次导入断号提醒:本次导入的最小流水号是:{curMinHostSN},上次导入的最大流水号是:{priorMaxHostSN},两者不连续\r\n";
}
}
return ret;
}
private BillM100 BuildM100Entity(ImportRecord orderItem)
{
BillM100 m100Obj = new BillM100(GuidGenerator.Create());
m100Obj.MessageFileReceiveID = orderItem.Id;
m100Obj.SerialNum = ServerHelper.VinToSN(orderItem.Vin);
m100Obj.SerialNumStr = ServerHelper.ToSerialNumStr(orderItem.OnlineTime, orderItem.HostSN);
m100Obj.HostSN = orderItem.HostSN;
m100Obj.HostSN2 = orderItem.HostSN; //流水号
m100Obj.KNR = orderItem.VehicleBodyCode;
m100Obj.VIN = orderItem.Vin;
m100Obj.AssemblyID = null;
m100Obj.OnlineTime = orderItem.OnlineTime;
m100Obj.VehicleModelCode = orderItem.VehicleModelCode.Substring(0, 2);
m100Obj.ProductLine = null;
m100Obj.Version = "";
m100Obj.ReceiveTime = ServerHelper.CurrentDateTime;
m100Obj.BillStatus = BillStatusEnum.NotMatch;
m100Obj.Description = "";
//m100Obj.OperationType = operationType;
//m100Obj.Operator = @operator;
//m100Obj.OperationTime = operationTime;
m100Obj.CanNotPrint = false;
m100Obj.NeedReplenishPrint = 0;
m100Obj.IsPartSwitch = false;
return m100Obj;
}
/// <summary>
/// 校验本次导入数据断号
/// </summary>
/// <param name="notRepeatOrder"></param>
/// <returns></returns>
private static string CheckBreakNum(ref List<ImportRecord> notRepeatOrder)
{
StringBuilder sb = new StringBuilder();
notRepeatOrder = notRepeatOrder.OrderBy(itm => itm.HostSN).ToList();
for (int curIdx = 1; curIdx < notRepeatOrder.Count; curIdx++)
{
int curVal = notRepeatOrder[curIdx].HostSN;
int priorIdx = curIdx - 1;
int priorVal = notRepeatOrder[priorIdx].HostSN;
if (curVal - priorVal != 1)
{
sb.AppendLine($"流水号{priorVal}和{curVal}之间存在断号");
}
}
return sb.ToString();
}
/// <summary>
/// 根据流水号、VIN 扣除重复导入的订单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
private async Task<List<ImportRecord>> GetNotRepeatOrder(List<ImportRecord> input)
{
List<ImportRecord> notRepeatLst = new List<ImportRecord>();
List<ImportRecord> importHistoryLst = await _importRecordRepository.GetPagedListAsync(0, 10000, "HostSN desc");
foreach (ImportRecord item in input)
{
bool hasData = importHistoryLst.Any(itm => itm.HostSN == item.HostSN && itm.Vin == item.Vin);
if (hasData)
{
}
else
{
notRepeatLst.Add(item);
}
}
return notRepeatLst;
}
/// <summary>
/// 更新车型、生产线
/// </summary>
/// <param name="billResObj"></param>
private void UpdateProductLine(BillM100 bill)
{
string ediVehicleModel = bill.VehicleModelCode; //报文车型
//车型转换:3H 转 CC
var obj1 = HQ_CacheManagerDomainService._msgToPaiGeVehicleModelList.FirstOrDefault(itm => itm.DicItemCode == ediVehicleModel);
if (obj1 != null)
{
string paigeVehicleModel = obj1.DicItemName; // CC
if (paigeVehicleModel.Contains('-')) //去掉B8L-PHEV中的-PHEV
{
paigeVehicleModel = paigeVehicleModel.Split('-')[0];
}
bill.SetVehicleModelCode(paigeVehicleModel);
//根据车型取对应生产线
var obj2 = HQ_CacheManagerDomainService._m100VehicleModelProductLineList.FirstOrDefault(itm => itm.DicItemCode == paigeVehicleModel);
if (obj2 != null)
{
string productLine = obj2.DicItemName;
bill.SetProductLine(productLine);
}
else
{
string errorMsg = $"零件生产工厂车型{paigeVehicleModel}没有对应的生产线!";
_logger.LogError(errorMsg);
}
}
else //报文车型 没有对应的 派格车型
{
string errorMsg = $"报文车型{ediVehicleModel}没有对应的零件生产工厂车型!";
_logger.LogError(errorMsg);
}
}
private async Task<RepeatM100> InsertM100RepeatBill(ImportRecord impordRec, BillM100 m100Bill)
{
RepeatM100 ret = null;
int newSN = ServerHelper.VinToSN(m100Bill.VIN);
RepeatM100 repeatBill = new RepeatM100(
GuidGenerator.Create(),
impordRec.Id,
newSN,
m100Bill.HostSN,
m100Bill.KNR,
m100Bill.VIN,
null,
m100Bill.OnlineTime,
ServerHelper.CurrentDateTime,
m100Bill.VehicleModelCode,
m100Bill.ProductLine,
((DateTime)m100Bill.OnlineTime).ToString("yyyyMM"),
BillStatusEnum.None
);
//零件子表赋值
foreach (BillM100Part m100Part in m100Bill.BillM100Parts)
{
repeatBill.AddChildObj(GuidGenerator.Create(), m100Part.PartCode, m100Part.PartNum, m100Part.Description);
}
//插入重复单据
ret = await _repeatM100Repository.InsertAsync(repeatBill, true);
return ret;
}
/// <summary>
/// 不匹配时,插入未知总成,写提醒日志
/// </summary>
/// <param name="bill"></param>
private async Task<UnknownAssembly> InsertUnknownAssembly(BillM100 bill)
{
UnknownAssembly ret = null;
try
{
//插入未知总成
UnknownAssembly unknownAssemblyObj = new UnknownAssembly(GuidGenerator.Create(), bill.Id, "M100");
//预批量赋值
unknownAssemblyObj.Description = bill.Description; //描述字段保存预批量信息
//foreach (BillM100Part billPart in bill.BillM100Parts)
//{
// unknownAssemblyObj.AddChildObj(GuidGenerator.Create(), billPart.PartCode, billPart.PartNum, billPart.Description);
//}
//var partNumSum = unknownAssemblyObj.UnknownAssemblyParts.Sum(itm => (int)itm.PartNum);
//unknownAssemblyObj.SetPartNum(partNumSum);
ret = await _unknownAssemblyRepository.InsertAsync(unknownAssemblyObj);
return ret;
}
catch (Exception ex)
{
throw new Exception($"InsertUnknownAssembly方法报错:" + ex.Message);
}
}
}
}

239
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_CacheManagerDomainService.cs

@ -0,0 +1,239 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
using Volo.Abp.Uow;
using WY.NewJit.Common;
using WY.NewJit.MsgBaseData;
using WY.NewJit.MsgCheck;
using WY.NewJit.IRepositories;
using WY.NewJit.MsgBaseData.Entitys;
namespace WY.NewJit.EdiReceive.Services
{
public partial class HQ_CacheManagerDomainService : ITransientDependency
{
#region 仓储
/// <summary>
/// 日志
/// </summary>
private ILogger<HQ_CacheManagerDomainService> _logger;
/// <summary>
/// 配置
/// </summary>
private readonly Microsoft.Extensions.Configuration.IConfiguration _configuration;
/// <summary>
/// Dapper仓储
/// </summary>
private readonly INewJitDapperRepository _newJitDapperRepository;
/// <summary>
/// 字典领域服务
/// </summary>
private readonly DicDomainService _dicDomainService;
/// <summary>
/// 跨进程全局配置领域服务
/// </summary>
private readonly GlobalSettingsDomainService _globalSettingsDomainService;
#endregion
#region 缓存
/// <summary>
/// 分组对应多个总成 清单-
/// </summary>
public static List<Group_Assembly> _groupAssemblyList = new List<Group_Assembly>();
/// <summary>
/// 结算件切换列表
/// </summary>
public static List<PartSwitch> _partSwitchList = new List<PartSwitch>();
/// <summary>
/// 报文车型VS派格车型
/// </summary>
public static List<DicItem> _msgToPaiGeVehicleModelList = new List<DicItem>();
/// <summary>
/// R100派格车型VS生产线
/// </summary>
public static List<DicItem> _r100VehicleModelProductLineList = new List<DicItem>();
/// <summary>
/// M100派格车型VS生产线
/// </summary>
public static List<DicItem> _m100VehicleModelProductLineList = new List<DicItem>();
/// <summary>
/// 结算件信息列表
/// </summary>
public static List<PartCfg> _partCfgList = new List<PartCfg>();
#endregion
#region 变量
/// <summary>
/// 错误信息前缀
/// </summary>
private string _errorMessagePrefix
{
get
{
return System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + ".";
}
}
/// <summary>
/// 上一次缓存刷新时间,和配置文件中RefreshCacheIntervalInMinutes一起使用
/// </summary>
private DateTime _lastRefreshCacheTime = DateTime.Now;
#endregion
#region 构造函数
/// <summary>
/// 构造函数
/// </summary>
public HQ_CacheManagerDomainService(
ILogger<HQ_CacheManagerDomainService> logger,
Microsoft.Extensions.Configuration.IConfiguration configuration,
INewJitDapperRepository newJitDapperRepository,
DicDomainService dicDomainService,
GlobalSettingsDomainService globalSettingsDomainService
)
{
_logger = logger;
_configuration = configuration;
_newJitDapperRepository = newJitDapperRepository;
_dicDomainService = dicDomainService;
_globalSettingsDomainService = globalSettingsDomainService;
}
#endregion
#region 方法
public bool InitLoadCache(bool forceRefresh = false)
{
bool ret = false;
try
{
if (forceRefresh == true)
{
DoInitLoadCache();
//结算件信息列表,库存系统同步过来,无法缓存
DoInitPartCfg();
ret = true;
}
else
{
bool isFirstRun = (_partCfgList.Any() == false); //第一次执行
if (isFirstRun)
{
DoInitLoadCache();
ret = true;
}
else //不是第一次执行
{
//判断是否需要刷新
bool isRefresh = _globalSettingsDomainService.GetSetting(GlobalSettingsNameEnum.);
if (isRefresh)
{
DoInitLoadCache();
_globalSettingsDomainService.SetSetting(GlobalSettingsNameEnum., false);
}
else
{
#region 10分钟自动刷新一次缓存
int refCacheInterval = _configuration["ConfigDic:RefreshCacheIntervalInMinutes"]?.TryToInt() ?? 10;
DateTime nowRefreshCacheTime = DateTime.Now;
TimeSpan ts = nowRefreshCacheTime - _lastRefreshCacheTime;
if (ts.TotalMinutes >= refCacheInterval)
{
DoInitLoadCache();
_lastRefreshCacheTime = DateTime.Now;
}
#endregion
ret = true;
}
}
//结算件信息列表,库存系统同步过来,无法缓存
DoInitPartCfg();
}
return ret;
}
catch (Exception ex)
{
string errorMsg = _errorMessagePrefix + "调用InitLoadCache方法时报错:" + ex.Message;
throw new Exception(errorMsg);
}
}
/// <summary>
/// 报文解析前加载缓存
/// </summary>
public void DoInitLoadCache()
{
//取ERP总成的零件
string group2assemblySql = @"
select g.Id as GroupId, g.GroupCode, g.VehicleModel, e.Id as ErpAssemblyId, e.ErpAssemblyCode, e.ErpAssemblyName,
g.SpecExplain, g.ColorExplain
from FisAssemblyCfgGroup g
join FisAssemblyCfgErp e on g.Id = e.GroupId
where g.IsDisable = 0 and g.IsDeleted = 0
order by g.CreationTime desc
";
var group2assemblyList = _newJitDapperRepository.GetListBySql<Group2Assembly>(group2assemblySql, true);
//转换成分组、总成 两层结构
_groupAssemblyList = group2assemblyList.GroupBy(itm => itm.GroupId).Select(itm => new Group_Assembly
{
Id = itm.Key,
GroupCode = itm.ElementAt(0).GroupCode,
SpecExplain = itm.ElementAt(0).SpecExplain,
ColorExplain = itm.ElementAt(0).ColorExplain,
AssemblyDetails = itm.Select(itm2 => new OnlyAssemblyInfo
{
Id = itm2.ErpAssemblyId,
ErpAssemblyCode = itm2.ErpAssemblyCode,
ErpAssemblyName = itm2.ErpAssemblyName
}).ToList()
}).ToList();
//结算件切换列表
string partSwitchSql = "select SourcePartCode, TargetPartCode, ActiveBeginTime, ActiveEndTime from FisPartSwitch";
_partSwitchList = _newJitDapperRepository.GetListBySql<PartSwitch>(partSwitchSql, true);
_msgToPaiGeVehicleModelList = _dicDomainService.GetDicItems(DicTypeName.);
_r100VehicleModelProductLineList = _dicDomainService.GetDicItems(DicTypeName.R100派格车型对应生产线);
_m100VehicleModelProductLineList = _dicDomainService.GetDicItems(DicTypeName.M100派格车型对应生产线);
_logger.LogDebug("重新刷新报文解析缓存!");
}
/// <summary>
/// 初始化零件基本信息
/// </summary>
private void DoInitPartCfg()
{
//结算件信息列表,库存系统同步过来,无法缓存
string partCfgSql = @"select Id, PartCode, PartName, PartType, Description, PartType2, PartType3, RelationKey from FisPartCfg where 1=1"; //,DaXiaoLiangGang,DoorPlankCode,MaterialDescription,SAPMaterialNum
_partCfgList = _newJitDapperRepository.GetListBySql<PartCfg>(partCfgSql, true);
}
#endregion
}
}

209
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs

@ -0,0 +1,209 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using WY.NewJit.PrintTable;
using WY.NewJit.Common;
namespace WY.NewJit.MsgCheck
{
public class HQ_M100DomainService : DomainService
{
/// <summary>
/// M100单据
/// </summary>
private readonly IRepository<BillM100, Guid> _billM100Repository;
/// <summary>
/// 日志
/// </summary>
private ILogger<M100CheckDomainService> _logger;
/// <summary>
/// 未打印表
/// </summary>
private readonly IRepository<WaitPrint, Guid> _waitPrintRepository;
public HQ_M100DomainService(
IRepository<BillM100, Guid> billM100Repository,
ILogger<M100CheckDomainService> logger,
IRepository<WaitPrint, Guid> waitPrintRepository
)
{
_billM100Repository = billM100Repository;
_logger = logger;
_waitPrintRepository = waitPrintRepository;
}
public async Task<BillM100> InsertM100(BillM100 m100Obj, bool autoSave = false, bool isBatchImportBreakNum = false)
{
BillM100 m100Ret = null;
if (isBatchImportBreakNum) //批量导入断号模块调用
{
//更新M100
m100Obj.HostSN2 = 0;
//M100转换成WaitPrint:一个底盘、08产线插入3条记录,其它产线插入1条记录
WaitPrint[] wpArr2 = M100ConvertToWaitPrint(m100Obj);
foreach (var wp in wpArr2)
{
wp.PrintType = PrintTypeEnum.ReplenishPrint;
//wp.HostSN2 = 0; //WaitPrint的HostSN2从m100的HostSN2取值
}
m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100
await _waitPrintRepository.InsertManyAsync(wpArr2, autoSave); //插入未打印表
return m100Ret;
}
//M100转换成WaitPrint:一个底盘、08产线插入3条记录,其它产线插入1条记录
WaitPrint[] wpArr = M100ConvertToWaitPrint(m100Obj);
m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100
await _waitPrintRepository.InsertManyAsync(wpArr, autoSave); //插入未打印表
return m100Ret;
}
private WaitPrint[] M100ConvertToWaitPrint(BillM100 m100Obj)
{
WaitPrint[] wpArr;
WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
wpArr = new WaitPrint[1] { mbRec };
return wpArr;
}
public async Task<BillM100> UpdateM100(BillM100 m100Obj, bool autoSave = false)
{
var m100Ret = await _billM100Repository.UpdateAsync(m100Obj, autoSave);
if (m100Ret != null)
{
//更新已解析状态时,只涉及门板、不涉及柱护板【柱护板一对一解析成功】
List<WaitPrint> wpLst = await _waitPrintRepository.GetListAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan);
foreach (var wp in wpLst)
{
wp.AssemblyID = m100Ret.AssemblyID;
wp.BillStatus = m100Ret.BillStatus;
}
await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave);
return m100Ret;
}
return null;
}
private WaitPrint ConvertWaitPrint(BillM100 m100Ret, BusinessTypeEnum businessType)
{
WaitPrint waitPrint = new WaitPrint(GuidGenerator.Create());
ConvertWaitPrint(m100Ret, businessType, waitPrint);
return waitPrint;
}
private void ConvertWaitPrint(BillM100 m100Ret, BusinessTypeEnum businessType, WaitPrint waitPrint)
{
waitPrint.M100Id = m100Ret.Id;
waitPrint.BusinessType = businessType;
waitPrint.ProductLine = m100Ret.ProductLine;
waitPrint.OnlineTime = (DateTime)m100Ret.OnlineTime;
waitPrint.HostSN = (int)m100Ret.HostSN;
waitPrint.KNR = m100Ret.KNR;
waitPrint.VIN = m100Ret.VIN;
waitPrint.VehicleModelCode = m100Ret.VehicleModelCode;
waitPrint.AssemblyID = m100Ret.AssemblyID;
if (businessType == BusinessTypeEnum.MenBan)
{
waitPrint.BillStatus = m100Ret.BillStatus;
}
else
{
waitPrint.BillStatus = BillStatusEnum.Match; //柱护板默认是匹配状态
}
waitPrint.PrintType = PrintTypeEnum.OrderPrint;
waitPrint.HostSN2 = (int)m100Ret.HostSN2;
waitPrint.Description = m100Ret.Description;
waitPrint.ReceiveTime = m100Ret.ReceiveTime;
waitPrint.CreationTime = ServerHelper.CurrentDateTime; //m100Ret.CreationTime;
waitPrint.CreatorId = m100Ret.CreatorId;
waitPrint.LastModificationTime = m100Ret.LastModificationTime;
waitPrint.LastModifierId = m100Ret.LastModifierId;
}
private void Set_WaitPrint(WaitPrint sourceWaitPrint, WaitPrint targetWaitPrint)
{
targetWaitPrint.M100Id = sourceWaitPrint.M100Id;
targetWaitPrint.BusinessType = sourceWaitPrint.BusinessType;
targetWaitPrint.ProductLine = sourceWaitPrint.ProductLine;
targetWaitPrint.OnlineTime = sourceWaitPrint.OnlineTime;
targetWaitPrint.HostSN = sourceWaitPrint.HostSN;
targetWaitPrint.KNR = sourceWaitPrint.KNR;
targetWaitPrint.VIN = sourceWaitPrint.VIN;
targetWaitPrint.VehicleModelCode = sourceWaitPrint.VehicleModelCode;
targetWaitPrint.AssemblyID = sourceWaitPrint.AssemblyID;
targetWaitPrint.BillStatus = sourceWaitPrint.BillStatus;
targetWaitPrint.PrintType = sourceWaitPrint.PrintType;
targetWaitPrint.HostSN2 = sourceWaitPrint.HostSN2;
targetWaitPrint.Description = sourceWaitPrint.Description;
targetWaitPrint.ReceiveTime = sourceWaitPrint.ReceiveTime;
targetWaitPrint.CreationTime = sourceWaitPrint.CreationTime;
targetWaitPrint.CreatorId = sourceWaitPrint.CreatorId;
targetWaitPrint.LastModificationTime = sourceWaitPrint.LastModificationTime;
targetWaitPrint.LastModifierId = sourceWaitPrint.LastModifierId;
}
public async Task<Dictionary<Guid, List<BillM100Part>>> GetM100PartDic(List<Guid> m100IdLst)
{
List<BillM100> m100Lst = await _billM100Repository.GetListAsync(itm => m100IdLst.Contains(itm.Id), true);
Dictionary<Guid, List<BillM100Part>> ret = m100Lst.ToDictionary(itm => itm.Id, itm2 => itm2.BillM100Parts);
return ret;
}
/// <summary>
/// 根据M100插入或更新未打印表,【未知总成重新解析时调用】
/// </summary>
/// <param name="m100Obj"></param>
/// <returns></returns>
public async Task<ObjectResultDto> InsertOrUpdateWaitPrintByM100(BillM100 m100Obj, bool autoSave = false)
{
ObjectResultDto ret = new ObjectResultDto(true, "");
List<WaitPrint> wpLst = await _waitPrintRepository.GetListAsync(itm => itm.VIN == m100Obj.VIN && itm.BusinessType == BusinessTypeEnum.MenBan);
bool hasData = wpLst.Count > 0;
if (hasData) //未打印表有数据
{
foreach (WaitPrint wp in wpLst)
{
wp.AssemblyID = m100Obj.AssemblyID;
wp.BillStatus = m100Obj.BillStatus;
}
await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave);
}
else //未打印表没有数据
{
WaitPrint[] wpArr;
if (m100Obj.ProductLine == "08")
{
WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
//WaitPrint zhbOtherRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.OtherZhuHuBan);
//WaitPrint zhbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.AC_ZhuHuBan);
//wpArr = new WaitPrint[3] { mbRec, zhbOtherRec, zhbRec };
wpArr = new WaitPrint[1] { mbRec };
}
else
{
WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
wpArr = new WaitPrint[1] { mbRec };
}
foreach (WaitPrint wp in wpArr)
{
wp.PrintType = PrintTypeEnum.ReplenishPrint;
}
await _waitPrintRepository.InsertManyAsync(wpArr, autoSave); //插入未打印表
}
return ret;
}
}
}

102
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/LastImportHostSNDomainService.cs

@ -0,0 +1,102 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using WY.NewJit.EdiReceive.Entitys;
using WY.NewJit.IRepositories;
using WY.NewJit.MsgBaseData;
using WY.NewJit.MsgCheck;
namespace WY.NewJit.EdiReceive.Services
{
public class LastImportHostSNDomainService : DomainService
{
#region 成员
/// <summary>
/// 日志
/// </summary>
private readonly ILogger<LastImportHostSNDomainService> _logger;
/// <summary>
/// Dapper仓储
/// </summary>
private readonly INewJitDapperRepository _newJitDapperRepository;
/// <summary>
/// 字典领域服务
/// </summary>
private readonly DicDomainService _dicDomainService;
/// <summary>
/// 零件仓储
/// </summary>
private readonly IRepository<ImportRecord, Guid> _importRecordRepository;
/// <summary>
/// M100单据
/// </summary>
private readonly IRepository<BillM100, Guid> _billM100Repository;
private readonly IRepository<LastImportHostSN, Guid> _lastImportHostSNRepository;
#endregion
public LastImportHostSNDomainService(ILogger<LastImportHostSNDomainService> logger, INewJitDapperRepository newJitDapperRepository, DicDomainService dicDomainService, IRepository<ImportRecord, Guid> importRecordRepository, IRepository<BillM100, Guid> billM100Repository, IRepository<LastImportHostSN, Guid> lastImportHostSNRepository)
{
_logger = logger;
_newJitDapperRepository = newJitDapperRepository;
_dicDomainService = dicDomainService;
_importRecordRepository = importRecordRepository;
_billM100Repository = billM100Repository;
_lastImportHostSNRepository = lastImportHostSNRepository;
}
/// <summary>
/// 假设:产线之间的流水号都是唯一的
/// </summary>
/// <param name="productLine"></param>
/// <returns></returns>
public async Task<int> GetLastImportMaxHostSN()
{
var lst = await _lastImportHostSNRepository.GetListAsync();
if (lst.Count > 0)
{
return lst[0].HostSN;
}
else
{
bool hasData = await _importRecordRepository.AnyAsync();
if (hasData)
{
int maxSN = await _importRecordRepository.MaxAsync(itm => itm.HostSN);
return maxSN;
}
else
{
return 0;
}
}
}
public async Task SetCurrentImportMaxHostSN(int maxHostSN)
{
var obj = await _lastImportHostSNRepository.FirstOrDefaultAsync();
if (obj != null)
{
obj.HostSN = maxHostSN;
await _lastImportHostSNRepository.UpdateAsync(obj, true);
}
else
{
LastImportHostSN newObj = new LastImportHostSN(GuidGenerator.Create());
newObj.HostSN = maxHostSN;
var insRet = await _lastImportHostSNRepository.InsertAsync(newObj);
}
}
}
}

10
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Entitys/AssemblyCfgErp.cs

@ -52,6 +52,16 @@ namespace WY.NewJit.MsgBaseData
/// </summary>
public virtual Guid GroupId { get; set; }
/// <summary>
/// 规格说明
/// </summary>
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明
/// </summary>
public virtual string ColorExplain { get; set; }
/// <summary>
/// 结算件列表
/// </summary>

11
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Entitys/AssemblyCfgGroup.cs

@ -27,6 +27,17 @@ namespace WY.NewJit.MsgBaseData
/// </summary>
public virtual bool IsDisable { get; set; }
/// <summary>
/// 规格说明
/// </summary>
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明
/// </summary>
public virtual string ColorExplain { get; set; }
private AssemblyCfgGroup()
{
}

17
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Entitys/BaseConfig.cs

@ -12,6 +12,19 @@ namespace WY.NewJit.MsgBaseData
/// </summary>
public class BaseConfig : AggregateRoot<Guid>
{
public BaseConfig()
{
}
public BaseConfig(Guid id ,string paramName, string paramValue, bool state, string remark):base(id)
{
ParamName = paramName;
ParamValue = paramValue;
State = state;
Remark = remark;
}
/// <summary>
/// 参数名称
/// </summary>
@ -21,9 +34,9 @@ namespace WY.NewJit.MsgBaseData
/// </summary>
public virtual string ParamValue { get; set; }
/// <summary>
/// 状态
/// 是否启用
/// </summary>
public virtual int State { get; set; }
public virtual bool State { get; set; }
/// <summary>
/// 备注
/// </summary>

52
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Entitys/Group_Assembly_Part.cs

@ -28,6 +28,34 @@ namespace WY.NewJit.MsgBaseData.Entitys
}
public class Group_Assembly
{
public virtual Guid Id { get; set; }
/// <summary>
/// SAP分组编码(对应SAP的长描述或补充备注)
/// </summary>
public virtual string GroupCode { get; set; }
/// <summary>
/// 规格说明
/// </summary>
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明
/// </summary>
public virtual string ColorExplain { get; set; }
public List<OnlyAssemblyInfo> AssemblyDetails;
public Group_Assembly()
{
AssemblyDetails = new List<OnlyAssemblyInfo>();
}
}
public class AssemblyInfo
{
/// <summary>
@ -49,6 +77,30 @@ namespace WY.NewJit.MsgBaseData.Entitys
}
public class OnlyAssemblyInfo
{
/// <summary>
/// Erp总成ID
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Erp总成编码
/// </summary>
public string ErpAssemblyCode { get; set; }
/// <summary>
/// Erp总成编码
/// </summary>
public string ErpAssemblyName { get; set; }
public OnlyAssemblyInfo()
{
}
}
public class PartInfo
{
/// <summary>

23
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Services/BaseGonfigDomainService.cs

@ -10,6 +10,8 @@ namespace WY.NewJit.MsgBaseData
{
public class BaseGonfigDomainService : DomainService
{
private static List<BaseConfig> _baseConfigdCaches = new List<BaseConfig>();//记录缓存
private readonly IRepository<BaseConfig, Guid> _repository;
public BaseGonfigDomainService(IRepository<BaseConfig, Guid> repository)
@ -17,6 +19,27 @@ namespace WY.NewJit.MsgBaseData
_repository = repository;
}
/// <summary>
/// 更新记录和内存
/// </summary>
/// <returns></returns>
public async Task<ObjectResultDto> UpdateBaseConfigCache()
{
ObjectResultDto ret = new ObjectResultDto(true, null);
_baseConfigdCaches.Clear();//清空缓存
_baseConfigdCaches = await _repository.GetListAsync();
return ret;
}
/// <summary>
/// 根据名称获取参数
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public BaseConfig GetCachesByName(string name)
{
var item = _baseConfigdCaches.FirstOrDefault(r => r.ParamName == name);
return item;
}
}
}

16
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillM100.cs

@ -17,7 +17,7 @@ namespace WY.NewJit.MsgCheck
/// <summary>
/// 报文接收ID,对应报文接收表主键
/// </summary>
public virtual Guid? MessageFileReceiveID { get; protected set; }
public virtual Guid? MessageFileReceiveID { get; set; }
/// <summary>
/// 流水号#
@ -49,7 +49,7 @@ namespace WY.NewJit.MsgCheck
/// <summary>
/// 车型代码(取通用字典)
/// </summary>
public virtual string VehicleModelCode { get; protected set; }
public virtual string VehicleModelCode { get; set; }
/// <summary>
/// 生产线(派格按生产线分类)
@ -59,17 +59,17 @@ namespace WY.NewJit.MsgCheck
/// <summary>
/// 版本
/// </summary>
public virtual string Version { get; protected set; }
public virtual string Version { get; set; }
/// <summary>
/// 接收时间
/// </summary>
public virtual DateTime? ReceiveTime { get; protected set; }
public virtual DateTime? ReceiveTime { get; set; }
/// <summary>
/// 单据状态(0 空;1 未匹配;2 已匹配未打印;3 已打印)
/// </summary>
public virtual BillStatusEnum BillStatus { get; protected set; }
public virtual BillStatusEnum BillStatus { get; set; }
/// <summary>
/// 描述
@ -142,9 +142,9 @@ namespace WY.NewJit.MsgCheck
//因为它会被来自数据库的值覆盖.可能不适用于私有构造函数.
}
//protected BillM100(Guid id)
// :base(id)
//{ }
public BillM100(Guid id)
: base(id)
{ }
//public BillM100(Guid id, Guid? messageFileReceiveID, int? serialNum, int? hostSN, string kNR, string vIN, Guid? assemblyID, DateTime? onlineTime, string vehicleModelCode, string version, DateTime? receiveTime, BillStatusEnum billStatus)
// : base(id)

3
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs

@ -15,6 +15,9 @@ using WY.NewJit.PrintTable;
namespace WY.NewJit.MsgCheck
{
/// <summary>
/// 吕志斌开发的生成断号数据
/// </summary>
[Dependency(Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton, ReplaceServices = true)]
public class BillNumberRecordDomainService : DomainService
{

5
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/CacheManagerDomainService.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging;
/*
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@ -301,6 +302,8 @@ namespace WY.NewJit.MsgCheck
}
}
*/
/*
private readonly CacheManagerDomainService _cacheManagerDomainService;
CacheManagerDomainService cacheManagerDomainService

345
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs

@ -43,102 +43,7 @@ namespace WY.NewJit.MsgCheck
_billNumRecDomainSrv = billNumRecDomainSrv;
}
public async Task<BillM100> InsertM100(BillM100 m100Obj, bool autoSave = false, bool isBatchImportBreakNum = false)
{
BillM100 m100Ret = null;
if (isBatchImportBreakNum) //批量导入断号模块调用
{
//更新M100
m100Obj.HostSN2 = 0;
//M100转换成WaitPrint:一个底盘、08产线插入3条记录,其它产线插入1条记录
WaitPrint[] wpArr2 = M100ConvertToWaitPrint(m100Obj);
foreach (var wp in wpArr2)
{
wp.PrintType = PrintTypeEnum.ReplenishPrint;
//wp.HostSN2 = 0; //WaitPrint的HostSN2从m100的HostSN2取值
}
m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100
await _waitPrintRepository.InsertManyAsync(wpArr2, autoSave); //插入未打印表
return m100Ret;
}
//调用HostSN2方法
BillNumberRecord billNumRec = await _billNumRecDomainSrv.GetBillNumber(m100Obj.HostSN.TryToIntNotNull(), m100Obj.ProductLine);
var normalObj = billNumRec.Datas.FirstOrDefault(itm => itm.BillNumberType == BillNumberTypeEnum.);
var lateObj = billNumRec.Datas.FirstOrDefault(itm => itm.BillNumberType == BillNumberTypeEnum.);
var breakNumLst = billNumRec.Datas.Where(itm => itm.BillNumberType == BillNumberTypeEnum.).ToList();
//更新M100
m100Obj.HostSN2 = normalObj != null ? normalObj.HostSN2 : lateObj.HostSN2;
//M100转换成WaitPrint:一个底盘、08产线插入3条记录,其它产线插入1条记录
WaitPrint[] wpArr = M100ConvertToWaitPrint(m100Obj);
//处理断号
if (breakNumLst.Count > 0)
{
List<WaitPrint> waitPrintBreakNumLst = new List<WaitPrint>();
foreach (var sourceWaitPrint in wpArr) //遍历门板、柱护板、其它柱护板
{
foreach (var breaknum in breakNumLst) //遍历断号
{
WaitPrint targetWaitPrint = new WaitPrint(GuidGenerator.Create());
targetWaitPrint.M100Id = Guid.Parse("00000000-0000-0000-0000-000000000000");
targetWaitPrint.BusinessType = sourceWaitPrint.BusinessType;
targetWaitPrint.ProductLine = sourceWaitPrint.ProductLine;
targetWaitPrint.OnlineTime = sourceWaitPrint.OnlineTime;
targetWaitPrint.HostSN = breaknum.HostSN;
targetWaitPrint.KNR = null;
targetWaitPrint.VIN = null;
targetWaitPrint.VehicleModelCode = null;
targetWaitPrint.AssemblyID = null;
targetWaitPrint.BillStatus = BillStatusEnum.BreakNum;
targetWaitPrint.PrintType = PrintTypeEnum.OrderPrint;
targetWaitPrint.HostSN2 = breaknum.HostSN2;
targetWaitPrint.Description = null;
targetWaitPrint.ReceiveTime = null;
targetWaitPrint.CreationTime = ServerHelper.CurrentDateTime;
//targetWaitPrint.CreatorId = null;
//targetWaitPrint.LastModificationTime = null;
//targetWaitPrint.LastModifierId = null;
waitPrintBreakNumLst.Add(targetWaitPrint);
}
}
await _waitPrintRepository.InsertManyAsync(waitPrintBreakNumLst, autoSave); //插入断号
}
//处理正常、迟到
if (normalObj != null) //正常
{
m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100
await _waitPrintRepository.InsertManyAsync(wpArr, autoSave); //插入未打印表
}
else if (lateObj != null) //迟到
{
m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100
foreach (var item in wpArr) //遍历门板、柱护板、其它柱护板
{
var insObj = await _waitPrintRepository.FirstOrDefaultAsync(itm =>
itm.HostSN2 == m100Obj.HostSN2
&& itm.BillStatus == BillStatusEnum.BreakNum
&& itm.BusinessType == item.BusinessType);
if (insObj != null)
{
//如果未打印表有对应断号记录,将迟到记录与之合并
Set_WaitPrint(item, insObj);
var updateRet = await _waitPrintRepository.UpdateAsync(insObj);
}
else
{
//如果未打印表没有----对应断号记录,则插入
item.PrintType = PrintTypeEnum.ReplenishPrint;
var insertRet = await _waitPrintRepository.InsertAsync(item, autoSave);
}
}
}
return m100Ret;
}
/*
private WaitPrint[] M100ConvertToWaitPrint(BillM100 m100Obj)
{
WaitPrint[] wpArr;
@ -158,40 +63,6 @@ namespace WY.NewJit.MsgCheck
return wpArr;
}
public async Task<BillM100> UpdateM100(BillM100 m100Obj, bool autoSave = false)
{
var m100Ret = await _billM100Repository.UpdateAsync(m100Obj, autoSave);
if (m100Ret != null)
{
//if (m100Obj.ProductLine == "08")
//{
// //更新已解析状态时,只涉及门板、2条柱护板
// WaitPrint mbRec = await _waitPrintRepository.GetAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan);
// ConvertWaitPrint(m100Ret, BusinessTypeEnum.MenBan, mbRec);
// await _waitPrintRepository.UpdateAsync(mbRec);
//}
//else
//{
// WaitPrint mbRec = await _waitPrintRepository.GetAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan);
// ConvertWaitPrint(m100Ret, BusinessTypeEnum.MenBan, mbRec);
// await _waitPrintRepository.UpdateAsync(mbRec);
//}
//更新已解析状态时,只涉及门板、不涉及柱护板【柱护板一对一解析成功】
List<WaitPrint> wpLst = await _waitPrintRepository.GetListAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan);
foreach (var wp in wpLst)
{
wp.AssemblyID = m100Ret.AssemblyID;
wp.BillStatus = m100Ret.BillStatus;
}
await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave);
return m100Ret;
}
return null;
}
private WaitPrint ConvertWaitPrint(BillM100 m100Ret, BusinessTypeEnum businessType)
{
WaitPrint waitPrint = new WaitPrint(GuidGenerator.Create());
@ -249,12 +120,148 @@ namespace WY.NewJit.MsgCheck
targetWaitPrint.LastModificationTime = sourceWaitPrint.LastModificationTime;
targetWaitPrint.LastModifierId = sourceWaitPrint.LastModifierId;
}
*/
public async Task<BillM100> InsertM100(BillM100 m100Obj, bool autoSave = false, bool isBatchImportBreakNum = false)
{
throw new NotImplementedException();
//BillM100 m100Ret = null;
//if (isBatchImportBreakNum) //批量导入断号模块调用
//{
// //更新M100
// m100Obj.HostSN2 = 0;
// //M100转换成WaitPrint:一个底盘、08产线插入3条记录,其它产线插入1条记录
// WaitPrint[] wpArr2 = M100ConvertToWaitPrint(m100Obj);
// foreach (var wp in wpArr2)
// {
// wp.PrintType = PrintTypeEnum.ReplenishPrint;
// //wp.HostSN2 = 0; //WaitPrint的HostSN2从m100的HostSN2取值
// }
// m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100
// await _waitPrintRepository.InsertManyAsync(wpArr2, autoSave); //插入未打印表
// return m100Ret;
//}
////调用HostSN2方法
//BillNumberRecord billNumRec = await _billNumRecDomainSrv.GetBillNumber(m100Obj.HostSN.TryToIntNotNull(), m100Obj.ProductLine);
//var normalObj = billNumRec.Datas.FirstOrDefault(itm => itm.BillNumberType == BillNumberTypeEnum.正常);
//var lateObj = billNumRec.Datas.FirstOrDefault(itm => itm.BillNumberType == BillNumberTypeEnum.迟到);
//var breakNumLst = billNumRec.Datas.Where(itm => itm.BillNumberType == BillNumberTypeEnum.断号).ToList();
////更新M100
//m100Obj.HostSN2 = normalObj != null ? normalObj.HostSN2 : lateObj.HostSN2;
////M100转换成WaitPrint:一个底盘、08产线插入3条记录,其它产线插入1条记录
//WaitPrint[] wpArr = M100ConvertToWaitPrint(m100Obj);
////处理断号
//if (breakNumLst.Count > 0)
//{
// List<WaitPrint> waitPrintBreakNumLst = new List<WaitPrint>();
// foreach (var sourceWaitPrint in wpArr) //遍历门板、柱护板、其它柱护板
// {
// foreach (var breaknum in breakNumLst) //遍历断号
// {
// WaitPrint targetWaitPrint = new WaitPrint(GuidGenerator.Create());
// targetWaitPrint.M100Id = Guid.Parse("00000000-0000-0000-0000-000000000000");
// targetWaitPrint.BusinessType = sourceWaitPrint.BusinessType;
// targetWaitPrint.ProductLine = sourceWaitPrint.ProductLine;
// targetWaitPrint.OnlineTime = sourceWaitPrint.OnlineTime;
// targetWaitPrint.HostSN = breaknum.HostSN;
// targetWaitPrint.KNR = null;
// targetWaitPrint.VIN = null;
// targetWaitPrint.VehicleModelCode = null;
// targetWaitPrint.AssemblyID = null;
// targetWaitPrint.BillStatus = BillStatusEnum.BreakNum;
// targetWaitPrint.PrintType = PrintTypeEnum.OrderPrint;
// targetWaitPrint.HostSN2 = breaknum.HostSN2;
// targetWaitPrint.Description = null;
// targetWaitPrint.ReceiveTime = null;
// targetWaitPrint.CreationTime = ServerHelper.CurrentDateTime;
// //targetWaitPrint.CreatorId = null;
// //targetWaitPrint.LastModificationTime = null;
// //targetWaitPrint.LastModifierId = null;
// waitPrintBreakNumLst.Add(targetWaitPrint);
// }
// }
// await _waitPrintRepository.InsertManyAsync(waitPrintBreakNumLst, autoSave); //插入断号
//}
////处理正常、迟到
//if (normalObj != null) //正常
//{
// m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100
// await _waitPrintRepository.InsertManyAsync(wpArr, autoSave); //插入未打印表
//}
//else if (lateObj != null) //迟到
//{
// m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100
// foreach (var item in wpArr) //遍历门板、柱护板、其它柱护板
// {
// var insObj = await _waitPrintRepository.FirstOrDefaultAsync(itm =>
// itm.HostSN2 == m100Obj.HostSN2
// && itm.BillStatus == BillStatusEnum.BreakNum
// && itm.BusinessType == item.BusinessType);
// if (insObj != null)
// {
// //如果未打印表有对应断号记录,将迟到记录与之合并
// Set_WaitPrint(item, insObj);
// var updateRet = await _waitPrintRepository.UpdateAsync(insObj);
// }
// else
// {
// //如果未打印表没有----对应断号记录,则插入
// item.PrintType = PrintTypeEnum.ReplenishPrint;
// var insertRet = await _waitPrintRepository.InsertAsync(item, autoSave);
// }
// }
//}
//return m100Ret;
}
public async Task<BillM100> UpdateM100(BillM100 m100Obj, bool autoSave = false)
{
throw new NotImplementedException();
//var m100Ret = await _billM100Repository.UpdateAsync(m100Obj, autoSave);
//if (m100Ret != null)
//{
// //if (m100Obj.ProductLine == "08")
// //{
// // //更新已解析状态时,只涉及门板、2条柱护板
// // WaitPrint mbRec = await _waitPrintRepository.GetAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan);
// // ConvertWaitPrint(m100Ret, BusinessTypeEnum.MenBan, mbRec);
// // await _waitPrintRepository.UpdateAsync(mbRec);
// //}
// //else
// //{
// // WaitPrint mbRec = await _waitPrintRepository.GetAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan);
// // ConvertWaitPrint(m100Ret, BusinessTypeEnum.MenBan, mbRec);
// // await _waitPrintRepository.UpdateAsync(mbRec);
// //}
// //更新已解析状态时,只涉及门板、不涉及柱护板【柱护板一对一解析成功】
// List<WaitPrint> wpLst = await _waitPrintRepository.GetListAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan);
// foreach (var wp in wpLst)
// {
// wp.AssemblyID = m100Ret.AssemblyID;
// wp.BillStatus = m100Ret.BillStatus;
// }
// await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave);
// return m100Ret;
//}
//return null;
}
public async Task<Dictionary<Guid, List<BillM100Part>>> GetM100PartDic(List<Guid> m100IdLst)
{
List<BillM100> m100Lst = await _billM100Repository.GetListAsync(itm => m100IdLst.Contains(itm.Id), true);
Dictionary<Guid, List<BillM100Part>> ret = m100Lst.ToDictionary(itm => itm.Id, itm2 => itm2.BillM100Parts);
return ret;
throw new NotImplementedException();
//List<BillM100> m100Lst = await _billM100Repository.GetListAsync(itm => m100IdLst.Contains(itm.Id), true);
//Dictionary<Guid, List<BillM100Part>> ret = m100Lst.ToDictionary(itm => itm.Id, itm2 => itm2.BillM100Parts);
//return ret;
}
/// <summary>
@ -264,41 +271,43 @@ namespace WY.NewJit.MsgCheck
/// <returns></returns>
public async Task<ObjectResultDto> InsertOrUpdateWaitPrintByM100(BillM100 m100Obj, bool autoSave = false)
{
ObjectResultDto ret = new ObjectResultDto(true, "");
List<WaitPrint> wpLst = await _waitPrintRepository.GetListAsync(itm => itm.VIN == m100Obj.VIN && itm.BusinessType == BusinessTypeEnum.MenBan);
bool hasData = wpLst.Count > 0;
if (hasData) //未打印表有数据
{
foreach (WaitPrint wp in wpLst)
{
wp.AssemblyID = m100Obj.AssemblyID;
wp.BillStatus = m100Obj.BillStatus;
}
await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave);
}
else //未打印表没有数据
{
WaitPrint[] wpArr;
if (m100Obj.ProductLine == "08")
{
WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
//WaitPrint zhbOtherRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.OtherZhuHuBan);
//WaitPrint zhbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.AC_ZhuHuBan);
//wpArr = new WaitPrint[3] { mbRec, zhbOtherRec, zhbRec };
wpArr = new WaitPrint[1] { mbRec };
}
else
{
WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
wpArr = new WaitPrint[1] { mbRec };
}
foreach (WaitPrint wp in wpArr)
{
wp.PrintType = PrintTypeEnum.ReplenishPrint;
}
await _waitPrintRepository.InsertManyAsync(wpArr, autoSave); //插入未打印表
}
return ret;
throw new NotImplementedException();
//ObjectResultDto ret = new ObjectResultDto(true, "");
//List<WaitPrint> wpLst = await _waitPrintRepository.GetListAsync(itm => itm.VIN == m100Obj.VIN && itm.BusinessType == BusinessTypeEnum.MenBan);
//bool hasData = wpLst.Count > 0;
//if (hasData) //未打印表有数据
//{
// foreach (WaitPrint wp in wpLst)
// {
// wp.AssemblyID = m100Obj.AssemblyID;
// wp.BillStatus = m100Obj.BillStatus;
// }
// await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave);
//}
//else //未打印表没有数据
//{
// WaitPrint[] wpArr;
// if (m100Obj.ProductLine == "08")
// {
// WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
// //WaitPrint zhbOtherRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.OtherZhuHuBan);
// //WaitPrint zhbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.AC_ZhuHuBan);
// //wpArr = new WaitPrint[3] { mbRec, zhbOtherRec, zhbRec };
// wpArr = new WaitPrint[1] { mbRec };
// }
// else
// {
// WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
// wpArr = new WaitPrint[1] { mbRec };
// }
// foreach (WaitPrint wp in wpArr)
// {
// wp.PrintType = PrintTypeEnum.ReplenishPrint;
// }
// await _waitPrintRepository.InsertManyAsync(wpArr, autoSave); //插入未打印表
//}
//return ret;
}
}
}

42
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/R100CheckDomainService.cs

@ -991,6 +991,48 @@ namespace WY.NewJit.MsgCheck
}
[Serializable]
public class Group2Assembly
{
/// <summary>
/// 分组Id, 对应总成分组表Id
/// </summary>
public Guid GroupId { get; set; }
/// <summary>
/// 分组代码
/// </summary>
public string GroupCode { get; set; }
/// <summary>
/// Erp总成ID
/// </summary>
public Guid ErpAssemblyId { get; set; }
/// <summary>
/// Erp总成编码
/// </summary>
public string ErpAssemblyCode { get; set; }
/// <summary>
/// Erp总成名称
/// </summary>
public string ErpAssemblyName { get; set; }
/// <summary>
/// 规格说明
/// </summary>
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明
/// </summary>
public virtual string ColorExplain { get; set; }
}
public class ErpAssemblyMain
{
public Guid Id { get; set; }

1
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/WY.NewJit.Domain.csproj

@ -30,7 +30,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="EdiReceive\Services\" />
<Folder Include="MsgConversion\Services\" />
<Folder Include="MsgTransmission\Services\" />
</ItemGroup>

6126
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240110033428_NewJitPG_HQ_0110.Designer.cs

File diff suppressed because it is too large

41
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240110033428_NewJitPG_HQ_0110.cs

@ -0,0 +1,41 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace WY.NewJit.Migrations
{
public partial class NewJitPG_HQ_0110 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "FisBaseConfig",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ParamName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ParamValue = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
State = table.Column<int>(type: "int", precision: 1, nullable: false),
Remark = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_FisBaseConfig", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_FisBaseConfig_ParamName",
table: "FisBaseConfig",
column: "ParamName",
unique: true,
filter: "[ParamName] IS NOT NULL");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "FisBaseConfig");
}
}
}

6132
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115023640_NewJitPG_HQ_Init.Designer.cs

File diff suppressed because it is too large

33
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115023640_NewJitPG_HQ_Init.cs

@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace WY.NewJit.Migrations
{
public partial class NewJitPG_HQ_Init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ColorExplain",
table: "FisAssemblyCfgErp",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SpecExplain",
table: "FisAssemblyCfgErp",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ColorExplain",
table: "FisAssemblyCfgErp");
migrationBuilder.DropColumn(
name: "SpecExplain",
table: "FisAssemblyCfgErp");
}
}
}

6134
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115024450_NewJitPG_HQ_Init2.Designer.cs

File diff suppressed because it is too large

53
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115024450_NewJitPG_HQ_Init2.cs

@ -0,0 +1,53 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace WY.NewJit.Migrations
{
public partial class NewJitPG_HQ_Init2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "SpecExplain",
table: "FisAssemblyCfgErp",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ColorExplain",
table: "FisAssemblyCfgErp",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "SpecExplain",
table: "FisAssemblyCfgErp",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ColorExplain",
table: "FisAssemblyCfgErp",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true);
}
}
}

6142
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115055730_NewJitPG_HQ_Init3.Designer.cs

File diff suppressed because it is too large

35
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/20240115055730_NewJitPG_HQ_Init3.cs

@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace WY.NewJit.Migrations
{
public partial class NewJitPG_HQ_Init3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ColorExplain",
table: "FisAssemblyCfgGroup",
type: "varchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SpecExplain",
table: "FisAssemblyCfgGroup",
type: "varchar(50)",
maxLength: 50,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ColorExplain",
table: "FisAssemblyCfgGroup");
migrationBuilder.DropColumn(
name: "SpecExplain",
table: "FisAssemblyCfgGroup");
}
}
}

57
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore.DbMigrations/Migrations/NewJitMigrationsDbContextModelSnapshot.cs

@ -3287,6 +3287,10 @@ namespace WY.NewJit.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ColorExplain")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
@ -3351,6 +3355,10 @@ namespace WY.NewJit.Migrations
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("SpecExplain")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("VehicleModel")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
@ -3366,6 +3374,10 @@ namespace WY.NewJit.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ColorExplain")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
@ -3413,6 +3425,10 @@ namespace WY.NewJit.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("SpecExplain")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("VehicleModel")
.HasColumnType("nvarchar(max)");
@ -3619,6 +3635,47 @@ namespace WY.NewJit.Migrations
b.ToTable("FisAssemblyCfgVehicleChild");
});
modelBuilder.Entity("WY.NewJit.MsgBaseData.BaseConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("ParamName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ParamValue")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<int>("State")
.HasPrecision(1)
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ParamName")
.IsUnique()
.HasFilter("[ParamName] IS NOT NULL");
b.ToTable("FisBaseConfig");
});
modelBuilder.Entity("WY.NewJit.MsgBaseData.DicItem", b =>
{
b.Property<Guid>("Id")

8
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore/EntityFrameworkCore/NewJitDbContextModelCreatingExtensions.cs

@ -73,8 +73,8 @@ namespace WY.NewJit.EntityFrameworkCore
b.Property(itm => itm.VehicleModel).HasColumnType("varchar").HasMaxLength(50);
b.Property(itm => itm.RelationKey).HasColumnType("varchar").HasMaxLength(50);
b.Property(itm => itm.GroupCode).HasColumnType("varchar").HasMaxLength(100);
b.Property(itm => itm.SpecExplain).HasColumnType("varchar").HasMaxLength(50);
b.Property(itm => itm.ColorExplain).HasColumnType("varchar").HasMaxLength(50);
});
builder.Entity<AssemblyCfgGroup>(b =>
@ -83,6 +83,9 @@ namespace WY.NewJit.EntityFrameworkCore
b.ConfigureByConvention();//配置/映射继承的属性,应始终对你所有的实体使用它
b.Property(itm => itm.GroupCode).HasColumnType("varchar").HasMaxLength(100);
b.Property(itm => itm.SpecExplain).HasColumnType("varchar").HasMaxLength(50);
b.Property(itm => itm.ColorExplain).HasColumnType("varchar").HasMaxLength(50);
});
@ -169,7 +172,6 @@ namespace WY.NewJit.EntityFrameworkCore
b.ConfigureByConvention();//配置/映射继承的属性,应始终对你所有的实体使用它
b.Property("ParamName").HasMaxLength(50);
b.Property("ParamValue").HasMaxLength(50);
b.Property("State").HasPrecision(1);
b.Property("Remark").HasMaxLength(500);
b.HasIndex(x => new { x.ParamName}).IsUnique();
});

Loading…
Cancel
Save