using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.EventBus; using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Npgsql; using SqlSugar; using Tnb.BasicData.Interfaces; using Tnb.ProductionMgr.Interfaces; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Entity; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr { [OverideVisualDev(ModuleConsts.MODULE_WmsInventorycheck_ID)] public class WmsInventorycheckService : BaseWareHouseService { private readonly ISqlSugarClient _db; private readonly IDictionaryDataService _dictionaryDataService; private readonly IUserManager _userManager; private readonly IWareHouseService _wareHouseService; private readonly IBillRullService _billRullService; private readonly IPrdInstockService _prdInstockService; private readonly IThirdApiRecordService _thirdApiRecordService; private static Dictionary _dicBillCodes = new(); public WmsInventorycheckService( ISqlSugarRepository repository, IDictionaryDataService dictionaryDataService, IUserManager userManager, IBillRullService billRullService, IWareHouseService wareHouseService, IPrdInstockService prdInstockService, IThirdApiRecordService thirdApiRecordService, IEventPublisher eventPublisher ) { _db = repository.AsSugarClient(); _dictionaryDataService = dictionaryDataService; _userManager = userManager; _billRullService = billRullService; _wareHouseService = wareHouseService; _thirdApiRecordService = thirdApiRecordService; _prdInstockService = prdInstockService; } /// /// 盘点单提交 /// /// /// [HttpPost] public async Task Submit(WmsInventorycheckSubmitInput input) { try { return await ToApiResult(HttpStatusCode.OK, "成功"); } catch (PostgresException ex) { Logger.LogError(ex.Message); Logger.LogError(ex.StackTrace); throw new AppFriendlyException($"{ex.Message}", 500); } catch (Exception ex) { Logger.LogInformation(ex.Message); Logger.LogInformation(ex.StackTrace); return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message); } } } }