Browse Source

喷涂叫料

dev_DY_CC
赵新宇 1 year ago
parent
commit
0a241536e6
  1. BIN
      .vs/WZC2/v17/.wsuo
  2. 4
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentLocAppService.cs
  3. 27
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobPermissions.cs
  4. 46
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/DTOs/CoatingIssueJobDTO.cs
  5. 112
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/DTOs/CoatingIssueJobDetailDTO.cs
  6. 26
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/ICoatingIssueJobAppService.cs
  7. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/Inputs/CoatingIssueJobCheckInput.cs
  8. 134
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/Inputs/CoatingIssueJobDetailInput.cs
  9. 82
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/Inputs/CoatingIssueJobEditInput.cs
  10. 30
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotePermissions.cs
  11. 54
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/DTOs/CoatingIssueNoteDTO.cs
  12. 42
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/DTOs/CoatingIssueNoteDetailDTO.cs
  13. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/ICoatingIssueNoteAppService.cs
  14. 53
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/Inputs/CoatingIssueNoteDetailInput.cs
  15. 63
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/Inputs/CoatingIssueNoteEditInput.cs
  16. 33
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/Inputs/CoatingIssueNoteImportInput.cs
  17. 27
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/CoatingMaterialRequestPermissions.cs
  18. 37
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/DTOs/CoatingMaterialRequestDTO.cs
  19. 94
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/DTOs/CoatingMaterialRequestDetailDTO.cs
  20. 35
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/ICoatingMaterialRequestAppService.cs
  21. 85
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/CoatingMaterialRequestDetailInput.cs
  22. 58
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/CoatingMaterialRequestEditInput.cs
  23. 53
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/CoatingMaterialRequestImportInput.cs
  24. 280
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobAppService.cs
  25. 30
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobAutoMapperProfile.cs
  26. 132
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNoteAppService.cs
  27. 31
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNoteAutoMapperProfile.cs
  28. 519
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequestAppService.cs
  29. 74
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequestAutoMapperProfile.cs
  30. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs
  31. 84
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJob.cs
  32. 108
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobDetail.cs
  33. 103
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobManager.cs
  34. 10
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/ICoatingIssueJobManager.cs
  35. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/ICoatingIssueJobRepository.cs
  36. 54
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/ICoatingssueExtension.cs
  37. 77
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNote.cs
  38. 43
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNoteDetail.cs
  39. 42
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNoteManager.cs
  40. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNoteRepository.cs
  41. 10
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/ICoatingIssueNoteManager.cs
  42. 48
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequest.cs
  43. 104
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequestDetail.cs
  44. 307
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequestManager.cs
  45. 16
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/ICoatingMaterialRequestManager.cs
  46. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/ICoatingMaterialRequestRepository.cs
  47. 69
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJobDbContextModelCreatingExtensions.cs
  48. 11
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJobEfCoreRepository.cs
  49. 62
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/CoatingIssueNoteDbContextModelCreatingExtensions.cs
  50. 11
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/CoatingIssueNoteEfCoreRepository.cs
  51. 64
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/CoatingMaterialRequestDbContextModelCreatingExtensions.cs
  52. 11
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/CoatingMaterialRequestEfCoreRepository.cs
  53. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs

BIN
.vs/WZC2/v17/.wsuo

Binary file not shown.

4
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentLocAppService.cs

@ -106,8 +106,8 @@ public class EquipmentLocAppService
protected override async Task ValidateImportModelAsync(EquipmentLocImportInput importInput, List<ValidationResult> validationRresult)
{
await base.CheckItemBasicItemCodeAsync(importInput.Code, validationRresult).ConfigureAwait(false);
await base.CheckRawLocationAsync(importInput.LocCode, validationRresult).ConfigureAwait(false);
//await base.CheckComponentAndComponentQtyAsync(importInput.Component, importInput.ComponentQty, validationRresult).ConfigureAwait(false);
await base.CheckProductLocationAsync(importInput.LocCode, validationRresult).ConfigureAwait(false);
}

27
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobPermissions.cs

@ -0,0 +1,27 @@
using Volo.Abp.Authorization.Permissions;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public static class CoatingIssueJobPermissions
{
public const string Default = StorePermissions.GroupName + "." + nameof(IssueJob);
public const string Create = Default + "." + StorePermissions.CreateStr;
public const string Update = Default + "." + StorePermissions.UpdateStr;
public const string Delete = Default + "." + StorePermissions.DeleteStr;
//自动发料任务
public const string AutoIssueJob = StorePermissions.GroupName + "." + nameof(AutoIssueJob);
public static void AddCoatingIssueJobPermission(this PermissionGroupDefinition permissionGroup)
{
var IssueJobPermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(IssueJob)));
IssueJobPermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr));
IssueJobPermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr));
IssueJobPermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr));
permissionGroup.AddPermission(AutoIssueJob, StorePermissionDefinitionProvider.L(nameof(AutoIssueJob)));
}
}

46
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/DTOs/CoatingIssueJobDTO.cs

