Browse Source

提交代码Kitting箱

dev_DY_CC
赵新宇 1 year ago
parent
commit
0e01e6019a
  1. 59
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentAreaDTO.cs
  2. 49
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentAreaForDongyangExportDTO.cs
  3. 6
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentDTO.cs
  4. 21
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/EquipmentAreaPermissions.cs
  5. 28
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/IEquipmentAreaAppService.cs
  6. 51
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentAreaCheckInput.cs
  7. 225
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentAreaEditInput.cs
  8. 53
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentAreaImportInput.cs
  9. 6
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs
  10. 20
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/DTOs/KittingDTO.cs
  11. 49
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/DTOs/KittingDetailDTO.cs
  12. 9
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/IKttingAppService.cs
  13. 49
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingDetailInput.cs
  14. 21
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingEditInput.cs
  15. 107
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingImportInput.cs
  16. 21
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/KittingPermissions.cs
  17. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Win_in.Sfs.Basedata.Application.Contracts.csproj
  18. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/BasedataApplicationAutoMapperProfile.cs
  19. 85
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAreaAppService.cs
  20. 33
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAreaAutoMapperProfile.cs
  21. 82
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs
  22. 89
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAutoMapperProfile.cs
  23. 166
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentArea.cs
  24. 29
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentAreaManager.cs
  25. 8
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentAreaManager.cs
  26. 13
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentAreaRepository.cs
  27. 20
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/IKittingManager.cs
  28. 9
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/IKittingRepository.cs
  29. 46
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/Kitting.cs
  30. 41
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/KittingDetail.cs
  31. 49
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/KittingManager.cs
  32. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataDbContextModelCreatingExtensions.cs
  33. 7
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataEntityFrameworkCoreModule.cs
  34. 39
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentAreaDbContextModelCreatingExtensions.cs
  35. 56
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentAreaEfCoreRepository.cs
  36. 71
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingDbContextModelCreatingExtensions.cs
  37. 75
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingEfCoreRepository.cs

59
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentAreaDTO.cs

