Bom管理
This commit is contained in:
parent
6450d43f61
commit
dd46c4f3c5
@ -1,10 +1,111 @@
|
||||
using System;
|
||||
using Abp.Application.Services;
|
||||
using Abp.Application.Services.Dto;
|
||||
using Abp.Collections.Extensions;
|
||||
using Abp.Domain.Repositories;
|
||||
using MineTec.ProManager.BOM_Manager.Dto;
|
||||
using MineTec.ProManager.Commd;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
|
||||
namespace MineTec.ProManager.BOM_Manager
|
||||
{
|
||||
class BOM_ManagerAppService
|
||||
public class BOM_ManagerAppService : AsyncCrudAppService<Entitys.Order.BOM_Manager.BOM_Manager, BOM_ManagerDto, Guid, PagedResultRequestDto,
|
||||
CreateUpdateBOM_ManagerDto, CreateUpdateBOM_ManagerDto>, IBOM_ManagerAppService
|
||||
|
||||
{
|
||||
private readonly IRepository<Entitys.Order.BOM_Manager.BOM_Manager, Guid> _BOM_ManagerRepository;
|
||||
|
||||
public BOM_ManagerAppService(IRepository<Entitys.Order.BOM_Manager.BOM_Manager, Guid> repository, IRepository<Entitys.Order.BOM_Manager.BOM_Manager, Guid> BOM_ManagerRepository)
|
||||
: base(repository)
|
||||
{
|
||||
_BOM_ManagerRepository = BOM_ManagerRepository;
|
||||
}
|
||||
|
||||
public OutputBase CreateBOM_Manager(CreateUpdateBOM_ManagerDto input)
|
||||
{
|
||||
var result = new OutputBase();
|
||||
try
|
||||
{
|
||||
var entity = _BOM_ManagerRepository.GetAll().FirstOrDefault(a => a.ProductProjectName == input.ProductProjectName && a.IsDelete == 0);
|
||||
if (entity == null)
|
||||
{
|
||||
_BOM_ManagerRepository.InsertAndGetId(ObjectMapper.Map<Entitys.Order.BOM_Manager.BOM_Manager>(input));
|
||||
//base.CreateAsync(input);
|
||||
result.code = 1;//成功
|
||||
result.msg = "保存成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
result.code = 2;//重复
|
||||
result.msg = "已经存在相同的产品项目名称,请修改!";
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
result.code = 0;//失败
|
||||
result.msg = e.Message;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public BOM_ManagerOutPut GetAllBOM_Manager(GetAllBOM_Manager input)
|
||||
{
|
||||
|
||||
var result = new BOM_ManagerOutPut();
|
||||
try
|
||||
{
|
||||
var query = _BOM_ManagerRepository.GetAll().Where(t => t.IsDelete != 1).WhereIf(!string.IsNullOrEmpty(input.ProductProjectName), t => t.ProductProjectName.Contains(input.ProductProjectName)).WhereIf(!string.IsNullOrEmpty(input.BOMName), t => t.BOMName.Contains(input.BOMName))
|
||||
.WhereIf(!string.IsNullOrEmpty(input.BOM_ProductionName), t => t.BOM_ProductionName.Contains(input.BOM_ProductionName));
|
||||
var bomcount = query.Count();
|
||||
var bomlist = query.ToList();
|
||||
var list = ObjectMapper.Map<List<BOM_ManagerDto>>(bomlist);
|
||||
result.code = 0;
|
||||
result.count = bomcount;
|
||||
result.data = list;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.msg = ex.Message;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public OutputBase UpdateBOM_Manager(UpdateBOM_Manager input)
|
||||
{
|
||||
|
||||
var result = new OutputBase();
|
||||
try
|
||||
{
|
||||
var query = _BOM_ManagerRepository.GetAll().FirstOrDefault(a => a.Id == input.id);
|
||||
if (input.IsDelete == 1)
|
||||
{
|
||||
query.IsDelete = 1;
|
||||
}
|
||||
query.UpdateTime = DateTime.Now;
|
||||
query.UpdateUserID = input.UpdateUserID;
|
||||
query.UpdateUserName = input.UpdateUserName;
|
||||
query.ProductProjectName = input.ProductProjectName;
|
||||
query.BOMID = input.BOMID;
|
||||
query.BOMName = input.BOMName;
|
||||
query.BOM_ProductionID = input.BOM_ProductionID;
|
||||
query.BOM_ProductionName = input.BOM_ProductionName;
|
||||
if (!string.IsNullOrEmpty(input.Remark))
|
||||
{
|
||||
query.Remark = input.Remark;
|
||||
}
|
||||
result.code = 1;//1成功0失败
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.code = 0;
|
||||
result.msg = ex.Message;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,86 @@
|
||||
using Abp.Application.Services.Dto;
|
||||
using Abp.AutoMapper;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MineTec.ProManager.BOM_Manager.Dto
|
||||
{
|
||||
[AutoMapFrom(typeof(Entitys.Order.BOM_Manager.BOM_Manager))]
|
||||
|
||||
public class BOM_ManagerDto : EntityDto<Guid>
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建日期
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string CreateUserID { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人姓名
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string CreateUserName { get; set; }
|
||||
/// <summary>
|
||||
/// 修改日期
|
||||
/// </summary>
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 修改人ID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string UpdateUserID { get; set; }
|
||||
/// <summary>
|
||||
/// 修改人名称
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string UpdateUserName { get; set; }
|
||||
/// <summary>
|
||||
/// 产品项目ID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string ProductProjectID { get; set; }
|
||||
/// <summary>
|
||||
/// 产品项目名称
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string ProductProjectName { get; set; }
|
||||
/// <summary>
|
||||
/// 研发BOMID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string BOMID { get; set; }
|
||||
/// <summary>
|
||||
/// 研发BOM名称
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string BOMName { get; set; }
|
||||
/// <summary>
|
||||
/// 生产BOMID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string BOM_ProductionID { get; set; }
|
||||
/// <summary>
|
||||
/// 生产BOM名称
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string BOM_ProductionName { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[StringLength(300)]
|
||||
public string Remark { get; set; }
|
||||
/// <summary>
|
||||
///是否关联附件:0 否, 1 是
|
||||
/// </summary>
|
||||
public int IsAnnex { get; set; }
|
||||
/// <summary>
|
||||
///是否删除:0 否, 1 是
|
||||
/// </summary>
|
||||
public int IsDelete { get; set; }
|
||||
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using MineTec.ProManager.Commd;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MineTec.ProManager.BOM_Manager.Dto
|
||||
{
|
||||
public class BOM_ManagerOutPut : OutputBase
|
||||
{
|
||||
public List<BOM_ManagerDto> data { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
using Abp.Application.Services.Dto;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MineTec.ProManager.BOM_Manager.Dto
|
||||
{
|
||||
public class CreateUpdateBOM_ManagerDto : EntityDto<Guid>
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建日期
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string CreateUserID { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人姓名
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string CreateUserName { get; set; }
|
||||
/// <summary>
|
||||
/// 修改日期
|
||||
/// </summary>
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 修改人ID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string UpdateUserID { get; set; }
|
||||
/// <summary>
|
||||
/// 修改人名称
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string UpdateUserName { get; set; }
|
||||
/// <summary>
|
||||
/// 产品项目ID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string ProductProjectID { get; set; }
|
||||
/// <summary>
|
||||
/// 产品项目名称
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string ProductProjectName { get; set; }
|
||||
/// <summary>
|
||||
/// 研发BOMID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string BOMID { get; set; }
|
||||
/// <summary>
|
||||
/// 研发BOM名称
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string BOMName { get; set; }
|
||||
/// <summary>
|
||||
/// 生产BOMID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string BOM_ProductionID { get; set; }
|
||||
/// <summary>
|
||||
/// 生产BOM名称
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string BOM_ProductionName { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[StringLength(300)]
|
||||
public string Remark { get; set; }
|
||||
/// <summary>
|
||||
///是否关联附件:0 否, 1 是
|
||||
/// </summary>
|
||||
public int IsAnnex { get; set; }
|
||||
/// <summary>
|
||||
///是否删除:0 否, 1 是
|
||||
/// </summary>
|
||||
public int IsDelete { get; set; }
|
||||
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using Abp.Application.Services.Dto;
|
||||
|
||||
namespace MineTec.ProManager.BOM_Manager.Dto
|
||||
{
|
||||
public class GetAllBOM_Manager : PagedResultRequestDto
|
||||
{
|
||||
public string ProductProjectName { get; set; } //用于产品名称
|
||||
|
||||
public string BOMName { get; set; } //用于研发BOM
|
||||
|
||||
public string BOM_ProductionName { get; set; } //用于生产BOM
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
namespace MineTec.ProManager.BOM_Manager.Dto
|
||||
{
|
||||
public class UpdateBOM_Manager
|
||||
{
|
||||
public Guid id { get; set; } //主键
|
||||
|
||||
public string UpdateUserID { get; set; }//更新用户ID
|
||||
|
||||
public string UpdateUserName { get; set; }//更新用户姓名
|
||||
|
||||
public string ProductProjectName { get; set; }//产品项目名称
|
||||
|
||||
public string BOMID { get; set; }//研发BOMID
|
||||
|
||||
public string BOMName { get; set; }//研发BOM名称
|
||||
|
||||
public string BOM_ProductionID { get; set; }//生产BOMID
|
||||
|
||||
public string BOM_ProductionName { get; set; }//生产BOM名称
|
||||
|
||||
public string Remark { get; set; } //备注
|
||||
|
||||
public int IsDelete { get; set; }//是否删除
|
||||
}
|
||||
}
|
@ -1,10 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Abp.Application.Services;
|
||||
using Abp.Application.Services.Dto;
|
||||
using MineTec.ProManager.BOM_Manager.Dto;
|
||||
using System;
|
||||
|
||||
namespace MineTec.ProManager.BOM_Manager
|
||||
{
|
||||
class IBOM_ManagerAppService
|
||||
public interface IBOM_ManagerAppService : IAsyncCrudAppService<//定义了CRUD方法
|
||||
BOM_ManagerDto, //用来展示BOM管理表单信息
|
||||
Guid, //BOM管理实体的主键
|
||||
PagedResultRequestDto, //获取BOM管理列表的时候用于分页
|
||||
CreateUpdateBOM_ManagerDto, //用于创建BOM管理表单
|
||||
CreateUpdateBOM_ManagerDto> //用于更新BOM管理表单
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,12 +16,12 @@ namespace MineTec.ProManager.FigureNumber.Dto
|
||||
/// 创建人ID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string? CreateUserID { get; set; }
|
||||
public string CreateUserID { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人姓名
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string? CreateUserName { get; set; }
|
||||
public string CreateUserName { get; set; }
|
||||
/// <summary>
|
||||
/// 修改日期
|
||||
/// </summary>
|
||||
@ -30,12 +30,12 @@ namespace MineTec.ProManager.FigureNumber.Dto
|
||||
/// 修改人ID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string? UpdateUserID { get; set; }
|
||||
public string UpdateUserID { get; set; }
|
||||
/// <summary>
|
||||
/// 修改人名称
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string? UpdateUserName { get; set; }
|
||||
public string UpdateUserName { get; set; }
|
||||
/// <summary>
|
||||
/// 图号编码
|
||||
/// </summary>
|
||||
@ -44,7 +44,7 @@ namespace MineTec.ProManager.FigureNumber.Dto
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[StringLength(300)]
|
||||
public string? Remark { get; set; }
|
||||
public string Remark { get; set; }
|
||||
/// <summary>
|
||||
///是否删除:0 否, 1 是
|
||||
/// </summary>
|
||||
|
@ -16,12 +16,12 @@ namespace MineTec.ProManager.FigureNumber.Dto
|
||||
/// 创建人ID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string? CreateUserID { get; set; }
|
||||
public string CreateUserID { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人姓名
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string? CreateUserName { get; set; }
|
||||
public string CreateUserName { get; set; }
|
||||
/// <summary>
|
||||
/// 修改日期
|
||||
/// </summary>
|
||||
@ -30,12 +30,12 @@ namespace MineTec.ProManager.FigureNumber.Dto
|
||||
/// 修改人ID
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string? UpdateUserID { get; set; }
|
||||
public string UpdateUserID { get; set; }
|
||||
/// <summary>
|
||||
/// 修改人名称
|
||||
/// </summary>
|
||||
[StringLength(50)]
|
||||
public string? UpdateUserName { get; set; }
|
||||
public string UpdateUserName { get; set; }
|
||||
/// <summary>
|
||||
/// 图号编码
|
||||
/// </summary>
|
||||
@ -44,7 +44,7 @@ namespace MineTec.ProManager.FigureNumber.Dto
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[StringLength(300)]
|
||||
public string? Remark { get; set; }
|
||||
public string Remark { get; set; }
|
||||
/// <summary>
|
||||
///是否删除:0 否, 1 是
|
||||
/// </summary>
|
||||
|
@ -13,7 +13,4 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MineTec.ProManager.Core\MineTec.ProManager.Core.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="BOM_Manager\Dto\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -38,8 +38,8 @@ namespace MineTec.ProManager.EntityFrameworkCore
|
||||
|
||||
public DbSet<Entitys.Order.BOM_Production.BOMDetails_Production> BOMDetails_Production { get; set; }
|
||||
|
||||
|
||||
|
||||
public DbSet<Entitys.Order.BOM_Manager.BOM_Manager> BOM_Manager { get; set; }
|
||||
|
||||
|
||||
|
||||
//视图:添加新表时,若需要更新数据库,需先注释下面的视图注册代码
|
||||
|
Loading…
x
Reference in New Issue
Block a user