@ -0,0 +1,46 @@
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
/// <summary>
/// 发料任务
/// </summary>
[Display(Name = "发料任务")]
public class CoatingIssueJobDTO : SfsJobDTOBase<IssueJobDetailDTO>
{
/// <summary>
/// 叫料请求类型
/// </summary>
[Display(Name = "叫料请求类型")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RequestType { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ProdLine { get; set; }
/// <summary>
/// 要货单号
/// </summary>
[Display(Name = "要货单号")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string MaterialRequestNumber { get; set; }
/// <summary>
/// 车间
/// </summary>
[Display(Name = "车间")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Workshop { get; set; }
/// <summary>
/// 使用在途库
/// </summary>
[Display(Name = "使用在途库")]
public bool UseOnTheWayLocation { get; set; }
}

112
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/DTOs/CoatingIssueJobDetailDTO.cs

@ -0,0 +1,112 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingIssueJobDetailDTO : SfsJobRecommendFromDetailDTOBase, IHasToLocation
{
/// <summary>
/// 请求库位
/// </summary>
[Display(Name = "请求库位")]
public string RequestLocationCode { get; set; }
/// <summary>
/// 到库位
/// </summary>
[Display(Name = "到库位")]
public string ToLocationCode { get; set; }
/// <summary>
/// 到库区
/// </summary>
[Display(Name = "到库区")]
public string ToLocationArea { get; set; }
/// <summary>
/// 到库位组
/// </summary>
[Display(Name = "到库位组")]
public string ToLocationGroup { get; set; }
/// <summary>
/// 到ERP库位
/// </summary>
[Display(Name = "到ERP库位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 到仓库
/// </summary>
[Display(Name = "到仓库")]
public string ToWarehouseCode { get; set; }
/// <summary>
/// 在途库库位
/// </summary>
[Display(Name = "在途库库位")]
public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
[Display(Name = "工作中心")]
public string WorkStation { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "过期时间")]
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 工序
/// </summary>
[Display(Name = "工序")]
public string Operation { get; set; }
/// <summary>
/// 配送方式
/// </summary>
[Display(Name = "配送方式")]
public EnumDistributionType DistributionType { get; set; }
/// <summary>
/// 取整方式
/// </summary>
[Display(Name = "取整方式")]
public EnumTruncType TruncType { get; set; }
/// <summary>
/// 取整后数量
/// </summary>
[Display(Name = "取整后数量")]
public decimal RoundedQty { get; set; }
/// <summary>
/// 计划拆分规则
/// </summary>
[Display(Name = "计划拆分规则")]
public EnumPlannedSplitRule PlannedSplitRule { get; set; }
/// <summary>
/// 计划开始时间
/// </summary>
[Display(Name = "计划开始时间")]
public DateTime PlanBeginTime { get; set; }
/// <summary>
/// 每次配送数量
/// </summary>
[Display(Name = "每次配送数量")]
public decimal DeliveryQty { get; set; }
}

26
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/ICoatingIssueJobAppService.cs

@ -0,0 +1,26 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public interface ICoatingIssueJobAppService
: ISfsJobAppServiceBase<CoatingIssueJobDTO, SfsJobRequestInputBase, CoatingIssueJobCheckInput, CoatingIssueJobEditInput>
{
Task<List<CoatingIssueJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode, string locationCode);
Task CancelByMaterialRequestAsync(string materialNumber);
Task<PagedResultDto<CoatingIssueJobDTO>> GetListByTypeAsync(SfsJobRequestInputBase requestInput, string requestType,
bool includeDetails = false, CancellationToken cancellationToken = default);
Task<List<CoatingIssueJobDTO>> GetByRequestNumberAsync(string requestNumber);
/// <summary>
/// 保存拆箱时涉及的明细修改
/// </summary>
/// <returns></returns>
Task<CoatingIssueJobDTO> SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input);
}

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/Inputs/CoatingIssueJobCheckInput.cs

@ -0,0 +1,6 @@
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingIssueJobCheckInput : SfsJobCheckInputBase
{
}

134
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/Inputs/CoatingIssueJobDetailInput.cs

@ -0,0 +1,134 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingIssueJobDetailInput : SfsJobRecommendFromDetailInputBase, IHasToLocation
{
/// <summary>
/// 请求库位
/// </summary>
[Display(Name = "请求库位")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RequestLocationCode { get; set; }
/// <summary>
/// 到库位
/// </summary>
[Display(Name = "到库位")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ToLocationCode { get; set; }
/// <summary>
/// 到库区
/// </summary>
[Display(Name = "到库区")]
public string ToLocationArea { get; set; }
/// <summary>
/// 到库位组
/// </summary>
[Display(Name = "到库位组")]
public string ToLocationGroup { get; set; }
/// <summary>
/// 到ERP库位
/// </summary>
[Display(Name = "到ERP库位")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 到仓库
/// </summary>
[Display(Name = "到仓库")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ToWarehouseCode { get; set; }
/// <summary>
/// 在途库库位
/// </summary>
[Display(Name = "在途库库位")]
public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
[Display(Name = "工作中心")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string WorkStation { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "过期时间")]
[Required(ErrorMessage = "{0}是必填项")]
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 工序
/// </summary>
[Display(Name = "工序")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Operation { get; set; }
/// <summary>
/// 配送方式
/// </summary>
[Display(Name = "配送方式")]
public EnumDistributionType DistributionType { get; set; }
/// <summary>
/// 取整方式
/// </summary>
[Display(Name = "取整方式")]
public EnumTruncType TruncType { get; set; }
/// <summary>
/// 取整后数量
/// </summary>
[Display(Name = "取整后数量")]
public decimal RoundedQty { get; set; }
/// <summary>
/// 计划拆分规则
/// </summary>
[Display(Name = "计划拆分规则")]
public EnumPlannedSplitRule PlannedSplitRule { get; set; }
/// <summary>
/// 计划开始时间
/// </summary>
[Display(Name = "计划开始时间")]
public DateTime PlanBeginTime { get; set; }
/// <summary>
/// 每次配送数量
/// </summary>
[Display(Name = "每次配送数量")]
public decimal DeliveryQty { get; set; }
/// <summary>
/// 位置码
/// </summary>
public string PositionCode { get; set; }
/// <summary>
/// 推荐类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
}

82
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/Inputs/CoatingIssueJobEditInput.cs

@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCreateInput<IssueJobDetailInput>
{
#region Create
/// <summary>
/// 上游任务编号
/// </summary>
[Display(Name = "上游任务编号")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string UpStreamJobNumber { get; set; }
/// <summary>
/// 要货单号
/// </summary>
[Display(Name = "要货单号")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string MaterialRequestNumber { get; set; }
/// <summary>
/// 叫料请求类型
/// </summary>
[Display(Name = "叫料请求类型")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RequestType { get; set; }
/// <summary>
/// 任务类型
/// </summary>
[Display(Name = "任务类型")]
[Required(ErrorMessage = "{0}是必填项")]
public EnumJobType JobType { get; set; }
/// <summary>
/// 是否自动完成
/// </summary>
[Display(Name = "是否自动完成")]
[Required(ErrorMessage = "{0}是必填项")]
public bool IsAutoComplete { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "过期时间")]
[Required(ErrorMessage = "{0}是必填项")]
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 任务明细
/// </summary>
[Display(Name = "任务明细")]
[Required(ErrorMessage = "{0}是必填项")]
public List<IssueJobDetailInput> Details { get; set; } = new();
/// <summary>
/// 车间
/// </summary>
[Display(Name = "车间")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Workshop { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ProdLine { get; set; }
/// <summary>
/// 使用在途库
/// </summary>
[Display(Name = "使用在途库")]
public bool UseOnTheWayLocation { get; set; }
#endregion
}

30
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotePermissions.cs

@ -0,0 +1,30 @@
using Volo.Abp.Authorization.Permissions;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public static class CoatingIssueNotePermissions
{
public const string Default = StorePermissions.GroupName + "." + nameof(IssueNote);
public const string Create = Default + "." + StorePermissions.CreateStr;
public const string Update = Default + "." + StorePermissions.UpdateStr;
public const string Delete = Default + "." + StorePermissions.DeleteStr;
//自动发料记录
public const string AutoIssueNote = StorePermissions.GroupName + "." + nameof(AutoIssueNote);
//直接发料
public const string DirectIssueNote = StorePermissions.GroupName + "." + nameof(DirectIssueNote);
public static void AddCoatingIssueNotePermission(this PermissionGroupDefinition permissionGroup)
{
var issueNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(IssueNote)));
issueNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr));
issueNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr));
issueNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr));
permissionGroup.AddPermission(AutoIssueNote, StorePermissionDefinitionProvider.L(nameof(AutoIssueNote)));
permissionGroup.AddPermission(DirectIssueNote, StorePermissionDefinitionProvider.L(nameof(DirectIssueNote)));
}
}

54
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/DTOs/CoatingIssueNoteDTO.cs

@ -0,0 +1,54 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingIssueNoteDTO : SfsStoreDTOBase<IssueNoteDetailDTO>, IHasJobNumber, IHasRequestNumber
{
/// <summary>
/// 任务ID
/// </summary>
[Display(Name = "任务ID")]
public string JobNumber { get; set; }
/// <summary>
/// 车间
/// </summary>
[Display(Name = "车间")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Workshop { get; set; }
/// <summary>
/// 请求代码
/// </summary>
[Display(Name = "请求代码")]
public string RequestNumber { get; set; }
/// <summary>
/// 叫料请求类型
/// </summary>
[Display(Name = "叫料请求类型")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RequestType { get; set; }
/// <summary>
/// 使用在途库
/// </summary>
[Display(Name = "使用在途库")]
public bool UseOnTheWayLocation { get; set; }
/// <summary>
/// 已确认
/// </summary>
[Display(Name = "已确认")]
public bool Confirmed { get; set; }
/// <summary>
/// 确认时间
/// </summary>
[Display(Name = "确认时间")]
public DateTime? ConfirmTime { get; set; }
}

42
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/DTOs/CoatingIssueNoteDetailDTO.cs

@ -0,0 +1,42 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingIssueNoteDetailDTO : SfsStoreRecommendFromDetailWithFromToDTOBase
{
/// <summary>
/// 发料时间
/// </summary>
[Display(Name = "发料时间")]
public DateTime IssueTime { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "过期时间")]
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
[Display(Name = "工作中心")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string WorkStation { get; set; }
/// <summary>
/// 在途库库位
/// </summary>
[Display(Name = "在途库库位")]
public string OnTheWayLocationCode { get; set; }
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/ICoatingIssueNoteAppService.cs

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public interface ICoatingIssueNoteAppService : ISfsStoreMasterReadOnlyAppServiceBase<CoatingIssueNoteDTO, SfsStoreRequestInputBase, CoatingIssueNoteDetailDTO, SfsStoreRequestInputBase>
{
Task<CoatingIssueNoteDTO> CreateAsync(CoatingIssueNoteEditInput input);
Task<CoatingIssueNoteDTO> ConfirmAsync(Guid id);
Task<CoatingIssueNoteDTO> ConfirmAsync(string number);
Task<PagedResultDto<CoatingIssueNoteDTO>> GetListByTypeAsync(SfsStoreRequestInputBase requestInput,
string requestType, bool includeDetails = false, CancellationToken cancellationToken = default);
Task<List<CoatingIssueNoteDTO>> GetListUnConfirmedByTypeAsync(string requestType);
}

53
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/Inputs/CoatingIssueNoteDetailInput.cs

@ -0,0 +1,53 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingIssueNoteDetailInput : SfsStoreRecommendFromDetailWithFromToInputBase
{
/// <summary>
/// 发料时间
/// </summary>
[Display(Name = "发料时间")]
public DateTime IssueTime { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "过期时间")]
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
[Display(Name = "工作中心")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string WorkStation { get; set; }
/// <summary>
/// 在途库库位
/// </summary>
[Display(Name = "在途库库位")]
public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 位置码
/// </summary>
public string PositionCode { get; set; }
/// <summary>
/// 推荐类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
}

63
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/Inputs/CoatingIssueNoteEditInput.cs

@ -0,0 +1,63 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingIssueNoteEditInput : SfsStoreCreateOrUpdateInputBase
{
#region Base
/// <summary>
/// 已确认
/// </summary>
[Display(Name = "已确认")]
public bool Confirmed { get; set; }
#endregion
#region Create
/// <summary>
/// 发料记录号
/// </summary>
[Display(Name = "发料记录号")]
public string Number { get; set; }
/// <summary>
/// 任务ID
/// </summary>
[Display(Name = "任务ID")]
[Required(ErrorMessage = "{0}是必填项")]
public string JobNumber { get; set; }
/// <summary>
/// 车间
/// </summary>
[Display(Name = "车间")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Workshop { get; set; }
/// <summary>
/// 明细列表
/// </summary>
[Display(Name = "明细列表")]
public List<IssueNoteDetailInput> Details { get; set; }
/// <summary>
/// 请求号码
/// </summary>
[Display(Name = "请求号码")]
public string RequestNumber { get; set; }
/// <summary>
/// 叫料请求类型
/// </summary>
[Display(Name = "叫料请求类型")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RequestType { get; set; }
/// <summary>
/// 使用在途库
/// </summary>
[Display(Name = "使用在途库")]
public bool UseOnTheWayLocation { get; set; }
#endregion
}

33
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/Inputs/CoatingIssueNoteImportInput.cs

@ -0,0 +1,33 @@
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingIssueNoteImportInput : SfsStoreImportInputBase, IHasJobNumber, IHasRequestNumber
{
/// <summary>
/// 任务ID
/// </summary>
[Display(Name = "任务ID")]
public string JobNumber { get; set; }
/// <summary>
/// 车间
/// </summary>
[Display(Name = "车间")]
public string Workshop { get; set; }
public string RequestNumber { get; set; }
/// <summary>
/// 叫料请求类型
/// </summary>
[Display(Name = "叫料请求类型")]
public string RequestType { get; set; }
/// <summary>
/// 使用在途库
/// </summary>
[Display(Name = "使用在途库")]
[Required(ErrorMessage = "{0}是必填项")]
public bool UseOnTheWayLocation { get; set; }
}

27
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/CoatingMaterialRequestPermissions.cs

@ -0,0 +1,27 @@
using Volo.Abp.Authorization.Permissions;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public static class CoatingMaterialRequestPermissions
{
public const string Default = StorePermissions.GroupName + "." + nameof(CoatingMaterialRequest);
public const string Create = Default + "." + StorePermissions.CreateStr;
public const string Update = Default + "." + StorePermissions.UpdateStr;
public const string Delete = Default + "." + StorePermissions.DeleteStr;
//自动叫料申请
public const string AutoMaterialRequest = StorePermissions.GroupName + "." + nameof(AutoMaterialRequest);
public static void AddCoatingMaterialRequestPermission(this PermissionGroupDefinition permissionGroup)
{
var MaterialRequestPermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(CoatingMaterialRequest)));
MaterialRequestPermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr));
MaterialRequestPermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr));
MaterialRequestPermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr));
permissionGroup.AddPermission(AutoMaterialRequest, StorePermissionDefinitionProvider.L(nameof(AutoMaterialRequest)));
}
}

37
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/DTOs/CoatingMaterialRequestDTO.cs

@ -0,0 +1,37 @@
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingMaterialRequestDTO : SfsStoreRequestDTOBase<CoatingMaterialRequestDetailDTO>, IHasNumber
{
/// <summary>
/// 叫料类型
/// </summary>
[Display(Name = "叫料类型")]
public string Type { get; set; }
/// <summary>
/// 备料计划单号
/// </summary>
[Display(Name = "备料计划单号")]
public string PreparationPlanNumber { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
public string ProdLine { get; set; }
/// <summary>
/// 车间
/// </summary>
[Display(Name = "车间")]
public string Workshop { get; set; }
/// <summary>
/// 使用在途库
/// </summary>
[Display(Name = "使用在途库")]
public bool UseOnTheWayLocation { get; set; }
}

94
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/DTOs/CoatingMaterialRequestDetailDTO.cs

@ -0,0 +1,94 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingMaterialRequestDetailDTO : SfsStoreDetailWithQtyDTOBase
{
/// <summary>
/// 目标库位
/// </summary>
[Display(Name = "目标库位")]
public string ToLocationCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
[Display(Name = "来源库区")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string FromLocationArea { get; set; }
// /// <summary>
// /// 在途库库位
// /// </summary>
// public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
[Display(Name = "工作中心")]
public string WorkStation { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "过期时间")]
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 目标ERP储位
/// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 已发数量
/// </summary>
[Display(Name = "已发数量")]
public decimal IssuedQty { get; set; }
/// <summary>
/// 已收数量
/// </summary>
[Display(Name = "已收数量")]
public decimal ReceivedQty { get; set; }
/// <summary>
/// 明细状态
/// </summary>
[Display(Name = "明细状态")]
public EnumStatus Status { get; set; }
/// <summary>
/// 请求未发
/// </summary>
[Display(Name = "请求未发")]
[NotMapped]
public decimal ToBeIssuedQty => Qty - IssuedQty;
/// <summary>
/// 已发未收
/// </summary>
[Display(Name = "已发未收")]
[NotMapped]
public decimal ToBeReceivedQty => IssuedQty - ReceivedQty;
/// <summary>
/// 请求未收
/// </summary>
[Display(Name = "请求未收")]
[NotMapped]
public decimal NotFinishQty => Qty - ReceivedQty;
}

35
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/ICoatingMaterialRequestAppService.cs

@ -0,0 +1,35 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public interface ICoatingMaterialRequestAppService
: ISfsStoreRequestMasterAppServiceBase<CoatingMaterialRequestDTO, SfsStoreRequestInputBase, CoatingMaterialRequestEditInput, CoatingMaterialRequestDetailDTO, SfsStoreRequestInputBase>
{
Task<CoatingMaterialRequestDTO> CreateAndHandleAsync(CoatingMaterialRequestEditInput input);
/// <summary>
/// 根据备料计划生成 叫料请求
/// </summary>
/// <returns></returns>
Task<CoatingMaterialRequestDTO> CreateAndHandleByPreparationPlan(string productionPlanNumber);
Task<CoatingMaterialRequestDTO> CreateAndHandleByAPIAsync(CoatingMaterialRequestEditInput input);
/// <summary>
/// 根据类型获取叫料请求
/// </summary>
/// <param name="requestInput"></param>
/// <param name="type">叫料请求类型</param>
/// <param name="includeDetails"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<PagedResultDto<CoatingMaterialRequestDTO>> GetListByTypeAsync(SfsStoreRequestInputBase requestInput,
string type, bool includeDetails = false, CancellationToken cancellationToken = default);
Task<List<CoatingMaterialRequestDTO>> GetListByTypeAsync(string type);
}

85
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/CoatingMaterialRequestDetailInput.cs

@ -0,0 +1,85 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingMaterialRequestDetailInput : SfsStoreDetailWithQtyInputBase
{
/// <summary>
/// 目标库位
/// </summary>
[Display(Name = "目标库位")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ToLocationCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
[Display(Name = "来源库区")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string FromLocationArea { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
[Display(Name = "工作中心")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string WorkStation { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "过期时间")]
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 状态
/// </summary>
[Display(Name = "状态")]
public EnumRequestStatus RequestStatus { get; set; } = EnumRequestStatus.New;
/// <summary>
/// ERP储位
/// </summary>
[Display(Name = "ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 已发数量
/// </summary>
[Display(Name = "已发数量")]
public decimal IssuedQty { get; set; }
/// <summary>
/// 已收数量
/// </summary>
[Display(Name = "已收数量")]
public decimal ReceivedQty { get; set; }
/// <summary>
/// 明细状态
/// </summary>
[Display(Name = "明细状态")]
public EnumStatus Status { get; set; }
/// <summary>
/// 位置码
/// </summary>
public string PositionCode { get; set; }
/// <summary>
/// 推荐类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
}

58
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/CoatingMaterialRequestEditInput.cs

@ -0,0 +1,58 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CoatingMaterialRequestEditInput : SfsStoreRequestCreateOrUpdateInputBase
{
#region Base
/// <summary>
/// 车间
/// </summary>
[Display(Name = "车间")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Workshop { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ProdLine { get; set; }
/// <summary>
/// 使用在途库
/// </summary>
[Display(Name = "使用在途库")]
public bool UseOnTheWayLocation { get; set; }
#endregion
#region Create
/// <summary>
/// 要货单号
/// </summary>
[Display(Name = "要货单号")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Number { get; set; }
/// <summary>
/// 叫料类型
/// </summary>
[Display(Name = "叫料类型")]
public string Type { get; set; }
/// <summary>
/// 备料计划单号
/// </summary>
[Display(Name = "备料计划单号")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string PreparationPlanNumber { get; set; }
/// <summary>
/// 明细列表
/// </summary>
[Display(Name = "明细列表")]
public List<CoatingMaterialRequestDetailInput> Details { get; set; } = new List<CoatingMaterialRequestDetailInput>();
#endregion
}

53
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/CoatingMaterialRequestImportInput.cs

@ -0,0 +1,53 @@
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
[Display(Name = "叫料申请")]
public class CoatingMaterialRequestImportInput : SfsStoreImportInputBase
{
/// <summary>
/// 叫料类型
/// </summary>
[Display(Name = "叫料类型")]
[Required(ErrorMessage = "{0}是必填项")]
[ImporterHeader(Name = "叫料类型")]
[ExporterHeader(DisplayName = "叫料类型")]
[ValueMapping("人工拉动", EnumMaterialRequestType.Issue_Manual)]
public string Type { get; set; }
/// <summary>
/// 物品代码
/// </summary>
[Display(Name = "物品代码")]
[Required]
public string ItemCode { get; set; }
/// <summary>
/// 目标库位
/// </summary>
[Display(Name = "目标库位")]
[Required]
public string ToLocationCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
[Display(Name = "调出库区")]
[Required]
public string FromLocationArea { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
[Required(ErrorMessage = "{0}是必填项")]
public decimal Qty { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string Remark { get; set; }
}

280
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobAppService.cs

@ -0,0 +1,280 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application;
[Authorize]
[Route($"{StoreConsts.RootPath}coatingissue-job")]
public class CoatingIssueJobAppService
: SfsJobAppServiceBase<CoatingIssueJob, CoatingIssueJobDetail, CoatingIssueJobDTO, SfsJobRequestInputBase, CoatingIssueJobCheckInput, CoatingIssueJobEditInput>,
ICoatingIssueJobAppService
{
private readonly ICoatingIssueJobManager _CoatingIssueJobManager;
public CoatingIssueJobAppService(
ICoatingIssueJobRepository repository, ICoatingIssueJobManager CoatingIssueJobManager
) : base(repository, CoatingIssueJobManager)
{
_CoatingIssueJobManager = CoatingIssueJobManager;
}
/// <summary>
/// 根据物品和库位 检查是否存在发料任务
/// </summary>
/// <param name="itemCode"></param>
/// <param name="locationCode"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
[Authorize]
[HttpGet("check-job-exist")]
public virtual async Task<List<CoatingIssueJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode,
string locationCode)
{
var entities = await _repository.GetListAsync(c =>
c.Details.Any(p =>
(p.ItemCode == itemCode && p.RecommendFromLocationCode == locationCode) ||
(p.ItemCode == itemCode && p.ToLocationCode == locationCode))
&& (c.JobStatus == EnumJobStatus.Open || c.JobStatus == EnumJobStatus.Doing), true).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<CoatingIssueJob>, List<CoatingIssueJobDTO>>(entities);
return dtos;
}
[HttpPost("cancel-by-request/{materialNumber}")]
public virtual async Task CancelByMaterialRequestAsync(string materialNumber)
{
var entities = await _repository.GetListAsync(p => p.MaterialRequestNumber == materialNumber).ConfigureAwait(false);
foreach (var entity in entities)
{
await _CoatingIssueJobManager.CancelAsync(entity).ConfigureAwait(false);
}
}
//[Authorize(CoatingIssueJobPermissions.Delete)]
//[HttpDelete("details/{id}")]
//public virtual async Task DeleteDetailAsync(Guid id, Guid detailId)
//{
// var entity = await _repository.GetAsync(id);
// Check.NotNull(entity, EntityClassName);
// var input = new CoatingIssueJobCheckInput
// {
// JobStatuses = new List<EnumJobStatus>() { EnumJobStatus.Pending, EnumJobStatus.Open },
// };
// var result = new AbpValidationResult();
// var detail = entity.GetDetail(detailId);
// _CoatingIssueJobManager.CheckJobStatus(entity, input.JobStatuses, result);
// if (result.Errors.Any())
// {
// throw new AbpValidationException("任务状态错误,不能进行删除明细操作");
// }
// entity.RemoveDetail(detailId);
//}
//[Authorize(CoatingIssueJobPermissions.Delete)]
[HttpPost("invalid")]
public override async Task CancelAsync(Guid id)
{
var CoatingIssueJob = await _repository.GetAsync(id).ConfigureAwait(false);
if (CoatingIssueJob == null)
{
throw new UserFriendlyException($"未找到ID为 {id} 的任务");
}
/*
var listLocationCode = new List<string>();//取出所有当前job 影响的库位code
foreach (var detail in CoatingIssueJob.Details)
{
if (detail.HandledLocationCode != null)
{
listLocationCode.Add(detail.HandledLocationCode);
}
if (detail.HandledLocationCode != null)
{
listLocationCode.Add(detail.RecommendLocationCode);
}
if (detail.HandledLocationCode != null)
{
listLocationCode.Add(detail.RequestLocationCode);
}
if (detail.HandledLocationCode != null)
{
listLocationCode.Add(detail.ToLocationCode);
}
}
listLocationCode = listLocationCode.Distinct().ToList();
*/
await _CoatingIssueJobManager.CancelAsync(CoatingIssueJob).ConfigureAwait(false);
}
/// <summary>
/// 根据叫料请求类型获取发料任务
/// </summary>
/// <param name="requestInput"></param>
/// <param name="requestType">
/// 叫料请求类型:
/// 人工拉动:Issue_Manual;
/// 线边拉动:Issue_WIP;
/// </param>
/// <param name="includeDetails"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpPost("by-type/{requestType}")]
public virtual async Task<PagedResultDto<CoatingIssueJobDTO>> GetListByTypeAsync(SfsJobRequestInputBase requestInput,
string requestType, bool includeDetails = false, CancellationToken cancellationToken = default)
{
Expression<Func<CoatingIssueJob, bool>> expression = p => p.RequestType == requestType;
if (requestInput.Condition.Filters?.Count > 0)
{
expression = expression.And(requestInput.Condition.Filters.ToLambda<CoatingIssueJob>());
}
return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount,
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
}
[HttpPost("by-request-number/{requestNumber}")]
public virtual async Task<List<CoatingIssueJobDTO>> GetByRequestNumberAsync(string requestNumber)
{
var entitys = await _repository.GetListAsync(p => p.MaterialRequestNumber == requestNumber).ConfigureAwait(false);
return ObjectMapper.Map<List<CoatingIssueJob>, List<CoatingIssueJobDTO>>(entitys);
}
/// <summary>
/// 保存拆箱时涉及的明细修改
/// </summary>
/// <returns></returns>
[HttpPost("save-detail-split-packing")]
public virtual async Task<CoatingIssueJobDTO> SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input)
{
var job = await _repository.FindAsync(p => p.Number == input.Number).ConfigureAwait(false);
CoatingIssueJobDetail detail = job.Details.FirstOrDefault(p => p.RecommendPackingCode == input.FromPackingCode ); /*&& p.HandledQty == input.FromQty*/
if (detail == null)
{
//throw new UserFriendlyException($"根据HandledPackingCode={input.FromPackingCode}取CoatingIssueJobDetail表为空!");
throw new UserFriendlyException($"根据RecommendPackingCode={input.FromPackingCode}取CoatingIssueJobDetail表为空!");
}
//插入目标箱
var newDetail = CommonHelper.CloneObj(detail);
newDetail.SetId(GuidGenerator.Create());
newDetail.RecommendPackingCode = input.ToPackingCode;
newDetail.RecommendQty = input.ToQty;
newDetail.HandledPackingCode = detail.HandledPackingCode.HasValue() ? input.ToPackingCode : null; //源实际实际箱码有值,则新记录实际箱码有值
newDetail.HandledQty = detail.HandledQty > 0 ? input.ToQty : 0;
//newDetail.CreationTime = CommonHelper.CurTime;
job.Details.Add(newDetail);
//修改源箱
detail.RecommendQty = input.FromQty - input.ToQty;
detail.HandledQty = detail.HandledQty > 0 ? input.FromQty - input.ToQty : 0;
var entity = await _repository.UpdateAsync(job).ConfigureAwait(false);
var ret = ObjectMapper.Map<CoatingIssueJob, CoatingIssueJobDTO>(entity);
return ret;
}
/*
/// <summary>
///
/// </summary>
/// <param name="jobNumber"></param>
/// <returns></returns>
[HttpPost("accept")]
public override async Task AcceptAsync(string jobNumber)
{
var input = new IssueJobCheckInput
{
JobStatuses = new List<EnumJobStatus>() { EnumJobStatus.New },
};
var dto = await CheckAsync(jobNumber, input);
await _issueJobManager.AcceptAsync(dto.Id, CurrentUser.Id ?? Guid.Empty);
}
/// <summary>
/// 执行任务时,修改实际数量
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("handle")]
public override async Task HandleAsync(IssueJobDTO dto)
{
var input = new IssueJobCheckInput
{
JobStatuses = new List<EnumJobStatus>() { EnumJobStatus.Pending },
};
await CheckAsync(dto.Number, input);
var entity = ObjectMapper.Map<IssueJobDTO, IssueJob>(dto);
await _issueJobManager.HandleAsync(entity, CurrentUser.Id ?? Guid.Empty);
}
[HttpPost("check")]
public override async Task<IssueJobDTO> CheckAsync(string jobNumber, IssueJobCheckInput input)
{
var result = new AbpValidationResult();
_issueJobManager.CheckFormat(jobNumber);
var dto = await GetByNumberAsync(jobNumber);
var entity = ObjectMapper.Map<IssueJobDTO, IssueJob>(dto);
_issueJobManager.CheckJobStatus(entity, input.JobStatuses, result);
_issueJobManager.CheckDetails(entity, result);
//TODO 添加其它校验
if (result.Errors.Any())
{
throw new AbpValidationException(result.Errors);
}
return dto;
}
*/
///// <summary>
///// 临时解决方案 解决创建补料的订阅事件无法返回错误信息的问题
///// </summary>
///// <param name="materialRequestHandledETO"></param>
///// <returns></returns>
//[Authorize(IssueJobPermissions.Create)]
//[HttpPost("create-by-eto")]
//public virtual async Task<MaterialRequestHandledETO> CreateByEtoAsync(MaterialRequestHandledETO materialRequestHandledETO)
//{
// await _issueJobManager.AddByEtoAsync(materialRequestHandledETO);
// return new MaterialRequestHandledETO();
//}
///// <summary>
///// 临时解决方案 解决创建补料的订阅事件无法返回错误信息的问题
///// </summary>
///// <param name="materialRequestHandledETO"></param>
///// <returns></returns>
//[Authorize(IssueJobPermissions.Create)]
//[HttpPost("create-by-eto2")]
//public virtual async Task<IssueJobDTO> CreateByEtoAsync2(MaterialRequestHandledETO materialRequestHandledETO)
//{
// await _issueJobManager.TestError();
// return new IssueJobDTO();
//} list-by
}

30
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobAutoMapperProfile.cs

@ -0,0 +1,30 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Application;
public partial class StoreApplicationAutoMapperProfile : Profile
{
private void CoatingIssueJobAutoMapperProfile()
{
CreateMap<CoatingIssueJob, CoatingIssueJobDTO>();
CreateMap<CoatingIssueJobDTO, CoatingIssueJob>();
CreateMap<CoatingIssueJobDetail, CoatingIssueJobDetailDTO>()
;
CreateMap<CoatingIssueJobDetailDTO, CoatingIssueJobDetail>()
;
CreateMap<CoatingIssueJobDetailInput, CoatingIssueJobDetail>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.MasterID)
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
}
}

132
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNoteAppService.cs

@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application;
[Authorize]
[Route($"{StoreConsts.RootPath}coatingissue-note")]
public class CoatingIssueNoteAppService :
SfsStoreWithDetailsAppServiceBase<CoatingIssueNote, CoatingIssueNoteDTO, SfsStoreRequestInputBase, CoatingIssueNoteEditInput, CoatingIssueNoteDetail,
CoatingIssueNoteDetailDTO, SfsStoreRequestInputBase, CoatingIssueNoteImportInput>,
ICoatingIssueNoteAppService
{
private readonly ICoatingIssueNoteManager _CoatingIssueNoteManager;
public CoatingIssueNoteAppService(
ICoatingIssueNoteRepository repository,
ICoatingIssueNoteManager CoatingIssueNoteManager
) : base(repository)
{
_CoatingIssueNoteManager = CoatingIssueNoteManager;
}
[HttpPost("")]
//[Authorize(CoatingIssueNotePermissions.Create)]
public override async Task<CoatingIssueNoteDTO> CreateAsync(CoatingIssueNoteEditInput input)
{
var entity = ObjectMapper.Map<CoatingIssueNoteEditInput, CoatingIssueNote>(input);
await _CoatingIssueNoteManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<CoatingIssueNote, CoatingIssueNoteDTO>(entity);
return dto;
}
/// <summary>
/// 确认对应的记录单
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("confirm/{id}")]
public virtual async Task<CoatingIssueNoteDTO> ConfirmAsync(Guid id)
{
var issueNote= await _repository.GetAsync(id).ConfigureAwait(false);
issueNote.Confirmed = true;
issueNote=await _repository.UpdateAsync(issueNote).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData<CoatingIssueNote>(issueNote), false).ConfigureAwait(false);
return ObjectMapper.Map<CoatingIssueNote, CoatingIssueNoteDTO>(issueNote);
}
[HttpPost("confirm-by-number/{number}")]
public virtual async Task<CoatingIssueNoteDTO> ConfirmAsync(string number)
{
var entity = await _repository.FindAsync(p => p.Number == number).ConfigureAwait(false);
Check.NotNull(entity, nameof(CoatingIssueNote));
var result = await _CoatingIssueNoteManager.ConfirmAsync(entity.Id).ConfigureAwait(false);
var dto = ObjectMapper.Map<CoatingIssueNote, CoatingIssueNoteDTO>(result);
return dto;
}
/// <summary>
/// 根据叫料请求类型获取发料记录
/// </summary>
/// <param name="requestInput"></param>
/// <param name="requestType">
/// 叫料请求类型:
/// 人工拉动:Issue_Manual;
/// 线边拉动:Issue_WIP;
/// </param>
/// <param name="includeDetails"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpPost("by-type/{requestType}")]
public virtual async Task<PagedResultDto<CoatingIssueNoteDTO>> GetListByTypeAsync(SfsStoreRequestInputBase requestInput,
string requestType, bool includeDetails = false, CancellationToken cancellationToken = default)
{
Expression<Func<CoatingIssueNote, bool>> expression = p => p.RequestType == requestType;
if (requestInput.Condition.Filters?.Count > 0)
{
expression = expression.And(requestInput.Condition.Filters.ToLambda<CoatingIssueNote>());
}
return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount,
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
}
[HttpGet("list/un-confirmed/{requestType}")]
public virtual async Task<List<CoatingIssueNoteDTO>> GetListUnConfirmedByTypeAsync(string requestType)
{
var entities = await _repository.GetListAsync(c => !c.Confirmed && c.RequestType == requestType)
.ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<CoatingIssueNote>, List<CoatingIssueNoteDTO>>(entities);
return dtos;
}
//[HttpPost("")]
//[Authorize(IssueNotePermissions.Create)]
//public override Task<IssueNoteDTO> CreateAsync(IssueNoteCreateInput input)
//{
// return base.CreateAsync(input);
//}
//[HttpPut]
//[Route($"{StoreConsts.RootPath}{id}")]
//[Authorize(IssueNotePermissions.Update)]
//public override Task<IssueNoteDTO> UpdateAsync(Guid id, IssueNoteUpdateInput input)
//{
// return base.UpdateAsync(id, input);
//}
//[HttpDelete]
//[Route($"{StoreConsts.RootPath}{id}")]
//[Authorize(IssueNotePermissions.Delete)]
//public override Task DeleteAsync(Guid id)
//{
// return base.DeleteAsync(id);
//}
}

31
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNoteAutoMapperProfile.cs

@ -0,0 +1,31 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Application;
public partial class StoreApplicationAutoMapperProfile : Profile
{
private void CoatingIssueNoteAutoMapperProfile()
{
CreateMap<CoatingIssueNote, CoatingIssueNoteDTO>()
.ReverseMap();
CreateMap<CoatingIssueNoteDetail, CoatingIssueNoteDetailDTO>();
CreateMap<CoatingIssueNoteDetailInput, CoatingIssueNoteDetail>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.MasterID)
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
CreateMap<CoatingIssueNoteEditInput, CoatingIssueNote>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
;
}
}

519
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequestAppService.cs

@ -0,0 +1,519 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Office.PowerPoint.Y2021.M06.Main;
using IdentityModel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application;
[Authorize]
[Route($"{StoreConsts.RootPath}coatingmaterial-request")]
public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase<CoatingMaterialRequest, CoatingMaterialRequestDTO,
SfsStoreRequestInputBase, CoatingMaterialRequestEditInput, CoatingMaterialRequestDetail, CoatingMaterialRequestDetailDTO,
SfsStoreRequestInputBase, CoatingMaterialRequestImportInput>,
ICoatingMaterialRequestAppService
{
private readonly ICoatingMaterialRequestManager _materialRequestManager;
private readonly IPreparationPlanManager _preparationPlanManager;
private readonly IItemStoreRelationAppService _itemStoreRelationApp;
private readonly IAreaAppService _areaApp;
private readonly ILocationAppService _locationAppService;
private readonly IItemBasicAppService _itemBasicAppService;
private readonly IProductionLineAppService _productionLineAppService;
private readonly IIssueJobAppService _issueJobAppService;
public CoatingMaterialRequestAppService(
ICoatingMaterialRequestRepository repository,
ICoatingMaterialRequestManager CoatingMaterialRequestManager,
IPreparationPlanManager preparationPlanManager,
IItemStoreRelationAppService itemStoreRelationApp,
IAreaAppService areaApp,
ILocationAppService locationAppService,
IItemBasicAppService itemBasicAppService,
IProductionLineAppService productionLineAppService,
IIssueJobAppService issueJobAppService)
: base(repository, CoatingMaterialRequestManager)
{
_materialRequestManager = CoatingMaterialRequestManager;
_preparationPlanManager = preparationPlanManager;
_itemStoreRelationApp = itemStoreRelationApp;
_areaApp = areaApp;
_locationAppService = locationAppService;
_itemBasicAppService = itemBasicAppService;
_productionLineAppService = productionLineAppService;
_issueJobAppService = issueJobAppService;
}
#region 东阳使用
/// <summary>
/// 用来重写 导入数据时可以加工数据
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
protected override async Task<Dictionary<CoatingMaterialRequest, EntityState>> ImportProcessingEntityAsync(
Dictionary<CoatingMaterialRequest, EntityState> dictionary)
{
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
foreach (var materialRequest in addList)
{
materialRequest.Worker = CurrentUser.GetUserName();
materialRequest.CreatorId = CurrentUser.Id;
if (materialRequest.Type == EnumTransSubType.Issue_Manual.GetDisplayName())
{
materialRequest.Type = EnumTransSubType.Issue_Manual.ToString();
}
foreach (var detail in materialRequest.Details)
{
var locationDto= await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
CheckLocation(locationDto,detail.ToLocationCode);
var itemBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
CheckItemBasic(itemBasicDto,detail.ItemCode);
detail.ToLocationArea = locationDto.AreaCode;
detail.ToLocationErpCode = locationDto.ErpLocationCode;
detail.ToLocationGroup = locationDto.LocationGroupCode;
detail.ToWarehouseCode = locationDto.WarehouseCode;
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2= itemBasicDto.Desc2;
detail.ItemName= itemBasicDto.Name;
detail.Uom = itemBasicDto.BasicUom;
}
}
return dictionary;
}
public override async Task<CoatingMaterialRequestDTO> HandleAsync(Guid id)
{
var entity=await _repository.GetAsync(id).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<CoatingMaterialRequest>(entity), false).ConfigureAwait(false);
return ObjectMapper.Map<CoatingMaterialRequest, CoatingMaterialRequestDTO>(entity);
}
#region 校验
private void CheckItemBasic(ItemBasicDTO ItemBasicDto, string itemCode)
{
if (ItemBasicDto == null)
{
throw new UserFriendlyException($"物品代码为【{itemCode}】不存在");
}
}
private void CheckLocation(LocationDTO LocationDto, string LocationCode)
{
if (LocationDto == null)
{
throw new UserFriendlyException($"库位代码为【{LocationCode}】不存在");
}
if (LocationDto.Type != EnumLocationType.WIP)
{
throw new UserFriendlyException($"库位代码【{LocationCode}】不是【{EnumLocationType.WIP.GetDisplayName()}】类型");
}
}
#endregion
#endregion
[HttpPost("")]
//[Authorize(CoatingMaterialRequestPermissions.Create)]
public override async Task<CoatingMaterialRequestDTO> CreateAsync(CoatingMaterialRequestEditInput input)
{
foreach (var item in input.Details)
{
if (item.Qty <= 0)
{
throw new UserFriendlyException($"{item.ItemCode} 物料的需求量必须大于 0");
}
}
//检验备料计划是否存在要料请求
if (!string.IsNullOrWhiteSpace(input.PreparationPlanNumber))
{
var exist = await CheckExistByPreparationPlanAsync(input.PreparationPlanNumber).ConfigureAwait(false);
if (exist.Count > 0)
{
throw new UserFriendlyException($"{input.PreparationPlanNumber} 备料计划已存在要料申请");
}
}
foreach (var item in input.Details) //赋值生产线
{
var location = await LocationAclService.GetByCodeAsync(item.ToLocationCode).ConfigureAwait(false);
item.ProdLine = location.LocationGroupCode;
input.ProdLine = location.LocationGroupCode;
}
var entity = ObjectMapper.Map<CoatingMaterialRequestEditInput, CoatingMaterialRequest>(input);
var result = await _materialRequestManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<CoatingMaterialRequest, CoatingMaterialRequestDTO>(result);
return dto;
}
/// <summary>
/// 创建并且执行叫料请求
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("create-and-handle-api")]
//[Authorize(CoatingMaterialRequestPermissions.Create)]
public virtual async Task<CoatingMaterialRequestDTO> CreateAndHandleByAPIAsync(CoatingMaterialRequestEditInput input)
{
foreach (var item in input.Details)
{
if (item.Qty <= 0)
{
throw new UserFriendlyException($"{item.ItemCode} 物料的需求量必须大于 0");
}
}
input.AutoSubmit = true;
input.AutoAgree = true;
input.AutoHandle = true;
input.AutoCompleteJob = false;
input.DirectCreateNote = false;
foreach (var detailInput in input.Details)
{
var toLocationDto= await _locationAppService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false);
CheckLocation(toLocationDto, detailInput.ToLocationCode);
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detailInput.ItemCode).ConfigureAwait(false);
CheckItemBasic(itemBasicDto, detailInput.ItemCode);
detailInput.ItemDesc1 = itemBasicDto.Desc1;
if(detailInput.PositionCode.Contains('W'))
{
detailInput.RecommendType = EnumRecommendType.W;
}
else if(detailInput.PositionCode.Contains('Q'))
{
detailInput.RecommendType = EnumRecommendType.Q;
}
else if(detailInput.PositionCode.Contains('K'))
{
detailInput.RecommendType = EnumRecommendType.K;
}
else
{
detailInput.RecommendType = EnumRecommendType.None;
}
var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false);
detailInput.ToLocationCode = toLocationDto.ErpLocationCode;
if (productionLineDto != null)
{
detailInput.ProdLine = productionLineDto.Code;
}
}
var entity = ObjectMapper.Map<CoatingMaterialRequestEditInput, CoatingMaterialRequest>(input);
foreach (var detail in entity.Details)
{
var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false);
detail.ToLocationArea= toLocationDto.AreaCode;
detail.ToLocationErpCode = toLocationDto.ErpLocationCode;
detail.ToLocationGroup = toLocationDto.LocationGroupCode;
detail.ToWarehouseCode= toLocationDto.WarehouseCode;
}
entity.UseOnTheWayLocation = false;
var result = await _materialRequestManager.CreateBynNumberAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<CoatingMaterialRequest, CoatingMaterialRequestDTO>(result);
return dto;
}
/// <summary>
/// 创建并且执行叫料请求
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("create-and-handle")]
//[Authorize(CoatingMaterialRequestPermissions.Create)]
public virtual async Task<CoatingMaterialRequestDTO> CreateAndHandleAsync(CoatingMaterialRequestEditInput input)
{
foreach (var item in input.Details)
{
if (item.Qty <= 0)
{
throw new UserFriendlyException($"{item.ItemCode} 物料的需求量必须大于0");
}
}
//检验备料计划是否存在要料请求
if (!string.IsNullOrWhiteSpace(input.PreparationPlanNumber))
{
var exist = await CheckExistByPreparationPlanAsync(input.PreparationPlanNumber).ConfigureAwait(false);
if (exist.Count > 0)
{
throw new UserFriendlyException($"{input.PreparationPlanNumber} 备料计划已存在要料申请");
}
}
foreach (var detailInput in input.Details) //赋值生产线
{
var toLocationDto = await _locationAppService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false);
CheckLocation(toLocationDto, detailInput.ToLocationCode);
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detailInput.ItemCode).ConfigureAwait(false);
CheckItemBasic(itemBasicDto, detailInput.ItemCode);
var location = await LocationAclService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false);
detailInput.ProdLine = location.LocationGroupCode;
input.ProdLine = location.LocationGroupCode;
input.Worker = input.Worker;
}
input.AutoSubmit = true;
input.AutoAgree = true;
input.AutoHandle = true;
input.AutoCompleteJob = false;
input.DirectCreateNote = false;
var entity = ObjectMapper.Map<CoatingMaterialRequestEditInput, CoatingMaterialRequest>(input);
var result = await _materialRequestManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<CoatingMaterialRequest, CoatingMaterialRequestDTO>(result);
return dto;
}
/// <summary>
/// 根据备料计划生成 叫料请求
/// </summary>
/// <returns></returns>
[HttpPost("create-and-handle-by-preparation-plan/{number}")]
public virtual async Task<CoatingMaterialRequestDTO> CreateAndHandleByPreparationPlan(string number)
{
var prodPreparationPlan = await _preparationPlanManager.GetByNumberAsync(number).ConfigureAwait(false);
var materialRequestCreateInput = new CoatingMaterialRequestEditInput { Worker = CurrentUser.GetUserName() };
foreach (var preparationPlanDetail in prodPreparationPlan.Details)
{
var detail = new CoatingMaterialRequestDetailInput
{
ItemCode = preparationPlanDetail.ItemCode,
ItemName = preparationPlanDetail.ItemName,
ItemDesc1 = preparationPlanDetail.ItemDesc1,
ItemDesc2 = preparationPlanDetail.ItemDesc2,
Uom = preparationPlanDetail.Uom,
Qty = preparationPlanDetail.Qty,
StdPackQty = preparationPlanDetail.StdPackQty,
ToLocationCode = preparationPlanDetail.ToLocationCode
};
materialRequestCreateInput.Details.Add(detail);
}
var dto = await CreateAndHandleAsync(materialRequestCreateInput).ConfigureAwait(false);
return dto;
}
/// <summary>
/// 检验备料计划是否存在要料请求
/// </summary>
/// <param name="preparationPlanNumber"></param>
/// <returns></returns>
private async Task<List<CoatingMaterialRequest>> CheckExistByPreparationPlanAsync(string preparationPlanNumber)
{
var entities = await _repository.GetListAsync(c => c.PreparationPlanNumber == preparationPlanNumber)
.ConfigureAwait(false);
return entities;
}
/// <summary>
/// 根据类型获取叫料请求
/// </summary>
/// <param name="requestInput"></param>
/// <param name="type">
/// 叫料请求类型:
/// 人工拉动:Issue_Manual;
/// 线边拉动:Issue_WIP;
/// </param>
/// <param name="includeDetails"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpPost("by-type/{type}")]
public virtual async Task<PagedResultDto<CoatingMaterialRequestDTO>> GetListByTypeAsync(
SfsStoreRequestInputBase requestInput,
string type,
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
Expression<Func<CoatingMaterialRequest, bool>> expression = p => p.Type == type;
if (requestInput.Condition.Filters?.Count > 0)
{
expression = expression.And(requestInput.Condition.Filters.ToLambda<CoatingMaterialRequest>());
}
return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount,
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
}
#region 导入
//protected override async Task CheckImportInputBusinessAsync(CoatingMaterialRequestImportInput importInput, EnumImportMethod importMethod)
//{
// //await base.CheckImportInputBusinessAsync(importInput, importMethod);
// var item = await CheckItemBasicAsync(importInput);
// await CheckItemPackAsync(importInput);
// var location = await CheckLocationAsync(importInput);
// await CheckAreaAsync(importInput);
// await CheckStoreRelationAsync(importInput);
// var transactionType = await CheckTransactionTypeAsync();
// CheckTransactionType(EnumTransInOut.In, EnumInventoryStatus.OK, transactionType, item, location);
//}
/// <summary>
/// 导入验证
/// </summary>
/// <param name="model"></param>
/// <param name="validationRresult"></param>
/// <returns></returns>
protected override async Task ValidateImportModelAsync(CoatingMaterialRequestImportInput model,
List<ValidationResult> validationRresult)
{
_ = new Dictionary<string, string>();
_ = await CheckItemBasicAsync(model, validationRresult).ConfigureAwait(false);
_ = await CheckLocationAsync(model, validationRresult).ConfigureAwait(false);
await CheckAreaAsync(model, validationRresult).ConfigureAwait(false);
await CheckStoreRelationAsync(model, validationRresult).ConfigureAwait(false);
}
#region 校验
protected override async Task<bool> ValidateImportEntities(Dictionary<CoatingMaterialRequest, EntityState> dict)
{
foreach (var entity in dict.Keys)
{
var tranType = await TransactionTypeAclService
.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);
Check.NotNull(tranType, "事务类型", "事务类型不存在");
entity.AutoCompleteJob = tranType.AutoCompleteJob;
entity.AutoSubmit = tranType.AutoSubmitRequest;
entity.AutoAgree = tranType.AutoAgreeRequest;
entity.AutoHandle = tranType.AutoHandleRequest;
entity.DirectCreateNote = tranType.DirectCreateNote;
}
return await base.ValidateImportEntities(dict).ConfigureAwait(false);
}
protected async Task<ItemBasicDTO> CheckItemBasicAsync(CoatingMaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var item = await _itemBasicAppService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false);
if (item == null)
{
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" }));
}
else if (item.StdPackQty == 0)
{
validationRresult.Add(
new ValidationResult($"物品代码{importInput.ItemCode}的物品信息中标准包装等于0或不存在", new[] { "标准包装" }));
}
return item;
}
protected async Task<LocationDTO> CheckLocationAsync(CoatingMaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var location = await _locationAppService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false);
if (location == null)
{
validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new[] { "目标库位" }));
}
return location;
}
protected async Task CheckAreaAsync(CoatingMaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var area = await _areaApp.GetByCodeAsync(importInput.FromLocationArea).ConfigureAwait(false);
if (area == null)
{
validationRresult.Add(new ValidationResult($"调出库区{importInput.FromLocationArea}不存在", new[] { "调出库区" }));
}
}
protected async Task CheckStoreRelationAsync(CoatingMaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var itemStoreRelation = await _itemStoreRelationApp
.GetFirstAsync(importInput.ItemCode, importInput.ToLocationCode).ConfigureAwait(false);
if (itemStoreRelation == null)
{
validationRresult.Add(new ValidationResult(
$"物品代码{importInput.ItemCode}与目标库位{importInput.ToLocationCode}不存在对应关", new[] { "物品库位对应关系" }));
}
}
#endregion
#endregion
/// <summary>
/// 根据类型 获取叫料申请
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
[HttpGet("list/by-type/{type}")]
public virtual async Task<List<CoatingMaterialRequestDTO>> GetListByTypeAsync(string type)
{
var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<CoatingMaterialRequest>, List<CoatingMaterialRequestDTO>>(entities);
return dtos;
}
}

