修复bug
This commit is contained in:
@@ -48,6 +48,10 @@ public static class DictConst
|
||||
/// 包装工单
|
||||
/// </summary>
|
||||
public const string PrdMoTypeBZ = "25019191681045";
|
||||
/// <summary>
|
||||
/// 物料分类
|
||||
/// </summary>
|
||||
public const string MaterialCatagoryID = "24882163283733";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
72
BasicData/Tnb.BasicData.Entities/Entity/BasRegionMat.cs
Normal file
72
BasicData/Tnb.BasicData.Entities/Entity/BasRegionMat.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.BasicData.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 区域物料设定
|
||||
/// </summary>
|
||||
[SugarTable("bas_region_mat")]
|
||||
public partial class BasRegionMat : BaseEntity<string>
|
||||
{
|
||||
public BasRegionMat()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 区域ID
|
||||
/// </summary>
|
||||
public string region_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 区域代码
|
||||
/// </summary>
|
||||
public string region_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 物料分类
|
||||
/// </summary>
|
||||
public string material_type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string create_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime create_time { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扩展字段
|
||||
/// </summary>
|
||||
public string? extras { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳(用于并发控制)
|
||||
/// </summary>
|
||||
public DateTime? timestamp { get; set; }
|
||||
|
||||
}
|
||||
99
BasicData/Tnb.BasicData/BasRegionMatService.cs
Normal file
99
BasicData/Tnb.BasicData/BasRegionMatService.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using DingTalk.Api.Request;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
/// <summary>
|
||||
/// 区域物料设定
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 701)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
|
||||
public class BasRegionMatService : IOverideVisualDevService, IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "26187428200229";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IDictionaryDataService _dataDictionaryService;
|
||||
private static Dictionary<string, object> s_materialCategoryMap = new();
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public BasRegionMatService(ISqlSugarRepository<BasRegionMat> repo,
|
||||
IRunService runService, IVisualDevService visualDevService,
|
||||
IDictionaryDataService dataDictionaryService
|
||||
)
|
||||
{
|
||||
_db = repo.AsSugarClient();
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
_dataDictionaryService = dataDictionaryService;
|
||||
OverideFuncs.CreateAsync = CreateAsync;
|
||||
}
|
||||
|
||||
private async Task<dynamic> CreateAsync(VisualDevModelDataCrInput input)
|
||||
{
|
||||
Task<int> respTask = Task.FromResult(1);
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
string? regionCode = null, materialType = null;
|
||||
if (input.data.ContainsKey(nameof(BasRegionMat.region_code)) && input.data[nameof(BasRegionMat.region_code)].IsNotEmptyOrNull())
|
||||
{
|
||||
regionCode = input.data[nameof(BasRegionMat.region_code)].ToString();
|
||||
}
|
||||
if (input.data.ContainsKey(nameof(BasRegionMat.material_type)) && input.data[nameof(BasRegionMat.material_type)].IsNotEmptyOrNull())
|
||||
{
|
||||
materialType = input.data[nameof(BasRegionMat.material_type)].ToString();
|
||||
}
|
||||
var blTrueAll = new List<bool> { regionCode.IsNullOrWhiteSpace(), materialType.IsNullOrWhiteSpace() };
|
||||
if (blTrueAll.All(b => !b))
|
||||
{
|
||||
if (s_materialCategoryMap.Count == 0)
|
||||
{
|
||||
s_materialCategoryMap = await _dataDictionaryService.GetDictionaryByTypeId(DictConst.MaterialCatagoryID);
|
||||
}
|
||||
var regionMat = await _db.Queryable<BasRegionMat>().FirstAsync(it => it.region_code == regionCode && it.material_type == materialType);
|
||||
if (regionMat != null)
|
||||
{
|
||||
throw new AppFriendlyException($"区域:【{regionCode}】,物料:【{s_materialCategoryMap[materialType]?.ToString()}】已存在", 500);
|
||||
}
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
respTask = Task.FromResult(0);
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
|
||||
return await respTask;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -195,4 +195,9 @@ public class ModuleConsts
|
||||
/// 模块标识-在库物料维护
|
||||
/// </summary>
|
||||
public const string MODULE_WMSINSTKMIN_ID = "27124095468309";
|
||||
/// <summary>
|
||||
/// 模块标识-区域物料设定
|
||||
/// </summary>
|
||||
public const string MODULE_BASREGIONMAT_ID = "26187428200229";
|
||||
|
||||
}
|
||||
@@ -265,5 +265,7 @@
|
||||
/// 盘点任务计算状态-未结算
|
||||
/// </summary>
|
||||
public const string CLOSINGSTATUS_WJS_ID = "27674058079509";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ public partial class WmsElevatorH : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int status { get; set; }
|
||||
[SugarColumn(ColumnName = "status")]
|
||||
public int enable_mark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务数量
|
||||
|
||||
@@ -59,4 +59,11 @@ public partial class WmsElevatorH
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string device_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "status")]
|
||||
public int enable_mark { get; set; }
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Claims;
|
||||
using JNPF;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
@@ -300,6 +301,8 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 斑马打印
|
||||
/// <summary>
|
||||
/// 打印
|
||||
@@ -347,7 +350,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,7 +39,7 @@ 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";
|
||||
@@ -54,7 +56,7 @@ namespace Tnb.WarehouseMgr
|
||||
return sb.ToString();
|
||||
};
|
||||
|
||||
})).CreateLogger<T>();
|
||||
})).CreateLogger<TService>();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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