@ -0,0 +1,59 @@
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Application.Contracts;
using System;
using System.Collections.Generic;
[Display(Name = "器具基本信息")]
public class EquipmentAreaDTO : SfsBaseDataDTOBase, IHasCode
{
/// <summary>
/// 器具编号
/// </summary>
[Display(Name = "器具编号")]
public string Code { get; set; }
/// <summary>
/// 类型
/// </summary>
[Display(Name = "类型")]
public string Type { get; set; } = string.Empty;
/// <summary>
/// 型号
/// </summary>
[Display(Name = "型号")]
public string Model { get; set; } = string.Empty;
/// <summary>
/// 库位编号
/// </summary>
[Display(Name = "库位编号")]
public string LocCode { get; set; } = string.Empty;
/// <summary>
/// 状态
/// </summary>
[Display(Name = "状态")]
public int State { get; set; } = 0;
/// <summary>
/// 位置编号
/// </summary>
[Display(Name = "位置编号")]
public string AreaCode { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
public decimal Qty { get; set; }
}

49
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentAreaForDongyangExportDTO.cs

@ -0,0 +1,49 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Application.Contracts;
[Display(Name = "物料信息")]
public class EquipmentAreaForDongyangExportDTO
{
/// <summary>
/// 器具编号
/// </summary>
[Display(Name = "器具编号")]
public string Code { get; set; }
/// <summary>
/// 类型
/// </summary>
[Display(Name = "类型")]
public string Type { get; set; } = string.Empty;
/// <summary>
/// 型号
/// </summary>
[Display(Name = "型号")]
public string Model { get; set; } = string.Empty;
/// <summary>
/// 库位编号
/// </summary>
[Display(Name = "库位编号")]
public string LocCode { get; set; } = string.Empty;
/// <summary>
/// 状态
/// </summary>
[Display(Name = "状态")]
public int State { get; set; } = 0;
/// <summary>
/// 位置编号
/// </summary>
[Display(Name = "位置编号")]
public string AreaCode { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
public decimal Qty { get; set; }
}

6
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentDTO.cs

@ -36,11 +36,7 @@ public class EquipmentDTO : SfsBaseDataDTOBase, IHasCode
/// </summary> /// </summary>
[Display(Name = "状态")] [Display(Name = "状态")]
public int State { get; set; } = 0; public int State { get; set; } = 0;
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string Remark { get; set; } = string.Empty;
/// <summary> /// <summary>

21
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/EquipmentAreaPermissions.cs

@ -0,0 +1,21 @@
using Volo.Abp.Authorization.Permissions;
using Win_in.Sfs.Basedata.Domain;
namespace Win_in.Sfs.Basedata.Application.Contracts;
public static class EquipmentAreaPermissions
{
public const string Default = BasedataPermissions.GroupName + "." + nameof(Equipment);
public const string Create = Default + "." + BasedataPermissions.CreateStr;
public const string Update = Default + "." + BasedataPermissions.UpdateStr;
public const string Delete = Default + "." + BasedataPermissions.DeleteStr;
public static void AddEquipmentPermission(this PermissionGroupDefinition permissionGroup)
{
var EquipmentPermission = permissionGroup.AddPermission(Default, BasedataPermissionDefinitionProvider.L(nameof(Equipment)));
EquipmentPermission.AddChild(Create, BasedataPermissionDefinitionProvider.L(BasedataPermissions.CreateStr));
EquipmentPermission.AddChild(Update, BasedataPermissionDefinitionProvider.L(BasedataPermissions.UpdateStr));
EquipmentPermission.AddChild(Delete, BasedataPermissionDefinitionProvider.L(BasedataPermissions.DeleteStr));
}
}

28
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/IEquipmentAreaAppService.cs

@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Application.Contracts;
public interface IEquipmentAreaAppService
: ISfsBaseDataAppServiceBase<EquipmentAreaDTO, SfsBaseDataRequestInputBase, EquipmentAreaEditInput>
, ISfsGetByCodeAppService<EquipmentAreaDTO>
, ISfsCheckAppService<EquipmentAreaCheckInput>
, ISfsUpsertAppService<EquipmentAreaEditInput>
{
//Task<bool> CheckItemIsAvailable(string itemCode);
//[HttpGet("check-item-is-available-no-select-sql")]
//void CheckItemIsAvailable(EquipmentDTO EquipmentDTO);
//Task<List<EquipmentDTO>> GetListByNameAsync(string name);
//Task<EquipmentDTO> GetOrAddAsync(EquipmentEditInput input);
//Task<EnumItemManageType> GetManageTypeAsync(string itemCode);
//Task<Dictionary<string, EnumItemManageType>> GetManageTypesAsync(List<string> itemCodes);
//Task UpsertAsyncByInterface(EquipmentEditInput input);
//Task UpsertStdPackQtyAsync(string itemCode, decimal stdpackqty);
}

51
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentAreaCheckInput.cs

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Application.Contracts;
public class EquipmentAreaCheckInput
{
/// <summary>
/// 器具编号
/// </summary>
[Display(Name = "器具编号")]
public string Code { get; set; }
/// <summary>
/// 类型
/// </summary>
[Display(Name = "类型")]
public string Type { get; set; } = string.Empty;
/// <summary>
/// 型号
/// </summary>
[Display(Name = "型号")]
public string Model { get; set; } = string.Empty;
/// <summary>
/// 库位编号
/// </summary>
[Display(Name = "库位编号")]
public string LocCode { get; set; } = string.Empty;
/// <summary>
/// 状态
/// </summary>
[Display(Name = "状态")]
public int State { get; set; } = 0;
/// <summary>
/// 位置编号
/// </summary>
[Display(Name = "位置编号")]
public string AreaCode { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
public decimal Qty { get; set; }
}

225
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentAreaEditInput.cs

@ -0,0 +1,225 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Application.Contracts;
public class EquipmentAreaEditInput : SfsBaseDataCreateOrUpdateInputBase
{
/// <summary>
/// 器具编号
/// </summary>
[Display(Name = "器具编号")]
public string Code { get; set; }
/// <summary>
/// 类型
/// </summary>
[Display(Name = "类型")]
public string Type { get; set; } = string.Empty;
/// <summary>
/// 型号
/// </summary>
[Display(Name = "型号")]
public string Model { get; set; } = string.Empty;
/// <summary>
/// 库位编号
/// </summary>
[Display(Name = "库位编号")]
public string LocCode { get; set; } = string.Empty;
/// <summary>
/// 状态
/// </summary>
[Display(Name = "状态")]
public int State { get; set; } = 0;
/// <summary>
/// 位置编号
/// </summary>
[Display(Name = "位置编号")]
public string AreaCode { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
public decimal Qty { get; set; }
//#region Base
///// <summary>
///// 名称
///// </summary>
//[Display(Name = "名称")]
//[Required(ErrorMessage = "{0}是必填项")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Name { get; set; }
///// <summary>
///// 描述1
///// </summary>
//[Display(Name = "描述1")]
//[StringLength(SfsEfCorePropertyConst.DescLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Desc1 { get; set; }
///// <summary>
///// 描述2
///// </summary>
//[Display(Name = "描述2")]
//[StringLength(SfsEfCorePropertyConst.DescLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Desc2 { get; set; }
///// <summary>
///// 状态
///// </summary>
//[Display(Name = "状态")]
//[Required(ErrorMessage = "{0}是必填项")]
//public EnumItemStatus Status { get; set; }
///// <summary>
///// 制造件
///// </summary>
//[Display(Name = "制造件")]
//[Required(ErrorMessage = "{0}是必填项")]
//public bool CanMake { get; set; }
///// <summary>
///// 采购件
///// </summary>
//[Display(Name = "采购件")]
//[Required(ErrorMessage = "{0}是必填项")]
//public bool CanBuy { get; set; }
///// <summary>
///// 外包件
///// </summary>
//[Display(Name = "外包件")]
//public bool CanOutsourcing { get; set; }
///// <summary>
///// 回收件
///// </summary>
//[Display(Name = "回收件")]
//public bool IsRecycled { get; set; }
///// <summary>
///// 类型
///// </summary>
//[Display(Name = "类型")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Type { get; set; }
///// <summary>
///// 种类
///// </summary>
//[Display(Name = "种类")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Category { get; set; }
///// <summary>
///// 分组
///// </summary>
//[Display(Name = "分组")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Group { get; set; }
///// <summary>
///// 颜色
///// </summary>
//[Display(Name = "颜色")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Color { get; set; }
///// <summary>
///// 配置
///// </summary>
//[Display(Name = "配置")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Configuration { get; set; }
///// <summary>
///// 虚零件
///// </summary>
//[Display(Name = "虚零件(Is phantom)")]
//public virtual bool IsPhantom { get; set; }
///// <summary>
///// 基本计量单位
///// </summary>
//[Display(Name = "基本计量单位")]
//[Required(ErrorMessage = "{0}是必填项")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string BasicUom { get; set; }
///// <summary>
///// 标包数
///// </summary>
//[Display(Name = "标包数")]
//[Required(ErrorMessage = "{0}是必填项")]
//public decimal StdPackQty { get; set; }
///// <summary>
///// ABC类
///// </summary>
//[Display(Name = "ABC类")]
//[Required(ErrorMessage = "{0}是必填项", AllowEmptyStrings = true)]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string AbcClass { get; set; }
///// <summary>
///// 项目
///// </summary>
//[Display(Name = "项目")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Project { get; set; }
///// <summary>
///// 版本
///// </summary>
//[Display(Name = "版本")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Version { get; set; }
///// <summary>
///// 工程变革
///// </summary>
//[Display(Name = "工程变革")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Eco { get; set; }
///// <summary>
///// 有效期
///// </summary>
//[Display(Name = "有效期")]
//public int Validity { get; set; }
///// <summary>
///// 有效期单位
///// </summary>
//[Display(Name = "有效期单位")]
//public EnumValidityUnit ValidityUnit { get; set; }
///// <summary>
///// 管理类型
///// </summary>
//[Display(Name = "管理类型")]
//public EnumItemManageType ManageType { get; set; }
///// <summary>
///// 打印标签用的一个等级
///// </summary>
//[Display(Name = "Elevel")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Elevel { get; set; }
//#endregion
//#region Create
///// <summary>
///// 代码
///// </summary>
//[Display(Name = "代码")]
//[Required(ErrorMessage = "{0}是必填项")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Code { get; set; }
//#endregion
}

53
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentAreaImportInput.cs

@ -0,0 +1,53 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Application.Contracts;
[Display(Name = "器具位置")]
public class EquipmentAreaImportInput : SfsBaseDataImportInputBase
{
/// <summary>
/// 器具编号
/// </summary>
[Display(Name = "器具编号")]
public string Code { get; set; }
/// <summary>
/// 类型
/// </summary>
[Display(Name = "类型")]
public string Type { get; set; } = string.Empty;
/// <summary>
/// 型号
/// </summary>
[Display(Name = "型号")]
public string Model { get; set; } = string.Empty;
/// <summary>
/// 库位编号
/// </summary>
[Display(Name = "库位编号")]
public string LocCode { get; set; } = string.Empty;
/// <summary>
/// 状态
/// </summary>
[Display(Name = "状态")]
public int State { get; set; } = 0;
/// <summary>
/// 位置编号
/// </summary>
[Display(Name = "位置编号")]
public string AreaCode { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
public decimal Qty { get; set; }
}

6
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs

@ -33,11 +33,7 @@ public class EquipmentEditInput : SfsBaseDataCreateOrUpdateInputBase
/// </summary> /// </summary>
[Display(Name = "状态")] [Display(Name = "状态")]
public int State { get; set; } = 0; public int State { get; set; } = 0;
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string Remark { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 创建人 /// 创建人
/// </summary> /// </summary>

20
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/DTOs/KittingDTO.cs

@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain;
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;
[Display(Name = "Kitting箱")]
public class KittingDTO : SfsBaseDataDTOBase, IHasCode, IHasName
{
[Display(Name ="编号")]
public string Code { get; set; }
[Display(Name = "名称")]
public string Name { get; set; }
[Display(Name = "明细")]
public virtual ICollection<KittingDetailDTO> Details { set; get; }= new List<KittingDetailDTO>();
}

49
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/DTOs/KittingDetailDTO.cs

@ -0,0 +1,49 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
using Volo.Abp.MultiTenancy;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Basedata.Application.Contracts;
[Display(Name = "Kitting箱明细")]
public class KittingDetailDTO: AuditedEntityDto<Guid>, IMultiTenant, IRemark
{
/// <summary>
/// 主表ID
/// </summary>
[Display(Name = "主表ID")]
public Guid MasterId { get; set; }
/// <summary>
/// 物料编码
/// </summary>
[Display(Name = "物料编码")]
public string PartCode { set; get; }
/// <summary>
/// 描述1
/// </summary>
[Display(Name = "描述1")]
public string Desc1 { set; get; }
/// <summary>
/// 描述2
/// </summary>
[Display(Name = "描述2")]
public string Desc2 { set; get; }
/// <summary>
/// 包装数量
/// </summary>
[Display(Name = "包装数量")]
public decimal Qty { set; get; }
/// <summary>
/// 配置
/// </summary>
[Display(Name = "配置")]
public string Conf { set; get; }
public Guid? TenantId { set; get; }
public string Remark { get; set; }
}

9
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/IKttingAppService.cs

@ -0,0 +1,9 @@
using System.Threading.Tasks;
using Win_in.Sfs.Shared.Application.Contracts;
namespace Win_in.Sfs.Basedata.Application.Contracts;
public interface IKittingAppService: ISfsBaseDataAppServiceBase<KittingDTO, SfsBaseDataRequestInputBase, KittingEditInput>, ISfsGetByCodeAppService<KittingDTO>
{
Task UpdateAsync(KittingEditInput input);
}

49
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingDetailInput.cs

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.MultiTenancy;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Basedata.Kittings.Inputs;
public class KittingDetailInput: EntityDto<Guid>, IMultiTenant, IRemark
{
/// <summary>
/// 主表ID
/// </summary>
[Display(Name = "主表ID")]
public Guid MasterId { get; set; }
/// <summary>
/// 物料编码
/// </summary>
[Display(Name = "物料编码")]
public string PartCode { set; get; }
/// <summary>
/// 描述1
/// </summary>
[Display(Name = "描述1")]
public string Desc1 { set; get; }
/// <summary>
/// 描述2
/// </summary>
[Display(Name = "描述2")]
public string Desc2 { set; get; }
/// <summary>
/// 包装数量
/// </summary>
[Display(Name = "包装数量")]
public decimal Qty { set; get; }
/// <summary>
/// 配置
/// </summary>
[Display(Name = "配置")]
public string Conf { set; get; }
[Display(Name = "租户ID")]
public Guid? TenantId { set; get;
}
[Display(Name = "备注")]
public string Remark { get; set; }
}

21
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingEditInput.cs

@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Basedata.Kittings.Inputs;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
public class KittingEditInput : SfsBaseDataCreateOrUpdateInputBase
{
public string Code { get; set; }
public string Name { get; set; }
public virtual ICollection<KittingDetailInput> Details { get; set; }=new List<KittingDetailInput>();
}

107
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingImportInput.cs

@ -0,0 +1,107 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain;
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;
[Display(Name = "Kitting箱")]
public class KittingImportInput : SfsBaseDataImportInputBase
{
public string Code { get; set; }
public string Name { get; set; }
}
//[Serializable]
//public class CustomerDTO : SfsBaseDataDTOBase
//{
// ///<summary>
// ///�ͻ�����
// ///</summary>
// [Display(Name = "�ͻ�����")]
// [Required(ErrorMessage = "{0}�DZ�����")]
// [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}�������{1}���ַ�")]
// public string Code { get; set; }
// /// <summary>
// /// �ͻ�����
// /// </summary>
// [Display(Name = "�ͻ�����")]
// [Required(ErrorMessage = "{0}�DZ�����")]
// [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}�������{1}���ַ�")]
// public string Name { get; set; }
// /// <summary>
// /// �ͻ�����
// /// </summary>
// [Display(Name = "�ͻ�����")]
// [StringLength(SfsEfCorePropertyConst.DescLength, ErrorMessage = "{0}�������{1}���ַ�")]
// public string Description { get; set; }
// /// <summary>
// /// ��ϵ��ַ
// /// </summary>
// [Display(Name = "��ϵ��ַ")]
// [StringLength(SfsEfCorePropertyConst.DescLength, ErrorMessage = "{0}�������{1}���ַ�")]
// public string Address { get; set; }
// /// <summary>
// /// ��ϵ��
// /// </summary>
// [Display(Name = "��ϵ��")]
// [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}�������{1}���ַ�")]
// public string Contact { get; set; }
// /// <summary>
// /// ��ϵ�绰
// /// </summary>
// [Display(Name = "��ϵ�绰")]
// public string ContactPhone { get; set; }
// /// <summary>
// /// ��ϵ�ʼ�
// /// </summary>
// [Display(Name = "��ϵ�ʼ�")]
// public string ContactEmail { get; set; }
// /// <summary>
// /// ��ϵ����
// /// </summary>
// [Display(Name = "��ϵ����")]
// public string ContactFax { get; set; }
// /// <summary>
// /// ˰��
// /// </summary>
// [Display(Name = "˰��")]
// public Nullable<decimal> TaxRate { get; set; }
// /// <summary>
// /// ����ID
// /// </summary>
// [Display(Name = "����Id")]
// public Guid CurrencyId { get; set; }
// /// <summary>
// /// ����ID
// /// </summary>
// [Display(Name = "��������")]
// public string CurrencyName { get; set; }
// /// <summary>
// /// �ͻ�����
// /// </summary>
// [Display(Name = "�ͻ�����")]
// public Nullable<int> CustomerType { get; set; }
// public bool Enabled { get; set; }
// //public ICollection<CustomerItemDTO> CustomerItems { set; get; }
//}

21
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/KittingPermissions.cs

@ -0,0 +1,21 @@
using Volo.Abp.Authorization.Permissions;
using Win_in.Sfs.Basedata.Domain;
namespace Win_in.Sfs.Basedata.Application.Contracts;
public static class KittingPermissions
{
public const string Default = BasedataPermissions.GroupName + "." + nameof(Kitting);
public const string Create = Default + "." + BasedataPermissions.CreateStr;
public const string Update = Default + "." + BasedataPermissions.UpdateStr;
public const string Delete = Default + "." + BasedataPermissions.DeleteStr;
public static void AddKittingPermission(this PermissionGroupDefinition permissionGroup)
{
var customerPermission = permissionGroup.AddPermission(Default, BasedataPermissionDefinitionProvider.L(nameof(Kitting)));
customerPermission.AddChild(Create, BasedataPermissionDefinitionProvider.L(BasedataPermissions.CreateStr));
customerPermission.AddChild(Update, BasedataPermissionDefinitionProvider.L(BasedataPermissions.UpdateStr));
customerPermission.AddChild(Delete, BasedataPermissionDefinitionProvider.L(BasedataPermissions.DeleteStr));
}
}

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Win_in.Sfs.Basedata.Application.Contracts.csproj

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

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/BasedataApplicationAutoMapperProfile.cs

@ -50,5 +50,7 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
WorkGroupAutoMapperProfile(); WorkGroupAutoMapperProfile();
WorkShopAutoMapperProfile(); WorkShopAutoMapperProfile();
EquipmentAutoMapperProfile(); EquipmentAutoMapperProfile();
EquipmentAreaAutoMapperProfile();
KittingAutoMapperProfile();
} }
} }

85
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAreaAppService.cs

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Validation;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Application;
[Authorize]
[Route($"{BasedataConsts.RootPath}EquipmentArea")]
public class EquipmentAreaAppService
: SfsBaseDataWithCodeAppServiceBase<EquipmentArea, EquipmentAreaDTO, SfsBaseDataRequestInputBase, EquipmentAreaEditInput, EquipmentAreaImportInput>
, IEquipmentAreaAppService
{
private readonly IEquipmentAreaManager _manager;
private new readonly IEquipmentAreaRepository _repository;
private new readonly IEquipmentRepository _eRepository;
public EquipmentAreaAppService(
IEquipmentAreaRepository repository,
IEquipmentRepository eRepository,
IDistributedCache<EquipmentAreaDTO> cache,
IEquipmentAreaManager manager)
: base(repository, cache)
{
_repository = repository;
_eRepository = eRepository;
_manager = manager;
base.CreatePolicyName = EquipmentPermissions.Create;
base.UpdatePolicyName = EquipmentPermissions.Update;
base.DeletePolicyName = EquipmentPermissions.Delete;
}
[HttpPost("check")]
//[Authorize(ErpLocationPermissions.Default)]
public virtual async Task CheckAsync(string code, EquipmentAreaCheckInput input)
{
//var result = new AbpValidationResult();
//if (Repository.GetDbSet().Where(p => p.Code == code).Any())
//{
// result.Errors.Add(new ValidationResult($"存在编码为{code}的器具!"));
//}
//if (result.Errors.Count > 0)
//{
// throw new AbpValidationException(result.Errors);
//}
await Task.CompletedTask.ConfigureAwait(false);
}
[HttpPost("upsert")]
public virtual async Task UpsertAsync(EquipmentAreaEditInput input)
{
var entity = ObjectMapper.Map<EquipmentAreaEditInput, EquipmentArea>(input);
await _repository.UpsertAsync(entity).ConfigureAwait(false);
}
protected override async Task ValidateImportModelAsync(EquipmentAreaImportInput importInput, List<ValidationResult> validationRresult)
{
await base.ValidateImportModelAsync(importInput, validationRresult).ConfigureAwait(false);
//await base.CheckEquipmentAsync(importInput.Code, validationRresult).ConfigureAwait(false);
}
}

33
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAreaAutoMapperProfile.cs

@ -0,0 +1,33 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
namespace Win_in.Sfs.Basedata.Application;
public partial class BasedataApplicationAutoMapperProfile : Profile
{
private void EquipmentAreaAutoMapperProfile()
{
CreateMap<EquipmentArea, EquipmentAreaDTO>()
.ReverseMap();
CreateMap<EquipmentAreaImportInput, EquipmentArea>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TenantId)
.Ignore(x => x.Remark)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.ConcurrencyStamp)
;
//CreateMap<Equipment, EquipmentImportInput>()
//CreateMap<Equipment, EquipmentForDongyangExportDTO>()
// .Ignore(x => x.ItemCategory)
// .Ignore(x => x.Color);
CreateMap<EquipmentAreaEditInput, EquipmentArea>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id);
}
}