74
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequestAutoMapperProfile.cs

@ -0,0 +1,74 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Application;
public partial class StoreApplicationAutoMapperProfile : Profile
{
private void CoatingMaterialRequestAutoMapperProfile()
{
CreateMap<CoatingMaterialRequest, CoatingMaterialRequestDTO>()
.ReverseMap();
CreateMap<CoatingMaterialRequestDetail, CoatingMaterialRequestDetailDTO>()
.ReverseMap();
CreateMap<CoatingMaterialRequestDetailInput, CoatingMaterialRequestDetail>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ToLocationArea)
.Ignore(x => x.ToLocationGroup)
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.MasterID)
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
CreateMap<CoatingMaterialRequestImportInput, CoatingMaterialRequest>()
.IgnoreAuditedObjectProperties()
.ForMember(x => x.Type, y => y.MapFrom(t => t.Type.ToString()))
.Ignore(x => x.PreparationPlanNumber)
.Ignore(x => x.ProdLine)
.Ignore(x => x.Workshop)
.Ignore(x => x.UseOnTheWayLocation)
.Ignore(x => x.Details)
.Ignore(x => x.Remark)
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.RequestStatus)
.Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.ActiveDate)
.Ignore(x => x.Remark);
CreateMap<CoatingMaterialRequestImportInput, CoatingMaterialRequestDetail>()
.IgnoreAuditedObjectProperties()
.ForMember(x => x.Status, y => y.MapFrom(t => EnumStatus.Open))
.Ignore(x => x.ToLocationErpCode)
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.ToLocationArea)
.Ignore(x => x.ToLocationGroup)
.Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2)
.Ignore(x => x.ProdLine)
.Ignore(x => x.WorkStation)
.Ignore(x => x.ExpiredTime)
.Ignore(x => x.IssuedQty)
.Ignore(x => x.ReceivedQty)
.Ignore(x => x.ToBeIssuedQty)
.Ignore(x => x.ToBeReceivedQty)
.Ignore(x => x.NotFinishQty)
.Ignore(x => x.StdPackQty)
.Ignore(x => x.Uom)
.Ignore(x => x.TenantId)
.Ignore(x => x.MasterID)
.Ignore(x => x.Number)
.Ignore(x => x.Id)
.Ignore(x => x.Remark);
CreateMap<CoatingMaterialRequestEditInput, CoatingMaterialRequest>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.RequestStatus)
.Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id);
}
}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs

