Browse Source

注塑-发料-生成任务成功

dev_DY_CC
郑勃旭 1 year ago
parent
commit
056a7fcff0
  1. 97
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/DTOs/ProductionLineItemDTO.cs
  2. 4
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/IProductionLineItemAppService.cs
  3. 50
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/Inputs/ProductionLineItemEditInput.cs
  4. 97
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/Inputs/ProductionLineItemImportInput.cs
  5. 35
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/DTOs/ProductionLineDTO.cs
  6. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/IProductionLineAppService.cs
  7. 38
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/Inputs/ProductionLineEditInput.cs
  8. 38
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/Inputs/ProductionLineImportInput.cs
  9. 32
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs
  10. 22
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLines/ProductionLineAppService.cs
  11. 80
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLineItems/ProductionLineItem.cs
  12. 34
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLines/ProductionLine.cs
  13. 4237
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240403083042_BaseData_ProductLine_BaseData_ProductLineItem.Designer.cs
  14. 223
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240403083042_BaseData_ProductLine_BaseData_ProductLineItem.cs
  15. 129
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/BasedataDbContextModelSnapshot.cs
  16. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLines/ProductionLineDbContextModelCreatingExtensions.cs
  17. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLines/ProductionLineEfCoreRepository.cs
  18. 14
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/Inputs/RecommendBalanceRequestInput.cs
  19. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/IProductReceiptNoteAppService.cs
  20. 35
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/Inputs/InjectionRequestDetailInput.cs
  21. 20
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteAppService.cs
  22. 101
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs
  23. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAutoMapperProfile.cs
  24. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/IInjectionRequestManager.cs
  25. 24
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs
  26. 36
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs
  27. 27637
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240403054940_Update_InjectionRequest.Designer.cs
  28. 568
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240403054940_Update_InjectionRequest.cs
  29. 2078
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs
  30. 169
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionRequestEventHandler.cs
  31. 70
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/BackFlushNoteEventHandler.cs
  32. 56
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs

97
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/DTOs/ProductionLineItemDTO.cs

