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