diff --git a/BPA.SAAS.Manage.Application/DataBase/BomServices.cs b/BPA.SAAS.Manage.Application/DataBase/BomServices.cs
index 859eb22..8216827 100644
--- a/BPA.SAAS.Manage.Application/DataBase/BomServices.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/BomServices.cs
@@ -1,6 +1,9 @@
using BPA.SAAS.Manage.Application.DataBase.Dtos.Bom;
using BPA.SAAS.Manage.Application.DataBase.Interface;
+using BPA.SAAS.Manage.Comm.Enum;
using BPA.SAAS.Manage.Core.Base;
+using BPA.SAAS.Manage.Core.DataBase;
+using Microsoft.AspNetCore.Components.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -107,5 +110,27 @@ namespace BPA.SAAS.Manage.Application.DataBase
{
return await _bomService.BomPage(inputDto);
}
+
+ ///
+ /// 添加配方
+ ///
+ ///
+ ///
+ [HttpPost("/api/bom/AddBom")]
+ public async Task AddBom(BomCreateInputDto dto)
+ {
+ return await _bomService.AddBom(dto);
+ }
+
+ ///
+ /// 删除配方
+ ///
+ ///
+ ///
+ [HttpPost("/api/bom/DelBom")]
+ public async Task DelBom(string id)
+ {
+ return await _bomService.DelBom(id);
+ }
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/Bom/BomDto.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/Bom/BomDto.cs
index 16ffc17..b626732 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Dtos/Bom/BomDto.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/Bom/BomDto.cs
@@ -9,6 +9,21 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Bom
{
public class BomPageInputDto: PageInputBase
{
+ public string Name { get; set; }
+ public string bomTypeList { get; set; }
+ public List Pertains { get; set; }
+ }
+ public class BomCreateInputDto
+ {
+ public string BomName { get; set; }
+ public string BomType { get; set; }
+ public string[] BomtypeList { get; set; }
+ public List Mate { get; set; }
+ }
+ public class Mateinfo
+ {
+ public string batchingId { get; set; }
+ public int dosage { get; set; }
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Interface/IBomService.cs b/BPA.SAAS.Manage.Application/DataBase/Interface/IBomService.cs
index 77d10db..1f7f762 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Interface/IBomService.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Interface/IBomService.cs
@@ -26,13 +26,13 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface
///
///
///
- Task AddBom(BomInputDto dto);
+ Task AddBom(BomInputDto dto);
///
/// 更新
///
///
///
- Task UpdateBom(BomInputDto dto);
+ Task UpdateBom(BomInputDto dto);
/// 更新配方详情
///
///
@@ -49,7 +49,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface
///
///
///
- Task AddBomType(AddBomTypeInputDto dto);
+ Task AddBomType(AddBomTypeInputDto dto);
///
/// 配方分类列表
///
@@ -62,5 +62,19 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface
///
///
Task BomPage(BomPageInputDto inputDto);
+
+ ///
+ /// 添加配方
+ ///
+ ///
+ ///
+ Task AddBom(BomCreateInputDto dto);
+
+ ///
+ /// 删除配方
+ ///
+ ///
+ ///
+ Task DelBom(string id);
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/BomService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/BomService.cs
index adb3f09..b68a8ca 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Services/BomService.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Services/BomService.cs
@@ -117,6 +117,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
}
}
+
+
///
/// 更新配方详情
///
@@ -229,16 +231,130 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
///
public async Task BomPage(BomPageInputDto inputDto)
{
+
+ var pertainList = _db.Queryable((a, b) =>
+ new JoinQueryInfos(JoinType.Left, a.BomTypeId == b.Id))
+ .Where((a, b) => a.IsDeleted == 0 && b.IsDeleted == 0)
+ .WhereIF(inputDto.Pertains != null && inputDto.Pertains.Count > 0, (a, b) => inputDto.Pertains.Contains(b.Pertain))
+ .WhereIF(!string.IsNullOrWhiteSpace(inputDto.bomTypeList), (a, b) => b.Id == inputDto.bomTypeList)
+ .Select((a, b) => a.BomId)
+ .ToList();
+
int total = new RefAsync();
- var res = await _db.Queryable()
- .ToPageListAsync(inputDto.Current, inputDto.PageSize, total);
+ var res = _db.Queryable()
+ .Where(it => it.IsDeleted == 0)
+ .WhereIF(!string.IsNullOrEmpty(inputDto.Name),x=>x.Name.Contains(inputDto.Name))
+ .WhereIF(!string.IsNullOrWhiteSpace(inputDto.bomTypeList), x => pertainList.Contains(x.Id))
+ .OrderBy(i => i.CreateAt, OrderByType.Desc)
+ .ToPageList(inputDto.Current, inputDto.PageSize, ref total);
+
+
+ var listtype = _db.Queryable()
+ .Where(a => res.Select(x => x.Id).Contains(a.BomId) && a.IsDeleted == 0).ToList();
- return new PageUtil()
+ var data = new List