@ -2,82 +2,67 @@
// Copyright (c) 闻荫科技 www.ccwin-in.com
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
/// <summary>
/// 生产线-物品配置
/// 生产线-物料关系
/// </summary>
[Display(Name = "生产线物品配置")]
[Display(Name = "生产线-物料关系")]
public class ProductionLineItemDTO : SfsBaseDataDTOBase
{
/// <summary>
/// 生产线代码
/// 生产线代码
/// </summary>
[Key]
[Display(Name = "生产线代码")]
[Required(ErrorMessage = "{0}是必填项")]
[IgnoreUpdate]
public string ProdLineCode { get; set; }
/// <summary>
/// 物品代码
/// 物品代码
/// </summary>
[Key]
[Display(Name = "物品代码")]
[Required(ErrorMessage = "{0}是必填项")]
[IgnoreUpdate]
public string ItemCode { get; set; }
//[Display(Name = "代码")]
//[Required(ErrorMessage = "{0}是必填项")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Code { get; set; }
///// <summary>
///// 生产线ID
///// </summary>
//[Display(Name = "生产线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid ProdLineId { get; set; }
///// <summary>
///// 生产线Name
///// </summary>
//public string ProdLineName { get; set; }
///// <summary>
///// 物品Code
///// </summary>
//public string ItemCode { get; set; }
///// <summary>
///// 物品Code
///// </summary>
//public string ItemName { get; set; }
///// <summary>
///// 产品结构ID
///// </summary>
//[Display(Name = "产品结构Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid BomId { get; set; }
/// <summary>
/// 物品名称
/// </summary>
[Display(Name = "物品名称")]
public string ItemName { get; set; }
///// <summary>
///// Bom名称
///// </summary>
//public string BomName { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
[Display(Name = "物品描述1")]
public string ItemDesc1 { get; set; }
///// <summary>
///// 产品结构BomType
///// </summary>
//public string BomBomType { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
[Display(Name = "物品描述2")]
public string ItemDesc2 { get; set; }
///// <summary>
///// 工艺路线ID
///// </summary>
//[Display(Name = "工艺路线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid RoutingId { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
///// <summary>
///// 工艺路线Name
///// </summary>
//public string RouteName { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

4
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/IProductionLineItemAppService.cs

@ -1,6 +1,8 @@
// 闻荫智慧工厂管理套件
// Copyright (c) 闻荫科技 www.ccwin-in.com
using System.Collections.Generic;
using System.Threading.Tasks;
using Win_in.Sfs.Shared.Application.Contracts;
namespace Win_in.Sfs.Basedata.Application.Contracts;
@ -10,5 +12,5 @@ public interface IProductionLineItemAppService
, ISfsUpsertAppService<ProductionLineItemEditInput>
{
Task<List<ProductionLineItemDTO>> GetByProductLineCodeAsync(string productLineCode);
}

50
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/Inputs/ProductionLineItemEditInput.cs

@ -2,30 +2,64 @@
// Copyright (c) 闻荫科技 www.ccwin-in.com
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
/// <summary>
/// 生产线物品
/// 生产线物品
/// </summary>
public class ProductionLineItemEditInput : SfsBaseDataCreateOrUpdateInputBase
{
#region Create
/// <summary>
/// 生产线代码
/// 生产线代码
/// </summary>
[Display(Name = "生产线代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[IgnoreUpdate]
public string ProdLineCode { get; set; }
/// <summary>
/// 物品代码
/// 物品代码
/// </summary>
[Display(Name = "物品代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[IgnoreUpdate]
public string ItemCode { get; set; }
#endregion
/// <summary>
/// 物品名称
/// </summary>
[Display(Name = "物品名称")]
public string ItemName { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
[Display(Name = "物品描述1")]
public string ItemDesc1 { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
[Display(Name = "物品描述2")]
public string ItemDesc2 { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

97
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/Inputs/ProductionLineItemImportInput.cs

@ -2,90 +2,71 @@
// Copyright (c) 闻荫科技 www.ccwin-in.com
using System.ComponentModel.DataAnnotations;
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 ProductionLineItemImportInput : SfsBaseDataImportInputBase
{
/// <summary>
/// 生产线代码
/// 生产线代码
/// </summary>
[Key]
[Display(Name = "生产线代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[IgnoreUpdate]
public string ProdLineCode { get; set; }
/// <summary>
/// 物品代码
/// 物品代码
/// </summary>
[Key]
[Display(Name = "物品代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[IgnoreUpdate]
public string ItemCode { get; set; }
/// <summary>
/// 备注
/// 物品名称
/// </summary>
[Display(Name = "备注")]
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Remark { get; set; }
///// <summary>
///// 生产线ID
///// </summary>
//[Display(Name = "生产线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid ProdLineId { get; set; }
///// <summary>
///// 生产线Name
///// </summary>
//public string ProdLineName { get; set; }
///// <summary>
///// 物品Code
///// </summary>
//public string ItemCode { get; set; }
[Display(Name = "物品名称")]
public string ItemName { get; set; }
///// <summary>
///// 物品Code
///// </summary>
//public string ItemName { get; set; }
///// <summary>
///// 产品结构ID
///// </summary>
//[Display(Name = "产品结构Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid BomId { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
[Display(Name = "物品描述1")]
public string ItemDesc1 { get; set; }
///// <summary>
///// Bom名称
///// </summary>
//public string BomName { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
[Display(Name = "物品描述2")]
public string ItemDesc2 { get; set; }
///// <summary>
///// 产品结构BomType
///// </summary>
//public string BomBomType { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
///// <summary>
///// 工艺路线ID
///// </summary>
//[Display(Name = "工艺路线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid RoutingId { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
///// <summary>
///// 工艺路线Name
///// </summary>
//public string RouteName { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string Remark { get; set; }
}

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

@ -1,6 +1,4 @@
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;
@ -15,11 +13,19 @@ public class ProductionLineDTO : SfsBaseDataDTOBase, IHasCode, IHasName
/// <summary>
/// 代码
/// </summary>
[Display(Name = "代码")]
[Display(Name = "生产线代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 库位
/// </summary>
[Display(Name = "库位代码")]
[Key]
[IgnoreUpdate]
public string LocationCode { get; set; }
/// <summary>
/// 名称
/// </summary>
@ -31,27 +37,4 @@ public class ProductionLineDTO : SfsBaseDataDTOBase, IHasCode, IHasName
/// </summary>
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// </summary>
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

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

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

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

@ -1,24 +1,29 @@
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>
/// 新增和更新基础DTO
/// 新增和更新基础DTO
/// </summary>
public class ProductionLineEditInput : SfsBaseDataCreateOrUpdateInputBase
{
/// <summary>
/// 代码
/// </summary>
[Display(Name = "代码")]
[Display(Name = "生产线代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 库位
/// </summary>
[Display(Name = "库位代码")]
[Key]
[IgnoreUpdate]
public string LocationCode { get; set; }
/// <summary>
/// 名称
/// </summary>
@ -30,27 +35,4 @@ public class ProductionLineEditInput : SfsBaseDataCreateOrUpdateInputBase
/// </summary>
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// </summary>
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

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

@ -1,13 +1,10 @@
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>
/// 实体DTO
/// 实体DTO
/// </summary>
[Display(Name = "生产线")]
public class ProductionLineImportInput : SfsBaseDataImportInputBase
@ -15,11 +12,19 @@ public class ProductionLineImportInput : SfsBaseDataImportInputBase
/// <summary>
/// 代码
/// </summary>
[Display(Name = "代码")]
[Display(Name = "生产线代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 库位
/// </summary>
[Display(Name = "库位代码")]
[Key]
[IgnoreUpdate]
public string LocationCode { get; set; }
/// <summary>
/// 名称
/// </summary>
@ -31,27 +36,4 @@ public class ProductionLineImportInput : SfsBaseDataImportInputBase
/// </summary>
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// </summary>
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

32
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Caching;
@ -13,44 +12,45 @@ namespace Win_in.Sfs.Basedata.Application;
[Authorize]
[Route($"{BasedataConsts.RootPath}prod-line-item")]
public class ProductionLineItemAppService : SfsBaseDataAppServiceBase<ProductionLineItem, ProductionLineItemDTO, SfsBaseDataRequestInputBase, ProductionLineItemEditInput, ProductionLineItemImportInput>, IProductionLineItemAppService
public class ProductionLineItemAppService :
SfsBaseDataAppServiceBase<ProductionLineItem, ProductionLineItemDTO, SfsBaseDataRequestInputBase,
ProductionLineItemEditInput, ProductionLineItemImportInput>, IProductionLineItemAppService
{
private new readonly IProductionLineItemRepository _repository;
private readonly IProductionLineItemManager _manager;
private readonly IProductionLineAppService _productionLineAppService;
public ProductionLineItemAppService(
IProductionLineItemRepository repository
, IDistributedCache<ProductionLineItemDTO> cache
, IProductionLineItemManager manager
, IProductionLineAppService prodLineAppService
) : base(repository, cache)
) : base(repository, cache)
{
_repository = repository;
_manager = manager;
_productionLineAppService = prodLineAppService;
base.CreatePolicyName = ProductionLineItemPermissions.Create;
base.UpdatePolicyName = ProductionLineItemPermissions.Update;
base.DeletePolicyName = ProductionLineItemPermissions.Delete;
}
[HttpPost("upsert")]
public virtual async Task UpsertAsync(ProductionLineItemEditInput input)
{
var entity = ObjectMapper.Map<ProductionLineItemEditInput, ProductionLineItem>(input);
await _repository.UpsertAsync(entity).ConfigureAwait(false);
}
protected override async Task ValidateImportModelAsync(ProductionLineItemImportInput importInput, List<ValidationResult> validationRresult)
protected override async Task ValidateImportModelAsync(ProductionLineItemImportInput importInput,
List<ValidationResult> validationRresult)
{
await base.ValidateImportModelAsync(importInput, validationRresult).ConfigureAwait(false);
await base.CheckItemBasicItemCodeAsync(importInput.ItemCode, validationRresult).ConfigureAwait(false);
await base.CheckProductionLineProdLineCodeAsync(importInput.ProdLineCode, validationRresult).ConfigureAwait(false);
await CheckItemBasicItemCodeAsync(importInput.ItemCode, validationRresult).ConfigureAwait(false);
await CheckProductionLineProdLineCodeAsync(importInput.ProdLineCode, validationRresult).ConfigureAwait(false);
}
[HttpPost("get-by-product")]
public virtual async Task<List<ProductionLineItemDTO>> GetByProductLineCodeAsync(string productLineCode)
{
var entityList = await _repository.GetListAsync(p => p.ProdLineCode == productLineCode).ConfigureAwait(false);
return ObjectMapper.Map<List<ProductionLineItem>, List<ProductionLineItemDTO>>(entityList);
}
}

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

@ -1,9 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Caching;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
@ -13,9 +11,9 @@ namespace Win_in.Sfs.Basedata.Application;
[Authorize]
[Route($"{BasedataConsts.RootPath}productionline")]
public class ProductionLineAppService
: SfsBaseDataWithCodeAppServiceBase<ProductionLine, ProductionLineDTO, SfsBaseDataRequestInputBase, ProductionLineEditInput, ProductionLineImportInput>
: SfsBaseDataWithCodeAppServiceBase<ProductionLine, ProductionLineDTO, SfsBaseDataRequestInputBase,
ProductionLineEditInput, ProductionLineImportInput>
, IProductionLineAppService
{
private new readonly IProductionLineRepository _repository;
@ -29,7 +27,7 @@ public class ProductionLineAppService
, IDistributedCache<ProductionLineDTO> cache
, IProductionLineManager manager
, IWorkGroupAppService workGroupAppService
) : base(repository, cache)
) : base(repository, cache)
{
_repository = repository;
_manager = manager;
@ -46,4 +44,16 @@ public class ProductionLineAppService
var entity = ObjectMapper.Map<ProductionLineEditInput, ProductionLine>(input);
await _repository.UpsertAsync(entity).ConfigureAwait(false);
}
[HttpPost("get-by-location")]
public virtual async Task<ProductionLineDTO> GetByLocationCodeAsync(string locationCode)
{
var entity = await _repository.FindAsync(p => p.LocationCode == locationCode).ConfigureAwait(false);
if (entity == null)
{
throw new UserFriendlyException($"【{locationCode}】库位不存在");
}
return ObjectMapper.Map<ProductionLine, ProductionLineDTO>(entity);
}
}

80
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLineItems/ProductionLineItem.cs

@ -7,72 +7,60 @@ using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Domain;
/// <summary>
/// 生产线-物品配置
/// 生产线-物品配置
/// </summary>
public class ProductionLineItem : SfsBaseDataAggregateRootBase
{
/// <summary>
/// 生产线代码
/// 生产线代码
/// </summary>
[Key]
[Display(Name = "生产线代码")]
[Required(ErrorMessage = "{0}是必填项")]
[IgnoreUpdate]
public string ProdLineCode { get; set; }
/// <summary>
/// 物品代码
/// 物品代码
/// </summary>
[Display(Name = "物品代码")]
[Required(ErrorMessage = "{0}是必填项")]
[IgnoreUpdate]
public string ItemCode { get; set; }
///// <summary>
///// 生产线ID
///// </summary>
//[Display(Name = "生产线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid ProdLineId { get; internal set; }
///// <summary>
///// 生产线 聚合根
///// </summary>
//public virtual ProductionLine ProdLineAggregateRoot { get; internal set; }
///// <summary>
///// 物品ID
///// </summary>
//[Display(Name = "物品Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid ItemId { get; internal set; }
///// <summary>
///// 物品 聚合根
///// </summary>
////public virtual Item ItemsAggregateRoot { get; internal set; }
/// <summary>
/// 物品名称
/// </summary>
[Display(Name = "物品名称")]
public string ItemName { get; set; }
///// <summary>
///// 产品结构ID
///// </summary>
//[Display(Name = "产品结构Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid BomId { get; internal set; }
/// <summary>
/// 物品描述1
/// </summary>
[Display(Name = "物品描述1")]
public string ItemDesc1 { get; set; }
///// <summary>
///// 产品结构 聚合根
///// </summary>
////public virtual Bom BomAggregateRoots { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
[Display(Name = "物品描述2")]
public string ItemDesc2 { get; set; }
///// <summary>
///// 工艺路线ID
///// </summary>
//[Display(Name = "工艺路线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid RoutingId { get; internal set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
///// <summary>
///// 工艺路线 聚合根
///// </summary>
////public virtual Route RouteAggregateRoot { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

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

@ -1,6 +1,4 @@
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;
@ -14,11 +12,18 @@ public class ProductionLine : SfsBaseDataAggregateRootBase, IHasCode, IHasName
/// <summary>
/// 代码
/// </summary>
[Display(Name = "代码")]
[Display(Name = "生产线代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 库位
/// </summary>
[Display(Name = "库位代码")]
[IgnoreUpdate]
public string LocationCode { get; set; }
/// <summary>
/// 名称
/// </summary>
@ -30,27 +35,4 @@ public class ProductionLine : SfsBaseDataAggregateRootBase, IHasCode, IHasName
/// </summary>
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// </summary>
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

4237
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240403083042_BaseData_ProductLine_BaseData_ProductLineItem.Designer.cs

File diff suppressed because it is too large

223
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240403083042_BaseData_ProductLine_BaseData_ProductLineItem.cs

@ -0,0 +1,223 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Win_in.Sfs.Basedata.Migrations
{
public partial class BaseData_ProductLine_BaseData_ProductLineItem : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Basedata_ProductionLineItem",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "ProductLocationCodeListJson",
table: "Basedata_ProductionLine");
migrationBuilder.DropColumn(
name: "RawLocationCodeListJson",
table: "Basedata_ProductionLine");
migrationBuilder.DropColumn(
name: "Type",
table: "Basedata_ProductionLine");
migrationBuilder.DropColumn(
name: "WipLocationCodeListJson",
table: "Basedata_ProductionLine");
migrationBuilder.AddColumn<string>(
name: "ItemDesc1",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ItemDesc2",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ItemName",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ProductLocationCodeListJson",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "RawLocationCodeListJson",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "WipLocationCodeListJson",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "LocationCode",
table: "Basedata_ProductionLine",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
migrationBuilder.AlterColumn<string>(
name: "Type",
table: "Basedata_Equipment",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(int),
oldType: "int",
oldMaxLength: 64);
migrationBuilder.AlterColumn<string>(
name: "Model",
table: "Basedata_Equipment",
type: "nvarchar(64)",
maxLength: 64,
nullable: true,
oldClrType: typeof(int),
oldType: "int",
oldMaxLength: 64);
migrationBuilder.AddPrimaryKey(
name: "PK_Basedata_ProductionLineItem",
table: "Basedata_ProductionLineItem",
column: "ProdLineCode");
migrationBuilder.CreateTable(
name: "Basedata_ItemContainer",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ContainerName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ContainerType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
BasicUom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Qty = table.Column<decimal>(type: "decimal(18,6)", 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)
},
constraints: table =>
{
table.PrimaryKey("PK_Basedata_ItemContainer", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Basedata_ItemContainer_ItemCode_ContainerCode",
table: "Basedata_ItemContainer",
columns: new[] { "ItemCode", "ContainerCode" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Basedata_ItemContainer");
migrationBuilder.DropPrimaryKey(
name: "PK_Basedata_ProductionLineItem",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "ItemDesc1",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "ItemDesc2",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "ItemName",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "ProductLocationCodeListJson",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "RawLocationCodeListJson",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "WipLocationCodeListJson",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "LocationCode",
table: "Basedata_ProductionLine");
migrationBuilder.AddColumn<string>(
name: "ProductLocationCodeListJson",
table: "Basedata_ProductionLine",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "RawLocationCodeListJson",
table: "Basedata_ProductionLine",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Type",
table: "Basedata_ProductionLine",
type: "nvarchar(64)",
maxLength: 64,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "WipLocationCodeListJson",
table: "Basedata_ProductionLine",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AlterColumn<int>(
name: "Type",
table: "Basedata_Equipment",
type: "int",
maxLength: 64,
nullable: false,
defaultValue: 0,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "Model",
table: "Basedata_Equipment",
type: "int",
maxLength: 64,
nullable: false,
defaultValue: 0,
oldClrType: typeof(string),
oldType: "nvarchar(64)",
oldMaxLength: 64,
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_Basedata_ProductionLineItem",
table: "Basedata_ProductionLineItem",
column: "Id");
}
}
}

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

@ -1112,9 +1112,9 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("Model")
b.Property<string>("Model")
.HasMaxLength(64)
.HasColumnType("int");
.HasColumnType("nvarchar(64)");
b.Property<string>("Remark")
.HasMaxLength(3072)
@ -1131,9 +1131,8 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<int>("Type")
.HasMaxLength(64)
.HasColumnType("int");
b.Property<string>("Type")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -1696,6 +1695,79 @@ namespace Win_in.Sfs.Basedata.Migrations
b.ToTable("Basedata_ItemCategory", (string)null);
});
modelBuilder.Entity("Win_in.Sfs.Basedata.Domain.ItemContainer", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("BasicUom")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ContainerCode")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ContainerName")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ContainerType")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("ItemCode")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<decimal>("Qty")
.HasColumnType("decimal(18,6)");
b.Property<string>("Remark")
.HasMaxLength(3072)
.HasColumnType("nvarchar(3072)")
.HasColumnName("Remark");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("ItemCode", "ContainerCode")
.IsUnique();
b.ToTable("Basedata_ItemContainer", (string)null);
});
modelBuilder.Entity("Win_in.Sfs.Basedata.Domain.ItemGuideBook", b =>
{
b.Property<Guid>("Id")
@ -2782,16 +2854,14 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("LocationCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ProductLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("RawLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("Remark")
.HasMaxLength(3072)
.HasColumnType("nvarchar(3072)")
@ -2801,14 +2871,6 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("WipLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.HasKey("Code");
b.HasIndex("Code")
@ -2819,8 +2881,8 @@ namespace Win_in.Sfs.Basedata.Migrations
modelBuilder.Entity("Win_in.Sfs.Basedata.Domain.ProductionLineItem", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ProdLineCode")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
@ -2840,10 +2902,22 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ItemCode")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("ItemDesc1")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemDesc2")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemName")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
@ -2852,9 +2926,11 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("ProdLineCode")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("ProductLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("RawLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("Remark")
.HasMaxLength(3072)
@ -2865,7 +2941,10 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.Property<string>("WipLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.HasKey("ProdLineCode");
b.HasIndex("ProdLineCode", "ItemCode")
.IsUnique();

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

@ -19,8 +19,8 @@ public static class ProductionLineDbContextModelCreatingExtensions
b.Property(x => x.Code).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
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.Remark).HasMaxLength(SfsPropertyConst.RemarkLength);
b.Property(x => x.LocationCode).IsRequired();
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

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

14
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/Inputs/RecommendBalanceRequestInput.cs

@ -44,12 +44,12 @@ public class RecommendBalanceRequestInput
[Display(Name = "是否必须有箱码")]
public bool IsPackingCode { get; set; } = false;
public override string ToString()
{
var locationTypes = LocationTypes.Aggregate("", (current, locationType) => current + (locationType.GetDisplayName() + ","));
var locationAreas = LocationAreas.JoinAsString(",");
var statuses = Statuses.Aggregate("", (current, status) => current + (status.GetDisplayName() + ","));
//public override string ToString()
//{
// var locationTypes = LocationTypes.Aggregate("", (current, locationType) => current + (locationType.GetDisplayName() + ","));
// var locationAreas = LocationAreas.JoinAsString(",");
// var statuses = Statuses.Aggregate("", (current, status) => current + (status.GetDisplayName() + ","));
return $"物料号:{ItemCode}, 数量:{Qty}, 库位类型:{locationTypes}, 库区:{locationAreas}, 库存状态:{statuses}.";
}
// return $"物料号:{ItemCode}, 数量:{Qty}, 库位类型:{locationTypes}, 库区:{locationAreas}, 库存状态:{statuses}.";
//}
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/IProductReceiptNoteAppService.cs

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
@ -14,4 +15,5 @@ public interface IProductReceiptNoteAppService : ISfsStoreMasterReadOnlyAppServi
bool includeDetails = false,
CancellationToken cancellationToken = default);
Task<List<ProductReceiptNoteDTO>> CreateManyAsync(List<ProductReceiptNoteEditInput> input);
}

35
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/Inputs/InjectionRequestDetailInput.cs

@ -7,6 +7,8 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class InjectionRequestDetailInput : SfsStoreDetailWithQtyInputBase
{
#region 目标库位信息
/// <summary>
/// 目标库位
/// </summary>
@ -15,11 +17,30 @@ public class InjectionRequestDetailInput : SfsStoreDetailWithQtyInputBase
public string ToLocationCode { get; set; }
/// <summary>
/// 来源库区
/// 目标库区
/// </summary>
[Display(Name = "来源库区")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string FromLocationArea { get; set; }
[Display(Name = "目标库区")]
public string ToLocationArea { get; set; }
/// <summary>
/// 目标库位组
/// </summary>
[Display(Name = "目标库位组")]
public string ToLocationGroup { get; set; }
/// <summary>
/// 目标ERP储位
/// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 目标仓库
/// </summary>
[Display(Name = "目标仓库")]
public string ToWarehouseCode { get; set; }
#endregion
/// <summary>
/// 生产线
@ -47,12 +68,6 @@ public class InjectionRequestDetailInput : SfsStoreDetailWithQtyInputBase
[Display(Name = "状态")]
public EnumRequestStatus RequestStatus { get; set; } = EnumRequestStatus.New;
/// <summary>
/// ERP储位
/// </summary>
[Display(Name = "ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 已发数量
/// </summary>

20
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteAppService.cs

@ -8,6 +8,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
@ -52,6 +53,25 @@ public class ProductReceiptNoteAppService :
return dto;
}
/// <summary>
/// 批量新增接口
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("create-many")]
//[Authorize(ProductReceiptNotePermissions.Create)]
public async Task<List<ProductReceiptNoteDTO>> CreateManyAsync(List<ProductReceiptNoteEditInput> input)
{
var entityList = ObjectMapper.Map<List<ProductReceiptNoteEditInput>, List<ProductReceiptNote>>(input);
//转到实现,保存【完工收货记录】
await _productReceiptNoteManager.CreateManyAsync(entityList).ConfigureAwait(false);
var dtoList = ObjectMapper.Map<List<ProductReceiptNote>, List<ProductReceiptNoteDTO>>(entityList);
//返回创建的记录
return dtoList;
}
[HttpPost("by-type/{type}")]
public virtual async Task<PagedResultDto<ProductReceiptNoteDTO>> GetListByTypeAsync(
SfsStoreRequestInputBase requestInput,

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

@ -40,6 +40,7 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
private readonly IItemBasicAppService _itemBasicAppService;
private readonly IProductionLineAppService _productionLineAppService;
private readonly IInjectionJobAppService _issueJobAppService;
public InjectionRequestAppService(
IInjectionRequestRepository repository,
IInjectionRequestManager injectionRequestManager,
@ -66,9 +67,13 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
public override async Task<InjectionRequestDTO> HandleAsync(Guid id)
{
var entity = await _repository.GetAsync(id).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<InjectionRequest>(entity), false).ConfigureAwait(false);
return ObjectMapper.Map<InjectionRequest, InjectionRequestDTO>(entity);
//var entity = await _repository.GetAsync(id).ConfigureAwait(false);
//await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<InjectionRequest>(entity), false)
// .ConfigureAwait(false);
//return ObjectMapper.Map<InjectionRequest, InjectionRequestDTO>(entity);
await Task.CompletedTask.ConfigureAwait(false);
return null;
}
[HttpPost("")]
@ -85,13 +90,20 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
foreach (var detailInput in input.Details) //赋值生产线
{
var toLocationDto = await _locationAppService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false);
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.ToLocationArea = toLocationDto.AreaCode;
detailInput.ToLocationGroup = toLocationDto.LocationGroupCode;
detailInput.ToWarehouseCode= toLocationDto.WarehouseCode;
detailInput.ProdLine = detailInput.ToLocationCode;
detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode;
//因为是刚创建的 所以发料数一定是0
detailInput.IssuedQty = 0;
}
input.AutoSubmit = true;
@ -102,7 +114,7 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
var entity = ObjectMapper.Map<InjectionRequestEditInput, InjectionRequest>(input);
var result = await _injectionRequestManager.CreateAsync(entity).ConfigureAwait(false);
var result = await _injectionRequestManager.CreateByNumberAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<InjectionRequest, InjectionRequestDTO>(result);
@ -196,6 +208,8 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
await CheckStoreRelationAsync(model, validationRresult).ConfigureAwait(false);
}
#endregion
#region 校验
protected override async Task<bool> ValidateImportEntities(Dictionary<InjectionRequest, EntityState> dict)
@ -217,35 +231,6 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
return await base.ValidateImportEntities(dict).ConfigureAwait(false);
}
protected async Task<ItemBasicDTO> CheckItemBasicAsync(InjectionRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var item = await _itemBasicAppService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false);
if (item == null)
{
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" }));
}
else if (item.StdPackQty == 0)
{
validationRresult.Add(
new ValidationResult($"物品代码{importInput.ItemCode}的物品信息中标准包装等于0或不存在", new[] { "标准包装" }));
}
return item;
}
protected async Task<LocationDTO> CheckLocationAsync(InjectionRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var location = await _locationAppService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false);
if (location == null)
{
validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new[] { "目标库位" }));
}
return location;
}
protected async Task CheckAreaAsync(InjectionRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
@ -268,33 +253,55 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
}
}
#endregion
#endregion
#region 校验
private void CheckItemBasic(ItemBasicDTO ItemBasicDto, string itemCode)
private void CheckItemBasic(ItemBasicDTO itemBasicDto, string itemCode)
{
if (ItemBasicDto == null)
if (itemBasicDto == null)
{
throw new UserFriendlyException($"物品代码为【{itemCode}】不存在");
}
}
private void CheckLocation(LocationDTO LocationDto, string LocationCode)
private void CheckLocation(LocationDTO locationDto, string locationCode)
{
if (LocationDto == null)
if (locationDto == null)
{
throw new UserFriendlyException($"库位代码为【{LocationCode}】不存在");
throw new UserFriendlyException($"库位代码为【{locationCode}】不存在");
}
if (LocationDto.Type != EnumLocationType.WIP)
if (locationDto.Type != EnumLocationType.WIP)
{
throw new UserFriendlyException($"库位代码【{locationCode}】不是【{EnumLocationType.WIP.GetDisplayName()}】类型");
}
}
protected async Task<ItemBasicDTO> CheckItemBasicAsync(InjectionRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var item = await _itemBasicAppService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false);
if (item == null)
{
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" }));
}
else if (item.StdPackQty == 0)
{
throw new UserFriendlyException($"库位代码【{LocationCode}】不是【{EnumLocationType.WIP.GetDisplayName()}】类型");
validationRresult.Add(
new ValidationResult($"物品代码{importInput.ItemCode}的物品信息中标准包装等于0或不存在", new[] { "标准包装" }));
}
return item;
}
protected async Task<LocationDTO> CheckLocationAsync(InjectionRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var location = await _locationAppService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false);
if (location == null)
{
validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new[] { "目标库位" }));
}
return location;
}
#endregion
}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAutoMapperProfile.cs

@ -18,9 +18,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<InjectionRequestDetailInput, InjectionRequestDetail>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ToLocationArea)
.Ignore(x => x.ToLocationGroup)
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.MasterID)
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)

8
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/IInjectionRequestManager.cs

@ -1,16 +1,14 @@
using System.Threading.Tasks;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Shared.Domain;
public interface IInjectionRequestManager : ISfsStoreRequestManager<InjectionRequest, InjectionRequestDetail>,
IBulkImportService<InjectionRequest>
IBulkImportService<InjectionRequest>
{
Task UpdateDetailsAsync(InjectionRequest entity);
Task CompleteAsync(string number);
Task<InjectionRequest> CreateBynNumberAsync(InjectionRequest entity);
Task<InjectionRequest> CreateByNumberAsync(InjectionRequest entity);
}

24
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs

@ -1,4 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
@ -10,35 +11,40 @@ namespace Win_in.Sfs.Wms.Store.Domain;
/// </summary>
public class InjectionRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation
{
#region 目标库位信息
/// <summary>
/// 到库位
/// 目标库位
/// </summary>
[Display(Name = "目标库位")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ToLocationCode { get; set; }
/// <summary>
/// 库区
/// 目标库区
/// </summary>
[Display(Name = "目标库区")]
public string ToLocationArea { get; set; }
/// <summary>
/// 库位组
/// 目标库位组
/// </summary>
[Display(Name = "目标库位组")]
public string ToLocationGroup { get; set; }
/// <summary>
/// 到ERP库
/// 目标ERP储
/// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 仓库
/// 目标仓库
/// </summary>
[Display(Name = "目标仓库")]
public string ToWarehouseCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
public string FromLocationArea { get; set; }
#endregion
// /// <summary>
// /// 在途库库位

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

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Math;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings;
namespace Win_in.Sfs.Wms.Store.Domain;
@ -19,7 +16,7 @@ public class InjectionRequestManager
public InjectionRequestManager(
IInjectionRequestRepository repository
, IIssueJobRepository issueJobRepository
) : base(repository)
) : base(repository)
{
_repository = repository;
_issueJobRepository = issueJobRepository;
@ -32,13 +29,15 @@ public class InjectionRequestManager
/// <summary>
/// 创建
/// 创建 同时 直接赋值Number 为了返回Number
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public virtual async Task<InjectionRequest> CreateBynNumberAsync(InjectionRequest entity)
{
var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(InjectionRequest), entity.ActiveDate).ConfigureAwait(false) : entity.Number;
public virtual async Task<InjectionRequest> CreateByNumberAsync(InjectionRequest entity)
{
var number = string.IsNullOrEmpty(entity.Number)
? await GenerateNumberAsync(nameof(InjectionRequest), entity.ActiveDate).ConfigureAwait(false)
: entity.Number;
entity.SetIdAndNumberWithDetails(GuidGenerator, number);
entity.Submit();
entity.Agree();
@ -51,8 +50,8 @@ public class InjectionRequestManager
public virtual async Task UpdateDetailsAsync(InjectionRequest newEntity)
{
var oldEntity = await Repository.FindAsync(newEntity.Id, true).ConfigureAwait(false);
if(oldEntity!=null)
var oldEntity = await Repository.FindAsync(newEntity.Id).ConfigureAwait(false);
if (oldEntity != null)
{
foreach (var newDetail in newEntity.Details)
{
@ -68,12 +67,11 @@ public class InjectionRequestManager
await Repository.UpdateAsync(oldEntity).ConfigureAwait(false);
}
}
private void SetMaterialRequestDetailStatus(InjectionRequestDetail detail)
{
if (detail.ReceivedQty >= detail.Qty)//执行的时候 实际收料 多余 要料数
if (detail.ReceivedQty >= detail.Qty) //执行的时候 实际收料 多余 要料数
{
detail.Status = EnumStatus.Close;
}
@ -91,10 +89,12 @@ public class InjectionRequestManager
}
else
{
var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
var issueJobs = await _issueJobRepository
.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
if (issueJobs.Count > 0)
{
if (issueJobs.All(t => t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled))
if (issueJobs.All(t =>
t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled))
{
if (materialRequest.Details.All(p => p.ReceivedQty >= p.Qty))
{
@ -125,14 +125,15 @@ public class InjectionRequestManager
await CompleteAsync(entity).ConfigureAwait(false);
}
}
#region 导入
/// <summary>
/// 执行导入
/// 执行导入
/// </summary>
public virtual async Task ImportDataAsync(List<InjectionRequest> mergeEntities, List<InjectionRequest> deleteEntities = null)
public virtual async Task ImportDataAsync(List<InjectionRequest> mergeEntities,
List<InjectionRequest> deleteEntities = null)
{
if (deleteEntities != null && deleteEntities.Count > 0)
{
@ -143,5 +144,4 @@ public class InjectionRequestManager
}
#endregion
}

27637
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240403054940_Update_InjectionRequest.Designer.cs

File diff suppressed because it is too large

568
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240403054940_Update_InjectionRequest.cs

@ -0,0 +1,568 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Win_in.Sfs.Wms.Store.Migrations
{
public partial class Update_InjectionRequest : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FromLocationArea",
table: "Store_InjectionRequestDetail");
migrationBuilder.DropColumn(
name: "PreparationPlanNumber",
table: "Store_InjectionRequest");
migrationBuilder.DropColumn(
name: "Workshop",
table: "Store_InjectionRequest");
migrationBuilder.AddColumn<string>(
name: "JobNumber",
table: "Store_ProductRecycleNote",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "ExecutedQty",
table: "Job_ProductRecycleJobDetail",
type: "decimal(18,6)",
nullable: false,
defaultValue: 0m);
migrationBuilder.AddColumn<string>(
name: "RequestNumber",
table: "Job_ProductRecycleJob",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.CreateTable(
name: "Job_AssembleJob",
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),
AssembleRequestNumber = 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_AssembleJob", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_AssembleNote",
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_AssembleNote", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_AssembleRequest",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = 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_AssembleRequest", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_MesNote",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
JobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
MesRequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
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_MesNote", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Job_AssembleJobDetail",
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_AssembleJobDetail", x => x.Id);
table.ForeignKey(
name: "FK_Job_AssembleJobDetail_Job_AssembleJob_MasterID",
column: x => x.MasterID,
principalTable: "Job_AssembleJob",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_AssembleNoteDetail",
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_AssembleNoteDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_AssembleNoteDetail_Store_AssembleNote_MasterID",
column: x => x.MasterID,
principalTable: "Store_AssembleNote",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_AssembleRequestDetail",
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_AssembleRequestDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_AssembleRequestDetail_Store_AssembleRequest_MasterID",
column: x => x.MasterID,
principalTable: "Store_AssembleRequest",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_MesNoteDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ReasonCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, 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),
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(64)", maxLength: 64, 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(450)", 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)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_MesNoteDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_MesNoteDetail_Store_MesNote_MasterID",
column: x => x.MasterID,
principalTable: "Store_MesNote",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Job_AssembleJob_Number",
table: "Job_AssembleJob",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Job_AssembleJobDetail_MasterID",
table: "Job_AssembleJobDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleNote_Number",
table: "Store_AssembleNote",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleNoteDetail_FromPackingCode",
table: "Store_AssembleNoteDetail",
column: "FromPackingCode");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleNoteDetail_MasterID",
table: "Store_AssembleNoteDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode",
table: "Store_AssembleNoteDetail",
columns: new[] { "Number", "FromPackingCode", "FromLocationCode", "ToLocationCode" },
unique: true,
filter: "[FromPackingCode] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleRequest_Number",
table: "Store_AssembleRequest",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleRequestDetail_ItemCode",
table: "Store_AssembleRequestDetail",
column: "ItemCode");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleRequestDetail_MasterID",
table: "Store_AssembleRequestDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleRequestDetail_Number_ItemCode_ToLocationCode",
table: "Store_AssembleRequestDetail",
columns: new[] { "Number", "ItemCode", "ToLocationCode" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_MesNote_Number",
table: "Store_MesNote",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_MesNoteDetail_MasterID",
table: "Store_MesNoteDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_MesNoteDetail_Number_ItemCode_FromPackingCode_FromLocationCode_ToLocationCode_FromLot_FromStatus",
table: "Store_MesNoteDetail",
columns: new[] { "Number", "ItemCode", "FromPackingCode", "FromLocationCode", "ToLocationCode", "FromLot", "FromStatus" },
unique: true,
filter: "[FromPackingCode] IS NOT NULL AND [FromLot] IS NOT NULL");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Job_AssembleJobDetail");
migrationBuilder.DropTable(
name: "Store_AssembleNoteDetail");
migrationBuilder.DropTable(
name: "Store_AssembleRequestDetail");
migrationBuilder.DropTable(
name: "Store_MesNoteDetail");
migrationBuilder.DropTable(
name: "Job_AssembleJob");
migrationBuilder.DropTable(
name: "Store_AssembleNote");
migrationBuilder.DropTable(
name: "Store_AssembleRequest");
migrationBuilder.DropTable(
name: "Store_MesNote");
migrationBuilder.DropColumn(
name: "JobNumber",
table: "Store_ProductRecycleNote");
migrationBuilder.DropColumn(
name: "ExecutedQty",
table: "Job_ProductRecycleJobDetail");
migrationBuilder.DropColumn(
name: "RequestNumber",
table: "Job_ProductRecycleJob");
migrationBuilder.AddColumn<string>(
name: "FromLocationArea",
table: "Store_InjectionRequestDetail",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "PreparationPlanNumber",
table: "Store_InjectionRequest",
type: "nvarchar(64)",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Workshop",
table: "Store_InjectionRequest",
type: "nvarchar(64)",
maxLength: 64,
nullable: true);
}
}
}

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

File diff suppressed because it is too large

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

@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using FluentValidation.Validators;
using Castle.Components.DictionaryAdapter;
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;
@ -18,72 +18,59 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest;
public class InjectionRequestEventHandler
: StoreEventHandlerBase
, ILocalEventHandler<SfsHandledEntityEventData<InjectionRequest>>
, ILocalEventHandler<SfsAbortedEntityEventData<InjectionRequest>>
, ILocalEventHandler<SfsCompletedEntityEventData<InjectionRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<InjectionRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<InjectionRequest>>>
, ILocalEventHandler<SfsHandledEntityEventData<InjectionRequest>>
, ILocalEventHandler<SfsAbortedEntityEventData<InjectionRequest>>
, ILocalEventHandler<SfsCompletedEntityEventData<InjectionRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<InjectionRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<InjectionRequest>>>
{
private readonly IInjectionJobAppService _injectionJobAppService;
private readonly IProductionLineAppService _productionLineAppService;
private readonly IInjectionRequestManager _injectionRequestManager;
private readonly IProductionLineItemAppService _productionLineItemAppService;
private readonly ILocationAppService _locationAppService;
private readonly IBalanceAppService _balanceAppService;
public InjectionRequestEventHandler(
IInjectionJobAppService injectionJobAppService
, IProductionLineAppService productionLineAppService
, IInjectionRequestManager injectionRequestManager
, ILocationAppService locationAppService
, IBalanceAppService balanceAppService)
IInjectionJobAppService injectionJobAppService, IProductionLineAppService productionLineAppService,
IInjectionRequestManager injectionRequestManager, ILocationAppService locationAppService,
IBalanceAppService balanceAppService, IProductionLineItemAppService productionLineItemAppService)
{
_injectionJobAppService = injectionJobAppService;
_productionLineAppService = productionLineAppService;
_injectionRequestManager = injectionRequestManager;
_locationAppService = locationAppService;
_balanceAppService = balanceAppService;
_productionLineItemAppService = productionLineItemAppService;
}
/// <summary>
/// 创建后
/// 创建后
/// </summary>
/// <param name="eventData">Event data</param>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<InjectionRequest> eventData)
{
var entity = eventData.Entity;
//if (entity.AutoSubmit)
//{
// await _injectionRequestManager.SubmitAsync(entity).ConfigureAwait(false);
//}
await Task.CompletedTask.ConfigureAwait(false);
}
/// <summary>
/// 批量创建后
/// 批量创建后
/// </summary>
/// <param name="eventData">Event data</param>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<InjectionRequest>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
if (entity.AutoSubmit)
{
await _injectionRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
await Task.CompletedTask.ConfigureAwait(false);
}
/// <summary>
/// 执行后
/// 执行后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<InjectionRequest> eventData)
{
var entity = eventData.Entity;
var injectionJobs = await BuildInjectionJobAsync(entity).ConfigureAwait(false);
var injectionJobs = await CreateInjectionJobAsync(entity).ConfigureAwait(false);
if (injectionJobs.Any())
{
await _injectionJobAppService.CreateManyAsync(injectionJobs).ConfigureAwait(false);
@ -91,17 +78,17 @@ public class InjectionRequestEventHandler
}
/// <summary>
/// 驳回后
/// 驳回后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<InjectionRequest> eventData)
{
await Task.CompletedTask.ConfigureAwait(false);
}
/// <summary>
/// 完成后
/// 完成后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
@ -115,24 +102,34 @@ public class InjectionRequestEventHandler
#region 私有
private async Task<List<InjectionJobEditInput>> BuildInjectionJobAsync
/// <summary>
/// 创建注塑任务
/// </summary>
/// <param name="injectionRequest"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
private async Task<List<InjectionJobEditInput>> CreateInjectionJobAsync
(InjectionRequest injectionRequest)
{
var jobs = new List<InjectionJobEditInput>();
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);//库存事务
var transactionType = await TransactionTypeAclService
.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false); //库存事务
var toLocationCodes = injectionRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList();//所有发送库位的集合
var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false);//所有库位的集合
var toLocationCodes = injectionRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList(); //所有发送库位的集合
var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false); //所有库位的集合
var injectionRequestDetails = injectionRequest.Details.Where(p => p.ToBeIssuedQty > 0);//所有还没发送物品的集合
foreach (var injectionRequestDetail in injectionRequestDetails)//如果有还有剩余未叫料的数量 则创建新的任务
var injectionRequestDetails = injectionRequest.Details.Where(p => p.ToBeIssuedQty > 0); //所有还没发送物品的集合
foreach (var injectionRequestDetail in injectionRequestDetails) //如果有还有剩余未叫料的数量 则创建新的任务
{
var toLocation = toLocations.FirstOrDefault(p => p.Code == injectionRequestDetail.ToLocationCode);//判断目标库位是否存在
var toLocation =
toLocations.FirstOrDefault(p => p.Code == injectionRequestDetail.ToLocationCode); //判断目标库位是否存在
Check.NotNull(toLocation, "库位代码", $"库位 {injectionRequestDetail.ToLocationCode} 不存在");
//创建详情
var jobDetails = await BuildInjectionJobDetailInputsAsync(injectionRequest, injectionRequestDetail, transactionType, toLocation.LocationGroupCode).ConfigureAwait(false);
var jobDetails =
await CreateInjectionJobDetailInputsAsync(injectionRequest, injectionRequestDetail,
toLocation.LocationGroupCode).ConfigureAwait(false);
if (!jobDetails.Any())
{
continue;
@ -146,6 +143,7 @@ public class InjectionRequestEventHandler
job = BuildInjectionJobCreateInput(injectionRequest, fromLocation);
jobs.Add(job);
}
job.Details.AddRange(jobDetails);
if (injectionRequestDetail.ToBeIssuedQty < 0)
{
@ -163,11 +161,11 @@ public class InjectionRequestEventHandler
return jobs;
}
var enableMultipleCreateInjectionJob = await SettingManager.IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false);
var enableMultipleCreateInjectionJob = await SettingManager
.IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false);
if (enableMultipleCreateInjectionJob)
{
//injectionRequest.Partial();
}
else
@ -175,14 +173,24 @@ public class InjectionRequestEventHandler
var sb = new StringBuilder();
foreach (var openRequestDetail in openRequestDetails)
{
sb.AppendLine($"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}");
sb.AppendLine(
$"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}");
}
throw new UserFriendlyException($"{sb} 可用库存数量不足, 无法生成发料任务");
}
return jobs;
}
private InjectionJobEditInput BuildInjectionJobCreateInput(InjectionRequest injectionRequest, LocationDTO fromLocation)
/// <summary>
/// 构造注塑任务
/// </summary>
/// <param name="injectionRequest"></param>
/// <param name="fromLocation"></param>
/// <returns></returns>
private InjectionJobEditInput BuildInjectionJobCreateInput(InjectionRequest injectionRequest,
LocationDTO fromLocation)
{
InjectionJobEditInput job;
job = ObjectMapper.Map<InjectionRequest, InjectionJobEditInput>(injectionRequest);
@ -192,56 +200,88 @@ public class InjectionRequestEventHandler
job.WarehouseCode = fromLocation.WarehouseCode;
job.ProdLine = fromLocation.LocationGroupCode;
job.Worker = injectionRequest.Worker;
if(string.IsNullOrEmpty(job.Worker))
if (string.IsNullOrEmpty(job.Worker))
{
job.Worker = "admin";
}
job.InjectionRequestNumber = injectionRequest.Number;
return job;
}
private async Task<List<InjectionJobDetailInput>> BuildInjectionJobDetailInputsAsync(InjectionRequest injectionRequest,
InjectionRequestDetail injectionRequestDetail, TransactionTypeDTO transactionType, string toLocationGroupCode)
/// <summary>
/// 创建注塑任务明细
/// </summary>
/// <param name="injectionRequest"></param>
/// <param name="injectionRequestDetail"></param>
/// <param name="toLocationGroupCode"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
private async Task<List<InjectionJobDetailInput>> CreateInjectionJobDetailInputsAsync(
InjectionRequest injectionRequest,
InjectionRequestDetail injectionRequestDetail, string toLocationGroupCode)
{
var jobDetails = new List<InjectionJobDetailInput>();
var input = new RecommendBalanceRequestInput()
//获取推荐库存
var productionLineDto = await _productionLineAppService
.GetByLocationCodeAsync(injectionRequestDetail.ToLocationCode).ConfigureAwait(false);
var productionLineItemDtos = await _productionLineItemAppService
.GetByProductLineCodeAsync(productionLineDto.Code).ConfigureAwait(false);
if (productionLineItemDtos == null)
{
throw new UserFriendlyException($"物品代码【{injectionRequestDetail.ItemCode}】没有对应的【生产线物品关系】");
}
var productionLineItemDto =
productionLineItemDtos.FirstOrDefault(p => p.ItemCode == injectionRequestDetail.ItemCode);
var input = new RecommendBalanceRequestInput
{
ItemCode = injectionRequestDetail.ItemCode,
Qty = injectionRequestDetail.ToBeIssuedQty,
LocationTypes = transactionType.OutLocationTypes,
LocationAreas = new List<string> { injectionRequestDetail.FromLocationArea },
Statuses = transactionType.OutInventoryStatuses,
//LocationTypes = transactionType.OutLocationTypes, productionLineItemDto.RawLocationCodeListJson
Statuses = new EditableList<EnumInventoryStatus> { EnumInventoryStatus.OK },
Locations = JsonSerializer.Deserialize<List<string>>(productionLineItemDto.RawLocationCodeListJson)
};
//获取推荐库存
var recommendList = await _balanceAppService.GetRecommendBalancesAsync(input).ConfigureAwait(false);
var recommendList = await _balanceAppService.GetRecommendBalancesByLocationsAsync(input).ConfigureAwait(false);
//没有推荐库存时 跳过此明细 不生成任务
if (recommendList.Count != 0)
{
foreach (var recommend in recommendList)
{
//拿走需求量
var detail = await BuildInjectionJobDetailAsync(injectionRequestDetail, recommend, toLocationGroupCode).ConfigureAwait(false);
var detail = await BuildInjectionJobDetailAsync(injectionRequestDetail, recommend, toLocationGroupCode)
.ConfigureAwait(false);
if (injectionRequest.UseOnTheWayLocation)
{
//获取在途库
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false);
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT)
.ConfigureAwait(false);
detail.OnTheWayLocationCode = locationDto.Code;
}
jobDetails.Add(detail);
injectionRequestDetail.IssuedQty += recommend.Qty;
//await _injectionRequestManager.UpdateDetailsAsync(injectionRequest).ConfigureAwait(false);
//await _injectionRequestManager.UpdateDetailsAsync(injectionRequest).ConfigureAwait(false);
}
}
return jobDetails;
}
private async Task<InjectionJobDetailInput> BuildInjectionJobDetailAsync(InjectionRequestDetail injectionRequestDetail, BalanceDTO balance, string toLocationGroupCode)
/// <summary>
/// 构造注塑任务明细
/// </summary>
/// <param name="injectionRequestDetail"></param>
/// <param name="balance"></param>
/// <param name="toLocationGroupCode"></param>
/// <returns></returns>
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);
@ -271,12 +311,11 @@ public class InjectionRequestEventHandler
detail.ToLocationErpCode = injectionRequestDetail.ToLocationErpCode;
detail.ToLocationArea = injectionRequestDetail.ToLocationArea;
detail.ToWarehouseCode = injectionRequestDetail.ToWarehouseCode;
//detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code;
detail.ProdLine = toLocationGroupCode ;
detail.ProdLine = toLocationGroupCode;
await Task.CompletedTask.ConfigureAwait(false);
return detail;
}
#endregion

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