@ -25,6 +25,9 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CountAdjustRequestAutoMapperProfile();
ScrapRequestAutoMapperProfile();
WipWarehouseAdjustRequestMapperProfile();
CoatingIssueJobAutoMapperProfile();
CoatingIssueNoteAutoMapperProfile();
CoatingMaterialRequestAutoMapperProfile();
#endregion

84
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJob.cs

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Wms.Store.Domain;
/// <summary>
/// 发料任务
/// </summary>
[Display(Name = "发料任务")]
public class CoatingIssueJob : SfsJobAggregateRootBase<CoatingIssueJobDetail>
{
/// <summary>
/// 叫料请求类型
/// </summary>
[IgnoreUpdate]
public string RequestType { get; set; }
/// <summary>
/// 生产线
/// </summary>
[IgnoreUpdate]
public string ProdLine { get; set; }
/// <summary>
/// 要货单号
/// </summary>
[IgnoreUpdate]
public string MaterialRequestNumber { get; set; }
/// <summary>
/// 车间
/// </summary>
[IgnoreUpdate]
public string Workshop { get; set; }
/// <summary>
/// 使用在途库
/// </summary>
[Display(Name = "使用在途库")]
[IgnoreUpdate]
public bool UseOnTheWayLocation { get; set; }
/// <summary>
/// 任务明细
/// </summary>
[IgnoreUpdate]
public override List<CoatingIssueJobDetail> Details { get; set; } = new List<CoatingIssueJobDetail>();
/// <summary>
/// 设置任务明细的实际库位和实际数量
/// </summary>
/// <param name="id"></param>
/// <param name="handledLocationCode"></param>
/// <param name="handledLocationErpCode"></param>
/// <param name="handledWarehouseCode"></param>
/// <param name="handledQty"></param>
/// <param name="handledBatch"></param>
/// <param name="handledContainerCode"></param>
/// <param name="handledLot"></param>
/// <param name="handledPackingCode"></param>
/// <returns></returns>
public virtual async Task BuildDetail(Guid id, string handledLocationCode, string handledLocationErpCode,
string handledWarehouseCode, decimal handledQty, string handledSupplierBatch, DateTime handledArriveDate, DateTime handledProduceDate, DateTime handledExpireDate,
string handledContainerCode, string handledLot, string handledPackingCode)
{
var detail = GetDetail(id);
detail.HandledFromLocationCode = handledLocationCode;
detail.HandledFromLocationErpCode = handledLocationErpCode;
detail.HandledFromWarehouseCode = handledWarehouseCode;
detail.HandledQty = handledQty;
detail.HandledSupplierBatch = handledSupplierBatch;
detail.HandledArriveDate = handledArriveDate;
detail.HandledProduceDate = handledProduceDate;
detail.HandledExpireDate = handledExpireDate;
detail.HandledContainerCode = handledContainerCode;
detail.HandledLot = handledLot;
detail.HandledPackingCode = handledPackingCode;
await Task.CompletedTask.ConfigureAwait(false);
}
}

