|
@ -1,4 +1,4 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Diagnostics; |
|
|
using System.Diagnostics; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
@ -48,7 +48,7 @@ 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; |
|
|
|
|
|
|
|
@ -65,7 +65,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
private readonly ISettleAccountBranchEfCoreRepository<BomVersion, Guid> _versionRepository; |
|
|
private readonly ISettleAccountBranchEfCoreRepository<BomVersion, Guid> _versionRepository; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 构造方法
|
|
|
/// ���췽��
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public BomAppService( |
|
|
public BomAppService( |
|
|
INormalEfCoreRepository<Bom, Guid> repository, |
|
|
INormalEfCoreRepository<Bom, Guid> repository, |
|
@ -91,9 +91,9 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
_importColumnMapRepository = importColumnMapRepository; |
|
|
_importColumnMapRepository = importColumnMapRepository; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#region 导入、导出
|
|
|
#region ���롢����
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 导出
|
|
|
/// ����
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
[Route("Export")] |
|
|
[Route("Export")] |
|
@ -104,14 +104,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 |
|
|
{ |
|
|
{ |
|
@ -125,7 +125,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
|
|
|
|
|
#region CURD
|
|
|
#region CURD
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 获取列表
|
|
|
/// ��ȡ�б�
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
[Route("list")] |
|
|
[Route("list")] |
|
@ -138,13 +138,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")]
|
|
@ -169,7 +169,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();
|
|
@ -179,7 +179,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);
|
|
@ -198,9 +198,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")]
|
|
@ -224,7 +224,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();
|
|
@ -234,7 +234,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);
|
|
@ -249,7 +249,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>
|
|
@ -260,7 +260,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() });
|
|
@ -273,23 +273,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
|
|
|
// {
|
|
|
// {
|
|
@ -302,13 +302,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)]
|
|
@ -339,9 +339,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)]
|
|
@ -353,10 +353,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)]
|
|
@ -368,10 +368,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)]
|
|
@ -390,13 +390,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)]
|
|
@ -420,13 +420,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)]
|
|
|