92 lines
3.1 KiB
C#
92 lines
3.1 KiB
C#
using APT.BaseData.Domain.Entities.FM;
|
|
using APT.BaseData.Domain.Entities;
|
|
using APT.BaseData.Domain.Enums.PF;
|
|
using APT.BaseData.Services.Services.FM;
|
|
using APT.Infrastructure.Core;
|
|
using APT.MS.Domain.Entities.SC.PR;
|
|
using APT.Utility;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System;
|
|
|
|
namespace APT.SC.WebApi.Controllers.Api.PRController
|
|
{
|
|
/// <summary>
|
|
/// 药品配置
|
|
/// </summary>
|
|
[Route("api/PR/PRDrugSet")]
|
|
public partial class DrugSetController : AuthorizeApiController<T_PR_DRUG_SET>
|
|
{
|
|
/// <summary>
|
|
/// 新增/编辑
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
[HttpPost, Route("FullUpdate")]
|
|
public JsonActionResult<bool> FullUpdate([FromBody] T_PR_DRUG_SET entity)
|
|
{
|
|
return SafeExecute(() =>
|
|
{
|
|
var details = entity.Nav_Specifys;
|
|
entity.Nav_Specifys = null;
|
|
var confirms = entity.Nav_Confirms;
|
|
entity.Nav_Confirms = null;
|
|
if (details != null && details.Any())
|
|
{
|
|
details.ForEach(t =>
|
|
{
|
|
t.ORG_ID = entity.ORG_ID; t.DRUG_SET_ID = entity.ID;
|
|
});
|
|
}
|
|
if (confirms != null && confirms.Any())
|
|
{
|
|
confirms.ForEach(t =>
|
|
{
|
|
t.ORG_ID = entity.ORG_ID; t.DRUG_SET_ID = entity.ID;
|
|
});
|
|
}
|
|
UnifiedCommit(() =>
|
|
{
|
|
if (entity != null)
|
|
this.UpdateEntityNoCommit(entity);
|
|
if (details != null && details.Any())
|
|
this.BantchSaveEntityNoCommit(details);
|
|
if (confirms != null && confirms.Any())
|
|
this.BantchSaveEntityNoCommit(confirms);
|
|
});
|
|
return true;
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// 新增/编辑
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
[HttpPost, Route("FullUpdateType")]
|
|
public JsonActionResult<bool> FullUpdateType([FromBody] T_PR_DRUG_TYPE entity)
|
|
{
|
|
return SafeExecute(() =>
|
|
{
|
|
var confirms = entity.Nav_Confirms;
|
|
entity.Nav_Confirms = null;
|
|
if (confirms != null && confirms.Any())
|
|
{
|
|
confirms.ForEach(t =>
|
|
{
|
|
t.ORG_ID = entity.ORG_ID; t.TYPE_ID = entity.ID;
|
|
});
|
|
}
|
|
UnifiedCommit(() =>
|
|
{
|
|
if (entity != null)
|
|
this.UpdateEntityNoCommit(entity);
|
|
if (confirms != null && confirms.Any())
|
|
this.BantchSaveEntityNoCommit(confirms);
|
|
});
|
|
return true;
|
|
});
|
|
}
|
|
}
|
|
}
|