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

127 lines
4.6 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.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(ISelBillService), ServiceLifetime.Transient)]
public class SelBillService : ServiceBase<BaseEntity, ISelBillRepository>, ISelBillService
{
public SelBillService(ISelBillRepository repository) : base(repository)
{
Init(repository);
}
/// <summary>
/// 查询出入库流程配置
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<List<BOS_SELBILL>> QuerySelBill(string orgID, string data)
{
return await (repository as ISelBillRepository).QuerySelBill(orgID, data);
}
/// <summary>
/// 扫描源单编号,查询源单信息
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<RetMessage> QuerySourceBillInfo(JObject data)
{
if (data.Property("tranType") == null ||
data.Property("sourceTranType") == null ||
data.Property("sourceBillNO") == null ||
data.Property("orgID") == null)
{
throw new O3AppException("传参信息错误,未定义", 400);
}
return await (repository as ISelBillRepository).QuerySourceBillInfo(data);
}
/// <summary>
/// 扫描条码信息,验证条码状态
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<RetMessage> QueryBarCode(JObject data)
{
if (data.Property("barCodeNum") == null ||
data.Property("isExit") == null ||
data.Property("isHaveSource") == null ||
data.Property("sourceTranType") == null ||
data.Property("sourceEntryID") == null ||
data.Property("sourceBillNO") == null ||
data.Property("tranType") == null ||
data.Property("orgID") == null
)
{
return new RetMessage
{
Status = 0,
Message = "传参信息错误,存在未定义的参数"
};
}
else
{
return await (repository as ISelBillRepository).QueryBarCode(data);
}
}
/// <summary>
/// 扫描位置信息,查询仓库仓位
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<RetMessage> QueryStockData(JObject data)
{
if (data.Property("tranType") == null ||
data.Property("stockData") == null ||
data.Property("sourceTranType") == null ||
data.Property("sourceBillNO") == null ||
data.Property("orgID") == null
)
{
if (data.Property("tranType").Value.ToString() == "SP_InStock" ||
data.Property("tranType").Value.ToString() == "SP_OUTSTOCK" ||
data.Property("tranType").Value.ToString().ToUpperEx() == "QM_STKAPPCHANGE"
)
{
return await (repository as ISelBillRepository).QueryStockData(data);
}
else
{
return new RetMessage
{
Status = 0,
Message = "传参信息错误,存在未定义的参数"
};
}
}
else
{
return await (repository as ISelBillRepository).QueryStockData(data);
}
}
/// <summary>
/// 查询仓库库存状态
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<RetMessage> QueryStockStatus(JObject data)
{
return await (repository as ISelBillRepository).QueryStockStatus(data);
}
}
}