Browse Source

解决冲突

dev_DY_CC
周红军 1 year ago
parent
commit
ee5e7b9bd5
  1. 4
      be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad/ProductLineAppService.cs
  2. 7
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentLocCapDTO.cs
  3. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentLocCapCheckInput.cs
  4. 42
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/DTOs/ProductionLineDTO.cs
  5. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/IProductionLineAppService.cs
  6. 59
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/Inputs/ProductionLineEditInput.cs
  7. 54
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/Inputs/ProductionLineImportInput.cs
  8. 13
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAutoMapperProfile.cs
  9. 16
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLines/ProductionLineAppService.cs
  10. 6
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLines/ProductionLineAutoMapperProfile.cs
  11. 52
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLines/ProductionLine.cs
  12. 4158
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240328061914_Added_First.Designer.cs
  13. 1873
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240328061914_Added_First.cs
  14. 4156
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/BasedataDbContextModelSnapshot.cs
  15. 5
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLines/ProductionLineDbContextModelCreatingExtensions.cs
  16. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLines/ProductionLineEfCoreRepository.cs
  17. 4
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Win_in.Sfs.Basedata.EntityFrameworkCore.csproj
  18. 29
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/DTOs/InjectionRequestDTO.cs
  19. 44
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/DTOs/InjectionRequestDetailDTO.cs
  20. 24
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/IInjectionRequestAppService.cs
  21. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs
  22. 357
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs
  23. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs
  24. 144
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/PreparationPlans/PreparationPlanManager.cs
  25. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequest.cs
  26. 10
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs
  27. 0
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJob/CoatingIssueJobDbContextModelCreatingExtensions.cs
  28. 0
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJob/CoatingIssueJobEfCoreRepository.cs
  29. 26195
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240328035332_Update_2024_03_28_ProductLine.Designer.cs
  30. 801
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240328035332_Update_2024_03_28_ProductLine.cs
  31. 9431
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs
  32. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs
  33. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Win_in.Sfs.Wms.Store.EntityFrameworkCore.csproj
  34. 132
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CoatingIssueJobEventHandler.cs
  35. 0
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingIssueJobEventHandler.cs
  36. 307
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs
  37. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionRequestEventHandler.cs
  38. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs
  39. 100
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs
  40. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductReceiptRequestEventHandler.cs
  41. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductionPlanEventHandler.cs

4
be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad/ProductLineAppService.cs

@ -55,10 +55,6 @@ public class ProductLineAppService : ApplicationService, IProductLineAppService
Validator.CheckSite(_configuration, entityObj.Site);
Validator.CheckCompany(_configuration, entityObj.Company);
var targetObj = ObjectMapper.Map<ProdLine, ProductionLineEditInput>(entityObj);
//if (targetObj.Type == null) { targetObj.Type = 0; }
if (targetObj.WorkshopCode == null) { targetObj.WorkshopCode = "_"; }
if (targetObj.RawLocationCode == null) { targetObj.RawLocationCode = "_"; }
if (targetObj.ProductLocationCode == null) { targetObj.ProductLocationCode = "_"; }
await _productionLineAppService.UpsertAsync(targetObj).ConfigureAwait(false);

7
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentLocCapDTO.cs

