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, IWIPInventoryService { private readonly IWIPInventoryRepository _WIPInventoryRepository; public WIPInventoryService(IWIPInventoryRepository WIPInventoryRepository) : base(WIPInventoryRepository) { Init(WIPInventoryRepository); _WIPInventoryRepository = WIPInventoryRepository; } /// /// 查询在制品盘点方案 /// /// /// public async Task GetWIPScheme(GetWIPSchemeFrom SData) { if (SData.sourceBillNO.IsNullOrEmpty()) { throw new O3AppException("传参信息错误,盘点方案编码为空", 400); } return await (repository as IWIPInventoryRepository).GetWIPScheme(SData); } /// /// 查询条码 /// /// /// public async Task 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); } /// /// 更新条码信息 /// /// /// public async Task 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); } } }