Files
GX.O3.WMS/APP.O3/Services/WMS/BillHandleService.cs
T

100 lines
3.6 KiB
C#
Executable File

using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Linq;
using Opsoft.NetCore.O3App.Domain;
using Opsoft.NetCore.O3App.Domain.Interface;
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IRepositories;
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
using Opsoft.NetCore.O3App.Shared;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Opsoft.NetCore.O3App.Services.WMS
{
[MapTo(typeof(IBillHandleService), ServiceLifetime.Transient)]
public class BillHandleService : ServiceBase<BaseEntity, IBillHandleRepository>, IBillHandleService
{
public BillHandleService(IBillHandleRepository repository) : base(repository)
{
Init(repository);
}
/// <summary>
/// 查询出入库流程配置
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<List<TRAN_INFO>> QuerySelBill()
{
return await (repository as IBillHandleRepository).QuerySelBill();
}
/// <summary>
/// 查询单据信息
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<RetMessage> QueryBillInfo(JObject data)
{
if (data.Property("tranType") == null ||
data.Property("billNO") == null ||
data.Property("orgID") == null)
{
throw new O3AppException("传参信息错误,未定义", 400);
}
return await (repository as IBillHandleRepository).QueryBillInfo(data);
}
/// <summary>
/// 单据复核查询条码信息
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<RetMessage> QueryBarCode(JObject data)
{
if (data.Property("tranType") == null ||
data.Property("barCode") == null ||
data.Property("billNO") == null ||
data.Property("isExit") == null ||
data.Property("orgID") == null)
{
throw new O3AppException("传参信息错误,未定义", 400);
}
return await (repository as IBillHandleRepository).QueryBarCode(data);
}
/// <summary>
/// 出入库复核提交
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<RetMessage> CheckSubmit(string orgID, string tranType, string fbillNo, List<BarCodeMsg<BD_BARCODERS2>> barcodeList)
{
if (orgID == null || orgID.IsNullOrEmpty())
{
throw new O3AppException("组织信息为空");
}
if (tranType == null || tranType.IsNullOrEmpty())
{
throw new O3AppException("复核单据类型为空");
}
if (fbillNo == null || fbillNo.IsNullOrEmpty())
{
throw new O3AppException("复核单据编号为空");
}
if (barcodeList == null || barcodeList.Count <= 0)
{
return new RetMessage
{
Status = 0,
Message = "提交信息为空"
};
}
return await (repository as IBillHandleRepository).CheckSubmit(orgID, tranType, fbillNo, barcodeList);
}
}
}