76 lines
2.7 KiB
C#
Executable File
76 lines
2.7 KiB
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Opsoft.NetCore.O3App.Domain;
|
|
using Opsoft.NetCore.O3App.Domain.Interface;
|
|
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Assets.IRepositories;
|
|
using Opsoft.NetCore.O3App.Shared;
|
|
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Assets.IServices;
|
|
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Assets.Model;
|
|
|
|
namespace Opsoft.NetCore.O3App.Services.Assets
|
|
{
|
|
[MapTo(typeof(IAssetInventoryService), ServiceLifetime.Transient)]
|
|
public class AssetInventoryService : ServiceBase<BaseEntity, IAssetInventoryRepository>, IAssetInventoryService
|
|
{
|
|
public AssetInventoryService(IAssetInventoryRepository repository) : base(repository)
|
|
{
|
|
Init(repository);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取盘点方案信息及暂存信息
|
|
/// </summary>
|
|
/// <param name="data"></param>
|
|
/// <returns></returns>
|
|
public async Task<List<GetAssetInventory>> GetAssetInventory(Inventory SData)
|
|
{
|
|
if (SData.FBILLNO==null)
|
|
{
|
|
throw new O3AppException("资产盘点方案条码信息错误,未定义!!",400);
|
|
}
|
|
return await (repository as IAssetInventoryRepository).GetAssetInventory(SData);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取资产信息
|
|
/// </summary>
|
|
/// <param name="data"></param>
|
|
/// <returns></returns>
|
|
public async Task<List<GetAssets>> GetAssets(Inventory SData)
|
|
{
|
|
if (SData.FBILLNO == null)
|
|
{
|
|
throw new O3AppException("资产条码信息错误,未定义!!", 400);
|
|
}
|
|
return await (repository as IAssetInventoryRepository).GetAssets(SData);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 资产盘点暂存
|
|
/// </summary>
|
|
/// <param name="data"></param>
|
|
/// <returns></returns>
|
|
public async Task<string> TemporaryStorage(Temporary SData)
|
|
{
|
|
if (SData.basicType.ToString() == "")
|
|
{
|
|
throw new O3AppException("资产盘点操作类型信息错误,未定义!!",400);
|
|
}
|
|
if (SData.FINTERID == null||SData.FBILLNO==null)
|
|
{
|
|
throw new O3AppException("资产盘点信息错误,未定义!!",400);
|
|
}
|
|
if (SData.SData.Count == 0)
|
|
{
|
|
throw new O3AppException("暂存资产信息错误,未定义!!", 400);
|
|
}
|
|
return await (repository as IAssetInventoryRepository).TemporaryStorage(SData);
|
|
}
|
|
}
|
|
}
|