@ -3,11 +3,7 @@ using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Application.Contracts;
[Display(Name = "器具容量占用信息")]
public class EquipmentLocCapDTO : SfsBaseDataDTOBase, IHasCode
{
/// <summary>
@ -15,12 +11,11 @@ public class EquipmentLocCapDTO : SfsBaseDataDTOBase, IHasCode
/// </summary>
[Display(Name = "器具代码")]
public string Code { get; set; }
/// <summary>
/// 占用百分比
/// </summary>
[Display(Name = "占用百分比")]
public decimal Percent { get; set; }
/// <summary>
/// 零件号
/// </summary>

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentLocCapCheckInput.cs

@ -12,6 +12,7 @@ public class EquipmentLocCapCheckInput
/// </summary>
[Display(Name = "器具代码")]
public string Code { get; set; }
/// <summary>
/// 占用百分比
/// </summary>
[Display(Name = "占用百分比")]

42
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/DTOs/ProductionLineDTO.cs

@ -1,61 +1,57 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
/// <summary>
/// 生产线
/// 生产线
/// </summary>
[Display(Name = "生产线")]
public class ProductionLineDTO : SfsBaseDataDTOBase, IHasCode, IHasName
{
/// <summary>
///
///
/// </summary>
[Display(Name = "编码")]
[Display(Name = "代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 名称
/// 名称
/// </summary>
[Display(Name = "名称")]
public string Name { get; set; }
/// <summary>
/// 描述
/// 描述
/// </summary>
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// 类型
/// </summary>
[Display(Name = "类型")]
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 车间
/// </summary>
[Display(Name = "车间")]
public string WorkshopCode { get; set; }
/// <summary>
/// 原料库位
/// 原料库位
/// </summary>
[Display(Name = "原料库位")]
public string RawLocationCode { get; set; }
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// 成品库位
/// </summary>
[Display(Name = "成品库位")]
public string ProductLocationCode { get; set; }
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 原料库位组
/// 线边库位
/// </summary>
[Display(Name = "原料库位组")]
public string RawLocationGroupCode { get; set; }
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/IProductionLineAppService.cs

@ -8,5 +8,4 @@ public interface IProductionLineAppService
, ISfsGetByCodeAppService<ProductionLineDTO>
, ISfsUpsertAppService<ProductionLineEditInput>
{
Task<ProductionLineDTO> GetByLocationGroupCodeAsync(string locationGroupCode);
}

59
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/Inputs/ProductionLineEditInput.cs

@ -1,6 +1,8 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
@ -9,63 +11,46 @@ namespace Win_in.Sfs.Basedata.Application.Contracts;
/// </summary>
public class ProductionLineEditInput : SfsBaseDataCreateOrUpdateInputBase
{
#region Base
/// <summary>
/// 名称
/// 代码
/// </summary>
[Display(Name = "代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 名称
/// </summary>
[Display(Name = "名称")]
[StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Name { get; set; }
/// <summary>
/// 描述
/// 描述
/// </summary>
[Display(Name = "描述")]
[StringLength(SfsEfCorePropertyConst.DescLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Description { get; set; }
/// <summary>
/// 类型
/// 类型
/// </summary>
[Display(Name = "类型")]
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 车间
/// 原料库位
/// </summary>
[Display(Name = "车间")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string WorkshopCode { get; set; }
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 原料库位
/// 成品库位
/// </summary>
[Display(Name = "原料库位")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RawLocationCode { get; set; }
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// 线边库位
/// </summary>
[Display(Name = "成品库位")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ProductLocationCode { get; set; }
/// <summary>
/// 原料库位组
/// </summary>
[Display(Name = "原料库位组")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RawLocationGroupCode { get; set; }
#endregion
#region Create
[Display(Name = "代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Code { get; set; }
#endregion
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

54
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/Inputs/ProductionLineImportInput.cs

@ -1,6 +1,8 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
@ -11,65 +13,45 @@ namespace Win_in.Sfs.Basedata.Application.Contracts;
public class ProductionLineImportInput : SfsBaseDataImportInputBase
{
/// <summary>
/// 生产线代码
/// 代码
/// </summary>
[Display(Name = "代码")]
[Key]
[Display(Name = "生产线代码")]
[Required(ErrorMessage = "物品代码是必填项")]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 生产线名称
/// 名称
/// </summary>
[Display(Name = "生产线名称")]
[Required(ErrorMessage = "{生产线名称}是必填项")]
[Display(Name = "名称")]
public string Name { get; set; }
/// <summary>
/// 描述
/// 描述
/// </summary>
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// 类型
/// </summary>
[Display(Name = "类型")]
[Required(ErrorMessage = "{0}是必填项")]
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 车间代码
/// 原料库位
/// </summary>
[Display(Name = "车间代码")]
[Required(ErrorMessage = "{0}是必填项")]
public string WorkshopCode { get; set; }
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 原料库位
/// 成品库位
/// </summary>
[Display(Name = "原料库位")]
[Required(ErrorMessage = "{0}是必填项")]
public string RawLocationCode { get; set; }
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// 线边库位
/// </summary>
[Display(Name = "成品库位")]
[Required(ErrorMessage = "{0}是必填项")]
public string ProductLocationCode { get; set; }
/// <summary>
/// 原料库位组
/// </summary>
[Display(Name = "原料库位组")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RawLocationGroupCode { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Remark { get; set; }
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

13
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAutoMapperProfile.cs

@ -13,16 +13,15 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
.ReverseMap();
CreateMap<ProductionLineItemImportInput, ProductionLineItem>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TenantId)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.ConcurrencyStamp)
;
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TenantId)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.ConcurrencyStamp)
;
CreateMap<ProductionLineItem, ProductionLineItemImportInput>()
.Ignore(x => x.ReportStatus)
.Ignore(x => x.ReportStatus)
.Ignore(x => x.ReportReason);
;
}
}

16
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLines/ProductionLineAppService.cs

@ -41,25 +41,9 @@ public class ProductionLineAppService
}
[HttpPost("upsert")]
public virtual async Task UpsertAsync(ProductionLineEditInput input)
{
var entity = ObjectMapper.Map<ProductionLineEditInput, ProductionLine>(input);
await _repository.UpsertAsync(entity).ConfigureAwait(false);
}
[HttpGet("by-location-group/{locationGroupCode}")]
public virtual async Task<ProductionLineDTO> GetByLocationGroupCodeAsync(string locationGroupCode)
{
var entity = await _repository.FindAsync(p => p.RawLocationGroupCode == locationGroupCode).ConfigureAwait(false);
return ObjectMapper.Map<ProductionLine, ProductionLineDTO>(entity);
}
protected override async Task ValidateImportModelAsync(ProductionLineImportInput importInput, List<ValidationResult> validationRresult)
{
await base.ValidateImportModelAsync(importInput, validationRresult).ConfigureAwait(false);
await base.CheckWorkGroupWorkshopCodeAsync(importInput.WorkshopCode, validationRresult).ConfigureAwait(false);
await base.CheckRawLocationAsync(importInput.RawLocationCode, validationRresult).ConfigureAwait(false);
await base.CheckProductLocationAsync(importInput.ProductLocationCode, validationRresult).ConfigureAwait(false);
}
}

6
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLines/ProductionLineAutoMapperProfile.cs

@ -17,11 +17,11 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
.Ignore(x => x.TenantId)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.ConcurrencyStamp)
;
.Ignore(x=>x.Remark)
;
CreateMap<ProductionLine, ProductionLineImportInput>()
.Ignore(x => x.ReportStatus)
.Ignore(x => x.ReportStatus)
.Ignore(x => x.ReportReason);
}
}

52
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLines/ProductionLine.cs

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
@ -6,61 +7,50 @@ using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Domain;
/// <summary>
/// 生产线
/// 生产线
/// </summary>
public class ProductionLine : SfsBaseDataAggregateRootBase, IHasCode, IHasName
{
[Display(Name = "编码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
/// <summary>
/// 代码
/// </summary>
[Display(Name = "代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 名称
/// 名称
/// </summary>
[Display(Name = "编码")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[Display(Name = "名称")]
public string Name { get; set; }
/// <summary>
/// 描述
/// 描述
/// </summary>
[Display(Name = "编码")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// 类型
/// </summary>
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 车间
/// </summary>
[Display(Name = "车间")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string WorkshopCode { get; set; }
/// <summary>
/// 原料库位
/// 原料库位
/// </summary>
[Display(Name = "原料库位")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RawLocationCode { get; set; }
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// 成品库位
/// </summary>
[Display(Name = "成品库位")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ProductLocationCode { get; set; }
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 原料库位组
/// 线边库位
/// </summary>
[Display(Name = "原料库位组")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RawLocationGroupCode { get; set; }
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

4158
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240328061914_Added_First.Designer.cs

File diff suppressed because it is too large

1873
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240328061914_Added_First.cs

File diff suppressed because it is too large

4156
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/BasedataDbContextModelSnapshot.cs

File diff suppressed because it is too large

5
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLines/ProductionLineDbContextModelCreatingExtensions.cs

@ -20,11 +20,8 @@ public static class ProductionLineDbContextModelCreatingExtensions
b.Property(x => x.Name).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(x => x.Description).HasMaxLength(SfsPropertyConst.DescLength);
b.Property(x => x.Type).IsRequired().HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.WorkshopCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RawLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ProductLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RawLocationGroupCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Remark).HasMaxLength(SfsPropertyConst.RemarkLength);
b.HasKey(q => q.Code);
b.HasIndex(x => new { x.Code }).IsUnique();
});

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLines/ProductionLineEfCoreRepository.cs

@ -29,7 +29,6 @@ public class ProductionLineEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<Ba
// exist.TenantId = entity.TenantId;
exist.Remark = entity.Remark;
exist.Type = entity.Type;
exist.WorkshopCode = entity.WorkshopCode;
// exist.RawLocation = entity.RawLocation;
// exist.ProductLocation = entity.ProductLocation;
// exist.RawLocationGroupCode = entity.RawLocationGroupCode;

4
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Win_in.Sfs.Basedata.EntityFrameworkCore.csproj

@ -30,4 +30,8 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

29
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/DTOs/InjectionRequestDTO.cs

@ -5,33 +5,36 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class InjectionRequestDTO : SfsStoreRequestDTOBase<InjectionRequestDetailDTO>, IHasNumber
{
/// <summary>
/// 叫料类型
/// 叫料类型
/// </summary>
[Display(Name = "叫料类型")]
public string Type { get; set; }
/// <summary>
/// 备料计划单号
/// 生产线
/// </summary>
[Display(Name = "备料计划单号")]
public string PreparationPlanNumber { get; set; }
[Display(Name = "生产线")]
public string ProdLine { get; set; }
/// <summary>
/// 生产线
/// 是否使用在途库
/// </summary>
[Display(Name = "生产线")]
public string ProdLine { get; set; }
[Display(Name = "是否使用在途库")]
public bool IsUseOnTheWayLocation { get; set; }
/// <summary>
/// 车间
/// 可用来源库位Json集合
/// </summary>
[Display(Name = "车间")]
public string Workshop { get; set; }
public string FromLocationCodeJsonList { get; set; }
/// <summary>
/// 使用在途库
/// 叫料库位
/// </summary>
[Display(Name = "使用在途库")]
public bool UseOnTheWayLocation { get; set; }
public string ToLocationCode { get; set; }
/// <summary>
/// 目标ERP储位
/// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; }
}

44
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/DTOs/InjectionRequestDetailDTO.cs

@ -7,51 +7,7 @@ using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class InjectionRequestDetailDTO : 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>

24
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/IInjectionRequestAppService.cs

@ -9,27 +9,5 @@ public interface IInjectionRequestAppService
: ISfsStoreRequestMasterAppServiceBase<InjectionRequestDTO, SfsStoreRequestInputBase, InjectionRequestEditInput, InjectionRequestDetailDTO, SfsStoreRequestInputBase>
{
Task<InjectionRequestDTO> CreateAndHandleAsync(InjectionRequestEditInput input);
/// <summary>
/// 根据备料计划生成 叫料请求
/// </summary>
/// <returns></returns>
Task<InjectionRequestDTO> CreateAndHandleByPreparationPlan(string productionPlanNumber);
Task<InjectionRequestDTO> CreateAndHandleByAPIAsync(InjectionRequestEditInput input);
/// <summary>
/// 根据类型获取叫料请求
/// </summary>
/// <param name="requestInput"></param>
/// <param name="type">叫料请求类型</param>
/// <param name="includeDetails"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<PagedResultDto<InjectionRequestDTO>> GetListByTypeAsync(SfsStoreRequestInputBase requestInput,
string type, bool includeDetails = false, CancellationToken cancellationToken = default);
Task<List<InjectionRequestDTO>> GetListByTypeAsync(string type);
}

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

@ -235,20 +235,20 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase<Co
detailInput.RecommendType = EnumRecommendType.None;
}
var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false);
//var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false);
detailInput.ToLocationCode = toLocationDto.ErpLocationCode;
if (productionLineDto != null)
{
detailInput.ProdLine = productionLineDto.Code;
}
//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);
//var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false);
detail.ToLocationArea = toLocationDto.AreaCode;
detail.ToLocationErpCode = toLocationDto.ErpLocationCode;

357
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs

@ -25,6 +25,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application;
//注塑叫料
[Authorize]
[Route($"{StoreConsts.RootPath}injection-request")]
public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<InjectionRequest, InjectionRequestDTO,
@ -33,15 +34,9 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
IInjectionRequestAppService
{
private readonly IInjectionRequestManager _injectionRequestManager;
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 IInjectionJobAppService _issueJobAppService;
@ -58,7 +53,6 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
: base(repository, injectionRequestManager)
{
_injectionRequestManager = injectionRequestManager;
_preparationPlanManager = preparationPlanManager;
_itemStoreRelationApp = itemStoreRelationApp;
_areaApp = areaApp;
_locationAppService = locationAppService;
@ -67,209 +61,19 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
_issueJobAppService = issueJobAppService;
}
#region 东阳使用
/// <summary>
/// 用来重写 导入数据时可以加工数据
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
protected override async Task<Dictionary<InjectionRequest, EntityState>> ImportProcessingEntityAsync(
Dictionary<InjectionRequest, EntityState> dictionary)
{
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
foreach (var injectionRequest in addList)
{
injectionRequest.Worker = CurrentUser.GetUserName();
injectionRequest.CreatorId = CurrentUser.Id;
if (injectionRequest.Type == EnumTransSubType.Issue_Manual.GetDisplayName())
{
injectionRequest.Type = EnumTransSubType.Issue_Manual.ToString();
}
foreach (var detail in injectionRequest.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;
}
#region 东阳V2
public override async Task<InjectionRequestDTO> HandleAsync(Guid id)
{
var entity=await _repository.GetAsync(id).ConfigureAwait(false);
var entity = await _repository.GetAsync(id).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<InjectionRequest>(entity), false).ConfigureAwait(false);
return ObjectMapper.Map<InjectionRequest, InjectionRequestDTO>(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(InjectionRequestPermissions.Create)]
public override async Task<InjectionRequestDTO> CreateAsync(InjectionRequestEditInput 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<InjectionRequestEditInput, InjectionRequest>(input);
var result = await _injectionRequestManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<InjectionRequest, InjectionRequestDTO>(result);
return dto;
}
/// <summary>
/// 创建并且执行叫料请求
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("create-and-handle-api")]
//[Authorize(InjectionRequestPermissions.Create)]
public virtual async Task<InjectionRequestDTO> CreateAndHandleByAPIAsync(InjectionRequestEditInput 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<InjectionRequestEditInput, InjectionRequest>(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 _injectionRequestManager.CreateBynNumberAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<InjectionRequest, InjectionRequestDTO>(result);
return dto;
}
/// <summary>
/// 创建并且执行叫料请求
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("create-and-handle")]
//[Authorize(InjectionRequestPermissions.Create)]
public virtual async Task<InjectionRequestDTO> CreateAndHandleAsync(InjectionRequestEditInput input)
{
foreach (var item in input.Details)
{
@ -279,16 +83,6 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
}
}
//检验备料计划是否存在要料请求
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);
@ -296,10 +90,8 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
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;
detailInput.ProdLine = detailInput.ToLocationCode;
detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode;
}
input.AutoSubmit = true;
@ -317,83 +109,77 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
return dto;
}
/// <summary>
/// 根据备料计划生成 叫料请求
/// </summary>
/// <returns></returns>
[HttpPost("create-and-handle-by-preparation-plan/{number}")]
public virtual async Task<InjectionRequestDTO> CreateAndHandleByPreparationPlan(string number)
//[Authorize(InjectionRequestPermissions.Create)]
[HttpPost("create-and-handle")]
public async Task<InjectionRequestDTO> CreateAndHandleAsync(InjectionRequestEditInput input)
{
var prodPreparationPlan = await _preparationPlanManager.GetByNumberAsync(number).ConfigureAwait(false);
var injectionRequestDto = await CreateAsync(input).ConfigureAwait(false);
var injectionRequestCreateInput = new InjectionRequestEditInput { Worker = CurrentUser.GetUserName() };
await HandleAsync(injectionRequestDto.Id).ConfigureAwait(false);
foreach (var preparationPlanDetail in prodPreparationPlan.Details)
{
var detail = new InjectionRequestDetailInput
{
ItemCode = preparationPlanDetail.ItemCode,
ItemName = preparationPlanDetail.ItemName,
ItemDesc1 = preparationPlanDetail.ItemDesc1,
ItemDesc2 = preparationPlanDetail.ItemDesc2,
Uom = preparationPlanDetail.Uom,
Qty = preparationPlanDetail.Qty,
StdPackQty = preparationPlanDetail.StdPackQty,
ToLocationCode = preparationPlanDetail.ToLocationCode
};
injectionRequestCreateInput.Details.Add(detail);
}
var dto = await CreateAndHandleAsync(injectionRequestCreateInput).ConfigureAwait(false);
return dto;
return injectionRequestDto;
}
#endregion
/// <summary>
/// 检验备料计划是否存在要料请求
/// 根据类型 获取叫料申请
/// </summary>
/// <param name="preparationPlanNumber"></param>
/// <param name="type"></param>
/// <returns></returns>
private async Task<List<InjectionRequest>> CheckExistByPreparationPlanAsync(string preparationPlanNumber)
[HttpGet("list/by-type/{type}")]
public virtual async Task<List<InjectionRequestDTO>> GetListByTypeAsync(string type)
{
var entities = await _repository.GetListAsync(c => c.PreparationPlanNumber == preparationPlanNumber)
.ConfigureAwait(false);
return entities;
var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<InjectionRequest>, List<InjectionRequestDTO>>(entities);
return dtos;
}
#region 导入
/// <summary>
/// 根据类型获取叫料请求
/// 用来重写 导入数据时可以加工数据
/// </summary>
/// <param name="requestInput"></param>
/// <param name="type">
/// 叫料请求类型:
/// 人工拉动:Issue_Manual;
/// 线边拉动:Issue_WIP;
/// </param>
/// <param name="includeDetails"></param>
/// <param name="cancellationToken"></param>
/// <param name="dictionary"></param>
/// <returns></returns>
[HttpPost("by-type/{type}")]
public virtual async Task<PagedResultDto<InjectionRequestDTO>> GetListByTypeAsync(
SfsStoreRequestInputBase requestInput,
string type,
bool includeDetails = false,
CancellationToken cancellationToken = default)
protected override async Task<Dictionary<InjectionRequest, EntityState>> ImportProcessingEntityAsync(
Dictionary<InjectionRequest, EntityState> dictionary)
{
Expression<Func<InjectionRequest, bool>> expression = p => p.Type == type;
if (requestInput.Condition.Filters?.Count > 0)
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
foreach (var injectionRequest in addList)
{
expression = expression.And(requestInput.Condition.Filters.ToLambda<InjectionRequest>());
injectionRequest.Worker = CurrentUser.GetUserName();
injectionRequest.CreatorId = CurrentUser.Id;
if (injectionRequest.Type == EnumTransSubType.Issue_Manual.GetDisplayName())
{
injectionRequest.Type = EnumTransSubType.Issue_Manual.ToString();
}
foreach (var detail in injectionRequest.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 await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount,
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
return dictionary;
}
#region 导入
/// <summary>
/// 导入验证
/// </summary>
@ -486,18 +272,29 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
#endregion
/// <summary>
/// 根据类型 获取叫料申请
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
[HttpGet("list/by-type/{type}")]
public virtual async Task<List<InjectionRequestDTO>> GetListByTypeAsync(string type)
#region 校验
private void CheckItemBasic(ItemBasicDTO ItemBasicDto, string itemCode)
{
var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false);
if (ItemBasicDto == null)
{
throw new UserFriendlyException($"物品代码为【{itemCode}】不存在");
}
}
var dtos = ObjectMapper.Map<List<InjectionRequest>, List<InjectionRequestDTO>>(entities);
private void CheckLocation(LocationDTO LocationDto, string LocationCode)
{
if (LocationDto == null)
{
throw new UserFriendlyException($"库位代码为【{LocationCode}】不存在");
}
return dtos;
if (LocationDto.Type != EnumLocationType.WIP)
{
throw new UserFriendlyException($"库位代码【{LocationCode}】不是【{EnumLocationType.WIP.GetDisplayName()}】类型");
}
}
#endregion
}

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs

@ -231,20 +231,20 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
detailInput.RecommendType = EnumRecommendType.None;
}
var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false);
//var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false);
detailInput.ToLocationCode = toLocationDto.ErpLocationCode;
if (productionLineDto != null)
{
detailInput.ProdLine = productionLineDto.Code;
}
//if (productionLineDto != null)
//{
// detailInput.ProdLine = productionLineDto.Code;
//}
}
var entity = ObjectMapper.Map<MaterialRequestEditInput, MaterialRequest>(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);
//var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false);
detail.ToLocationArea= toLocationDto.AreaCode;
detail.ToLocationErpCode = toLocationDto.ErpLocationCode;

144
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/PreparationPlans/PreparationPlanManager.cs

@ -31,78 +31,78 @@ public class PreparationPlanManager : SfsStoreManagerBase<PreparationPlan, Prepa
public virtual async Task<PreparationPlan> CreateFromProductionPlanAsync(ProductionPlan productionPlan)
{
//判断
Check.NotNull(productionPlan, nameof(productionPlan));
var prodLine = productionPlan.ProdLine;
//开始生产计划时,生成备料计划,开关控制
//①根据BOM拆分备料记录:备料计划的数量 = bom的用量 * 生产计划的计划数量
//②bom的父物料号 = 生产计划的Item_code
var preparationPlan = BuildPreparationPlan(productionPlan);
var boms = new List<BomDTO>();
//根据生产计划明细获取一层BOM信息,如果子零件为虚零件则下穿一层
foreach (var productionPlanDetail in productionPlan.Details.Where(productionPlanDetail =>
productionPlanDetail.PlanQty > 0))
{
//获得BOM信息
var productBoms = await _bomAppService.GetPlanListAsync(productionPlanDetail.ItemCode, prodLine).ConfigureAwait(false);
if (productBoms.Count == 0)
{
throw new UserFriendlyException(
$"生成备料计划失败:{productionPlanDetail.ItemCode} 在 {prodLine} 缺少对应的Bom信息!");
}
productBoms.ForEach(p => p.Product = productionPlanDetail.ItemCode);
boms.AddRange(productBoms);
}
var productionLine = await _productionLineAppService.GetByCodeAsync(prodLine).ConfigureAwait(false);
Check.NotNull(productionLine, "生产线代码", $"生产线 {prodLine} 不存在");
var rawLocationCodeOfProductionLine = productionLine.RawLocationCode;
//将BOM按子零件分组
var bomGroupByItemCode = boms.GroupBy(p => p.Component);
foreach (var bomGroup in bomGroupByItemCode)
{
var itemCode = bomGroup.Key;
var item = await ItemBasicAppService.GetByCodeAsync(itemCode).ConfigureAwait(false);
Check.NotNull(item, "物品代码", $"物品 {itemCode} 不存在");
//成品零件号
var productItemCode = bomGroup.First().Product;
//取整方式
var trunkType = bomGroup.First().TruncType;
//计量单位
var uom = bomGroup.First().ComponentUom;
//子零件的BOM用量为各个BOM用量的汇总
var bomGroupQty = bomGroup.Sum(p => p.ComponentQty);
//从生产计划明细中获得
var planQty = productionPlan.Details.First(p => p.ItemCode == productItemCode).PlanQty;
//实际需求量为成品计划生产量 * 汇总BOM用
var sumQty = planQty * bomGroupQty;
//获取标包数量,计算备料数量
var (stdPackQty, detailQty) = await CalcDetailQtyAsync(sumQty, item.StdPackQty, trunkType).ConfigureAwait(false);
//TODO 从物料存储关系中根据 库位组 = 生产线代码 查找是一个预定假设,需要改成可配置的
//从物料存储关系中查找 库位组 = 生产线代码 的库位
var locationCodeFromItemStoreRelation =
await GetFirstLocationFromItemStoreRelationAsync(prodLine, itemCode).ConfigureAwait(false);
//备料的物料没有物料存储关系,则目标库位取生产线的原料库位
var locationCode = string.IsNullOrEmpty(locationCodeFromItemStoreRelation)
? rawLocationCodeOfProductionLine
: locationCodeFromItemStoreRelation;
//构造备料计划明细
var detail = BuildPreparationPlanDetail(item, detailQty, stdPackQty, locationCode);
preparationPlan.Details.Add(detail);
}
await CreateAsync(preparationPlan).ConfigureAwait(false);
return preparationPlan;
////判断
//Check.NotNull(productionPlan, nameof(productionPlan));
//var prodLine = productionPlan.ProdLine;
////开始生产计划时,生成备料计划,开关控制
////①根据BOM拆分备料记录:备料计划的数量 = bom的用量 * 生产计划的计划数量
////②bom的父物料号 = 生产计划的Item_code
//var preparationPlan = BuildPreparationPlan(productionPlan);
//var boms = new List<BomDTO>();
////根据生产计划明细获取一层BOM信息,如果子零件为虚零件则下穿一层
//foreach (var productionPlanDetail in productionPlan.Details.Where(productionPlanDetail =>
// productionPlanDetail.PlanQty > 0))
//{
// //获得BOM信息
// var productBoms = await _bomAppService.GetPlanListAsync(productionPlanDetail.ItemCode, prodLine).ConfigureAwait(false);
// if (productBoms.Count == 0)
// {
// throw new UserFriendlyException(
// $"生成备料计划失败:{productionPlanDetail.ItemCode} 在 {prodLine} 缺少对应的Bom信息!");
// }
// productBoms.ForEach(p => p.Product = productionPlanDetail.ItemCode);
// boms.AddRange(productBoms);
//}
//var productionLine = await _productionLineAppService.GetByCodeAsync(prodLine).ConfigureAwait(false);
//Check.NotNull(productionLine, "生产线代码", $"生产线 {prodLine} 不存在");
////将BOM按子零件分组
//var bomGroupByItemCode = boms.GroupBy(p => p.Component);
//foreach (var bomGroup in bomGroupByItemCode)
//{
// var itemCode = bomGroup.Key;
// var item = await ItemBasicAppService.GetByCodeAsync(itemCode).ConfigureAwait(false);
// Check.NotNull(item, "物品代码", $"物品 {itemCode} 不存在");
// //成品零件号
// var productItemCode = bomGroup.First().Product;
// //取整方式
// var trunkType = bomGroup.First().TruncType;
// //计量单位
// var uom = bomGroup.First().ComponentUom;
// //子零件的BOM用量为各个BOM用量的汇总
// var bomGroupQty = bomGroup.Sum(p => p.ComponentQty);
// //从生产计划明细中获得
// var planQty = productionPlan.Details.First(p => p.ItemCode == productItemCode).PlanQty;
// //实际需求量为成品计划生产量 * 汇总BOM用量
// var sumQty = planQty * bomGroupQty;
// //获取标包数量,计算备料数
// var (stdPackQty, detailQty) = await CalcDetailQtyAsync(sumQty, item.StdPackQty, trunkType).ConfigureAwait(false);
// //TODO 从物料存储关系中根据 库位组 = 生产线代码 查找是一个预定假设,需要改成可配置的
// //从物料存储关系中查找 库位组 = 生产线代码 的库位
// var locationCodeFromItemStoreRelation =
// await GetFirstLocationFromItemStoreRelationAsync(prodLine, itemCode).ConfigureAwait(false);
// //备料的物料没有物料存储关系,则目标库位取生产线的原料库位
// var locationCode = string.IsNullOrEmpty(locationCodeFromItemStoreRelation)
// ? rawLocationCodeOfProductionLine
// : locationCodeFromItemStoreRelation;
// //构造备料计划明细
// var detail = BuildPreparationPlanDetail(item, detailQty, stdPackQty, locationCode);
// preparationPlan.Details.Add(detail);
//}
//await CreateAsync(preparationPlan).ConfigureAwait(false);
//return preparationPlan;
return null;
}
private async Task<string> GetFirstLocationFromItemStoreRelationAsync(string prodLine, string itemCode)

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequest.cs

@ -16,24 +16,12 @@ public class InjectionRequest : SfsStoreRequestAggregateRootBase<InjectionReques
[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>

10
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs

@ -25,6 +25,12 @@ public class InjectionRequestManager
_issueJobRepository = issueJobRepository;
}
#region 东阳V2
#endregion
/// <summary>
/// 创建
/// </summary>
@ -58,7 +64,7 @@ public class InjectionRequestManager
SetMaterialRequestDetailStatus(detail);
}
await SetMaterialRequestStatus(oldEntity).ConfigureAwait(false);
await SetMaterialRequestStatusAsync(oldEntity).ConfigureAwait(false);
await Repository.UpdateAsync(oldEntity).ConfigureAwait(false);
}
@ -77,7 +83,7 @@ public class InjectionRequestManager
}
}
private async Task SetMaterialRequestStatus(InjectionRequest materialRequest)
private async Task SetMaterialRequestStatusAsync(InjectionRequest materialRequest)
{
if (materialRequest.Details.All(p => p.Status == EnumStatus.Close))
{

0
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJobDbContextModelCreatingExtensions.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJob/CoatingIssueJobDbContextModelCreatingExtensions.cs

0
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJobEfCoreRepository.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJob/CoatingIssueJobEfCoreRepository.cs

26195
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240328035332_Update_2024_03_28_ProductLine.Designer.cs

File diff suppressed because it is too large

801
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240328035332_Update_2024_03_28_ProductLine.cs

@ -0,0 +1,801 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Win_in.Sfs.Wms.Store.Migrations
{
public partial class Update_2024_03_28_ProductLine : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "Confirmed",
table: "Job_TransferLibJob",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "Job_CoatingIssueJob",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RequestType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
MaterialRequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Workshop = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
UpStreamJobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
JobDescription = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
JobType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
JobStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Priority = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
PriorityIncrement = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
WorkGroupCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
IsAutoComplete = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
AcceptUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AcceptUserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
AcceptTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CompleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CompleteUserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
CompleteTime = table.Column<DateTime>(type: "datetime2", nullable: true),
WarehouseCode = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Job_CoatingIssueJob", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Job_InjectionJob",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RequestType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
InjectionRequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Workshop = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
UpStreamJobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
JobDescription = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
JobType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
JobStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Priority = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
PriorityIncrement = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
WorkGroupCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
IsAutoComplete = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
AcceptUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AcceptUserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
AcceptTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CompleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CompleteUserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
CompleteTime = table.Column<DateTime>(type: "datetime2", nullable: true),
WarehouseCode = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Job_InjectionJob", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_CoatingIssueNote",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
JobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Workshop = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RequestType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ConfirmTime = table.Column<DateTime>(type: "datetime2", nullable: true),
Confirmed = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_CoatingIssueNote", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_CoatingMaterialRequest",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
PreparationPlanNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Workshop = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
AutoSubmit = table.Column<bool>(type: "bit", nullable: false),
AutoAgree = table.Column<bool>(type: "bit", nullable: false),
AutoHandle = table.Column<bool>(type: "bit", nullable: false),
AutoCompleteJob = table.Column<bool>(type: "bit", nullable: false),
DirectCreateNote = table.Column<bool>(type: "bit", nullable: false),
RequestStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_CoatingMaterialRequest", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_InjectionNote",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
JobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Workshop = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RequestType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ConfirmTime = table.Column<DateTime>(type: "datetime2", nullable: true),
Confirmed = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_InjectionNote", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_InjectionRequest",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
PreparationPlanNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Workshop = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
AutoSubmit = table.Column<bool>(type: "bit", nullable: false),
AutoAgree = table.Column<bool>(type: "bit", nullable: false),
AutoHandle = table.Column<bool>(type: "bit", nullable: false),
AutoCompleteJob = table.Column<bool>(type: "bit", nullable: false),
DirectCreateNote = table.Column<bool>(type: "bit", nullable: false),
RequestStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_InjectionRequest", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Job_CoatingIssueJobDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RequestLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
OnTheWayLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Operation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
DistributionType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TruncType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RoundedQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
PlannedSplitRule = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
PlanBeginTime = table.Column<DateTime>(type: "datetime2", nullable: false),
DeliveryQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
PositionCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
Status = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RecommendContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Uom = table.Column<string>(type: "nvarchar(max)", nullable: true),
RecommendQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
HandledContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Job_CoatingIssueJobDetail", x => x.Id);
table.ForeignKey(
name: "FK_Job_CoatingIssueJobDetail_Job_CoatingIssueJob_MasterID",
column: x => x.MasterID,
principalTable: "Job_CoatingIssueJob",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Job_InjectionJobDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RequestLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
OnTheWayLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Operation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
DistributionType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TruncType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RoundedQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
PlannedSplitRule = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
PlanBeginTime = table.Column<DateTime>(type: "datetime2", nullable: false),
DeliveryQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
PositionCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
Status = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RecommendContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Uom = table.Column<string>(type: "nvarchar(max)", nullable: true),
RecommendQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
HandledContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Job_InjectionJobDetail", x => x.Id);
table.ForeignKey(
name: "FK_Job_InjectionJobDetail_Job_InjectionJob_MasterID",
column: x => x.MasterID,
principalTable: "Job_InjectionJob",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_CoatingIssueNoteDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IssueTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
OnTheWayLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
PositionCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
FromPackingCode = table.Column<string>(type: "nvarchar(450)", nullable: true),
ToPackingCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
SupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
FromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RecommendContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
HandledContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_CoatingIssueNoteDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_CoatingIssueNoteDetail_Store_CoatingIssueNote_MasterID",
column: x => x.MasterID,
principalTable: "Store_CoatingIssueNote",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_CoatingMaterialRequestDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(max)", nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
IssuedQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
ReceivedQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
Status = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
PositionCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_CoatingMaterialRequestDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_CoatingMaterialRequestDetail_Store_CoatingMaterialRequest_MasterID",
column: x => x.MasterID,
principalTable: "Store_CoatingMaterialRequest",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_InjectionNoteDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IssueTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
OnTheWayLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
PositionCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
FromPackingCode = table.Column<string>(type: "nvarchar(450)", nullable: true),
ToPackingCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
SupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
FromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RecommendContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
HandledContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_InjectionNoteDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_InjectionNoteDetail_Store_InjectionNote_MasterID",
column: x => x.MasterID,
principalTable: "Store_InjectionNote",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_InjectionRequestDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(max)", nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
IssuedQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
ReceivedQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
Status = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
PositionCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_InjectionRequestDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_InjectionRequestDetail_Store_InjectionRequest_MasterID",
column: x => x.MasterID,
principalTable: "Store_InjectionRequest",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Job_CoatingIssueJob_Number",
table: "Job_CoatingIssueJob",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Job_CoatingIssueJobDetail_MasterID",
table: "Job_CoatingIssueJobDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Job_InjectionJob_Number",
table: "Job_InjectionJob",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Job_InjectionJobDetail_MasterID",
table: "Job_InjectionJobDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_CoatingIssueNote_Number",
table: "Store_CoatingIssueNote",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_CoatingIssueNoteDetail_FromPackingCode",
table: "Store_CoatingIssueNoteDetail",
column: "FromPackingCode");
migrationBuilder.CreateIndex(
name: "IX_Store_CoatingIssueNoteDetail_MasterID",
table: "Store_CoatingIssueNoteDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_CoatingIssueNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode",
table: "Store_CoatingIssueNoteDetail",
columns: new[] { "Number", "FromPackingCode", "FromLocationCode", "ToLocationCode" },
unique: true,
filter: "[FromPackingCode] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Store_CoatingMaterialRequest_Number",
table: "Store_CoatingMaterialRequest",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_CoatingMaterialRequestDetail_ItemCode",
table: "Store_CoatingMaterialRequestDetail",
column: "ItemCode");
migrationBuilder.CreateIndex(
name: "IX_Store_CoatingMaterialRequestDetail_MasterID",
table: "Store_CoatingMaterialRequestDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_CoatingMaterialRequestDetail_Number_ItemCode_ToLocationCode",
table: "Store_CoatingMaterialRequestDetail",
columns: new[] { "Number", "ItemCode", "ToLocationCode" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_InjectionNote_Number",
table: "Store_InjectionNote",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_InjectionNoteDetail_FromPackingCode",
table: "Store_InjectionNoteDetail",
column: "FromPackingCode");
migrationBuilder.CreateIndex(
name: "IX_Store_InjectionNoteDetail_MasterID",
table: "Store_InjectionNoteDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_InjectionNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode",
table: "Store_InjectionNoteDetail",
columns: new[] { "Number", "FromPackingCode", "FromLocationCode", "ToLocationCode" },
unique: true,
filter: "[FromPackingCode] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Store_InjectionRequest_Number",
table: "Store_InjectionRequest",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_InjectionRequestDetail_ItemCode",
table: "Store_InjectionRequestDetail",
column: "ItemCode");
migrationBuilder.CreateIndex(
name: "IX_Store_InjectionRequestDetail_MasterID",
table: "Store_InjectionRequestDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_InjectionRequestDetail_Number_ItemCode_ToLocationCode",
table: "Store_InjectionRequestDetail",
columns: new[] { "Number", "ItemCode", "ToLocationCode" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Job_CoatingIssueJobDetail");
migrationBuilder.DropTable(
name: "Job_InjectionJobDetail");
migrationBuilder.DropTable(
name: "Store_CoatingIssueNoteDetail");
migrationBuilder.DropTable(
name: "Store_CoatingMaterialRequestDetail");
migrationBuilder.DropTable(
name: "Store_InjectionNoteDetail");
migrationBuilder.DropTable(
name: "Store_InjectionRequestDetail");
migrationBuilder.DropTable(
name: "Job_CoatingIssueJob");
migrationBuilder.DropTable(
name: "Job_InjectionJob");
migrationBuilder.DropTable(
name: "Store_CoatingIssueNote");
migrationBuilder.DropTable(
name: "Store_CoatingMaterialRequest");
migrationBuilder.DropTable(
name: "Store_InjectionNote");
migrationBuilder.DropTable(
name: "Store_InjectionRequest");
migrationBuilder.DropColumn(
name: "Confirmed",
table: "Job_TransferLibJob");
}
}
}

9431
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs

File diff suppressed because it is too large

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

@ -24,13 +24,11 @@ public static class StoreDbContextModelCreatingExtensions
optionsAction?.Invoke(options);
#region Orders
builder.ConfigurePurchaseOrder(options);
builder.ConfigureSaleOrder(options);
builder.ConfigureWorkOrder(options);
builder.ConfigureEquipmentRecord(options);
//builder.ConfigureEquipmentLocCap(options);
#endregion
#region Plans

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Win_in.Sfs.Wms.Store.EntityFrameworkCore.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
 <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />

132
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CoatingIssueJobEventHandler.cs

@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
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;
using Win_in.Sfs.Wms.Store.Jobs.IssueJobs;
using Win_in.Sfs.Wms.Store.Notes.IssueNotes;
namespace Win_in.Sfs.Wms.Store.Event.BusinessJob;
public class CoatingIssueJobEventHandler :
StoreEventHandlerBase
, ILocalEventHandler<SfsCompletedEntityEventData<CoatingIssueJob>>
{
private const EnumTransType TransType = EnumTransType.Issue;
private readonly ICoatingIssueNoteAppService _issueNoteAppService;
private readonly ILocationAppService _locationAppService;
public CoatingIssueJobEventHandler(ICoatingIssueNoteAppService issueNoteAppService, ILocationAppService locationAppService)
{
_issueNoteAppService = issueNoteAppService;
_locationAppService = locationAppService;
}
/// <summary>
/// 执行后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<CoatingIssueJob> eventData)
{
var entity = eventData.Entity;
var issueNote = await BuildIssueNoteAsync(entity).ConfigureAwait(false);
await _issueNoteAppService.CreateAsync(issueNote).ConfigureAwait(false);
}
#region 私有
/// <summary>
/// 创建补料记录实体
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
private async Task<CoatingIssueNoteEditInput> BuildIssueNoteAsync(CoatingIssueJob entity)
{
var issueNoteCreateInput = ObjectMapper.Map<CoatingIssueJob, CoatingIssueNoteEditInput>(entity);
issueNoteCreateInput.JobNumber = entity.Number;
var locationCodes = issueNoteCreateInput.Details.Select(p => p.ToLocationCode).Distinct().ToList();
var locations = await _locationAppService.GetByCodesAsync(locationCodes).ConfigureAwait(false);
issueNoteCreateInput.Details.RemoveAll(p => p.Qty == 0);
foreach (var detail in issueNoteCreateInput.Details)
{
var location = locations.First(p => p.Code == detail.ToLocationCode);
await RemovePackingCodeAndContainerCodeAndLotAsync(detail, location.Type).ConfigureAwait(false); //去箱 去托 去批
detail.ToLocationArea = location.AreaCode;
detail.ToLocationGroup = location.LocationGroupCode;
detail.ToLocationErpCode = location.ErpLocationCode;
detail.ToWarehouseCode = location.WarehouseCode;
}
return issueNoteCreateInput;
}
/// <summary>
/// 去除箱码 托码 批次
/// </summary>
private async Task RemovePackingCodeAndContainerCodeAndLotAsync(CoatingIssueNoteDetailInput issueNoteDetail,
EnumLocationType locationType)
{
switch (locationType)
{
case EnumLocationType.WIP:
{
//用开关控制 发料到线边后去除箱码和托码 ???
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode)
.ConfigureAwait(false))
{
issueNoteDetail.ToPackingCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode)
.ConfigureAwait(false))
{
issueNoteDetail.ToContainerCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false))
{
issueNoteDetail.ToLot = "";
}
break;
}
case EnumLocationType.SEMI:
{
//用开关控制 发料到后去除箱码和托码 ???
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemovePackingCode)
.ConfigureAwait(false))
{
issueNoteDetail.ToPackingCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode)
.ConfigureAwait(false))
{
issueNoteDetail.ToContainerCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false))
{
issueNoteDetail.ToLot = "";
}
break;
}
}
}
#endregion
}

0
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingIssueJobEventHandler.cs

307
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs

@ -0,0 +1,307 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentValidation.Validators;
using Volo.Abp;
using Volo.Abp.EventBus;
using Volo.Abp.SettingManagement;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
using Win_in.Sfs.Wms.Store.Jobs.IssueJobs;
using Win_in.Sfs.Wms.Store.Requests.MaterialRequests;
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest;
public class CoatingMaterialRequestEventHandler
: StoreEventHandlerBase
, ILocalEventHandler<SfsHandledEntityEventData<CoatingMaterialRequest>>
, ILocalEventHandler<SfsAbortedEntityEventData<CoatingMaterialRequest>>
, ILocalEventHandler<SfsCompletedEntityEventData<CoatingMaterialRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<CoatingMaterialRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<CoatingMaterialRequest>>>
{
private readonly ICoatingIssueJobAppService _issueJobAppService;
private readonly IProductionLineAppService _productionLineAppService;
private readonly ICoatingMaterialRequestManager _CoatingMaterialRequestManager;
private readonly ILocationAppService _locationAppService;
private readonly IBalanceAppService _balanceAppService;
public CoatingMaterialRequestEventHandler(
ICoatingIssueJobAppService issueJobAppService
, IProductionLineAppService productionLineAppService
, ICoatingMaterialRequestManager CoatingMaterialRequestManager
, ILocationAppService locationAppService
, IBalanceAppService balanceAppService)
{
_issueJobAppService = issueJobAppService;
_productionLineAppService = productionLineAppService;
_CoatingMaterialRequestManager = CoatingMaterialRequestManager;
_locationAppService = locationAppService;
_balanceAppService = balanceAppService;
}
/// <summary>
/// 创建后
/// </summary>
/// <param name="eventData">Event data</param>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<CoatingMaterialRequest> eventData)
{
var entity = eventData.Entity;
//if (entity.AutoSubmit)
//{
// await _CoatingMaterialRequestManager.SubmitAsync(entity).ConfigureAwait(false);
//}
}
/// <summary>
/// 批量创建后
/// </summary>
/// <param name="eventData">Event data</param>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<CoatingMaterialRequest>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
if (entity.AutoSubmit)
{
await _CoatingMaterialRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
if (entity.Type == EnumMaterialRequestType.Issue_WIP.ToString())
{
await _CoatingMaterialRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
}
/// <summary>
/// 执行后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<CoatingMaterialRequest> eventData)
{
var entity = eventData.Entity;
var issueJobs = await BuildIssueJobAsync(entity).ConfigureAwait(false);
if (issueJobs.Any())
{
await _issueJobAppService.CreateManyAsync(issueJobs).ConfigureAwait(false);
}
}
/// <summary>
/// 驳回后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<CoatingMaterialRequest> eventData)
{
var entity = eventData.Entity;
await _issueJobAppService.CancelByMaterialRequestAsync(entity.Number).ConfigureAwait(false);
}
/// <summary>
/// 完成后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<CoatingMaterialRequest> eventData)
{
_ = eventData.Entity;
// await _issueJobAppService.CompleteByCoatingMaterialRequestAsync(entity.Number);
await Task.CompletedTask.ConfigureAwait(false);
}
#region 私有
private async Task<List<CoatingIssueJobEditInput>> BuildIssueJobAsync
(CoatingMaterialRequest CoatingMaterialRequest)
{
var jobs = new List<CoatingIssueJobEditInput>();
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);//库存事务
var toLocationCodes = CoatingMaterialRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList();//所有发送库位的集合
var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false);//所有库位的集合
var CoatingMaterialRequestDetails = CoatingMaterialRequest.Details.Where(p => p.ToBeIssuedQty > 0);//所有还没发送物品的集合
foreach (var CoatingMaterialRequestDetail in CoatingMaterialRequestDetails)//如果有还有剩余未叫料的数量 则创建新的任务
{
var toLocation = toLocations.FirstOrDefault(p => p.Code == CoatingMaterialRequestDetail.ToLocationCode);//判断目标库位是否存在
Check.NotNull(toLocation, "库位代码", $"库位 {CoatingMaterialRequestDetail.ToLocationCode} 不存在");
//创建详情
var jobDetails = await BuildIssueJobDetailInputsAsync(CoatingMaterialRequest, CoatingMaterialRequestDetail, transactionType, toLocation.LocationGroupCode).ConfigureAwait(false);
if (!jobDetails.Any())
{
continue;
}
var fromLocationCode = jobDetails[0].RecommendFromLocationCode;
var fromLocation = await _locationAppService.GetByCodeAsync(fromLocationCode).ConfigureAwait(false);
var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode);
if (job == null || job.Details.Any(p => p.ToLocationCode != CoatingMaterialRequestDetail.ToLocationCode))
{
job = BuildIssueJobCreateInput(CoatingMaterialRequest, fromLocation);
jobs.Add(job);
}
job.Details.AddRange(jobDetails);
if (CoatingMaterialRequestDetail.ToBeIssuedQty < 0)
{
CoatingMaterialRequestDetail.Status = EnumStatus.Close;
}
}
jobs = jobs.Where(p => p.Details.Any()).ToList();
var openRequestDetails =
CoatingMaterialRequest.Details.Where(p => p.Status != EnumStatus.Close).ToList();
if (!openRequestDetails.Any())
{
return jobs;
}
var enableMultipleCreateIssueJob = await SettingManager.IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false);
if (enableMultipleCreateIssueJob)
{
CoatingMaterialRequest.Partial();
}
else
{
var sb = new StringBuilder();
foreach (var openRequestDetail in openRequestDetails)
{
sb.AppendLine($"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}");
}
throw new UserFriendlyException($"{sb} 可用库存数量不足, 无法生成发料任务");
}
return jobs;
}
private CoatingIssueJobEditInput BuildIssueJobCreateInput(CoatingMaterialRequest CoatingMaterialRequest, LocationDTO fromLocation)
{
CoatingIssueJobEditInput job;
job = ObjectMapper.Map<CoatingMaterialRequest,CoatingIssueJobEditInput>(CoatingMaterialRequest);
job.JobType = EnumJobType.IssueJob;
job.JobStatus = EnumJobStatus.Open;
job.WorkGroupCode = fromLocation.WorkGroupCode;
job.WarehouseCode = fromLocation.WarehouseCode;
job.ProdLine = fromLocation.LocationGroupCode;
job.Worker = CoatingMaterialRequest.Worker;
job.MaterialRequestNumber = CoatingMaterialRequest.Number;
return job;
}
private async Task<List<CoatingIssueJobDetailInput>> BuildIssueJobDetailInputsAsync(CoatingMaterialRequest CoatingMaterialRequest,
CoatingMaterialRequestDetail CoatingMaterialRequestDetail, TransactionTypeDTO transactionType, string toLocationGroupCode)
{
var jobDetails = new List<CoatingIssueJobDetailInput>();
var input = new RecommendBalanceRequestInput()
{
ItemCode = CoatingMaterialRequestDetail.ItemCode,
Qty = CoatingMaterialRequestDetail.ToBeIssuedQty,
LocationTypes = transactionType.OutLocationTypes,
LocationAreas = new List<string> { CoatingMaterialRequestDetail.FromLocationArea },
Statuses = transactionType.OutInventoryStatuses,
};
//获取推荐库存
var recommendList = await _balanceAppService.GetRecommendBalancesAsync(input).ConfigureAwait(false);
//没有推荐库存时 跳过此明细 不生成任务
if (recommendList.Count != 0)
{
foreach (var recommend in recommendList)
{
//拿走需求量
var detail = await BuildIssueJobDetailAsync(CoatingMaterialRequestDetail, recommend, toLocationGroupCode).ConfigureAwait(false);
if (CoatingMaterialRequest.UseOnTheWayLocation)
{
//获取在途库
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false);
detail.OnTheWayLocationCode = locationDto.Code;
}
jobDetails.Add(detail);
CoatingMaterialRequestDetail.IssuedQty += recommend.Qty;
await _CoatingMaterialRequestManager.UpdateDetailsAsync(CoatingMaterialRequest).ConfigureAwait(false);
}
}
return jobDetails;
}
private async Task<CoatingIssueJobDetailInput> BuildIssueJobDetailAsync(CoatingMaterialRequestDetail CoatingMaterialRequestDetail, BalanceDTO balance, string toLocationGroupCode)
{
//ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false);
var detail = ObjectMapper.Map<BalanceDTO, CoatingIssueJobDetailInput>(balance);
detail.RequestLocationCode = CoatingMaterialRequestDetail.ToLocationCode;
detail.WorkStation = CoatingMaterialRequestDetail.WorkStation;
detail.ExpiredTime = CoatingMaterialRequestDetail.ExpiredTime;
detail.PositionCode = CoatingMaterialRequestDetail.PositionCode;
detail.RecommendType = CoatingMaterialRequestDetail.RecommendType;
detail.RecommendPackingCode = balance.PackingCode;
detail.RecommendContainerCode = balance.ContainerCode;
detail.RecommendSupplierBatch = balance.SupplierBatch;
detail.RecommendProduceDate = balance.ProduceDate;
detail.RecommendExpireDate = balance.ExpireDate;
detail.RecommendLot = balance.Lot;
detail.RecommendProduceDate = balance.ProduceDate;
detail.RecommendArriveDate = balance.ArriveDate;
detail.RecommendFromLocationArea = balance.LocationArea;
detail.RecommendFromLocationCode = balance.LocationCode;
detail.RecommendFromLocationErpCode = balance.LocationErpCode;
detail.RecommendFromLocationGroup = balance.LocationGroup;
detail.RecommendFromWarehouseCode = balance.WarehouseCode;
detail.RecommendQty = balance.Qty;
detail.Uom = balance.Uom;
detail.ToLocationCode = CoatingMaterialRequestDetail.ToLocationCode;
detail.ToLocationErpCode = CoatingMaterialRequestDetail.ToLocationErpCode;
detail.ToLocationArea = CoatingMaterialRequestDetail.ToLocationArea;
detail.ToWarehouseCode = CoatingMaterialRequestDetail.ToWarehouseCode;
detail.ToLocationGroup = CoatingMaterialRequestDetail.ToLocationGroup;
//detail.Operation = //TODO
//detail.DistributionType =//TODO
//detail.TruncType = //TODO
//detail.RoundedQty =//TODO
//detail.PlannedSplitRule = //TODO
//detail.PlanBeginTime = //TODO
//detaiol.DeliveryQty = //TODO
// var detail = ObjectMapper.Map<CoatingMaterialRequestDetail, IssueJobDetailInput>(CoatingMaterialRequestDetail);
//
// detail.RecommendPackingCode = balance.PackingCode;
// detail.RecommendContainerCode = balance.ContainerCode;
// detail.RecommendLot = balance.Lot;
// detail.RecommendLocationCode = balance.LocationCode;
// detail.RecommendLocationArea = balance.LocationArea;
// detail.RecommendLocationGroup = balance.LocationGroup;
// detail.RecommendLocationErpCode = balance.LocationErpCode;
// detail.WarehouseCode = balance.WarehouseCode;
// detail.Status = balance.Status;
// detail.RecommendSupplierBatch = balance.SupplierBatch;
// detail.RecommendArriveDate = balance.ArriveDate;
// detail.RecommendProduceDate = balance.ProduceDate;
// detail.RecommendExpireDate = balance.ExpireDate;
// detail.RecommendQty = balance.Qty;
// detail.RecommendUom = balance.Uom;
// detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code;
detail.ProdLine = toLocationGroupCode;
await Task.CompletedTask.ConfigureAwait(false);
return detail;
}
#endregion
}

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionRequestEventHandler.cs