@ -23,28 +23,68 @@ public class BackFlushNoteEventHandler
await AddTransactionsAsync(entity).ConfigureAwait(false);
}
private async Task AddTransactionsAsync(BackFlushNote backFlushNote)
{
var inboundTransactions = new List<TransactionEditInput>();
inboundTransactions.AddRange(await BuildTransactionsAsync(backFlushNote));
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<BackFlushNote>> eventData)
{
var entities = eventData.Entity;
foreach (var entity in entities)
{
await AddTransactionsAsync(entity).ConfigureAwait(false);
}
await AddTransactionsAsync(entities).ConfigureAwait(false);
}
private async Task AddTransactionsAsync(BackFlushNote backFlushNote)
private async Task AddTransactionsAsync(List<BackFlushNote> backFlushNotes)
{
var inboundTransactions = new List<TransactionEditInput>();
inboundTransactions.AddRange(BuildTransactions(backFlushNote));
//如果要做库存事务汇总,可以修改此处
foreach (var backFlushNote in backFlushNotes)
{
inboundTransactions.AddRange(await BuildTransactionsAsync(backFlushNote).ConfigureAwait(false));
}
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
var transactionEditInputs = inboundTransactions.GroupBy(p => new
{
p.ItemCode,
p.LocationCode,
p.Status,
p.PackingCode,
p.Lot
}).Select(p => p.FirstOrDefault()).ToList();
foreach (var variableTransactionEditInput in transactionEditInputs)
{
var sameList = inboundTransactions.Where(p =>
p.ItemCode == variableTransactionEditInput.ItemCode &&
p.LocationCode == variableTransactionEditInput.LocationCode &&
p.Status == variableTransactionEditInput.Status &&
p.Lot == variableTransactionEditInput.Lot &&
p.PackingCode == variableTransactionEditInput.PackingCode)
.ToList();
variableTransactionEditInput.Qty = sameList
.Sum(p => p.Qty);
var docNumber = string.Empty;
foreach (var transactionEditInput in sameList)
{
docNumber += "----【单据号】" + transactionEditInput.DocNumber + "【物料代码】" + transactionEditInput.ItemCode + "【数量】" + transactionEditInput.Qty + " 】 ";
}
variableTransactionEditInput.Remark = docNumber;
}
await Task.CompletedTask.ConfigureAwait(false);
await TransactionAppService.AddManyAsync(transactionEditInputs).ConfigureAwait(false);
}
private List<TransactionEditInput> BuildTransactions(BackFlushNote backFlushNote)
private async Task<List<TransactionEditInput>> BuildTransactionsAsync(BackFlushNote backFlushNote)
{
var transactions = new List<TransactionEditInput>();
//构造库存转移记录创建Input
@ -69,15 +109,17 @@ public class BackFlushNoteEventHandler
transaction.JobNumber = backFlushNote.JobNumber;
transaction.Status = detail.Status;
transaction.LocationArea = detail.LocationArea;
transaction.LocationGroup=detail.LocationGroup;
transaction.LocationCode=detail.LocationCode;
transaction.LocationErpCode=detail.LocationErpCode;
transaction.WarehouseCode=detail.WarehouseCode;
transaction.LocationGroup = detail.LocationGroup;
transaction.LocationCode = detail.LocationCode;
transaction.LocationErpCode = detail.LocationErpCode;
transaction.WarehouseCode = detail.WarehouseCode;
transaction.Status = EnumInventoryStatus.OK;
transactions.Add(transaction);
}
return transactions;
await Task.CompletedTask.ConfigureAwait(false);
return transactions;
}
}

