|
|
@ -27,12 +27,12 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
public class BomAppService : SettleAccountApplicationBase<Bom> |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// BOM�ִ�
|
|
|
|
/// BOM仓储
|
|
|
|
/// </summary>
|
|
|
|
private readonly INormalEfCoreRepository<Bom, Guid> _repository; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ����
|
|
|
|
/// 构造
|
|
|
|
/// </summary>
|
|
|
|
public BomAppService( |
|
|
|
INormalEfCoreRepository<Bom, Guid> repository, |
|
|
@ -40,14 +40,14 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
IExcelImportAppService excelImportService, |
|
|
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
|
|
|
ICommonManager commonManager |
|
|
|
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) |
|
|
|
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) |
|
|
|
{ |
|
|
|
_repository = repository; |
|
|
|
} |
|
|
|
|
|
|
|
#region ����
|
|
|
|
#region 导出
|
|
|
|
/// <summary>
|
|
|
|
/// ����
|
|
|
|
/// 导出
|
|
|
|
/// </summary>
|
|
|
|
[HttpPost] |
|
|
|
public virtual async Task<string> ExportAsync(BomRequestDto input) |
|
|
@ -55,16 +55,16 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
string _fileName = string.Format("BOM_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")); |
|
|
|
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, |
|
|
|
0, true); |
|
|
|
var dtoDetails = ObjectMapper.Map<List<Bom>, List<BomExportDto> >(entities); |
|
|
|
var dtoDetails = ObjectMapper.Map<List<Bom>, List<BomExportDto>>(entities); |
|
|
|
|
|
|
|
//������������
|
|
|
|
//声明导出容器
|
|
|
|
ExportImporter _exportImporter = new ExportImporter(); |
|
|
|
|
|
|
|
var result = await _exportImporter.ExcelExporter(dtoDetails); |
|
|
|
|
|
|
|
result.ShouldNotBeNull(); |
|
|
|
|
|
|
|
//���浼���ļ�����������ɶ�����
|
|
|
|
//保存导出文件到服务器存成二进制
|
|
|
|
await _excelImportService.SaveBlobAsync( |
|
|
|
new SaveExcelImportInputDto |
|
|
|
{ |
|
|
@ -78,7 +78,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
|
|
|
|
#region CURD
|
|
|
|
/// <summary>
|
|
|
|
/// ��ȡ�б�
|
|
|
|
/// 获取列表
|
|
|
|
/// </summary>
|
|
|
|
[HttpPost] |
|
|
|
public async Task<PagedResultDto<BomDto>> GetListAsync(BomRequestDto input) |
|
|
@ -90,13 +90,13 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ԭ������������
|
|
|
|
// #region ���뵼������
|
|
|
|
#region 原方法(废弃)
|
|
|
|
// #region 导入导出功能
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// ���빦��
|
|
|
|
// /// 导入功能
|
|
|
|
// /// </summary>
|
|
|
|
// /// <param name="files">�ϴ����ļ�(ǰ���Ѿ�����ֻ���ϴ�һ������)</param>
|
|
|
|
// /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
|
|
|
// /// <returns></returns>
|
|
|
|
// [HttpPost]
|
|
|
|
// [Route("ExcelImport-Map")]
|
|
|
@ -121,7 +121,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// {
|
|
|
|
// if (itm.Count > 1)
|
|
|
|
// {
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("���ܵ��븸����{0},�ӱ���{1}���ظ�����", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// var _id = GuidGenerator.Create();
|
|
|
@ -131,7 +131,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// {
|
|
|
|
// if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode))
|
|
|
|
// {
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("���������ݲ��������Ϻ�{0}��", itm.ParentItemCode), string.Empty));
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty));
|
|
|
|
// continue;
|
|
|
|
// }
|
|
|
|
// itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id, factory);
|
|
|
@ -150,9 +150,9 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// ���빦��
|
|
|
|
// /// 导入功能
|
|
|
|
// /// </summary>
|
|
|
|
// /// <param name="files">�ϴ����ļ�(ǰ���Ѿ�����ֻ���ϴ�һ������)</param>
|
|
|
|
// /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
|
|
|
// /// <returns></returns>
|
|
|
|
// [HttpPost]
|
|
|
|
// [Route("ExcelImport")]
|
|
|
@ -176,7 +176,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// {
|
|
|
|
// if (itm.Count > 1)
|
|
|
|
// {
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("���ܵ��븸����{0},�ӱ���{1}���ظ�����", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// var _id = GuidGenerator.Create();
|
|
|
@ -186,7 +186,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// {
|
|
|
|
// if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode))
|
|
|
|
// {
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("���������ݲ��������Ϻ�{0}��", itm.ParentItemCode), string.Empty));
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty));
|
|
|
|
// continue;
|
|
|
|
// }
|
|
|
|
// itm.SetValue(GuidGenerator.Create(),branchId,year,period,version,_id,factory);
|
|
|
@ -201,7 +201,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// return ApplicationConsts.SuccessStr;
|
|
|
|
// }
|
|
|
|
// /// <summary>
|
|
|
|
// /// �����ļ�
|
|
|
|
// /// 导出文件
|
|
|
|
// /// </summary>
|
|
|
|
// /// <param name="input"></param>
|
|
|
|
// /// <returns></returns>
|
|
|
@ -212,7 +212,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// {
|
|
|
|
// IExporter _csv = new CsvExporter();
|
|
|
|
// IExporter _excel = new ExcelExporter();
|
|
|
|
// //�������ϰ汾��������������ȫ����
|
|
|
|
// //导出加上版本过滤条件,不能全导出
|
|
|
|
// if (input.ParentId != Guid.Empty)
|
|
|
|
// {
|
|
|
|
// input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "ParentId", Logic = EnumFilterLogic.And, Value = input.ParentId.ToString() });
|
|
|
@ -225,23 +225,23 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// 0, true);
|
|
|
|
// var dtoDetails = ObjectMapper.Map<List<Bom>, List<BomExportDto>>(entities);
|
|
|
|
// string _fileName = string.Empty;
|
|
|
|
// //������������
|
|
|
|
// //声明导出容器
|
|
|
|
|
|
|
|
// byte[] result = null;
|
|
|
|
// switch (input.FileType)
|
|
|
|
// {
|
|
|
|
// case 0:
|
|
|
|
// _fileName = string.Format("��Ʒ�ṹ_{0}.csv", input.UserId.ToString());
|
|
|
|
// _fileName = string.Format("产品结构_{0}.csv", input.UserId.ToString());
|
|
|
|
// result = await _csv.ExportAsByteArray(dtoDetails);
|
|
|
|
// break;
|
|
|
|
// case 1:
|
|
|
|
// _fileName = string.Format("��Ʒ�ṹ_{0}.xlsx", input.UserId.ToString());
|
|
|
|
// _fileName = string.Format("产品结构_{0}.xlsx", input.UserId.ToString());
|
|
|
|
// result = await _excel.ExportAsByteArray(dtoDetails);
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// result.ShouldNotBeNull();
|
|
|
|
|
|
|
|
// //���浼���ļ�����������ɶ�����
|
|
|
|
// //保存导出文件到服务器存成二进制
|
|
|
|
// await _excelImportService.SaveBlobAsync(
|
|
|
|
// new SaveExcelImportInputDto
|
|
|
|
// {
|
|
|
@ -254,13 +254,13 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// #endregion
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// ��ID��ȡΨһʵ��
|
|
|
|
// /// 按ID获取唯一实体
|
|
|
|
// /// </summary>
|
|
|
|
// /// <remarks>
|
|
|
|
// /// ����ʵ��ȫ������
|
|
|
|
// /// 返回实体全部属性
|
|
|
|
// /// </remarks>
|
|
|
|
// /// <param name="id">ID</param>
|
|
|
|
// /// <returns>ʵ��DTO</returns>
|
|
|
|
// /// <returns>实体DTO</returns>
|
|
|
|
// [HttpGet]
|
|
|
|
// [Route("{id}")]
|
|
|
|
//[Authorize(SettleAccountPermissions.Boms.Default)]
|
|
|
@ -291,9 +291,9 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// }
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// ��ȡʵ������
|
|
|
|
// /// 获取实体总数
|
|
|
|
// /// </summary>
|
|
|
|
// /// <returns>ʵ������</returns>
|
|
|
|
// /// <returns>实体总数</returns>
|
|
|
|
// [HttpGet]
|
|
|
|
// [Route("count")]
|
|
|
|
//[Authorize(SettleAccountPermissions.Boms.Default)]
|
|
|
@ -305,10 +305,10 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// ɾ��ʵ��
|
|
|
|
// /// 删除实体
|
|
|
|
// /// </summary>
|
|
|
|
// /// <param name="id">ID</param>
|
|
|
|
// /// <returns>��</returns>
|
|
|
|
// /// <returns>无</returns>
|
|
|
|
// [HttpDelete]
|
|
|
|
// [Route("{id}")]
|
|
|
|
//[Authorize(SettleAccountPermissions.Boms.Delete)]
|
|
|
@ -320,10 +320,10 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// }
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// ��IDsɾ��ʵ���б�
|
|
|
|
// /// 按IDs删除实体列表
|
|
|
|
// /// </summary>
|
|
|
|
// /// <param name="ids">IDs</param>
|
|
|
|
// /// <returns>�Ƿ�ִ�гɹ�</returns>
|
|
|
|
// /// <returns>是否执行成功</returns>
|
|
|
|
// [HttpPost]
|
|
|
|
// [Route("delete")]
|
|
|
|
//[Authorize(SettleAccountPermissions.Boms.Delete)]
|
|
|
@ -342,13 +342,13 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// ///// <summary>
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// ����ɸѡ������ȡʵ���б�
|
|
|
|
// /// 根据筛选条件获取实体列表
|
|
|
|
// /// </summary>
|
|
|
|
// /// <remarks>
|
|
|
|
// /// ������������:ɸѡ�����б�,��������,��������,ҳ��
|
|
|
|
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
|
|
|
// /// </remarks>
|
|
|
|
// /// <param name="input">��������</param>
|
|
|
|
// /// <returns>ʵ��DTO�б�</returns>
|
|
|
|
// /// <param name="input">请求条件</param>
|
|
|
|
// /// <returns>实体DTO列表</returns>
|
|
|
|
// [HttpPost]
|
|
|
|
// [Route("list")]
|
|
|
|
// [Authorize(SettleAccountPermissions.Boms.Default)]
|
|
|
@ -372,13 +372,13 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// ///// <summary>
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// ����ɸѡ������ȡʵ���б�
|
|
|
|
// /// 根据筛选条件获取实体列表
|
|
|
|
// /// </summary>
|
|
|
|
// /// <remarks>
|
|
|
|
// /// ������������:ɸѡ�����б�,��������,��������,ҳ��
|
|
|
|
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
|
|
|
// /// </remarks>
|
|
|
|
// /// <param name="input">��������</param>
|
|
|
|
// /// <returns>ʵ��DTO�б�</returns>
|
|
|
|
// /// <param name="input">请求条件</param>
|
|
|
|
// /// <returns>实体DTO列表</returns>
|
|
|
|
// [HttpPost]
|
|
|
|
// [Route("listVersion")]
|
|
|
|
// [Authorize(SettleAccountPermissions.Boms.Default)]
|
|
|
|