82
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs

@ -0,0 +1,82 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using NUglify.Helpers;
using Volo.Abp.Caching;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared;
namespace Win_in.Sfs.Basedata.Application;
[Authorize]
[Route($"{BasedataConsts.RootPath}kitting")]
public class KittingAppService : SfsBaseDataWithCodeAppServiceBase<Kitting, KittingDTO, SfsBaseDataRequestInputBase, KittingEditInput, KittingImportInput>, IKittingAppService
{
private new readonly IKittingRepository _repository;
private readonly IKittingManager _manager;
public KittingAppService(IKittingRepository repository, IDistributedCache<KittingDTO> cache, IKittingManager manager) : base(repository,cache)
{
_repository = repository;
_manager = manager;
//base.CreatePolicyName = KittingPermissions.Create;
//base.UpdatePolicyName = KittingPermissions.Update;
//base.DeletePolicyName = KittingPermissions.Delete;
}
[HttpPost]
[Route("")]
public override async Task<KittingDTO> CreateAsync(KittingEditInput input)
{
var entity = ObjectMapper.Map<KittingEditInput, Kitting>(input);
entity.SetId(Guid.NewGuid());
entity.Details.ForEach(item =>
{
item.MasterId = entity.Id;
});
entity = await _repository.InsertAsync(entity).ConfigureAwait(false);
return ObjectMapper.Map<Kitting, KittingDTO>(entity);
}
[HttpPut]
[Route("{id}")]
public override Task<KittingDTO> UpdateAsync(Guid id, KittingEditInput input)
{
return base.UpdateAsync(id, input);
}
[HttpPost("update")]
public virtual async Task UpdateAsync(KittingEditInput input)
{
var entity = ObjectMapper.Map<KittingEditInput, Kitting>(input);
//var dic=await _repository.GetAsync(r => r.Code == entity.Code);
// if (dic != null)
// {
// await _repository.DeleteAsync(dic);
// }
// await _repository.InsertAsync(entity);
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
protected override async Task<KittingDTO> GetFromRepositoryAsync(string code)
{
var displayName = typeof(KittingDTO).GetNameOfDisplay();
var query = await _repository.WithDetailsAsync().ConfigureAwait(false);
var entity = await query.Where(p => p.Code == code).FirstOrDefaultAsync().ConfigureAwait(false);
return ObjectMapper.Map<Kitting, KittingDTO>(entity);
}
}

89
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAutoMapperProfile.cs

@ -0,0 +1,89 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Basedata.Kittings.Inputs;
namespace Win_in.Sfs.Basedata.Application;
public partial class BasedataApplicationAutoMapperProfile : Profile
{
private void KittingAutoMapperProfile()
{
CreateMap<Kitting, KittingDTO>()
.ReverseMap();
CreateMap<KittingDetail, KittingDetailDTO>()
.ReverseMap();
// CreateMap<DictImportInput, Dict>()
// .IgnoreAuditedObjectProperties()
// .Ignore(x => x.Items)
// .Ignore(x => x.TenantId)
// .Ignore(x => x.ExtraProperties)
// .Ignore(x => x.Remark)
// .Ignore(x => x.ConcurrencyStamp)
// .Ignore(x => x.Id);
//CreateMap<KittingDetailImportInput, DictItem>()
// .IgnoreAuditedObjectProperties()
// .Ignore(x => x.MasterId)
// .Ignore(x => x.Enabled)
// .Ignore(x => x.TenantId)
// .Ignore(x => x.Remark)
// .Ignore(x => x.Id);
CreateMap<KittingDetailInput, KittingDetail>()
.IgnoreAuditedObjectProperties()
// .ForMember(x => x.MasterId, y => y.MapFrom(t => t.MasterId))
;
CreateMap<KittingEditInput, Kitting>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.Id);
}
//CreateMap<Dict, DictDTO>()
// ;
// CreateMap<DictItem, DictItemDTO>()
// ;
// CreateMap<DictImportInput, Dict>()
// .IgnoreAuditedObjectProperties()
// .Ignore(x => x.Items)
// .Ignore(x => x.TenantId)
// .Ignore(x => x.ExtraProperties)
// .Ignore(x => x.Remark)
// .Ignore(x => x.ConcurrencyStamp)
// .Ignore(x => x.Id);
//CreateMap<DictImportInput, DictItem>()
// .IgnoreAuditedObjectProperties()
// .ForMember(x => x.Code, y => y.MapFrom(t => t.Item_Code))
// .ForMember(x => x.Name, y => y.MapFrom(t => t.Item_Name))
// .ForMember(x => x.Description, y => y.MapFrom(t => t.Item_Description))
// .ForMember(x => x.Value, y => y.MapFrom(t => t.Item_Value))
// .Ignore(x => x.MasterId)
// .Ignore(x => x.Enabled)
// .Ignore(x => x.TenantId)
// .Ignore(x => x.Remark)
// .Ignore(x => x.Id);
//CreateMap<DictItemInput, DictItem>()
// .IgnoreAuditedObjectProperties()
// ;
//CreateMap<DictEditInput, Dict>()
// .IgnoreAuditedObjectProperties()
// .Ignore(x => x.ConcurrencyStamp)
//.Ignore(x => x.Id);
}

