You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
3.2 KiB
104 lines
3.2 KiB
using Shentun.Peis.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Volo.Abp;
|
|
using Volo.Abp.Domain.Repositories;
|
|
using Volo.Abp.Domain.Services;
|
|
|
|
namespace Shentun.Peis.SampleGroupDetails
|
|
{
|
|
public class SampleGroupDetailManager : DomainService
|
|
{
|
|
private readonly IRepository<SampleGroupDetail> _repository;
|
|
|
|
public SampleGroupDetailManager(
|
|
IRepository<SampleGroupDetail> repository
|
|
)
|
|
{
|
|
this._repository = repository;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 创建
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
public SampleGroupDetail CreateAsbitemAsync(SampleGroupDetail entity)
|
|
{
|
|
DataHelper.CheckGuidIsDefaultValue(entity.AsbitemId, "组合项目编号");
|
|
DataHelper.CheckGuidIsDefaultValue(entity.SampleGroupId, "条码分组ID");
|
|
|
|
return entity;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 删除条码分组明细 批量删
|
|
/// </summary>
|
|
/// <param name="SampleGroupId">条码分组ID</param>
|
|
/// <returns></returns>
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
public async Task CheckAndDeleteAsync(Guid SampleGroupId)
|
|
{
|
|
var sampleGroupDetailList = await _repository.GetListAsync(m => m.SampleGroupId == SampleGroupId);
|
|
if (sampleGroupDetailList.Any())
|
|
{
|
|
|
|
//删除条码分组明细 批量删
|
|
await _repository.DeleteManyAsync(sampleGroupDetailList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 删除条码分组明细 单个
|
|
/// </summary>
|
|
/// <param name="SampleGroupId">条码分组ID</param>
|
|
/// <param name="AsbitemId">组合项目ID</param>
|
|
/// <returns></returns>
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
public async Task CheckAndDeleteInSampleGroupIdAndAsbitemIdAsync(Guid SampleGroupId, Guid AsbitemId)
|
|
{
|
|
var sampleGroupDetailList = await _repository.GetListAsync(m => m.SampleGroupId == SampleGroupId && m.AsbitemId == AsbitemId);
|
|
if (sampleGroupDetailList.Any())
|
|
{
|
|
|
|
//删除条码分组明细
|
|
await _repository.DeleteManyAsync(sampleGroupDetailList);
|
|
|
|
}
|
|
else
|
|
{
|
|
throw new UserFriendlyException("数据不存在");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 删除组合项目相关的明细
|
|
/// </summary>
|
|
/// <param name="AsbitemId">组合项目ID</param>
|
|
/// <returns></returns>
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
public async Task CheckAndDeleteInAsbitemIdAsync(Guid AsbitemId)
|
|
{
|
|
var medicalPackageDetailList = await _repository.GetListAsync(m => m.AsbitemId == AsbitemId);
|
|
if (medicalPackageDetailList.Any())
|
|
{
|
|
|
|
//删除组合项目相关的明细
|
|
await _repository.DeleteManyAsync(medicalPackageDetailList);
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|