|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.Linq; |
|
|
@ -48,7 +48,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
public class BomAppService : SettleAccountApplicationBase<Bom> |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// BOM仓储
|
|
|
|
/// BOM�ִ�
|
|
|
|
/// </summary>
|
|
|
|
private readonly INormalEfCoreRepository<Bom, Guid> _repository; |
|
|
|
|
|
|
@ -65,7 +65,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
private readonly ISettleAccountBranchEfCoreRepository<BomVersion, Guid> _versionRepository; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 构造方法
|
|
|
|
/// ���췽��
|
|
|
|
/// </summary>
|
|
|
|
public BomAppService( |
|
|
|
INormalEfCoreRepository<Bom, Guid> repository, |
|
|
@ -91,9 +91,9 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
_importColumnMapRepository = importColumnMapRepository; |
|
|
|
} |
|
|
|
|
|
|
|
#region 导入、导出
|
|
|
|
#region ���롢����
|
|
|
|
/// <summary>
|
|
|
|
/// 导出
|
|
|
|
/// ����
|
|
|
|
/// </summary>
|
|
|
|
[HttpPost] |
|
|
|
[Route("Export")] |
|
|
@ -104,14 +104,14 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
0, true); |
|
|
|
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 |
|
|
|
{ |
|
|
@ -125,7 +125,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
|
|
|
|
#region CURD
|
|
|
|
/// <summary>
|
|
|
|
/// 获取列表
|
|
|
|
/// ��ȡ�б�
|
|
|
|
/// </summary>
|
|
|
|
[HttpPost] |
|
|
|
[Route("list")] |
|
|
@ -138,13 +138,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")]
|
|
|
@ -169,7 +169,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();
|
|
|
@ -179,7 +179,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);
|
|
|
@ -198,9 +198,9 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// 导入功能
|
|
|
|
// /// ���빦��
|
|
|
|
// /// </summary>
|
|
|
|
// /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
|
|
|
// /// <param name="files">�ϴ����ļ�(ǰ���Ѿ�����ֻ���ϴ�һ������)</param>
|
|
|
|
// /// <returns></returns>
|
|
|
|
// [HttpPost]
|
|
|
|
// [Route("ExcelImport")]
|
|
|
@ -224,7 +224,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();
|
|
|
@ -234,7 +234,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);
|
|
|
@ -249,7 +249,7 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// return ApplicationConsts.SuccessStr;
|
|
|
|
// }
|
|
|
|
// /// <summary>
|
|
|
|
// /// 导出文件
|
|
|
|
// /// �����ļ�
|
|
|
|
// /// </summary>
|
|
|
|
// /// <param name="input"></param>
|
|
|
|
// /// <returns></returns>
|
|
|
@ -260,7 +260,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() });
|
|
|
@ -273,23 +273,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
|
|
|
|
// {
|
|
|
@ -302,13 +302,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)]
|
|
|
@ -339,9 +339,9 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
// }
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// 获取实体总数
|
|
|
|
// /// ��ȡʵ������
|
|
|
|
// /// </summary>
|
|
|
|
// /// <returns>实体总数</returns>
|
|
|
|
// /// <returns>ʵ������</returns>
|
|
|
|
// [HttpGet]
|
|
|
|
// [Route("count")]
|
|
|
|
//[Authorize(SettleAccountPermissions.Boms.Default)]
|
|
|
@ -353,10 +353,10 @@ namespace Win.Sfs.SettleAccount.Boms |
|
|
|
|
|
|
|
|
|
|
|
// /// <summary>
|
|
|
|
// /// 删除实体
|
|
|
|
// /// ɾ��ʵ��
|
|
|
|
// /// </summary>
|
|
|
|
// /// <param name="id">ID</param>
|
|
|
|
// /// <returns>无</returns>
|
|
|
|
// /// <returns>��</returns>
|
|
|
|
// [HttpDelete]
|
|
|
|
// [Route("{id}")]
|
|
|
|
//[Authorize(SettleAccountPermissions.Boms.Delete)]
|
|
|
@ -368,10 +368,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)]
|
|
|
@ -390,13 +390,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)]
|
|
|
@ -420,13 +420,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)]
|
|
|
|