166
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentArea.cs

@ -0,0 +1,166 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Domain;
/// <summary>
/// 器具基本信息
/// </summary>
public class EquipmentArea : SfsBaseDataAggregateRootBase, IHasCode
{
/// <summary>
/// 器具编号
/// </summary>
public string Code { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 型号
/// </summary>
public string Model { get; set; }
/// <summary>
/// 库位编号
/// </summary>
public string LocCode { get; set; }
/// <summary>
/// 位置编号
/// </summary>
public string AreaCode { get; set; }
/// <summary>
/// 数量
/// </summary>
public decimal Qty { get; set; }
/// <summary>
/// 状态
/// </summary>
public int State { get; set; }
///// <summary>
///// 创建人
///// </summary>
//public string Creator { get; set; }
///// <summary>
///// 创建时间
///// </summary>
//public DateTime CreatTime { get; set; }
///// <summary>
///// 代码
///// </summary>
//[IgnoreUpdate]
//public string Code { get; set; }
///// <summary>
///// 名称
///// </summary>
//public string Name { get; set; }
///// <summary>
///// 描述
///// </summary>
//public string Desc1 { get; set; }
///// <summary>
///// 描述2
///// </summary>
//public string Desc2 { get; set; }
///// <summary>
///// 状态
///// </summary>
//public EnumItemStatus Status { get; set; }
///// <summary>
///// 制造件
///// </summary>
//public bool CanMake { get; set; }
///// <summary>
///// 采购件
///// </summary>
//[IgnoreUpdate]
//public bool CanBuy { get; set; }
///// <summary>
///// 外包件
///// </summary>
//public bool CanOutsourcing { get; set; }
///// <summary>
///// 回收件
///// </summary>
//public bool IsRecycled { get; set; }
//[Display(Name = "类型")]
//public string Type { get; set; }
//[Display(Name = "种类")]
//public string Category { get; set; }
//[Display(Name = "分组")]
//public string Group { get; set; }
//[Display(Name = "颜色")]
//public string Color { get; set; }
//[Display(Name = "配置")]
//public string Configuration { get; set; }
///// <summary>
///// 基本计量单位
///// </summary>
//public string BasicUom { get; set; }
///// <summary>
///// 标包数
///// </summary>
//public decimal StdPackQty { get; set; }
///// <summary>
///// ABC类,默认为C
///// </summary>
//public string AbcClass { get; set; }
///// <summary>
///// 项目
///// </summary>
//public string Project { get; set; }
///// <summary>
///// 版本
///// </summary>
//public string Version { get; set; }
///// <summary>
///// 工程变革
///// </summary>
//public string Eco { get; set; }
///// <summary>
///// 有效期
///// </summary>
//public int Validity { get; set; }
///// <summary>
///// 有效期单位
///// </summary>
//public EnumValidityUnit ValidityUnit { get; set; }
///// <summary>
///// 管理类型
///// </summary>
//public EnumItemManageType ManageType { get; set; }
///// <summary>
///// 打印标签用的一个等级
///// </summary>
//public string Elevel { get; set; }
///// <summary>
///// 虚零件
///// </summary>
//public virtual bool IsPhantom { get; set; }
}

29
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentAreaManager.cs

@ -0,0 +1,29 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
namespace Win_in.Sfs.Basedata.Domain;
public class EquipmentAreaManager : DomainService, IEquipmentAreaManager
{
private readonly IEquipmentAreaRepository _repository;
public EquipmentAreaManager(IEquipmentAreaRepository repository)
{
_repository = repository;
}
/// <summary>
/// 执行导入
/// </summary>
public virtual async Task ImportDataAsync(List<EquipmentArea> mergeEntities, List<EquipmentArea> deleteEntities = null)
{
if (deleteEntities != null && deleteEntities.Count > 0)
{
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false);
}
await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false);
}
}