56
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs

@ -15,15 +15,16 @@ namespace Win_in.Sfs.Wms.Store.Event.Transactions;
public class ProductReceiptNoteEventHandler
: StoreInventoryEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<ProductReceiptNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<ProductReceiptNote>>>
, ILocalEventHandler<SfsCreatedEntityEventData<ProductReceiptNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<ProductReceiptNote>>>
{
private const EnumTransInOut TransInOut = EnumTransInOut.In;
private const EnumTransType TransType = EnumTransType.ProductReceipt;
private readonly IItemBasicAppService _itemBasicAppService;
private readonly ILocationAppService _locationAppService;
public ProductReceiptNoteEventHandler(IItemBasicAppService itemBasicAppService, ILocationAppService locationAppService)
public ProductReceiptNoteEventHandler(IItemBasicAppService itemBasicAppService,
ILocationAppService locationAppService)
{
_itemBasicAppService = itemBasicAppService;
_locationAppService = locationAppService;
@ -34,17 +35,15 @@ public class ProductReceiptNoteEventHandler
{
var entity = eventData.Entity;
await AddTransactionsAsync(entity).ConfigureAwait(false);
}
private async Task AddTransactionsAsync(ProductReceiptNote productReceiptNote)
{
var inboundTransactions = new List<TransactionEditInput>();
inboundTransactions.AddRange(await BuildTransactions(productReceiptNote));
inboundTransactions.AddRange(await BuildTransactionsAsync(productReceiptNote).ConfigureAwait(false));
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
}
[UnitOfWork]
@ -56,19 +55,48 @@ public class ProductReceiptNoteEventHandler
private async Task AddTransactionsAsync(List<ProductReceiptNote> productReceiptNotes)
{
var inboundTransactions = new List<TransactionEditInput>();
//如果要做库存事务汇总,可以修改此处
foreach (var productReceiptNote in productReceiptNotes)
{
inboundTransactions.AddRange(await BuildTransactions(productReceiptNote));
inboundTransactions.AddRange(await BuildTransactionsAsync(productReceiptNote).ConfigureAwait(false));
}
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
var transactionEditInputs = inboundTransactions.GroupBy(p => new
{
p.ItemCode,
p.LocationCode,
p.Status,
p.PackingCode,
p.Lot
}).Select(p => p.FirstOrDefault()).ToList();
foreach (var variableTransactionEditInput in transactionEditInputs)
{
var sameList = inboundTransactions.Where(p =>
p.ItemCode == variableTransactionEditInput.ItemCode &&
p.LocationCode == variableTransactionEditInput.LocationCode &&
p.Status == variableTransactionEditInput.Status &&
p.Lot == variableTransactionEditInput.Lot &&
p.PackingCode == variableTransactionEditInput.PackingCode)
.ToList();
variableTransactionEditInput.Qty = sameList
.Sum(p => p.Qty);
var docNumber = string.Empty;
foreach (var transactionEditInput in sameList)
{
docNumber += "----【单据号】" + transactionEditInput.DocNumber + "【物料代码】" + transactionEditInput.ItemCode + "【数量】" + transactionEditInput.Qty + " 】 ";
}
variableTransactionEditInput.Remark = docNumber;
}
await TransactionAppService.AddManyAsync(transactionEditInputs).ConfigureAwait(false);
}
private async Task<List<TransactionEditInput>> BuildTransactions(ProductReceiptNote productReceiptNote)
private async Task<List<TransactionEditInput>> BuildTransactionsAsync(ProductReceiptNote productReceiptNote)
{
var transactionCreateInputs = new List<TransactionEditInput>();
//构造库存入库创建Input
@ -76,7 +104,7 @@ public class ProductReceiptNoteEventHandler
{
var transaction = ObjectMapper.Map<ProductReceiptNoteDetail, TransactionEditInput>(detail);
var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
if (itemBasicDto == null)
{
@ -86,8 +114,8 @@ public class ProductReceiptNoteEventHandler
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2 = itemBasicDto.Desc2;
detail.ItemName=itemBasicDto.Name;
detail.StdPackQty=itemBasicDto.StdPackQty;
detail.ItemName = itemBasicDto.Name;
detail.StdPackQty = itemBasicDto.StdPackQty;
transaction.TransType = TransType;
transaction.TransInOut = TransInOut;
@ -98,7 +126,7 @@ public class ProductReceiptNoteEventHandler
transactionCreateInputs.Add(transaction);
}
return transactionCreateInputs;
}
}

Loading…
Cancel
Save