108
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobDetail.cs

@ -0,0 +1,108 @@
using System;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
public class CoatingIssueJobDetail : SfsJobRecommendFromDetailEntityBase, IHasToLocation
{
/// <summary>
/// 请求库位
/// </summary>
public string RequestLocationCode { get; set; }
/// <summary>
/// 到库位
/// </summary>
public string ToLocationCode { get; set; }
/// <summary>
/// 到库区
/// </summary>
public string ToLocationArea { get; set; }
/// <summary>
/// 到库位组
/// </summary>
public string ToLocationGroup { get; set; }
/// <summary>
/// 到ERP库位
/// </summary>
public string ToLocationErpCode { get; set; }
/// <summary>
/// 到仓库
/// </summary>
public string ToWarehouseCode { get; set; }
/// <summary>
/// 在途库库位
/// </summary>
public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 生产线
/// </summary>
public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
public string WorkStation { get; set; }
/// <summary>
/// 过期时间
/// </summary>
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 工序
/// </summary>
public string Operation { get; set; }
/// <summary>
/// 配送方式
/// </summary>
public EnumDistributionType DistributionType { get; set; }
/// <summary>
/// 取整方式
/// </summary>
public EnumTruncType TruncType { get; set; }
/// <summary>
/// 取整后数量
/// </summary>
public decimal RoundedQty { get; set; }
/// <summary>
/// 计划拆分规则
/// </summary>
public EnumPlannedSplitRule PlannedSplitRule { get; set; }
/// <summary>
/// 计划开始时间
/// </summary>
public DateTime PlanBeginTime { get; set; }
/// <summary>
/// 每次配送数量
/// </summary>
public decimal DeliveryQty { get; set; }
/// <summary>
/// 位置码
/// </summary>
public string PositionCode { get; set; }
/// <summary>
/// 推荐类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
public void SetId(Guid id)
{
this.Id = id;
}
}

