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, IBillHandleService { public BillHandleService(IBillHandleRepository repository) : base(repository) { Init(repository); } /// /// 查询出入库流程配置 /// /// /// public async Task> QuerySelBill() { return await (repository as IBillHandleRepository).QuerySelBill(); } /// /// 查询单据信息 /// /// /// public async Task 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); } /// /// 单据复核查询条码信息 /// /// /// public async Task 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); } /// /// 出入库复核提交 /// /// /// public async Task CheckSubmit(string orgID, string tranType, string fbillNo, List> 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); } } }