8
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentAreaManager.cs

@ -0,0 +1,8 @@
using Volo.Abp.Domain.Services;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Basedata.Domain;
public interface IEquipmentAreaManager : IDomainService, IBulkImportService<EquipmentArea>
{
}

13
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentAreaRepository.cs

@ -0,0 +1,13 @@
using System.Threading.Tasks;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Basedata.Domain;
public interface IEquipmentAreaRepository : ISfsBaseDataRepositoryBase<EquipmentArea>, ISfsBulkRepositoryBase<EquipmentArea>
{
public Task UpsertAsync(EquipmentArea entity);
public Task InsertAutoSaveAsync(EquipmentArea entity);
public Task UpsertAsyncByInterface(EquipmentArea entity);
}

20
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/IKittingManager.cs

@ -0,0 +1,20 @@
using Volo.Abp.Domain.Services;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Basedata.Domain;
public interface IKittingManager : IDomainService, IBulkImportService<Kitting>
{
//Task<PutawayJob> AddByContainerAsync(Guid traceId, string containerCode);
//// Task<List<PutawayJob>> AddMergeAsync(List<BalanceDTO> inventories);
//Task<List<PutawayJob>> AddByPackingAsync(Guid traceId, List<PutawayInventory> putawayInventories);
///// <summary>
///// 按箱采购收货上架 根据收货时的ERP储位 物品 进行分组上架 只推荐空库位
///// </summary>
///// <param name="putawayJob"></param>
///// <returns></returns>
//Task<PutawayJob> CreateByErpCodeAndEmptyCapacityAsync(PutawayJob putawayJob);
}

