Files
tnb.server/WarehouseMgr/Tnb.WarehouseMgr/WmsInventorycheckService.cs
2024-10-25 17:58:09 +08:00

87 lines
3.0 KiB
C#

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<string, object> _dicBillCodes = new();
public WmsInventorycheckService(
ISqlSugarRepository<WmsInventorycheckH> 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;
}
/// <summary>
/// 盘点单提交
/// </summary>
/// <param name="input"></param>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost]
public async Task<dynamic> 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);
}
}
}
}