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, ISelBillService { public SelBillService(ISelBillRepository repository) : base(repository) { Init(repository); } /// /// 查询出入库流程配置 /// /// /// public async Task> QuerySelBill(string orgID, string data) { return await (repository as ISelBillRepository).QuerySelBill(orgID, data); } /// /// 扫描源单编号,查询源单信息 /// /// /// public async Task 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); } /// /// 扫描条码信息,验证条码状态 /// /// /// public async Task 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); } } /// /// 扫描位置信息,查询仓库仓位 /// /// /// public async Task 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); } } /// /// 查询仓库库存状态 /// /// /// public async Task QueryStockStatus(JObject data) { return await (repository as ISelBillRepository).QueryStockStatus(data); } } }