103
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobManager.cs

@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Volo.Abp.Users;
using Volo.Abp.Validation;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
public class CoatingIssueJobManager : SfsJobManagerBase<CoatingIssueJob, CoatingIssueJobDetail>, ICoatingIssueJobManager
{
public CoatingIssueJobManager(
ICoatingIssueJobRepository repository
) : base(repository)
{
}
/// <summary>
/// 执行任务 发料任务
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <param name="user"></param>
/// <returns></returns>
public override async Task<CoatingIssueJob> CompleteAsync(CoatingIssueJob input, ICurrentUser user)
{
var entity = await Repository.FindAsync(input.Id).ConfigureAwait(false);
foreach (var detail in input.Details)
{
//发料子任务 赋值实际转移
await entity.BuildDetail(detail.Id,
detail.HandledFromLocationCode,
detail.HandledFromLocationErpCode,
detail.HandledFromWarehouseCode,
detail.HandledQty,
detail.HandledSupplierBatch,
detail.HandledArriveDate,
detail.HandledProduceDate,
detail.HandledExpireDate,
detail.HandledContainerCode,
detail.HandledLot,
detail.HandledPackingCode).ConfigureAwait(false);
}
return await base.CompleteAsync(entity, user).ConfigureAwait(false);
}
public override void CheckDetails(CoatingIssueJob entity, AbpValidationResult result)
{
var details = entity.Details;
foreach (var detail in details)
{
if (detail.HandledFromLocationCode == null)
{
result.Errors.Add(new ValidationResult($"{detail.HandledFromLocationCode} 不能为空"));
}
}
}
public override async Task<List<CoatingIssueJob>> GetWorkingListByPackingAsync(string packingCode)
{
return await Repository.GetListAsync(c => c.Details.Any(p => p.RecommendPackingCode == packingCode) && c.JobStatus != EnumJobStatus.Closed && c.JobStatus != EnumJobStatus.Cancelled, true).ConfigureAwait(false);
}
public override async Task<List<CoatingIssueJob>> GetWorkingListByContainerAsync(string containerCode)
{
return await Repository.GetListAsync(c => c.Details.Any(p => p.RecommendContainerCode == containerCode) && c.JobStatus != EnumJobStatus.Closed && c.JobStatus != EnumJobStatus.Cancelled, true).ConfigureAwait(false);
}
///// <summary>
///// 临时修改 解决补料无法拿到订阅错误
///// </summary>
///// <param name="eventData"></param>
///// <returns></returns>
//public virtual async Task<List<CoatingIssueJob>> AddByEtoAsync(MaterialRequestHandledETO eventData)
//{
// var CoatingIssueJobs = await BuildCoatingIssueJobByMaterialRequestAsync(eventData);
// await Repository.InsertManyAsync(CoatingIssueJobs);
// var expectIns = await BuildExpectInAsync(CoatingIssueJobs);
// await _expectInAppService.AddManyAndCalculationAvailableCapacityAsync(expectIns);
// return CoatingIssueJobs;
//}
//public virtual async Task TestError()
//{
// throw new UserFriendlyException("我是测试的异常");
//}
public async Task<CoatingIssueJob> GetAsync(Expression<Func<CoatingIssueJob, bool>> expression)
{
return await Repository.FindAsync(expression).ConfigureAwait(false);
}
}

10
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/ICoatingIssueJobManager.cs