9
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/IKittingRepository.cs

@ -0,0 +1,9 @@
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Basedata.Domain;
public interface IKittingRepository : ISfsBaseDataRepositoryBase<Kitting>, ISfsBulkRepositoryBase<Kitting>
{
}

46
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/Kitting.cs

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Domain;
/// <summary>
/// Kitting箱
/// </summary>
[Serializable]
[Display(Name = "Kitting箱")]
public class Kitting : SfsBaseDataAggregateRootBase, IHasCode
{
public string Code { get ; set ; }
public string Name { get ; set ; }
public virtual ICollection<KittingDetail> Details { get; set; } = new List<KittingDetail>();
public void SetId(Guid id)
{
this.Id = id;
}
///// <summary>
///// 设置任务明细的实际库位和实际数量
///// </summary>
///// <param name="id"></param>
///// <param name="locationCode"></param>
///// <param name="qty"></param>
///// <returns></returns>
//public virtual async Task SetDetail(Guid id, string partCode, string desc1, string desc2, decimal qty, string conf)
//{
// var detail = GetDetail(id);
// detail.PartCode = partCode;
// detail.Desc1 = desc1;
// detail.Desc2 = desc2;
// detail.Qty = qty;
// detail.Conf = conf;
// await Task.CompletedTask.ConfigureAwait(false);
//}
}

