盘点单接口 报表优化
This commit is contained in:
86
WarehouseMgr/Tnb.WarehouseMgr/WmsInventorycheckService.cs
Normal file
86
WarehouseMgr/Tnb.WarehouseMgr/WmsInventorycheckService.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -198,8 +198,9 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
await _db.Ado.BeginTranAsync();
|
||||
//入库取终点 //出库起点
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_MJC_ID, Size = 1 };
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_MJC_ID, Size = 9999 };
|
||||
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
endLocations = endLocations.Where(r => r.location_code.Contains("MJWC-C")).ToList();
|
||||
if (endLocations.Count == 0)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的入库库位", 500);
|
||||
|
||||
@@ -218,11 +218,14 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
IEnumerable<dynamic> result = null;
|
||||
|
||||
|
||||
result = await _db.Queryable<WmsOutinStockDetail>()
|
||||
.InnerJoin<WmsOutinStockCode>((a, b) => a.id == b.bill_d_id)
|
||||
.InnerJoin<BasWarehouse>((a, b, c) => a.warehouse_id == c.id)
|
||||
.Select((a,b,c) => new
|
||||
.InnerJoin<BasMaterial>((a, b, c, d) => b.material_id == d.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d) => b.code_batch.Contains(code_batch))
|
||||
.WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d) => b.material_specification.Contains(material_specification))
|
||||
.Select((a, b, c) => new
|
||||
{
|
||||
act_start_date = a.act_start_date,
|
||||
act_end_date = a.act_end_date,
|
||||
|
||||
Reference in New Issue
Block a user