Files
GX.O3.WMS/APP.O3/Services/WIPBarCode/WIPInventoryService.cs
T

82 lines
3.2 KiB
C#
Executable File

using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Linq;
using ODK.WPF.Helper;
using Opsoft.NetCore.O3App.Domain;
using Opsoft.NetCore.O3App.Domain.Interface;
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WIPBarCode.IRepositories;
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WIPBarCode.IServices;
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WIPBarCode.Model;
using Opsoft.NetCore.O3App.Shared;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Opsoft.NetCore.O3App.Services.WIPBarCode
{
[MapTo(typeof(IWIPInventoryService), ServiceLifetime.Transient)]
public class WIPInventoryService : ServiceBase<BaseEntity, IWIPInventoryRepository>, IWIPInventoryService
{
private readonly IWIPInventoryRepository _WIPInventoryRepository;
public WIPInventoryService(IWIPInventoryRepository WIPInventoryRepository) : base(WIPInventoryRepository)
{
Init(WIPInventoryRepository);
_WIPInventoryRepository = WIPInventoryRepository;
}
/// <summary>
/// 查询在制品盘点方案
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<GetWIPSchemeTo> GetWIPScheme(GetWIPSchemeFrom SData)
{
if (SData.sourceBillNO.IsNullOrEmpty())
{
throw new O3AppException("传参信息错误,盘点方案编码为空", 400);
}
return await (repository as IWIPInventoryRepository).GetWIPScheme(SData);
}
/// <summary>
/// 查询条码
/// </summary>
/// <param name="sData"></param>
/// <returns></returns>
public async Task<RetMessage> GetWIPBarcode(JObject data)
{
if (data.Property("sourceBillNO") == null || data["sourceBillNO"].ToStringEx().IsNullOrEmpty())
{
throw new O3AppException("传参信息错误,请先扫描盘点方案为空", 400);
}
if (data.Property("barCodeNum") == null || data["barCodeNum"].ToStringEx().IsNullOrEmpty())
{
throw new O3AppException("传参信息错误,条码为空", 400);
}
if (data.Property("orgID") == null || data["orgID"].ToStringEx().IsNullOrEmpty())
{
throw new O3AppException("传参信息错误,组织为空", 400);
}
return await(repository as IWIPInventoryRepository).GetWIPBarcode(data);
}
/// <summary>
/// 更新条码信息
/// </summary>
/// <param name="sData"></param>
/// <returns></returns>
public async Task<object> UpdateWIPBarcode(GetWIPSchemeFrom SData)
{
if (SData.sourceBillNO.IsNullOrEmpty())
{
throw new O3AppException("传参信息错误,请先扫描盘点方案为空", 400);
}
if (SData.barcodeList.IsNullOrEmpty())
{
throw new O3AppException("传参信息错误,条码为空", 400);
}
return await(repository as IWIPInventoryRepository).UpdateWIPBarcode(SData);
}
}
}