41
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/KittingDetail.cs

@ -0,0 +1,41 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Basedata.Domain;
public class KittingDetail : AuditedEntity<Guid>, IMultiTenant, IRemark
{
public Guid MasterId { get; set; }
/// <summary>
/// 物料编码
/// </summary>
public string PartCode { set; get; }
/// <summary>
/// 描述1
/// </summary>
public string Desc1 { set; get; }
/// <summary>
/// 描述2
/// </summary>
public string Desc2 { set; get; }
/// <summary>
/// 包装数量
/// </summary>
public decimal Qty { set; get; }
/// <summary>
/// 配置
/// </summary>
public string Conf { set; get; }
public Guid? TenantId { set; get; }
public string Remark { get; set; }
}

49
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/KittingManager.cs

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Volo.Abp;
using Volo.Abp.Users;
using Volo.Abp.Validation;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Basedata.Domain;
public class KittingManager : IKittingManager
{
private readonly IKittingRepository _repository;
public KittingManager(IKittingRepository repository, IWarehouseRepository warehourseRepository, ILocationRepository locationRepository)
{
_repository = repository;
}
/// <summary>
/// 执行导入
/// </summary>
public virtual async Task ImportDataAsync(List<Kitting> mergeEntities, List<Kitting> deleteEntities = null)
{
if (deleteEntities != null && deleteEntities.Count > 0)
{
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false);
}
await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false);
var insertDetails = new List<KittingDetail>();
foreach (var item in mergeEntities)
{
insertDetails.AddRange(item.Details);
}
await _repository.BulkInsertAsync(insertDetails).ConfigureAwait(false);
}
}

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

@ -67,6 +67,8 @@ public static class BasedataDbContextModelCreatingExtensions
//设置decimal的默认小数位数 //设置decimal的默认小数位数
builder.ConfigurePrecisionOfDecimal(); builder.ConfigurePrecisionOfDecimal();
builder.ConfigurePositionCode(options); builder.ConfigurePositionCode(options);
builder.ConfigureEquipmentArea(options);
builder.ConfigureKitting(options);
} }

7
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataEntityFrameworkCoreModule.cs

@ -69,6 +69,8 @@ public class BasedataEntityFrameworkCoreModule : AbpModule
context.Services.AddTransient<IItemGuideBookRepository, ItemGuideBookEfCoreRepository>(); context.Services.AddTransient<IItemGuideBookRepository, ItemGuideBookEfCoreRepository>();
context.Services.AddTransient<IDocumentSettingRepository, DocumentSettingEfCoreRepository>(); context.Services.AddTransient<IDocumentSettingRepository, DocumentSettingEfCoreRepository>();
context.Services.AddTransient<IEquipmentRepository, EquipmentEfCoreRepository>(); context.Services.AddTransient<IEquipmentRepository, EquipmentEfCoreRepository>();
context.Services.AddTransient<IEquipmentAreaRepository, EquipmentAreaEfCoreRepository>();
context.Services.AddTransient<IKittingRepository, KittingEfCoreRepository>();
ConfigureEntity(); ConfigureEntity();
} }
@ -80,6 +82,11 @@ public class BasedataEntityFrameworkCoreModule : AbpModule
{ {
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Items); orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Items);
}); });
options.Entity<Kitting>(orderOptions =>
{
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details);
});
}); });

39
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentAreaDbContextModelCreatingExtensions.cs

@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.EntityFrameworkCore;
namespace Win_in.Sfs.Basedata.EntityFrameworkCore;
public static class EquipmentAreaDbContextModelCreatingExtensions
{
public static void ConfigureEquipmentArea(this ModelBuilder builder, BasedataModelBuilderConfigurationOptions options)
{
builder.Entity<EquipmentArea>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + nameof(EquipmentArea), options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsBase();
//Properties
b.Property(q => q.Code).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength).IsRequired(true);
b.Property(q => q.Model).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.LocCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.AreaCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.HasIndex(q => new { q.Code });
b.HasIndex(q => new { q.AreaCode });
});
}
}
/// <summary>
/// 器具编号
/// </summary>

