Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
18
WarehouseMgr/Tnb.WarehouseMgr/BasRegionMatService.cs
Normal file
18
WarehouseMgr/Tnb.WarehouseMgr/BasRegionMatService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.VisualDev;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 区域物料设定
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_BASREGIONMAT_ID)]
|
||||
public class BasRegionMatService :BaseWareHouseService
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using JNPF;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
@@ -12,6 +14,7 @@ using JNPF.EventBus;
|
||||
using JNPF.Extras.CollectiveOAuth.Enums;
|
||||
using JNPF.VisualDev;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
@@ -37,7 +40,24 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
protected IEventPublisher? EventPublisher { set; get; }
|
||||
|
||||
protected ILogger Logger => LoggerFactory.Create(builder => builder.AddFile($"{AppContext.BaseDirectory}/logs/{this.GetType().Name}{DateTime.Now:yyyyMMdd}.log", cfgOpts =>
|
||||
{
|
||||
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
{
|
||||
Span<char> span = logMsg.LogLevel.ToString().ToCharArray();
|
||||
StringBuilder sb = new();
|
||||
_ = sb.Append($"{span[..4]} ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
|
||||
})).CreateLogger(this.GetType());
|
||||
|
||||
|
||||
static BaseWareHouseService()
|
||||
@@ -300,6 +320,8 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 斑马打印
|
||||
/// <summary>
|
||||
/// 打印
|
||||
@@ -347,7 +369,7 @@ namespace Tnb.WarehouseMgr
|
||||
// tcs.SetResult(printerList);
|
||||
// return tcs.Task;
|
||||
//}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Api响应结果
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// Wms设备接口提供程序服务类
|
||||
/// </summary>
|
||||
|
||||
public class DeviceProviderService : BaseWareHouseService<DeviceProviderService>
|
||||
public class DeviceProviderService : ServiceLoggerBase<DeviceProviderService>
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
|
||||
@@ -6,17 +6,19 @@ using Tnb.WarehouseMgr.Entities;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
public class BaseWareHouseService<T> : BaseWareHouseService
|
||||
public class ServiceLoggerBase<TService> : BaseWareHouseService
|
||||
{
|
||||
protected static Dictionary<string, object> s_elevatorMap = new();
|
||||
private static readonly Lazy<Task> initializationTask;
|
||||
|
||||
|
||||
static BaseWareHouseService()
|
||||
static ServiceLoggerBase()
|
||||
{
|
||||
initializationTask = new Lazy<Task>(InitializeAsync);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static async Task InitializeAsync()
|
||||
{
|
||||
|
||||
@@ -37,24 +39,24 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
|
||||
|
||||
protected ILogger Logger => LoggerFactory.Create(builder => builder.AddFile($"{AppContext.BaseDirectory}/logs/custom{DateTime.Now:yyyyMMdd}.log", cfgOpts =>
|
||||
{
|
||||
//protected ILogger Logger => LoggerFactory.Create(builder => builder.AddFile($"{AppContext.BaseDirectory}/logs/{this.GetType().Name}{DateTime.Now:yyyyMMdd}.log", cfgOpts =>
|
||||
//{
|
||||
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
{
|
||||
Span<char> span = logMsg.LogLevel.ToString().ToCharArray();
|
||||
StringBuilder sb = new();
|
||||
_ = sb.Append($"{span[..4]} ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
// //cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
// cfgOpts.MessageFormat = (logMsg) =>
|
||||
// {
|
||||
// Span<char> span = logMsg.LogLevel.ToString().ToCharArray();
|
||||
// StringBuilder sb = new();
|
||||
// _ = sb.Append($"{span[..4]} ");
|
||||
// _ = sb.Append($"{logMsg.LogName} ");
|
||||
// _ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
// _ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
// _ = sb.Append(logMsg.Message + " ");
|
||||
// _ = sb.Append(logMsg.Exception?.ToString());
|
||||
// return sb.ToString();
|
||||
// };
|
||||
|
||||
})).CreateLogger<T>();
|
||||
//})).CreateLogger(this.GetType());
|
||||
}
|
||||
|
||||
public static class CustomLoggerExtenstions
|
||||
@@ -33,7 +33,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 库房业务类(出入库)
|
||||
/// </summary>
|
||||
public class WareHouseService : BaseWareHouseService<WareHouseService>, IWareHouseService
|
||||
public class WareHouseService : ServiceLoggerBase<WareHouseService>, IWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
@@ -977,9 +977,9 @@ namespace Tnb.WarehouseMgr
|
||||
if (curEleDs?.Count > 0)
|
||||
{
|
||||
//当前电梯
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.status == 1);
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enable_mark == 1);
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync();
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enable_mark == 1).ToListAsync();
|
||||
|
||||
if (curEle == null && sGpEle?.Count > 0)
|
||||
{
|
||||
@@ -1048,9 +1048,9 @@ namespace Tnb.WarehouseMgr
|
||||
if (curEleDs?.Count > 0)
|
||||
{
|
||||
//当前电梯
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.status == 1);
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enable_mark == 1);
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync();
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enable_mark == 1).ToListAsync();
|
||||
|
||||
if (curEle == null && sGpEle?.Count > 0)
|
||||
{
|
||||
|
||||
29
WarehouseMgr/Tnb.WarehouseMgr/WmsBasicDataBase`1.cs
Normal file
29
WarehouseMgr/Tnb.WarehouseMgr/WmsBasicDataBase`1.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// Wms基础数据基类
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
//public class WmsBasicDataBase<TEntity> : BaseWareHouseService where TEntity : BaseEntity<string>, new()
|
||||
//{
|
||||
// private readonly ISqlSugarClient _db;
|
||||
// public WmsBasicDataBase()
|
||||
// {
|
||||
|
||||
// }
|
||||
// [HttpPost]
|
||||
// public async Task<bool> IsEnabledMark(IEnumerable<string> ids,int status)
|
||||
// {
|
||||
|
||||
// }
|
||||
//}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// 盘点任务
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCHECKTASK_ID)]
|
||||
public class WmsCheckTaskService : BaseWareHouseService<WmsCheckTaskService>
|
||||
public class WmsCheckTaskService : ServiceLoggerBase<WmsCheckTaskService>
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IWareHouseService _warehouseService;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Tnb.WarehouseMgr
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSEMPTYINSTOCK_ID)]
|
||||
[ServiceModule(BizTypeId)]
|
||||
|
||||
public class WmsEmptyInstockService : BaseWareHouseService<WmsEmptyInstockService>, IWmsEmptyInstockService
|
||||
public class WmsEmptyInstockService : ServiceLoggerBase<WmsEmptyInstockService>, IWmsEmptyInstockService
|
||||
{
|
||||
private const string BizTypeId = "26121986416677";
|
||||
private readonly ISqlSugarClient _db;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSOUTSTOCK_ID)]
|
||||
[ServiceModule(BizTypeId)]
|
||||
public class WmsOutStockService : BaseWareHouseService<WmsOutStockService>, IWmsOutStockService
|
||||
public class WmsOutStockService : ServiceLoggerBase<WmsOutStockService>, IWmsOutStockService
|
||||
{
|
||||
private const string BizTypeId = "26191522660645";
|
||||
private readonly ISqlSugarClient _db;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using Mapster;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
@@ -29,11 +31,18 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
private async Task<dynamic> GetListAsync(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var materialCode = "";
|
||||
if (!input.queryJson.IsNullOrWhiteSpace())
|
||||
{
|
||||
materialCode = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.material_code));
|
||||
}
|
||||
|
||||
List<WmsStockReportH> items = await _db.Queryable<WmsCarryCode>().InnerJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.InnerJoin<BasMaterialSendWarehouse>((a, b, c) => b.id == c.material_id)
|
||||
.InnerJoin<WmsCarryH>((a, b, c, d) => a.carry_id == d.id)
|
||||
.InnerJoin<BasLocation>((a, b, c, d, e) => d.location_id == e.id)
|
||||
.Where((a, b, c, d, e) => e.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.WhereIF(!string.IsNullOrEmpty(materialCode), (a, b, c, d, e) => a.material_code.Contains(materialCode))
|
||||
.Select((a, b, c, d, e) => new WmsStockReportH
|
||||
{
|
||||
warehouse_id = a.warehouse_id,
|
||||
|
||||
Reference in New Issue
Block a user