@ -0,0 +1,10 @@
using System;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace Win_in.Sfs.Wms.Store.Domain;
public interface ICoatingIssueJobManager : IJobManager<CoatingIssueJob>
{
Task<CoatingIssueJob> GetAsync(Expression<Func<CoatingIssueJob, bool>> expression);
}

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/ICoatingIssueJobRepository.cs

@ -0,0 +1,6 @@
namespace Win_in.Sfs.Wms.Store.Domain;
public interface ICoatingIssueJobRepository : ISfsJobRepositoryBase<CoatingIssueJob>
{
}

54
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/ICoatingssueExtension.cs

@ -0,0 +1,54 @@
using Volo.Abp.Timing;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
public static class CoatingIssueExtension
{
// public static IssueJob SetDetails(this IssueJob job,IGuidGenerator guidGenerator, LocationDTO location)
// {
// foreach (var detail in job.Details)
// {
// detail.SetIdAndNumber(guidGenerator,job.Id,job.Number);
// detail.RecommendLocationCode = location.Code;
// detail.SetBatch(detail.RecommendBatch);
// }
// return job;
// }
public static IssueJob Init(this IssueJob job)
{
job.JobType = EnumJobType.IssueJob;
job.JobStatus = EnumJobStatus.Open;
return job;
}
public static IssueJob SetWorkGroup(this IssueJob job, string warehouseCode, string workGroupCode, string groupCode)
{
job.WorkGroupCode = workGroupCode;
job.WarehouseCode = warehouseCode;
job.ProdLine = groupCode;
return job;
}
public static IssueJob SetWorker(this IssueJob job, string worker)
{
job.Worker = worker;
return job;
}
public static IssueJob SetPriority(this IssueJob job, IClock clock)
{
job.Priority = PriorityHelper.GetPriority(clock);
job.PriorityIncrement = 1;
return job;
}
// public static IssueJob SetIdAndNumber(this IssueJob job,IGuidGenerator guidGenerator, ISnowflakeIdGenerator numberGenerator)
// {
// var number = (numberGenerator.CreateAsync().GetAwaiter().GetResult()).ToString();
// job.SetIdAndNumber(guidGenerator, number);
// return job;
// }
}

77
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNote.cs

@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Wms.Store.Domain;
/// <summary>
/// 发料记录
/// </summary>
public class CoatingIssueNote : SfsStoreAggregateRootBase<CoatingIssueNoteDetail>, IHasJobNumber, IHasRequestNumber
{
/// <summary>
/// 任务ID
/// </summary>
[IgnoreUpdate]
public string JobNumber { get; set; }
/// <summary>
/// 车间
/// </summary>
[IgnoreUpdate]
public string Workshop { get; set; }
/// <summary>
/// 明细列表
/// </summary>
[IgnoreUpdate]
public override List<CoatingIssueNoteDetail> Details { get; set; } = new List<CoatingIssueNoteDetail>();
[IgnoreUpdate]
public string RequestNumber { get; set; }
/// <summary>
/// 叫料请求类型
/// </summary>
[IgnoreUpdate]
public string RequestType { get; set; }
/// <summary>
/// 使用在途库
/// </summary>
[IgnoreUpdate]
public bool UseOnTheWayLocation { get; set; }
/// <summary>
/// 确认时间
/// </summary>
[Display(Name = "确认时间")]
[IgnoreUpdate]
public DateTime? ConfirmTime { get; set; }
/// <summary>
/// 已确认
/// </summary>
[Display(Name = "已确认")]
public bool Confirmed { get; set; }
public void Confirm(DateTime confirmTime)
{
CheckStatus(Confirmed);
Confirmed = true;
ConfirmTime = confirmTime;
}
private static void CheckStatus(bool confirmed)
{
if (confirmed)
{
throw new UserFriendlyException($"当前状态为 【已确认】 ,无法再次确认!");
}
}
}

43
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNoteDetail.cs

@ -0,0 +1,43 @@
using System;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
public class CoatingIssueNoteDetail : SfsStoreRecommendFromDetailWithFromToEntityBase
{
/// <summary>
/// 发料时间
/// </summary>
public DateTime IssueTime { get; set; }
/// <summary>
/// 过期时间
/// </summary>
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 生产线
/// </summary>
public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
public string WorkStation { get; set; }
/// <summary>
/// 在途库库位
/// </summary>
public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 位置码
/// </summary>
public string PositionCode { get; set; }
/// <summary>
/// 推荐类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
}

42
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNoteManager.cs

@ -0,0 +1,42 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Volo.Abp;
using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Event;
namespace Win_in.Sfs.Wms.Store.Domain;
public class CoatingIssueNoteManager : SfsStoreManagerBase<CoatingIssueNote, CoatingIssueNoteDetail>, ICoatingIssueNoteManager
{
public CoatingIssueNoteManager(
ICoatingIssueNoteRepository repository
) : base(repository)
{
}
[UnitOfWork]
public virtual async Task<CoatingIssueNote> ConfirmAsync(Guid id)
{
var entity = await Repository.FindAsync(id).ConfigureAwait(false);
Check.NotNull(entity, EntityClassName);
entity.Confirm(Clock.Now);
await PublishConfirmedAsync(entity).ConfigureAwait(false);
return await Repository.UpdateAsync(entity).ConfigureAwait(false);
}
private async Task PublishConfirmedAsync(CoatingIssueNote entity)
{
try
{
await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData<CoatingIssueNote>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{
Logger.LogDebug($"{nameof(CoatingIssueNote)} Confirmed Event:{ex.Message}", null);
Console.WriteLine(ex.Source);
throw;
}
}
}

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNoteRepository.cs

@ -0,0 +1,6 @@
namespace Win_in.Sfs.Wms.Store.Domain;
public interface ICoatingIssueNoteRepository : ISfsStoreRepositoryBase<CoatingIssueNote>
{
}

10
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/ICoatingIssueNoteManager.cs

@ -0,0 +1,10 @@
using System;
using System.Threading.Tasks;
namespace Win_in.Sfs.Wms.Store.Domain;
public interface ICoatingIssueNoteManager : ISfsStoreManager<CoatingIssueNote, CoatingIssueNoteDetail>
{
Task<CoatingIssueNote> ConfirmAsync(Guid id);
}

48
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequest.cs

@ -0,0 +1,48 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Wms.Store.Domain;
/// <summary>
/// 要料申请
/// </summary>
public class CoatingMaterialRequest : SfsStoreRequestAggregateRootBase<CoatingMaterialRequestDetail>
{
/// <summary>
/// 叫料类型
/// </summary>
[Display(Name = "叫料类型")]
[IgnoreUpdate]
public string Type { get; set; }
/// <summary>
/// 备料计划单号
/// </summary>
[IgnoreUpdate]
public string PreparationPlanNumber { get; set; }
/// <summary>
/// 生产线
/// </summary>
[IgnoreUpdate]
public string ProdLine { get; set; }
/// <summary>
/// 车间
/// </summary>
[IgnoreUpdate]
public string Workshop { get; set; }
/// <summary>
/// 使用在途库
/// </summary>
public bool UseOnTheWayLocation { get; set; }
/// <summary>
/// 明细列表
/// </summary>
[IgnoreUpdate]
public override List<CoatingMaterialRequestDetail> Details { get; set; } = new List<CoatingMaterialRequestDetail>();
}

104
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequestDetail.cs

@ -0,0 +1,104 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
public class CoatingMaterialRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation
{
/// <summary>
/// 到库位
/// </summary>
public string ToLocationCode { get; set; }
/// <summary>
/// 到库区
/// </summary>
public string ToLocationArea { get; set; }
/// <summary>
/// 到库位组
/// </summary>
public string ToLocationGroup { get; set; }
/// <summary>
/// 到ERP库位
/// </summary>
public string ToLocationErpCode { get; set; }
/// <summary>
/// 到仓库
/// </summary>
public string ToWarehouseCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
public string FromLocationArea { get; set; }
// /// <summary>
// /// 在途库库位
// /// </summary>
// public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 生产线
/// </summary>
public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
public string WorkStation { get; set; }
/// <summary>
/// 过期时间
/// </summary>
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 已发数量
/// </summary>
public decimal IssuedQty { get; set; }
/// <summary>
/// 已收数量
/// </summary>
public decimal ReceivedQty { get; set; }
/// <summary>
/// 明细状态
/// </summary>
public EnumStatus Status { get; set; }
/// <summary>
/// 请求未发 还未发送的数量
/// </summary>
[NotMapped]
public decimal ToBeIssuedQty => Qty - IssuedQty;
/// <summary>
/// 已发未收
/// </summary>
[NotMapped]
public decimal ToBeReceivedQty => IssuedQty - ReceivedQty;
/// <summary>
/// 请求未收
/// </summary>
[NotMapped]
public decimal NotFinishQty => Qty - ReceivedQty;
/// <summary>
/// 位置码
/// </summary>
public string PositionCode { get; set; }
/// <summary>
/// 推荐类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
}

307
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequestManager.cs

@ -0,0 +1,307 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Math;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings;
namespace Win_in.Sfs.Wms.Store.Domain;
public class CoatingMaterialRequestManager
: SfsStoreRequestManagerBase<CoatingMaterialRequest, CoatingMaterialRequestDetail>
, ICoatingMaterialRequestManager
{
private readonly ICoatingMaterialRequestRepository _repository;
private readonly ICoatingIssueJobRepository _issueJobRepository;
public CoatingMaterialRequestManager(
ICoatingMaterialRequestRepository repository
, ICoatingIssueJobRepository issueJobRepository
) : base(repository)
{
_repository = repository;
_issueJobRepository = issueJobRepository;
}
/// <summary>
/// 创建
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public virtual async Task<CoatingMaterialRequest> CreateBynNumberAsync(CoatingMaterialRequest entity)
{
var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(CoatingMaterialRequest), entity.ActiveDate).ConfigureAwait(false) : entity.Number;
entity.SetIdAndNumberWithDetails(GuidGenerator, number);
entity.Submit();
entity.Agree();
entity.RequestStatus = EnumRequestStatus.Partial;
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<CoatingMaterialRequest>(entity), false)
.ConfigureAwait(false);
await _repository.InsertAsync(entity).ConfigureAwait(false);
return entity;
}
public virtual async Task UpdateDetailsAsync(CoatingMaterialRequest newEntity)
{
var oldEntity = await Repository.FindAsync(newEntity.Id, true).ConfigureAwait(false);
if(oldEntity!=null)
{
foreach (var newDetail in newEntity.Details)
{
oldEntity.ReplaceDetail(newDetail.Id, newDetail);
}
foreach (var detail in oldEntity.Details)
{
SetMaterialRequestDetailStatus(detail);
}
await SetMaterialRequestStatus(oldEntity).ConfigureAwait(false);
await Repository.UpdateAsync(oldEntity).ConfigureAwait(false);
}
}
private void SetMaterialRequestDetailStatus(CoatingMaterialRequestDetail detail)
{
if (detail.ReceivedQty >= detail.Qty)//执行的时候 实际收料 多余 要料数
{
detail.Status = EnumStatus.Close;
}
else
{
detail.Status = EnumStatus.Open;
}
}
private async Task SetMaterialRequestStatus(CoatingMaterialRequest materialRequest)
{
if (materialRequest.Details.All(p => p.Status == EnumStatus.Close))
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
if (issueJobs.Count > 0)
{
if (issueJobs.All(t => t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled))
{
if (materialRequest.Details.All(p => p.ReceivedQty >= p.Qty))
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
}
public virtual async Task CompleteAsync(string number)
{
var entity = await GetByNumberAsync(number).ConfigureAwait(false);
if (entity != null && !entity.Details.Any(p => p.ToBeIssuedQty > 0))
{
await CompleteAsync(entity).ConfigureAwait(false);
}
}
#region 公有
/*
// /// <summary>
// /// 处理
// /// </summary>
// /// <returns></returns>
// public virtual async Task<bool> Handle(Guid id)
// {
// var entity =await Repository.GetAsync(id);
// if (entity == null)
// {
// return false;
// }
// entity.Handle();
// await Repository.UpdateAsync(entity);
//
// await HandledPublishAsync(entity);
// return true;
// }
//
// private async Task HandledPublishAsync(MaterialRequest entity)
// {
// //发布,以生成发料任务
// var eto = BuildMaterialRequestHandledETO(entity);
// await DistributedEventBus.PublishAsync(eto);
// }
//
// /// <summary>
// /// 关闭
// /// </summary>
// /// <returns></returns>
// public virtual async Task<bool> Close(Guid id)
// {
// var entity = await Repository.GetAsync(id);
// if (entity == null)
// {
// return false;
// }
// entity.Close();
// await Repository.UpdateAsync(entity);
//
// //发布,以关闭发料任务
// var eto = BuildMaterialRequestClosedETO(entity);
// await DistributedEventBus.PublishAsync(eto);
// return true;
// }
//
// /// <summary>
// /// 打开
// /// </summary>
// /// <returns></returns>
// public virtual async Task<bool> Open(Guid id)
// {
// var entity = await Repository.GetAsync(id);
// if (entity == null)
// {
// return false;
// }
// entity.Open();
//
// await Repository.UpdateAsync(entity);
//
// //发布,以打开发料任务
// var eto = BuildMaterialRequestOpenedETO(entity);
// await DistributedEventBus.PublishAsync(eto);
// return true;
// }
public virtual async Task<MaterialRequest> CreateAndHandleAsync(MaterialRequest entity)
{
await base.CreateAsync(entity);
await base.HandleAsync(entity.Id);
return entity;
}
*/
#endregion
#region Import
/// <summary>
/// 执行导入
/// </summary>
public virtual async Task ImportDataAsync(List<CoatingMaterialRequest> mergeEntities, List<CoatingMaterialRequest> deleteEntities = null)
{
if (deleteEntities != null && deleteEntities.Count > 0)
{
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false);
}
await CreateManyAsync(mergeEntities).ConfigureAwait(false);
}
#endregion
/*
#region 私有
private MaterialRequestOpenedETO BuildMaterialRequestOpenedETO(MaterialRequest materialRequest)
{
var materialRequestETO = new MaterialRequestOpenedETO()
{
Number = materialRequest.Number,
Workshop = materialRequest.Workshop,
Status = materialRequest.Status,
Details = BuildMaterialRequestDetailETO(materialRequest.Details)
};
return materialRequestETO;
}
private MaterialRequestClosedETO BuildMaterialRequestClosedETO(MaterialRequest materialRequest)
{
var materialRequestETO = new MaterialRequestClosedETO()
{
Company = materialRequest.Company,
Number = materialRequest.Number
};
return materialRequestETO;
}
private MaterialRequestHandledETO BuildMaterialRequestHandledETO(MaterialRequest materialRequest)
{
var materialRequestETO = new MaterialRequestHandledETO()
{
Company = materialRequest.Company,
Number = materialRequest.Number,
Workshop = materialRequest.Workshop,
Status = materialRequest.Status,
Details = BuildMaterialRequestDetailETO(materialRequest.Details)
};
return materialRequestETO;
}
private List<MaterialRequestDetailETO> BuildMaterialRequestDetailETO(List<MaterialRequestDetail> materialRequestDetail)
{
var list = new List<MaterialRequestDetailETO>();
foreach (var detail in materialRequestDetail)
{
var materialRequestDetailETO = new MaterialRequestDetailETO()
{
Number = detail.Number,
Item = detail.Item,
ItemCode = detail.ItemCode,
Qty = detail.Qty,
ToLocationCode = detail.ToLocationCode,
ProdLine = detail.ProdLine,
WorkStation = detail.WorkStation,
ExpiredTime = detail.ExpiredTime,
Status = detail.Status
};
list.Add(materialRequestDetailETO);
}
return list;
}
#endregion
*/
}
///// <summary>
///// 为了解决补料时 无法拿到订阅错误信息
///// </summary>
///// <param name="entity"></param>
///// <param name="flag"></param>
///// <returns></returns>
//public virtual async Task<MaterialRequest> CreateAndHandleAsync(MaterialRequest entity, bool flag)
//{
// await entity.Handle();
// foreach (var detail in entity.Details)
// {
// detail.Status = EnumStoreStatus.Handle;
// }
// await base.CreateAsync(entity);
// //发布,以打开发料任务??
// //var eto = BuildMaterialRequestHandledETO(entity);
// //await DistributedEventBus.PublishAsync(eto);
// return entity;
//}