56
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentAreaEfCoreRepository.cs

@ -0,0 +1,56 @@
using System;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Basedata.EntityFrameworkCore;
public class EquipmentAreaEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<BasedataDbContext, EquipmentArea>, IEquipmentAreaRepository, ISfsBulkRepositoryBase<EquipmentArea>
{
public EquipmentAreaEfCoreRepository(IDbContextProvider<BasedataDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public virtual async Task UpsertAsyncByInterface(EquipmentArea entity)
{
var dbSet = await GetDbSetAsync().ConfigureAwait(false);
var exist = await dbSet.FirstOrDefaultAsync(p => p.Code == entity.Code && p.AreaCode==entity.AreaCode).ConfigureAwait(false);
if (exist == null)
{
var insRet = await InsertAsync(entity).ConfigureAwait(false);
}
else
{
exist.State = entity.State;
exist.Model = entity.Model;
exist.Type = entity.Type;
exist.LastModificationTime = DateTimeOffset.Now.DateTime;
}
}
public virtual async Task UpsertAsync(EquipmentArea entity)
{
var dbSet = await GetDbSetAsync().ConfigureAwait(false);
var exist = await dbSet.FirstOrDefaultAsync(p => p.Code == entity.Code && p.AreaCode==entity.AreaCode).ConfigureAwait(false);
if (exist == null)
{
var insRet = await InsertAsync(entity).ConfigureAwait(false);
}
else
{
exist.State = entity.State;
exist.Model = entity.Model;
exist.Type = entity.Type;
exist.LastModificationTime = DateTimeOffset.Now.DateTime;
}
}
public virtual async Task InsertAutoSaveAsync(EquipmentArea entity)
{
_ = await InsertAsync(entity, true, GetCancellationToken()).ConfigureAwait(false);
}
}

71
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingDbContextModelCreatingExtensions.cs

@ -0,0 +1,71 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.EntityFrameworkCore;
namespace Win_in.Sfs.Basedata.EntityFrameworkCore;
public static class KittingDbContextModelCreatingExtensions
{
public static void ConfigureKitting(this ModelBuilder builder, BasedataModelBuilderConfigurationOptions options)
{
builder.Entity<Kitting>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + nameof(Kitting), options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsBase();
b.Property(p=>p.Name).HasMaxLength(SfsPropertyConst.DescLength);
//Properties
b.Property(q => q.Code).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
//Relations
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterId).IsRequired();
//Indexes
b.HasIndex(q => new { q.Code }).IsUnique();
});
builder.Entity<KittingDetail>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + nameof(KittingDetail), options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsBase();
b.Property(p => p.Desc1).HasMaxLength(SfsPropertyConst.DescLength);
//Properties
b.Property(q => q.Desc2).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
//Relations
b.Property(q => q.MasterId).IsRequired();
//Indexes
});
}
//public static void ConfigureCustomer(this ModelBuilder builder, BasedataModelBuilderConfigurationOptions options)
//{
// builder.Entity<Customer>(b =>
// {
// //Configure table & schema name
// b.ToTable(options.TablePrefix + nameof(Customer), options.Schema);
// //Configure ABP properties
// b.ConfigureByConvention();
// //Configure Sfs base properties
// b.ConfigureSfsBase();
// //Properties
// b.Property(q => q.Code).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
// b.Property(q => q.Name).HasMaxLength(SfsPropertyConst.NameLength);
// b.Property(q => q.Description).HasMaxLength(SfsPropertyConst.DescLength);
// //Relations
// //None
// //Indexes
// b.HasIndex(q => new { q.Code }).IsUnique();
// });
//}
}

75
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingEfCoreRepository.cs

@ -0,0 +1,75 @@
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Basedata.EntityFrameworkCore;
public class KittingEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<BasedataDbContext, Kitting>, IKittingRepository, ISfsBulkRepositoryBase<Kitting>
{
public KittingEfCoreRepository(IDbContextProvider<BasedataDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public virtual async Task UpsertAsync(Kitting entity)
{
var dbSet = await GetDbSetAsync().ConfigureAwait(false);
var exist = await dbSet.FirstOrDefaultAsync(p => p.Code == entity.Code).ConfigureAwait(false);
if (exist == null)
{
var insRet = await InsertAsync(entity).ConfigureAwait(false);
}
else
{
//exist.Code = entity.Code;
exist.Name = entity.Name;
//exist.Address = entity.Address;
//exist.Country = entity.Country;
//exist.City = entity.City;
//exist.Phone = entity.Phone;
//exist.Fax = entity.Fax;
//exist.PostID = entity.PostID;
//exist.Contacts = entity.Contacts;
//exist.Currency = entity.Currency;
//exist.IsActive = entity.IsActive;
//exist.Type = entity.Type;
exist.TenantId = entity.TenantId;
exist.Remark = entity.Remark;
}
// var context = await GetDbContextAsync();
// await context.SingleMergeAsync(entity, options =>
// {
// //业务主键,可以是联合主键
// options.ColumnPrimaryKeyExpression = c => new
// {
// c.Company,
// c.Code
// };
// //需要在更新时忽略的属性
// options.IgnoreOnMergeUpdateExpression = c => new
// {
// c.Id,
// };
// });
}
public virtual async Task UpsertAsyncByInterface(Kitting entity)
{
//var dbSet = await GetDbSetAsync().ConfigureAwait(false);
//var exist = await dbSet.FirstOrDefaultAsync(p => p.Code == entity.Code).ConfigureAwait(false);
//if (exist == null)
//{
// var insRet = await InsertAsync(entity).ConfigureAwait(false);
//}
//else
//{
// exist.Name = entity.Name;
// exist.ShortName = entity.ShortName;
// exist.LastModificationTime = DateTime.Now;
//}
}
}
Loading…
Cancel
Save