64 changed files with 1914 additions and 653 deletions
@ -0,0 +1,40 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
|
|||
|
|||
[Display(Name = "器具容量占用信息")] |
|||
|
|||
public class EquipmentLocCapDTO : SfsBaseDataDTOBase, IHasCode |
|||
{ |
|||
/// <summary>
|
|||
/// 器具代码
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
public string Code { get; set; } |
|||
/// 占用百分比
|
|||
/// </summary>
|
|||
[Display(Name = "占用百分比")] |
|||
public decimal Percent { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
public string PartCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 录入数量
|
|||
/// </summary>
|
|||
public decimal Qty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 标包数量
|
|||
/// </summary>
|
|||
public decimal StdQty { get; set; } |
|||
|
|||
|
|||
} |
@ -0,0 +1,31 @@ |
|||
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 EquipmentLocDTO : SfsBaseDataDTOBase, IHasCode |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 器具编号
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 库位编号
|
|||
/// </summary>
|
|||
[Display(Name = "库位代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string LocCode { get; set; } |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,73 @@ |
|||
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 EquipmentPartCodeDTO : SfsBaseDataDTOBase, IHasCode |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 器具代号
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
|
|||
///// <summary>
|
|||
///// 型号
|
|||
///// </summary>
|
|||
//[Display(Name = "型号")]
|
|||
//public string Model { get; set; } = string.Empty;
|
|||
/// <summary>
|
|||
/// 库位编号
|
|||
/// </summary>
|
|||
[Display(Name = "零件代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string PartCode { get; set; } |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 标包数量
|
|||
/// </summary>
|
|||
[Display(Name = "标包数")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public decimal StdQty { get; set; } |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 单位
|
|||
/// </summary>
|
|||
[Display(Name = "单位")] |
|||
public string Unit { get; set; } |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 状态
|
|||
/// </summary>
|
|||
|
|||
//[Display(Name = "状态")]
|
|||
//public int State { get; set; } = 0;
|
|||
|
|||
///// <summary>
|
|||
///// 创建人
|
|||
///// </summary>
|
|||
//[Display(Name = "创建人")]
|
|||
//public string Creator { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 创建时间
|
|||
///// </summary>
|
|||
//[Display(Name = "创建时间")]
|
|||
//public DateTime CreatTime { get; set; } = DateTime.Now;
|
|||
} |
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Equipments.DTOs; |
|||
[Display(Name = "器具校验信息")] |
|||
public class EquipmentRecordErrorDTO |
|||
{ |
|||
[Display(Name = "器具代码")] |
|||
public string EqptCode { set; get; } |
|||
[Display(Name = "零件代码")] |
|||
public string PartCode { set; get; } |
|||
[Display(Name = "错误信息")] |
|||
public string Error { set; get; } |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
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 IEquipmentLocAppService |
|||
: ISfsBaseDataAppServiceBase<EquipmentLocDTO, SfsBaseDataRequestInputBase, EquipmentLocEditInput> |
|||
, ISfsGetByCodeAppService<EquipmentLocDTO> |
|||
, ISfsCheckAppService<EquipmentLocCheckInput> |
|||
, ISfsUpsertAppService<EquipmentLocEditInput> |
|||
{ |
|||
|
|||
|
|||
Task<List<EquipmentLocDTO>> GetEquipmentLocAsync(List<string> p_ls); |
|||
|
|||
|
|||
//Task<bool> CheckItemIsAvailable(string itemCode);
|
|||
//[HttpGet("check-item-is-available-no-select-sql")]
|
|||
//void CheckItemIsAvailable(EquipmentLocDTO EquipmentLocDTO);
|
|||
|
|||
//Task<List<EquipmentLocDTO>> GetListByNameAsync(string name);
|
|||
|
|||
//Task<EquipmentLocDTO> GetOrAddAsync(EquipmentLocEditInput input);
|
|||
|
|||
//Task<EnumItemManageType> GetManageTypeAsync(string itemCode);
|
|||
//Task<Dictionary<string, EnumItemManageType>> GetManageTypesAsync(List<string> itemCodes);
|
|||
|
|||
//Task UpsertAsyncByInterface(EquipmentLocEditInput input);
|
|||
//Task UpsertStdPackQtyAsync(string itemCode, decimal stdpackqty);
|
|||
} |
@ -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 IEquipmentLocCapAppService |
|||
: ISfsBaseDataAppServiceBase<EquipmentLocCapDTO, SfsBaseDataRequestInputBase, EquipmentLocCapEditInput> |
|||
, ISfsGetByCodeAppService<EquipmentLocCapDTO> |
|||
, ISfsCheckAppService<EquipmentLocCapCheckInput> |
|||
, ISfsUpsertAppService<EquipmentLocCapEditInput> |
|||
{ |
|||
//Task<bool> CheckItemIsAvailable(string itemCode);
|
|||
//[HttpGet("check-item-is-available-no-select-sql")]
|
|||
//void CheckItemIsAvailable(EquipmentLocCapDTO EquipmentLocCapDTO);
|
|||
|
|||
//Task<List<EquipmentLocCapDTO>> GetListByNameAsync(string name);
|
|||
|
|||
//Task<EquipmentLocCapDTO> GetOrAddAsync(EquipmentLocCapEditInput input);
|
|||
|
|||
//Task<EnumItemManageType> GetManageTypeAsync(string itemCode);
|
|||
//Task<Dictionary<string, EnumItemManageType>> GetManageTypesAsync(List<string> itemCodes);
|
|||
|
|||
//Task UpsertAsyncByInterface(EquipmentLocCapEditInput input);
|
|||
//Task UpsertStdPackQtyAsync(string itemCode, decimal stdpackqty);
|
|||
} |
@ -0,0 +1,31 @@ |
|||
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 IEquipmentPartCodeAppService |
|||
: ISfsBaseDataAppServiceBase<EquipmentPartCodeDTO, SfsBaseDataRequestInputBase, EquipmentPartCodeEditInput> |
|||
, ISfsGetByCodeAppService<EquipmentPartCodeDTO> |
|||
|
|||
, ISfsUpsertAppService<EquipmentPartCodeEditInput> |
|||
{ |
|||
|
|||
|
|||
Task<List<EquipmentPartCodeDTO>> GetEquipmentPartCodesAsync(List<string> p_ls); |
|||
//Task<bool> CheckItemIsAvailable(string itemCode);
|
|||
//[HttpGet("check-item-is-available-no-select-sql")]
|
|||
//void CheckItemIsAvailable(EquipmentPartCodeDTO EquipmentPartCodeDTO);
|
|||
|
|||
//Task<List<EquipmentPartCodeDTO>> GetListByNameAsync(string name);
|
|||
|
|||
//Task<EquipmentPartCodeDTO> GetOrAddAsync(EquipmentPartCodeEditInput input);
|
|||
|
|||
//Task<EnumItemManageType> GetManageTypeAsync(string itemCode);
|
|||
//Task<Dictionary<string, EnumItemManageType>> GetManageTypesAsync(List<string> itemCodes);
|
|||
|
|||
//Task UpsertAsyncByInterface(EquipmentPartCodeEditInput input);
|
|||
//Task UpsertStdPackQtyAsync(string itemCode, decimal stdpackqty);
|
|||
} |
@ -0,0 +1,20 @@ |
|||
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 EquipmentLocCapCheckInput |
|||
{ |
|||
/// <summary>
|
|||
/// 器具代码
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
public string Code { get; set; } |
|||
/// 占用百分比
|
|||
/// </summary>
|
|||
[Display(Name = "占用百分比")] |
|||
public decimal Percent { get; set; } |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Domain.Shared.Enums.Basedata; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
public class EquipmentLocCapEditInput : SfsBaseDataCreateOrUpdateInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 器具代码
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
public string Code { get; set; } |
|||
/// 占用百分比
|
|||
/// </summary>
|
|||
[Display(Name = "占用百分比")] |
|||
public decimal Percent { get; set; } |
|||
} |
@ -0,0 +1,38 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
using Win_in.Sfs.Shared.Domain.Shared.Enums.Basedata; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
[Display(Name = "器具容量")] |
|||
public class EquipmentLocCapImportInput : SfsBaseDataImportInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 器具代码
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
public string Code { get; set; } |
|||
/// 占用百分比
|
|||
/// </summary>
|
|||
[Display(Name = "占用百分比")] |
|||
public decimal Percent { get; set; } |
|||
//[Display(Name = "零件代码")]
|
|||
|
|||
//public string PartCode { get; set; }
|
|||
|
|||
//[Display(Name = "当前数量")]
|
|||
///// <summary>
|
|||
///// 录入数量
|
|||
///// </summary>
|
|||
//public decimal Qty { get; set; }
|
|||
//[Display(Name = "标包数量")]
|
|||
///// <summary>
|
|||
///// 标包数量
|
|||
///// </summary>
|
|||
//public decimal StdQty { get; set; }
|
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
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 EquipmentLocCheckInput |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 器具编号
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 库位编号
|
|||
/// </summary>
|
|||
[Display(Name = "库位代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string LocCode { get; set; } |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
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 EquipmentLocEditInput : SfsBaseDataCreateOrUpdateInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 器具编号
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 库位编号
|
|||
/// </summary>
|
|||
[Display(Name = "库位代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string LocCode { get; set; } |
|||
|
|||
[Display(Name = "状态")] |
|||
public int State { get; set; } = 0; |
|||
|
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
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 EquipmentLocImportInput : SfsBaseDataImportInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 器具编号
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 库位编号
|
|||
/// </summary>
|
|||
[Display(Name = "库位代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string LocCode { get; set; } |
|||
|
|||
|
|||
[Display(Name = "状态")] |
|||
public int State { get; set; } = 0; |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,43 @@ |
|||
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 EquipmentPartCodeCheckInput |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 器具代号
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
|
|||
|
|||
|
|||
///// <summary>
|
|||
///// 型号
|
|||
///// </summary>
|
|||
//[Display(Name = "型号")]
|
|||
//public string Model { get; set; } = string.Empty;
|
|||
/// <summary>
|
|||
/// 库位编号
|
|||
/// </summary>
|
|||
[Display(Name = "零件代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string PartCode { get; set; } |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 标包数量
|
|||
/// </summary>
|
|||
[Display(Name = "标包数")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public decimal StdQty { get; set; } |
|||
|
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
public class EquipmentPartCodeEditInput : SfsBaseDataCreateOrUpdateInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 器具代号
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
|
|||
|
|||
|
|||
///// <summary>
|
|||
///// 型号
|
|||
///// </summary>
|
|||
//[Display(Name = "型号")]
|
|||
//public string Model { get; set; } = string.Empty;
|
|||
/// <summary>
|
|||
/// 库位编号
|
|||
/// </summary>
|
|||
[Display(Name = "零件代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string PartCode { get; set; } |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 标包数量
|
|||
/// </summary>
|
|||
[Display(Name = "标包数")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public decimal StdQty { get; set; } |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 标包数量
|
|||
/// </summary>
|
|||
[Display(Name = "单位")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Unit { get; set; } |
|||
|
|||
[Display(Name = "状态")] |
|||
public int State { get; set; } = 0; |
|||
|
|||
} |
@ -0,0 +1,60 @@ |
|||
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 EquipmentPartCodeImportInput : SfsBaseDataImportInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 器具代号
|
|||
/// </summary>
|
|||
[Display(Name = "器具代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
|
|||
|
|||
|
|||
///// <summary>
|
|||
///// 型号
|
|||
///// </summary>
|
|||
//[Display(Name = "型号")]
|
|||
//public string Model { get; set; } = string.Empty;
|
|||
/// <summary>
|
|||
/// 库位编号
|
|||
/// </summary>
|
|||
[Display(Name = "零件代码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string PartCode { get; set; } |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 标包数量
|
|||
/// </summary>
|
|||
[Display(Name = "标包数")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public decimal StdQty { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 标包数量
|
|||
/// </summary>
|
|||
[Display(Name = "单位")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Unit { get; set; } |
|||
|
|||
|
|||
[Display(Name = "状态")] |
|||
public int State { get; set; } = 0; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,95 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Linq.Expressions; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Caching; |
|||
using Volo.Abp.Domain.Repositories; |
|||
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.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Application.Contracts.ExportAndImport; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application; |
|||
|
|||
[Authorize] |
|||
[Route($"{BasedataConsts.RootPath}EquipmentLoc")] |
|||
public class EquipmentLocAppService |
|||
: SfsBaseDataWithCodeAppServiceBase<EquipmentLoc, EquipmentLocDTO, SfsBaseDataRequestInputBase, EquipmentLocEditInput, EquipmentLocImportInput> |
|||
, IEquipmentLocAppService |
|||
{ |
|||
//private readonly ItemValidator _itemValidator;
|
|||
private readonly IEquipmentLocManager _manager; |
|||
private new readonly IEquipmentLocRepository _repository; |
|||
private readonly IExportImportService _importService; |
|||
|
|||
public EquipmentLocAppService( |
|||
IEquipmentLocRepository repository, |
|||
IDistributedCache<EquipmentLocDTO> cache, |
|||
IExportImportService importService, |
|||
// ItemValidator itemValidator,
|
|||
IEquipmentLocManager manager) |
|||
: base(repository, cache) |
|||
{ |
|||
_importService=importService; |
|||
_repository = repository; |
|||
//_itemValidator = itemValidator;
|
|||
_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, EquipmentLocCheckInput input) |
|||
{ |
|||
await Task.CompletedTask.ConfigureAwait(false); |
|||
} |
|||
|
|||
[HttpPost("upsert")] |
|||
|
|||
public virtual async Task UpsertAsync(EquipmentLocEditInput input) |
|||
{ |
|||
var entity = ObjectMapper.Map<EquipmentLocEditInput, EquipmentLoc>(input); |
|||
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
|||
} |
|||
[HttpPost] |
|||
[Route("")] |
|||
public override async Task<EquipmentLocDTO> CreateAsync(EquipmentLocEditInput input) |
|||
{ |
|||
var first= _repository.WithDetails().FirstOrDefault(p => p.Code == input.Code && p.LocCode==input.LocCode); |
|||
if (first == null) |
|||
{ |
|||
var entity = ObjectMapper.Map<EquipmentLocEditInput, EquipmentLoc>(input); |
|||
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
|||
var entity1=_repository.WithDetails().FirstOrDefault(p => p.Code == input.Code && p.LocCode == input.LocCode); |
|||
return ObjectMapper.Map<EquipmentLoc,EquipmentLocDTO>(entity1); |
|||
} |
|||
else |
|||
{ |
|||
throw new UserFriendlyException($"已存在器具代码{input.Code}和库位{input.LocCode}关系!"); |
|||
} |
|||
} |
|||
[HttpPost] |
|||
[Route("GetEquipmentLocs")] |
|||
public async Task<List<EquipmentLocDTO>> GetEquipmentLocAsync(List<string> p_ls) |
|||
{ |
|||
var query=await _repository.GetQueryableAsync().ConfigureAwait(false); |
|||
var list =query.Where(p => p_ls.Contains(p.Code)); |
|||
return ObjectMapper.Map< List<EquipmentLoc> ,List<EquipmentLocDTO>>(list.ToList()); |
|||
} |
|||
} |
@ -0,0 +1,34 @@ |
|||
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 EquipmentLocAutoMapperProfile() |
|||
{ |
|||
CreateMap<EquipmentLoc, EquipmentLocDTO>() |
|||
|
|||
.ReverseMap(); |
|||
|
|||
CreateMap<EquipmentLocImportInput, EquipmentLoc>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.Remark) |
|||
.Ignore(x => x.ExtraProperties) |
|||
.Ignore(x => x.ConcurrencyStamp) |
|||
.Ignore(x=>x.State) |
|||
.ForMember(p =>p.Code, p => p.MapFrom(q =>q.Code)) ; |
|||
|
|||
//CreateMap<EquipmentLoc, EquipmentLocImportInput>()
|
|||
|
|||
//CreateMap<EquipmentLoc, EquipmentLocForDongyangExportDTO>()
|
|||
// .Ignore(x => x.ItemCategory)
|
|||
// .Ignore(x => x.Color);
|
|||
CreateMap<EquipmentLocEditInput, EquipmentLoc>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id); |
|||
} |
|||
} |
@ -0,0 +1,70 @@ |
|||
using System.Linq; |
|||
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; |
|||
using Win_in.Sfs.Basedata.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Application.Contracts.ExportAndImport; |
|||
namespace Win_in.Sfs.Basedata.Application; |
|||
|
|||
[Authorize] |
|||
[Route($"{BasedataConsts.RootPath}EquipmentLocCap")] |
|||
public class EquipmentLocCapAppService |
|||
: SfsBaseDataWithCodeAppServiceBase<EquipmentLocCap, EquipmentLocCapDTO, SfsBaseDataRequestInputBase, EquipmentLocCapEditInput, EquipmentLocCapImportInput> |
|||
, IEquipmentLocCapAppService |
|||
{ |
|||
private readonly IEquipmentLocCapManager _manager; |
|||
private new readonly IEquipmentLocCapRepository _repository; |
|||
private readonly IExportImportService _importService; |
|||
public EquipmentLocCapAppService( |
|||
IEquipmentLocCapRepository repository, |
|||
IDistributedCache<EquipmentLocCapDTO> cache, |
|||
IExportImportService importService, |
|||
IEquipmentLocCapManager manager) |
|||
: base(repository, cache) |
|||
{ |
|||
_importService=importService; |
|||
_repository = repository; |
|||
_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, EquipmentLocCapCheckInput input) |
|||
{ |
|||
await Task.CompletedTask.ConfigureAwait(false); |
|||
} |
|||
[HttpPost("upsert")] |
|||
|
|||
public virtual async Task UpsertAsync(EquipmentLocCapEditInput input) |
|||
{ |
|||
var entity = ObjectMapper.Map<EquipmentLocCapEditInput, EquipmentLocCap>(input); |
|||
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("")] |
|||
public override async Task<EquipmentLocCapDTO> CreateAsync(EquipmentLocCapEditInput input) |
|||
{ |
|||
var query =await _repository.GetQueryableAsync().ConfigureAwait(false); |
|||
var first=query.FirstOrDefault(p => p.Code == input.Code); |
|||
if (first == null) |
|||
{ |
|||
var entity = ObjectMapper.Map<EquipmentLocCapEditInput, EquipmentLocCap>(input); |
|||
entity.Code = string.Format("{0}{1}", "Q", entity.Code); |
|||
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
|||
var entity1=_repository.WithDetails().FirstOrDefault(p => p.Code == input.Code); |
|||
return ObjectMapper.Map<EquipmentLocCap,EquipmentLocCapDTO>(entity1); |
|||
} |
|||
else |
|||
{ |
|||
throw new UserFriendlyException($"已存在器具编号{input.Code}!"); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,43 @@ |
|||
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 EquipmentLocCapAutoMapperProfile() |
|||
{ |
|||
CreateMap<EquipmentLocCap, EquipmentLocCapDTO>() |
|||
.IgnoreAuditedObjectProperties() |
|||
|
|||
.ReverseMap(); |
|||
|
|||
CreateMap<EquipmentLocCapImportInput, EquipmentLocCap>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.Remark) |
|||
.Ignore(x => x.ExtraProperties) |
|||
.Ignore(x => x.ConcurrencyStamp) |
|||
.Ignore(x => x.StdQty) |
|||
.Ignore(x => x.PartCode) |
|||
.Ignore(x => x.Qty) |
|||
.Ignore(x => x.ConcurrencyStamp) |
|||
|
|||
|
|||
.ForMember(p => p.Code, p => p.MapFrom(q =>q.Code)); |
|||
|
|||
//CreateMap<EquipmentLocCap, EquipmentLocCapImportInput>()
|
|||
|
|||
//CreateMap<EquipmentLocCap, EquipmentLocCapForDongyangExportDTO>()
|
|||
// .Ignore(x => x.ItemCategory)
|
|||
// .Ignore(x => x.Color);
|
|||
CreateMap<EquipmentLocCapEditInput, EquipmentLocCap>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.StdQty) |
|||
.Ignore(x => x.PartCode) |
|||
.Ignore(x => x.Qty) |
|||
.Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id); |
|||
} |
|||
} |
@ -0,0 +1,109 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Linq.Expressions; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Http; |
|||
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.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Application.Contracts.ExportAndImport; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application; |
|||
|
|||
[Authorize] |
|||
[Route($"{BasedataConsts.RootPath}EquipmentPartCode")] |
|||
public class EquipmentPartCodeAppService |
|||
: SfsBaseDataWithCodeAppServiceBase<EquipmentPartCode, EquipmentPartCodeDTO, SfsBaseDataRequestInputBase, EquipmentPartCodeEditInput, EquipmentPartCodeImportInput> |
|||
, IEquipmentPartCodeAppService |
|||
{ |
|||
private readonly IEquipmentPartCodeManager _manager; |
|||
private new readonly IEquipmentPartCodeRepository _repository; |
|||
private readonly IExportImportService _importService; |
|||
|
|||
public EquipmentPartCodeAppService( |
|||
IEquipmentPartCodeRepository repository, |
|||
IDistributedCache<EquipmentPartCodeDTO> cache, |
|||
IExportImportService importService, |
|||
|
|||
IEquipmentPartCodeManager manager) |
|||
: base(repository, cache) |
|||
{ |
|||
_importService=importService; |
|||
_repository = repository; |
|||
_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, EquipmentPartCodeCheckInput input) |
|||
{ |
|||
await Task.CompletedTask.ConfigureAwait(false); |
|||
} |
|||
|
|||
[HttpPost("upsert")] |
|||
|
|||
public virtual async Task UpsertAsync(EquipmentPartCodeEditInput input) |
|||
{ |
|||
var entity = ObjectMapper.Map<EquipmentPartCodeEditInput, EquipmentPartCode>(input); |
|||
|
|||
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("")] |
|||
public override async Task<EquipmentPartCodeDTO> CreateAsync(EquipmentPartCodeEditInput input) |
|||
{ |
|||
var first= _repository.WithDetails().FirstOrDefault(p => p.Code == input.Code && p.PartCode==input.PartCode); |
|||
if (first == null) |
|||
{ |
|||
var entity = ObjectMapper.Map<EquipmentPartCodeEditInput, EquipmentPartCode>(input); |
|||
|
|||
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
|||
var entity1=_repository.WithDetails().FirstOrDefault(p => p.Code == input.Code && p.PartCode == input.PartCode); |
|||
return ObjectMapper.Map<EquipmentPartCode,EquipmentPartCodeDTO>(entity1); |
|||
} |
|||
else |
|||
{ |
|||
throw new UserFriendlyException($"已存在器具代码{input.Code}和零件代码{input.PartCode}关系!"); |
|||
} |
|||
} |
|||
[HttpPost] |
|||
[Route("GetEquipmentPartCodes")] |
|||
public async Task<List<EquipmentPartCodeDTO>> GetEquipmentPartCodesAsync(List<string> p_ls) |
|||
{ |
|||
var query = await _repository.GetQueryableAsync().ConfigureAwait(false); |
|||
var list = query.Where(p => p_ls.Contains(p.Code)); |
|||
|
|||
return ObjectMapper.Map<List<EquipmentPartCode>, List<EquipmentPartCodeDTO>>(list.ToList()); |
|||
|
|||
} |
|||
protected override async Task ValidateImportModelAsync(EquipmentPartCodeImportInput importInput, List<ValidationResult> validationRresult) |
|||
{ |
|||
await base.CheckItemBasicItemCodeAsync(importInput.Code, validationRresult).ConfigureAwait(false); |
|||
|
|||
//await base.CheckComponentAndComponentQtyAsync(importInput.Component, importInput.ComponentQty, validationRresult).ConfigureAwait(false);
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
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 EquipmentPartCodeAutoMapperProfile() |
|||
{ |
|||
CreateMap<EquipmentPartCode, EquipmentPartCodeDTO>() |
|||
|
|||
.ReverseMap(); |
|||
|
|||
CreateMap<EquipmentPartCodeImportInput, EquipmentPartCode>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.Remark) |
|||
.Ignore(x => x.ExtraProperties) |
|||
.Ignore(x => x.ConcurrencyStamp) |
|||
.ForMember(p =>p.Code, p => p.MapFrom(q =>q.Code)) |
|||
|
|||
; |
|||
|
|||
//CreateMap<EquipmentPartCode, EquipmentPartCodeImportInput>()
|
|||
|
|||
//CreateMap<EquipmentPartCode, EquipmentPartCodeForDongyangExportDTO>()
|
|||
// .Ignore(x => x.ItemCategory)
|
|||
// .Ignore(x => x.Color);
|
|||
CreateMap<EquipmentPartCodeEditInput, EquipmentPartCode>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id); |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
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; |
|||
using Win_in.Sfs.Shared.Domain.Shared.Enums.Basedata; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
/// <summary>
|
|||
/// 物品基本信息
|
|||
/// </summary>
|
|||
public class EquipmentLoc : SfsBaseDataAggregateRootBase, IHasCode |
|||
{ |
|||
/// <summary>
|
|||
/// 器具代码
|
|||
/// </summary>
|
|||
public string Code { get; set; } |
|||
///// <summary>
|
|||
///// 类型
|
|||
///// </summary>
|
|||
//public EquipmentType Type { get; set; }
|
|||
///// <summary>
|
|||
///// 型号
|
|||
///// </summary>
|
|||
//public EquipmentModel Model { get; set; }
|
|||
/// <summary>
|
|||
/// 库位代码
|
|||
/// </summary>
|
|||
public string LocCode { get; set; } |
|||
/// <summary>
|
|||
/// 状态
|
|||
/// </summary>
|
|||
public int State { get; set; } |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
|
|||
public class EquipmentLocCap:SfsAggregateRootBase, IHasCode |
|||
{ |
|||
/// <summary>
|
|||
/// 器具代码
|
|||
/// </summary>
|
|||
public string Code { get; set; } |
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
public string PartCode { get; set; } |
|||
/// <summary>
|
|||
/// 占用百分比
|
|||
/// </summary>
|
|||
public decimal Percent { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 录入数量
|
|||
/// </summary>
|
|||
public decimal Qty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 标包数量
|
|||
/// </summary>
|
|||
public decimal StdQty { get; set; } |
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Domain.Services; |
|||
|
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public class EquipmentLocCapManager : DomainService, IEquipmentLocCapManager |
|||
{ |
|||
private readonly IEquipmentLocCapRepository _repository; |
|||
|
|||
|
|||
public EquipmentLocCapManager(IEquipmentLocCapRepository repository |
|||
|
|||
) |
|||
{ |
|||
_repository = repository; |
|||
|
|||
} |
|||
|
|||
|
|||
public Task ImportDataAsync(List<EquipmentLocCap> entities, List<EquipmentLocCap> deleteEntities = null) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
|
|||
|
|||
private async Task SetDetailAsync(List<EquipmentLocCap> details) |
|||
{ |
|||
|
|||
} |
|||
} |
@ -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 EquipmentLocManager : DomainService, IEquipmentLocManager |
|||
{ |
|||
private readonly IEquipmentLocRepository _repository; |
|||
|
|||
public EquipmentLocManager(IEquipmentLocRepository repository) |
|||
{ |
|||
_repository = repository; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行导入
|
|||
/// </summary>
|
|||
public virtual async Task ImportDataAsync(List<EquipmentLoc> mergeEntities, List<EquipmentLoc> deleteEntities = null) |
|||
{ |
|||
if (deleteEntities != null && deleteEntities.Count > 0) |
|||
{ |
|||
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); |
|||
} |
|||
|
|||
await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,44 @@ |
|||
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; |
|||
using Win_in.Sfs.Shared.Domain.Shared.Enums.Basedata; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
/// <summary>
|
|||
/// 器具基本信息
|
|||
/// </summary>
|
|||
public class EquipmentPartCode : SfsBaseDataAggregateRootBase, IHasCode |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 器具编号
|
|||
/// </summary>
|
|||
public string Code { get; set; } |
|||
///// <summary>
|
|||
///// 类型
|
|||
///// </summary>
|
|||
//public EquipmentType Type { get; set; }
|
|||
///// <summary>
|
|||
///// 型号
|
|||
///// </summary>
|
|||
//public EquipmentModel Model { get; set; }
|
|||
/// <summary>
|
|||
/// 库位编号
|
|||
/// </summary>
|
|||
public string PartCode { get; set; } |
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public decimal StdQty { get; set; } |
|||
/// <summary>
|
|||
/// 状态
|
|||
/// </summary>
|
|||
public int State { get; set; } |
|||
/// <summary>
|
|||
/// 单位
|
|||
/// </summary>
|
|||
public string Unit { get; set; } |
|||
} |
@ -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 EquipmentPartCodeManager : DomainService, IEquipmentPartCodeManager |
|||
{ |
|||
private readonly IEquipmentPartCodeRepository _repository; |
|||
|
|||
public EquipmentPartCodeManager(IEquipmentPartCodeRepository repository) |
|||
{ |
|||
_repository = repository; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行导入
|
|||
/// </summary>
|
|||
public virtual async Task ImportDataAsync(List<EquipmentPartCode> mergeEntities, List<EquipmentPartCode> deleteEntities = null) |
|||
{ |
|||
if (deleteEntities != null && deleteEntities.Count > 0) |
|||
{ |
|||
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); |
|||
} |
|||
|
|||
await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public interface IEquipmentLocCapManager : IBulkImportService<EquipmentLocCap> |
|||
{ |
|||
//Task OpenDetailAsync(Guid id, Guid detailId);
|
|||
//Task CloseDetailAsync(Guid id, Guid detailId);
|
|||
//Task<bool> CheckIsCloseAsync(string number, string supplierCode, string itemCode);
|
|||
} |
@ -0,0 +1,11 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Services; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public interface IEquipmentLocCapRepository : ISfsBaseDataRepositoryBase<EquipmentLocCap>, ISfsBulkRepositoryBase<EquipmentLocCap> |
|||
{ |
|||
Task UpsertAsync(EquipmentLocCap newData); |
|||
} |
@ -0,0 +1,8 @@ |
|||
using Volo.Abp.Domain.Services; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public interface IEquipmentLocManager : IDomainService, IBulkImportService<EquipmentLoc> |
|||
{ |
|||
} |
@ -0,0 +1,13 @@ |
|||
using System.Threading.Tasks; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public interface IEquipmentLocRepository : ISfsBaseDataRepositoryBase<EquipmentLoc>, ISfsBulkRepositoryBase<EquipmentLoc> |
|||
{ |
|||
public Task UpsertAsync(EquipmentLoc entity); |
|||
|
|||
public Task InsertAutoSaveAsync(EquipmentLoc entity); |
|||
|
|||
public Task UpsertAsyncByInterface(EquipmentLoc entity); |
|||
} |
@ -0,0 +1,8 @@ |
|||
using Volo.Abp.Domain.Services; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public interface IEquipmentPartCodeManager : IDomainService, IBulkImportService<EquipmentPartCode> |
|||
{ |
|||
} |
@ -0,0 +1,13 @@ |
|||
using System.Threading.Tasks; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public interface IEquipmentPartCodeRepository : ISfsBaseDataRepositoryBase<EquipmentPartCode>, ISfsBulkRepositoryBase<EquipmentPartCode> |
|||
{ |
|||
public Task UpsertAsync(EquipmentPartCode entity); |
|||
|
|||
public Task InsertAutoSaveAsync(EquipmentPartCode entity); |
|||
|
|||
public Task UpsertAsyncByInterface(EquipmentPartCode entity); |
|||
} |
@ -0,0 +1,66 @@ |
|||
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 EquipmentLocCapEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<BasedataDbContext, EquipmentLocCap>, IEquipmentLocCapRepository, ISfsBulkRepositoryBase<EquipmentLocCap> |
|||
{ |
|||
public EquipmentLocCapEfCoreRepository(IDbContextProvider<BasedataDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
} |
|||
public virtual async Task UpsertAsyncByInterface(EquipmentLocCap 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.Qty = entity.Qty; |
|||
exist.StdQty = entity.StdQty; |
|||
exist.Percent = entity.Percent; |
|||
exist.LastModificationTime = DateTimeOffset.Now.DateTime; |
|||
|
|||
} |
|||
} |
|||
public virtual async Task UpsertAsync(EquipmentLocCap 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.Qty = entity.Qty; |
|||
exist.StdQty = entity.StdQty; |
|||
exist.Percent = entity.Percent; |
|||
exist.LastModificationTime = DateTimeOffset.Now.DateTime; |
|||
|
|||
} |
|||
} |
|||
|
|||
public virtual async Task InsertAutoSaveAsync(EquipmentLocCap entity) |
|||
{ |
|||
_ = await InsertAsync(entity, true, GetCancellationToken()).ConfigureAwait(false); |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
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 EquipmentLocDbContextModelCreatingExtensions |
|||
{ |
|||
public static void ConfigureEquipmentLoc(this ModelBuilder builder, BasedataModelBuilderConfigurationOptions options) |
|||
{ |
|||
builder.Entity<EquipmentLoc>(b => |
|||
{ |
|||
//Configure table & schema name
|
|||
b.ToTable(options.TablePrefix + nameof(EquipmentLoc), 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.LocCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength).IsRequired(true); |
|||
|
|||
|
|||
|
|||
//Relations
|
|||
//None
|
|||
|
|||
//Indexes
|
|||
b.HasIndex(q => new { q.Code ,q.LocCode}).IsUnique(); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 器具编号
|
|||
/// </summary>
|
@ -0,0 +1,54 @@ |
|||
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 EquipmentLocEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<BasedataDbContext, EquipmentLoc>, IEquipmentLocRepository, ISfsBulkRepositoryBase<EquipmentLoc> |
|||
{ |
|||
public EquipmentLocEfCoreRepository(IDbContextProvider<BasedataDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
} |
|||
public virtual async Task UpsertAsyncByInterface(EquipmentLoc 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.State = entity.State; |
|||
|
|||
exist.LastModificationTime = DateTimeOffset.Now.DateTime; |
|||
|
|||
} |
|||
} |
|||
public virtual async Task UpsertAsync(EquipmentLoc 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.State = entity.State; |
|||
|
|||
exist.LastModificationTime = DateTimeOffset.Now.DateTime; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
public virtual async Task InsertAutoSaveAsync(EquipmentLoc entity) |
|||
{ |
|||
_ = await InsertAsync(entity, true, GetCancellationToken()).ConfigureAwait(false); |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
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 EquipmentPartCodeDbContextModelCreatingExtensions |
|||
{ |
|||
public static void ConfigureEquipmentPartCode(this ModelBuilder builder, BasedataModelBuilderConfigurationOptions options) |
|||
{ |
|||
builder.Entity<EquipmentPartCode>(b => |
|||
{ |
|||
//Configure table & schema name
|
|||
b.ToTable(options.TablePrefix + nameof(EquipmentPartCode), 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.PartCode).HasMaxLength(SfsPropertyConst.CodeLength).IsRequired(true); |
|||
|
|||
|
|||
|
|||
//Relations
|
|||
//None
|
|||
|
|||
//Indexes
|
|||
b.HasIndex(q => new { q.Code,q.PartCode }).IsUnique(); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 器具编号
|
|||
/// </summary>
|
@ -0,0 +1,68 @@ |
|||
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 EquipmentPartCodeEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<BasedataDbContext, EquipmentPartCode>, IEquipmentPartCodeRepository, ISfsBulkRepositoryBase<EquipmentPartCode> |
|||
{ |
|||
public EquipmentPartCodeEfCoreRepository(IDbContextProvider<BasedataDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
} |
|||
public virtual async Task UpsertAsyncByInterface(EquipmentPartCode 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.State = entity.State; |
|||
|
|||
exist.LastModificationTime = DateTimeOffset.Now.DateTime; |
|||
|
|||
} |
|||
} |
|||
public virtual async Task UpsertAsync(EquipmentPartCode 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.State = entity.State; |
|||
|
|||
exist.LastModificationTime = DateTimeOffset.Now.DateTime; |
|||
|
|||
} |
|||
|
|||
// var context = await GetDbContextAsync();
|
|||
// await context.SingleMergeAsync(entity, options =>
|
|||
// {
|
|||
// //业务主键,可以是联合主键
|
|||
// options.ColumnPrimaryKeyExpression = c => new
|
|||
// {
|
|||
// c.Code
|
|||
// };
|
|||
// //需要在更新时忽略的属性
|
|||
// options.IgnoreOnMergeUpdateExpression = c => new
|
|||
// {
|
|||
// c.Id,
|
|||
// c.ManageType,
|
|||
// };
|
|||
// });
|
|||
} |
|||
|
|||
public virtual async Task InsertAutoSaveAsync(EquipmentPartCode entity) |
|||
{ |
|||
_ = await InsertAsync(entity, true, GetCancellationToken()).ConfigureAwait(false); |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Win_in.Sfs.Shared.Domain.Shared.Enums.Basedata; |
|||
public enum EnumEquipmentType |
|||
{ |
|||
[Display(Name = "小")] |
|||
Small =0, |
|||
[Display(Name = "大")] |
|||
Large =1, |
|||
[Display(Name = "超大")] |
|||
Oversized =2 |
|||
} |
|||
|
|||
public enum EnumEquipmentModel |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 内部
|
|||
/// </summary>
|
|||
[Display(Name = "内部")] |
|||
Internal = 0, |
|||
|
|||
/// <summary>
|
|||
/// 外部
|
|||
/// </summary>
|
|||
[Display(Name = "外部")] |
|||
External = 1, |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Win_in.Sfs.Shared.Domain.Shared.Enums.Store.Statuses; |
|||
public enum EnumEquipmentRecordType |
|||
{ |
|||
Bind=0, |
|||
UnBind=1 |
|||
|
|||
} |
@ -1,126 +1,226 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using DocumentFormat.OpenXml.Packaging; |
|||
using Volo.Abp.Domain.Services; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Basedata.Domain.Shared; |
|||
using Win_in.Sfs.Basedata.Equipments.DTOs; |
|||
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store.Statuses; |
|||
using Win_in.Sfs.Wms.Store.Equipments; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
|
|||
|
|||
|
|||
public class EquipmentRecordManager : DomainService, IEquipmentRecordManager |
|||
{ |
|||
private readonly IEquipmentRecordRepository _repository; |
|||
//private readonly IPurchaseReceiptNoteManager _purchaseReceiptNoteManager;
|
|||
//private readonly ISupplierAppService _supplierApp;
|
|||
//private readonly IWarehouseAppService _warehouseApp;
|
|||
|
|||
public EquipmentRecordManager(IEquipmentRecordRepository repository |
|||
//, IPurchaseReceiptNoteManager purchaseReceiptNoteManager
|
|||
//, ISupplierAppService supplierApp
|
|||
// , IWarehouseAppService warehouseApp
|
|||
// private readonly IEquipmentLocCapRepository _repositoryCap;
|
|||
|
|||
private readonly IEquipmentLocAppService _locService; |
|||
private readonly IEquipmentPartCodeAppService _partService; |
|||
|
|||
public EquipmentRecordManager( |
|||
IEquipmentRecordRepository repository, |
|||
//IEquipmentLocCapRepository repositoryCap,
|
|||
IEquipmentLocAppService locService, |
|||
IEquipmentPartCodeAppService partService |
|||
) |
|||
{ |
|||
_locService=locService; |
|||
_repository = repository; |
|||
//_purchaseReceiptNoteManager = purchaseReceiptNoteManager;
|
|||
// _supplierApp = supplierApp;
|
|||
// _warehouseApp = warehouseApp;
|
|||
// _repositoryCap = repositoryCap;
|
|||
_partService= partService; |
|||
} |
|||
/// <summary>
|
|||
///// 打开订单明细
|
|||
///// </summary>
|
|||
///// <returns></returns>
|
|||
//public virtual async Task<bool> CheckIsCloseAsync(string number,string supplierCode, string itemCode)
|
|||
//{
|
|||
// bool result = false;
|
|||
// var entitys = await _repository.GetListAsync(p =>p.Number==number && p.Details.Any(y => y.ItemCode == itemCode&&y.LineStatus== EnumOrderStatus.Close) && p.SupplierCode == supplierCode, true).ConfigureAwait(false);
|
|||
// if (entitys.Count!=0) result = true;
|
|||
// return result;
|
|||
//}
|
|||
///// <summary>
|
|||
///// 打开订单明细
|
|||
///// </summary>
|
|||
///// <returns></returns>
|
|||
//public virtual async Task OpenDetailAsync(Guid id, Guid detailId)
|
|||
//{
|
|||
// var entity = await Repository.GetAsync(id).ConfigureAwait(false);
|
|||
// Check.NotNull(entity, EntityClassName);
|
|||
// await entity.OpenDetailAsync(detailId).ConfigureAwait(false);
|
|||
//}
|
|||
|
|||
///// <summary>
|
|||
///// 关闭订单明细
|
|||
///// </summary>
|
|||
///// <returns></returns>
|
|||
//public virtual async Task CloseDetailAsync(Guid id, Guid detailId)
|
|||
//{
|
|||
// var entity = await Repository.GetAsync(id).ConfigureAwait(false);
|
|||
// Check.NotNull(entity, EntityClassName);
|
|||
// await entity.CloseDetailAsync(detailId).ConfigureAwait(false);
|
|||
//}
|
|||
|
|||
//public override async Task<PurchaseOrder> CreateAsync(PurchaseOrder purchaseOrder)
|
|||
//{
|
|||
// //接收到新的采购订单时,更新无PO收货单的PoNumber
|
|||
// //await _purchaseReceiptNoteManager.AppendPoNumberAsync(purchaseOrder).ConfigureAwait(false);
|
|||
// purchaseOrder.SetIdAndNumberWithDetails(GuidGenerator, purchaseOrder.Number);
|
|||
// //不要用base.create 要不会把number覆盖
|
|||
// purchaseOrder = await Repository.InsertAsync(purchaseOrder).ConfigureAwait(false);
|
|||
// await PublishCreatedAsync(purchaseOrder).ConfigureAwait(false);
|
|||
// return purchaseOrder;
|
|||
|
|||
//}
|
|||
|
|||
///// <summary>
|
|||
///// 执行导入
|
|||
///// </summary>
|
|||
//public virtual async Task ImportDataAsync(List<EquipmentRecord> mergeEntities, List<EquipmentRecord> deleteEntities = null)
|
|||
//{
|
|||
// //if (deleteEntities != null && deleteEntities.Count > 0)
|
|||
// //{
|
|||
// // await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false);
|
|||
// //}
|
|||
|
|||
// //foreach (var entity in mergeEntities)
|
|||
// //{
|
|||
// // entity.SetIdAndNumberWithDetails(GuidGenerator, await GenerateNumberAsync(nameof(PurchaseOrder), entity.OrderDate).ConfigureAwait(false));
|
|||
// //}
|
|||
|
|||
// //await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false);
|
|||
|
|||
// //var insertDetails = new List<PurchaseOrderDetail>();
|
|||
|
|||
// //foreach (var item in mergeEntities)
|
|||
// //{
|
|||
// // await SetDetailAsync(item.Details).ConfigureAwait(false);
|
|||
|
|||
// // insertDetails.AddRange(item.Details);
|
|||
// //}
|
|||
|
|||
// // await _repository.BulkInsertAsync(insertDetails).ConfigureAwait(false);
|
|||
|
|||
//}
|
|||
|
|||
public Task ImportDataAsync(List<EquipmentRecord> entities, List<EquipmentRecord> deleteEntities = null) |
|||
public async Task<List<EquipmentRecordErrorDTO>> Bind(List<EquipmentRecord> p_ls) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
List<EquipmentRecordErrorDTO> errors=new List<EquipmentRecordErrorDTO>(); |
|||
// var list= p_ls.GroupBy(p => new { p.EqptCode, p.PartCode }).Select(p=>new { EqptCode= p.Key.EqptCode, PartCode= p.Key.PartCode,SumQty=p.Sum(p=>p.Qty)});//导入零件
|
|||
// var partialErrors1=list.GroupBy(p => p.EqptCode).Where(g =>g.Count()>1).Select(p => new EquipmentRecordErrorDTO() { EqptCode= p.Key,PartCode=string.Empty,Error=$"同器具代码有{p.Count().ToString()}种零件!" });
|
|||
// errors.AddRange(partialErrors1.ToList());//同容器放不同零件校验
|
|||
// var ls=p_ls.Select(p => p.EqptCode).Distinct().ToList();//录入的器具记录代码列表
|
|||
// var Locs=_locService.GetEquipmentLocAsync(ls).Result;//获取器具库位关系
|
|||
// var parts =_partService.GetEquipmentPartCodesAsync(ls).Result;//获取器具零件关系
|
|||
// //零件和器具关系校验
|
|||
// var partErrorQery = from itm in list
|
|||
// join itm1 in parts on
|
|||
// new { itm.EqptCode, PartCode = itm.PartCode } equals new { EqptCode = itm1.Code, PartCode = itm1.PartCode }
|
|||
// into temp
|
|||
// from tm in temp.DefaultIfEmpty()
|
|||
// where tm == null
|
|||
// select new EquipmentRecordErrorDTO()
|
|||
// {
|
|||
// EqptCode = itm.EqptCode,
|
|||
// PartCode = itm.PartCode,
|
|||
// Error = $"器具零件关系不存在!"
|
|||
// };
|
|||
// errors.AddRange(partErrorQery.ToList());
|
|||
// var query= await _repositoryCap.GetQueryableAsync().ConfigureAwait(false);
|
|||
// var capExistList= query.Where(p => ls.Contains(p.EqptCode)).ToList();//器具容量
|
|||
|
|||
// var partialErrors2 = from itm in capExistList
|
|||
// join itm1 in list.ToList() on itm.EqptCode equals itm1.EqptCode
|
|||
// where itm.PartCode != itm.PartCode
|
|||
// select new EquipmentRecordErrorDTO() {
|
|||
// EqptCode = itm.EqptCode,PartCode=itm.PartCode ,Error=$"录入器具代码{itm.EqptCode}零件代码{itm.PartCode}与器具容量{itm1.EqptCode}零件代码{itm1.PartCode}不符!"
|
|||
// };
|
|||
// errors.AddRange(partialErrors2.ToList());//导入记录和容量记录零件不是同一零件
|
|||
// var existList = from itm in list
|
|||
// join itm1 in capExistList
|
|||
// on new { itm.EqptCode, itm.PartCode } equals new { itm1.EqptCode, itm1.PartCode }
|
|||
// select itm;
|
|||
// foreach (var itm in existList)
|
|||
// {
|
|||
// var cap = capExistList.FirstOrDefault(p => p.EqptCode == itm.EqptCode && p.PartCode == itm.PartCode);//读取当前器具容量
|
|||
// cap.Qty += itm.SumQty;//当前数量
|
|||
|
|||
// if (cap.Qty > cap.StdQty)
|
|||
// {
|
|||
// errors.Add(new EquipmentRecordErrorDTO() { EqptCode=itm.EqptCode,PartCode=itm.PartCode,Error=$"超出容量限制!" });
|
|||
// }
|
|||
// }
|
|||
|
|||
// if (errors.Count > 0)
|
|||
// {
|
|||
// return errors;
|
|||
// }
|
|||
// //新建器具容量
|
|||
//var newList =from itm in list
|
|||
// join itm1 in capExistList
|
|||
// on new { itm.EqptCode, itm.PartCode } equals new { itm1.EqptCode, itm1.PartCode }
|
|||
// into temp1
|
|||
// from tm1 in temp1.DefaultIfEmpty()
|
|||
// where tm1 == null
|
|||
// select itm;
|
|||
// List<EquipmentLocCap> newlocList=new List<EquipmentLocCap>();
|
|||
// foreach (var itm in newList)
|
|||
// {
|
|||
// var gpart = parts.FirstOrDefault(p => p.Code == itm.EqptCode && p.PartCode == itm.PartCode);
|
|||
// var stdQty = gpart.StdQty;//标包
|
|||
// var qty = itm.SumQty;
|
|||
// var cap = new EquipmentLocCap()
|
|||
|
|||
// {
|
|||
// EqptCode=itm.EqptCode,
|
|||
// PartCode=itm.PartCode,
|
|||
// Percent=qty/stdQty,
|
|||
// Qty=qty,
|
|||
// StdQty=stdQty,
|
|||
// };
|
|||
// cap.SetId(GuidGenerator.Create());
|
|||
// newlocList.Add(cap);
|
|||
// }
|
|||
// //已存在器具容量变更
|
|||
|
|||
// foreach (var itm in existList)
|
|||
// {
|
|||
// var cap = capExistList.FirstOrDefault(p => p.EqptCode == itm.EqptCode && p.PartCode == itm.PartCode);//读取当前器具容量
|
|||
// cap.Qty = cap.Qty+itm.SumQty;//当前数量
|
|||
// cap.Percent = cap.Qty / cap.StdQty;
|
|||
// }
|
|||
|
|||
// foreach (var itm in p_ls)
|
|||
// {
|
|||
// itm.Type = EnumEquipmentRecordType.Bind;
|
|||
// itm.SetId(GuidGenerator.Create());
|
|||
// }
|
|||
// await _repositoryCap.InsertManyAsync(newlocList).ConfigureAwait(false);
|
|||
// await _repository.InsertManyAsync(p_ls).ConfigureAwait(false);
|
|||
|
|||
|
|||
return errors; |
|||
|
|||
} |
|||
|
|||
private async Task SetDetailAsync(List<PurchaseOrderDetail> details) |
|||
|
|||
|
|||
|
|||
public async Task<List<EquipmentRecordErrorDTO>> UnBind(List<EquipmentRecord> p_ls) |
|||
{ |
|||
//foreach (var detail in details)
|
|||
List<EquipmentRecordErrorDTO> errors = new List<EquipmentRecordErrorDTO>(); |
|||
//var list = p_ls.GroupBy(p => new { p.EqptCode, p.PartCode }).Select(p => new { EqptCode = p.Key.EqptCode, PartCode = p.Key.PartCode, SumQty = p.Sum(p => p.Qty) });//导入零件
|
|||
//var partialErrors1 = list.GroupBy(p => p.EqptCode).Where(g => g.Count() > 1).Select(p => new EquipmentRecordErrorDTO() { EqptCode = p.Key, PartCode = string.Empty, Error = $"同器具代码有{p.Count().ToString()}种零件!" });
|
|||
//errors.AddRange(partialErrors1.ToList());//同容器放不同零件校验
|
|||
//var ls = p_ls.Select(p => p.EqptCode).Distinct().ToList();//录入的器具记录代码列表
|
|||
//var Locs = _locService.GetEquipmentLocAsync(ls).Result;//获取器具库位关系
|
|||
//var parts = _partService.GetEquipmentPartCodesAsync(ls).Result;//获取器具零件关系
|
|||
////零件和器具关系校验
|
|||
//var partErrorQery = from itm in list
|
|||
// join itm1 in parts on
|
|||
// new { itm.EqptCode, PartCode = itm.PartCode } equals new { EqptCode = itm1.Code, PartCode = itm1.PartCode }
|
|||
// into temp
|
|||
// from tm in temp.DefaultIfEmpty()
|
|||
// where tm == null
|
|||
// select new EquipmentRecordErrorDTO()
|
|||
// {
|
|||
// EqptCode = itm.EqptCode,
|
|||
// PartCode = itm.PartCode,
|
|||
// Error = $"器具零件关系不存在!"
|
|||
// };
|
|||
//errors.AddRange(partErrorQery.ToList());
|
|||
//var query = await _repositoryCap.GetQueryableAsync().ConfigureAwait(false);
|
|||
//var capExistList = query.Where(p => ls.Contains(p.EqptCode)).ToList();//器具容量
|
|||
|
|||
//var partialErrors2 = from itm in capExistList
|
|||
// join itm1 in list.ToList() on itm.EqptCode equals itm1.EqptCode
|
|||
// where itm.PartCode != itm.PartCode
|
|||
// select new EquipmentRecordErrorDTO()
|
|||
// {
|
|||
// EqptCode = itm.EqptCode,
|
|||
// PartCode = itm.PartCode,
|
|||
// Error = $"录入器具代码{itm.EqptCode}零件代码{itm.PartCode}与器具容量{itm1.EqptCode}零件代码{itm1.PartCode}不符!"
|
|||
// };
|
|||
//errors.AddRange(partialErrors2.ToList());//导入记录和器具容量记录零件不是同一零件
|
|||
//var existList = from itm in list
|
|||
// join itm1 in capExistList
|
|||
// on new { itm.EqptCode, itm.PartCode } equals new { itm1.EqptCode, itm1.PartCode }
|
|||
// select itm;
|
|||
//foreach (var itm in existList)
|
|||
//{
|
|||
// var item = await ItemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
|
|||
// Check.NotNull(item, "物品代码", $"物品 {detail.ItemCode} 不存在");
|
|||
// var cap = capExistList.FirstOrDefault(p => p.EqptCode == itm.EqptCode && p.PartCode == itm.PartCode);//读取当前器具容量
|
|||
// cap.Qty =cap.Qty- itm.SumQty;//当前数量
|
|||
|
|||
// if (item != null)
|
|||
// if (cap.Qty <0)
|
|||
// {
|
|||
// detail.ItemName = item.Name;
|
|||
// detail.ItemDesc1 = item.Desc1;
|
|||
// detail.ItemDesc2 = item.Desc2;
|
|||
// errors.Add(new EquipmentRecordErrorDTO() { EqptCode = itm.EqptCode, PartCode = itm.PartCode, Error = $"解绑数量小0!" });
|
|||
// }
|
|||
//}
|
|||
|
|||
//foreach (var itm in existList)
|
|||
//{
|
|||
// var cap = capExistList.FirstOrDefault(p => p.EqptCode == itm.EqptCode && p.PartCode == itm.PartCode);//读取当前器具容量
|
|||
// cap.Qty = cap.Qty - itm.SumQty;//当前数量
|
|||
// cap.Percent = cap.Qty / cap.StdQty;
|
|||
//}
|
|||
|
|||
//foreach (var itm in p_ls)
|
|||
//{
|
|||
// itm.Type = EnumEquipmentRecordType.UnBind;
|
|||
// itm.SetId(GuidGenerator.Create());
|
|||
//}
|
|||
|
|||
//await _repository.InsertManyAsync(p_ls).ConfigureAwait(false);
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
return errors; |
|||
|
|||
} |
|||
public Task ImportDataAsync(List<EquipmentRecord> entities, List<EquipmentRecord> deleteEntities = null) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
private async Task SetDetailAsync(List<PurchaseOrderDetail> details) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
|
@ -1,13 +1,16 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Win_in.Sfs.Basedata.Equipments.DTOs; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Wms.Store.Equipments; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
public interface IEquipmentRecordManager :IBulkImportService<EquipmentRecord> |
|||
public interface IEquipmentRecordManager : IBulkImportService<EquipmentRecord> |
|||
{ |
|||
//Task OpenDetailAsync(Guid id, Guid detailId);
|
|||
//Task CloseDetailAsync(Guid id, Guid detailId);
|
|||
//Task<bool> CheckIsCloseAsync(string number, string supplierCode, string itemCode);
|
|||
Task<List<EquipmentRecordErrorDTO>> Bind(List<EquipmentRecord> p_ls); |
|||
Task<List<EquipmentRecordErrorDTO>> UnBind(List<EquipmentRecord> p_ls); |
|||
|
|||
|
|||
} |
|||
|
Loading…
Reference in new issue