16
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/ICoatingMaterialRequestManager.cs

@ -0,0 +1,16 @@
using System.Threading.Tasks;
namespace Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Shared.Domain;
public interface ICoatingMaterialRequestManager : ISfsStoreRequestManager<CoatingMaterialRequest, CoatingMaterialRequestDetail>,
IBulkImportService<CoatingMaterialRequest>
{
// Task<MaterialRequest> CreateAndHandleAsync(MaterialRequest entity);
Task UpdateDetailsAsync(CoatingMaterialRequest entity);
Task CompleteAsync(string number);
Task<CoatingMaterialRequest> CreateBynNumberAsync(CoatingMaterialRequest entity);
}

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/ICoatingMaterialRequestRepository.cs

@ -0,0 +1,9 @@
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Wms.Store.Domain;
public interface ICoatingMaterialRequestRepository : ISfsStoreRepositoryBase<CoatingMaterialRequest>,
ISfsBulkRepositoryBase<CoatingMaterialRequest>
{
}

69
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJobDbContextModelCreatingExtensions.cs

@ -0,0 +1,69 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.EntityFrameworkCore;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore;
public static class CoatingIssueJobDbContextModelCreatingExtensions
{
public static void ConfigureCoatingIssueJob(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options)
{
builder.Entity<CoatingIssueJob>(b =>
{
//Configure table & schema name
b.ToTable(StoreDbProperties.JobDbTablePrefix + nameof(CoatingIssueJob), options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsBase();
//Configure Job base properties
b.ConfigureJob<CoatingIssueJob, CoatingIssueJobDetail>();
//Properties
b.Property(q => q.RequestType).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.MaterialRequestNumber).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Workshop).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
//Relations
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired();
//Indexes
b.HasIndex(q => new { q.Number }).IsUnique();
});
builder.Entity<CoatingIssueJobDetail>(b =>
{
//Configure table & schema name
b.ToTable(StoreDbProperties.JobDbTablePrefix + nameof(CoatingIssueJobDetail), options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsBase();
//Configure Job base properties
b.ConfigureJobRecommendFromDetail();
//Properties
b.Property(q => q.ExpiredTime).IsRequired();
b.Property(q => q.ToLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationErpCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToWarehouseCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationArea).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationGroup).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RequestLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Operation).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.DistributionType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.TruncType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.PlannedSplitRule).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength).IsRequired(false);
b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.CodeLength).HasConversion<string>();
//Relations
//None
//Indexes
//b.HasIndex(q => new { q.PackingCode }).IsUnique();
});
}
}

11
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJobEfCoreRepository.cs

@ -0,0 +1,11 @@
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore;
public class CoatingIssueJobEfCoreRepository : SfsJobEfCoreRepositoryBase<StoreDbContext, CoatingIssueJob>, ICoatingIssueJobRepository
{
public CoatingIssueJobEfCoreRepository(IDbContextProvider<StoreDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}

62
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/CoatingIssueNoteDbContextModelCreatingExtensions.cs

@ -0,0 +1,62 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore;
public static class CoatingIssueNoteDbContextModelCreatingExtensions
{
public static void ConfigureCoatingIssueNote(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options)
{
builder.Entity<CoatingIssueNote>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + nameof(CoatingIssueNote), options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsStoreBase();
//Properties
b.Property(q => q.RequestNumber).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RequestType).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Workshop).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.Remark).HasMaxLength(SfsPropertyConst.RemarkLength);
//Relations
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired();
//Indexes
b.HasIndex(q => new { q.Number }).IsUnique();
});
builder.Entity<CoatingIssueNoteDetail>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + nameof(CoatingIssueNoteDetail), options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsStoreBase();
//Configure Sfs store detail properties
b.ConfigureSfsStoreDetailBase();
//Properties
b.Property(q => q.IssueTime).IsRequired();
b.Property(q => q.ExpiredTime).IsRequired();
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
//Relations
//Indexes
b.HasIndex(q => new { q.Number, q.FromPackingCode, q.FromLocationCode, q.ToLocationCode }).IsUnique();
b.HasIndex(q => new { q.FromPackingCode });
});
}
}

11
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/CoatingIssueNoteEfCoreRepository.cs

@ -0,0 +1,11 @@
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore;
public class CoatingIssueNoteEfCoreRepository : SfsStoreEfCoreRepositoryBase<StoreDbContext, CoatingIssueNote>, ICoatingIssueNoteRepository
{
public CoatingIssueNoteEfCoreRepository(IDbContextProvider<StoreDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}

64
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/CoatingMaterialRequestDbContextModelCreatingExtensions.cs

@ -0,0 +1,64 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore;
public static class CoatingMaterialRequestDbContextModelCreatingExtensions
{
public static void ConfigureCoatingMaterialRequest(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options)
{
builder.Entity<CoatingMaterialRequest>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + nameof(CoatingMaterialRequest), options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsStoreBase();
//Properties
b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.PreparationPlanNumber).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Workshop).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
//Relations
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired();
//Indexes
b.HasIndex(q => new { q.Number }).IsUnique();
});
builder.Entity<CoatingMaterialRequestDetail>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + nameof(CoatingMaterialRequestDetail), options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsStoreBase();
//Configure Sfs store detail properties
b.ConfigureSfsStoreDetailBase();
//Properties
b.Property(q => q.ToLocationCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationErpCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToWarehouseCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationArea).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ExpiredTime).IsRequired();
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.IssuedQty).HasPrecision(18, 6);
b.Property(q => q.ReceivedQty).HasPrecision(18, 6);
b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
//Relations
//Indexes
b.HasIndex(q => new { q.Number, q.ItemCode, q.ToLocationCode }).IsUnique();
b.HasIndex(q => new { q.ItemCode });
});
}
}

11
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/CoatingMaterialRequestEfCoreRepository.cs

@ -0,0 +1,11 @@
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore;
public class CoatingMaterialRequestEfCoreRepository : SfsStoreEfCoreRepositoryBase<StoreDbContext, CoatingMaterialRequest>, ICoatingMaterialRequestRepository
{
public CoatingMaterialRequestEfCoreRepository(IDbContextProvider<StoreDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs

@ -66,6 +66,9 @@ public static class StoreDbContextModelCreatingExtensions
builder.ConfigureScrapRequest(options);
builder.ConfigureCountAdjustRequest(options);
builder.ConfigureWipWarehouseAdjustRequest(options);
builder.ConfigureCoatingIssueNote(options);
builder.ConfigureCoatingMaterialRequest(options);
builder.ConfigureCoatingIssueJob(options);
#endregion

Loading…
Cancel
Save