@ -163,9 +163,11 @@ public class InjectionRequestEventHandler
return jobs;
}
var enableMultipleCreateInjectionJob = await SettingManager.IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false);
if (enableMultipleCreateInjectionJob)
{
//injectionRequest.Partial();
}
else
@ -229,6 +231,7 @@ public class InjectionRequestEventHandler
jobDetails.Add(detail);
injectionRequestDetail.IssuedQty += recommend.Qty;
//await _injectionRequestManager.UpdateDetailsAsync(injectionRequest).ConfigureAwait(false);
}
@ -238,6 +241,7 @@ public class InjectionRequestEventHandler
private async Task<InjectionJobDetailInput> BuildInjectionJobDetailAsync(InjectionRequestDetail injectionRequestDetail, BalanceDTO balance, string toLocationGroupCode)
{
//ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false);
var detail = ObjectMapper.Map<BalanceDTO, InjectionJobDetailInput>(balance);
@ -267,8 +271,7 @@ public class InjectionRequestEventHandler
detail.ToLocationErpCode = injectionRequestDetail.ToLocationErpCode;
detail.ToLocationArea = injectionRequestDetail.ToLocationArea;
detail.ToWarehouseCode = injectionRequestDetail.ToWarehouseCode;
detail.ToLocationGroup = injectionRequestDetail.ToLocationGroup;
//detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code;
detail.ProdLine = toLocationGroupCode ;
await Task.CompletedTask.ConfigureAwait(false);

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs

@ -238,7 +238,7 @@ public class MaterialRequestEventHandler
private async Task<IssueJobDetailInput> BuildIssueJobDetailAsync(MaterialRequestDetail materialRequestDetail, BalanceDTO balance, string toLocationGroupCode)
{
ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false);
//ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false);
var detail = ObjectMapper.Map<BalanceDTO, IssueJobDetailInput>(balance);
detail.RequestLocationCode = materialRequestDetail.ToLocationCode;
@ -294,7 +294,7 @@ public class MaterialRequestEventHandler
// detail.RecommendQty = balance.Qty;
// detail.RecommendUom = balance.Uom;
detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code;
//detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code;
await Task.CompletedTask.ConfigureAwait(false);
return detail;

100
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs

@ -0,0 +1,100 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Notes.IssueNotes;
using Win_in.Sfs.Wms.Store.Requests.MaterialRequests;
using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings;
using MaterialRequest = Win_in.Sfs.Wms.Store.Domain.MaterialRequest;
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest;
public class CoatingIssueNoteEventHandler
: StoreEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<CoatingIssueNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<CoatingIssueNote>>>
, ILocalEventHandler<SfsConfirmedEntityEventData<CoatingIssueNote>>
{
private readonly ICoatingMaterialRequestManager _materialRequestManager;
public CoatingIssueNoteEventHandler(
ICoatingMaterialRequestManager materialRequestManager
)
{
_materialRequestManager = materialRequestManager;
}
/// <summary>
/// 当叫料记录创建后 修改请求的值
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData<CoatingIssueNote> eventData)
{
var entity = eventData.Entity;
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 当叫料记录创建后 修改请求的值
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<CoatingIssueNote> eventData)
{
var entity = eventData.Entity;
if (!entity.UseOnTheWayLocation)
{
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false);
}
}
/// <summary>
/// 当叫料记录创建后 修改请求的值
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<CoatingIssueNote>> eventData)
{
var entities = eventData.Entity;
foreach (var entity in entities.Where(entity => !entity.UseOnTheWayLocation))
{
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false);
}
}
private async Task UpdateReceivedQtyMaterialRequestAsync(CoatingIssueNote entity)
{
var receiveQtyGroup = entity.Details
.GroupBy(p => new { p.ItemCode, p.ToLocationCode })
.Select(p => new { p.Key.ItemCode, p.Key.ToLocationCode, Qty = p.Sum(d => d.Qty) })
.ToList();
var materialRequest = await _materialRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false);
if (entity.RequestType != EnumMaterialRequestType.Issue_Direct.ToString())
{
//更新叫料请求的已收数量
foreach (var materialRequestDetail in materialRequest.Details)
{
var receiveQty = receiveQtyGroup.FirstOrDefault(p =>
p.ItemCode == materialRequestDetail.ItemCode &&
p.ToLocationCode == materialRequestDetail.ToLocationCode)?.Qty;
if (receiveQty != null)
{
materialRequestDetail.ReceivedQty += receiveQty.Value;
}
}
await _materialRequestManager.UpdateDetailsAsync(materialRequest).ConfigureAwait(false);
}
}
}

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductReceiptRequestEventHandler.cs

@ -128,13 +128,13 @@ public class ProductReceiptRequestEventHandler
{
var detail = ObjectMapper.Map<ProductReceiptRequestDetail, ProductReceiveJobDetailInput>(productionPlanDetail);
detail.ProdLine = productionPlan.ProdLine;
detail.RawLocationCode = productionLine.RawLocationCode; //原料回冲库位
//detail.RawLocationCode = productionLine.RawLocationCode; //原料回冲库位
detail.RecommendSupplierBatch = productionPlanDetail.SupplierBatch;
detail.RecommendArriveDate = productionPlanDetail.ArriveDate;
detail.RecommendProduceDate = productionPlanDetail.ProduceDate;
detail.RecommendExpireDate = productionPlanDetail.ExpireDate;
detail.RecommendLot = productionPlanDetail.Lot;
detail.RecommendToLocationCode = productionLine.ProductLocationCode;
//detail.RecommendToLocationCode = productionLine.ProductLocationCode;
detail.RecommendQty = productionPlanDetail.Qty;
detail.Uom = productionPlanDetail.Uom;
detail.StdPackQty = productionPlanDetail.StdPackQty;
@ -153,8 +153,8 @@ public class ProductReceiptRequestEventHandler
var productionLine = await _productionLineAppService.GetByCodeAsync(productionPlan.ProdLine).ConfigureAwait(false);
Check.NotNull(productionLine, "生产线代码", $"生产线 {productionPlan.ProdLine} 不存在");
var location = await LocationAclService.GetByCodeAsync(productionLine.ProductLocationCode).ConfigureAwait(false);
Check.NotNull(location, "库位代码", $"库位 {productionLine.ProductLocationCode} 不存在");
//var location = await LocationAclService.GetByCodeAsync(productionLine.ProductLocationCode).ConfigureAwait(false);
//Check.NotNull(location, "库位代码", $"库位 {productionLine.ProductLocationCode} 不存在");
var num = itemPack == 0 ? 1 : (int)Math.Ceiling(productionPlanDetail.Qty / itemPack);
for (var n = 0; n < num; n++)
@ -169,8 +169,8 @@ public class ProductReceiptRequestEventHandler
//设置工作组和任务优先级
entity.Priority = PriorityHelper.GetPriority(Clock);
entity.PriorityIncrement = 1;
entity.WarehouseCode = location.WarehouseCode;
entity.WorkGroupCode = location.WorkGroupCode;
//entity.WarehouseCode = location.WarehouseCode;
//entity.WorkGroupCode = location.WorkGroupCode;
return entity;

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductionPlanEventHandler.cs

@ -66,13 +66,13 @@ public class ProductionPlanEventHandler
{
var detail = ObjectMapper.Map<ProductionPlanDetail, ProductReceiveJobDetailInput>(productionPlanDetail);
detail.ProdLine = productionPlan.ProdLine;
detail.RawLocationCode = productionLine.RawLocationCode; //原料回冲库位
//detail.RawLocationCode = productionLine.RawLocationCode; //原料回冲库位
detail.RecommendSupplierBatch = productionPlanDetail.SupplierBatch;
detail.RecommendArriveDate = productionPlanDetail.ArriveDate;
detail.RecommendProduceDate = productionPlanDetail.ProduceDate;
detail.RecommendExpireDate = productionPlanDetail.ExpireDate;
detail.RecommendLot = productionPlanDetail.Lot;
detail.RecommendToLocationCode = productionLine.ProductLocationCode;
//detail.RecommendToLocationCode = productionLine.ProductLocationCode;
detail.RecommendQty = productionPlanDetail.PlanQty;
detail.Uom = productionPlanDetail.Uom;
detail.StdPackQty = stdPackQty;
@ -91,8 +91,8 @@ public class ProductionPlanEventHandler
var productionLine = await _productionLineAppService.GetByCodeAsync(productionPlan.ProdLine).ConfigureAwait(false);
Check.NotNull(productionLine, "生产线代码", $"生产线 {productionPlan.ProdLine} 不存在");
var location = await LocationAclService.GetByCodeAsync(productionLine.ProductLocationCode).ConfigureAwait(false);
Check.NotNull(location, "库位代码", $"库位 {productionLine.ProductLocationCode} 不存在");
//var location = await LocationAclService.GetByCodeAsync(productionLine.ProductLocationCode).ConfigureAwait(false);
//Check.NotNull(location, "库位代码", $"库位 {productionLine.ProductLocationCode} 不存在");
var num = (int)Math.Ceiling(productionPlanDetail.PlanQty / item.StdPackQty);
for (var n = 0; n < num; n++)
@ -107,8 +107,8 @@ public class ProductionPlanEventHandler
//设置工作组和任务优先级
entity.Priority = PriorityHelper.GetPriority(Clock);
entity.PriorityIncrement = 1;
entity.WarehouseCode = location.WarehouseCode;
entity.WorkGroupCode = location.WorkGroupCode;
//entity.WarehouseCode = location.WarehouseCode;
//entity.WorkGroupCode = location.WorkGroupCode;
return entity;

Loading…
Cancel
Save