Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -163,6 +163,11 @@ public static class DictConst
|
||||
/// andon状态已完成
|
||||
/// </summary>
|
||||
public const string AndonStatusYWC = "5";
|
||||
|
||||
/// <summary>
|
||||
/// 产成品入库单
|
||||
/// </summary>
|
||||
public const string CHANCHENGPINRUKUDAN = "40";
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -207,5 +207,15 @@ public partial class EqpEquipment : BaseEntity<string>
|
||||
/// 二维码
|
||||
/// </summary>
|
||||
public string? qrcode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 挤出件类型
|
||||
/// </summary>
|
||||
public string? tube { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库库位id
|
||||
/// </summary>
|
||||
public string? as_location_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
public class InstockInput
|
||||
{
|
||||
public string equip_code { get; set; }
|
||||
public string as_location_code { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -126,5 +126,23 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// 实际完工日期
|
||||
/// </summary>
|
||||
public string? act_end_date { get; set; }
|
||||
/// <summary>
|
||||
/// 挤出件类型
|
||||
/// </summary>
|
||||
public string? tube { get; set; }
|
||||
/// <summary>
|
||||
/// 最小包装
|
||||
/// </summary>
|
||||
public decimal? minpacking { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主单位数量
|
||||
/// </summary>
|
||||
public string? main_num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 副单位数量(kg)
|
||||
/// </summary>
|
||||
public string? deputy_num { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -103,6 +103,11 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// 工位
|
||||
/// </summary>
|
||||
public string? station { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 料箱二维码
|
||||
/// </summary>
|
||||
public string material_box_qrcode { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,5 +124,10 @@ public partial class PrdReport : BaseEntity<string>
|
||||
/// 工序id
|
||||
/// </summary>
|
||||
public string? process_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 料箱编号
|
||||
/// </summary>
|
||||
public string material_box_code { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -21,5 +21,12 @@ namespace Tnb.ProductionMgr.Interfaces
|
||||
/// <param name="dic">source_id</param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> SyncInstock(Dictionary<string, string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 注塑满箱到位后入库申请
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> InstockTypeOne(InstockInput inut);
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using SQLitePCL;
|
||||
using SqlSugar.Extensions;
|
||||
|
||||
@@ -261,5 +262,132 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
return result.IsSuccess;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注塑满箱到位后入库申请
|
||||
/// </summary>
|
||||
/// <param name="inut"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> InstockTypeOne(InstockInput inut)
|
||||
{
|
||||
string equip_code = inut.equip_code;
|
||||
string as_location_code = inut.as_location_code;
|
||||
if (!string.IsNullOrEmpty(equip_code)) throw Oops.Bah("请传机台号");
|
||||
var db = _repository.AsSugarClient();
|
||||
EqpEquipment equipment = await db.Queryable<EqpEquipment>().Where(x => x.code == equip_code).FirstAsync();
|
||||
if(equipment==null ) throw Oops.Bah("未找到机台");
|
||||
if(string.IsNullOrEmpty(equipment.as_location_id)) throw Oops.Bah("未找到入库库位");
|
||||
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x=>x.id==equipment.as_location_id);
|
||||
if(basLocation==null) throw Oops.Bah("未找到入库库位");
|
||||
PrdReport prdReport = await db.Queryable<PrdReport>()
|
||||
.Where(x => x.equip_id == equipment.id && x.status == 0).OrderByDescending(x => x.create_time)
|
||||
.FirstAsync();
|
||||
if(prdReport==null) throw Oops.Bah("未找到提报记录");
|
||||
|
||||
PrdInstockH prdInstockH = null;
|
||||
List<PrdInstockD> prdInstockDs = new List<PrdInstockD>() { };
|
||||
DbResult<bool> result2 = new DbResult<bool>();
|
||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x=>x.id==prdReport.material_id);
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode);
|
||||
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorkshopCode);
|
||||
|
||||
prdInstockH = new PrdInstockH()
|
||||
{
|
||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||
bill_date = DateTime.Now,
|
||||
create_id = _userManager.UserId,
|
||||
location_code = basLocation.location_code,
|
||||
carry_code = prdReport.material_box_code,
|
||||
is_check = 1,
|
||||
station_id = prdReport.station,
|
||||
workline_id = workline?.Id ?? "",
|
||||
workshop_id = workshop?.Id ?? "",
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
warehouse_id = basLocation?.wh_id,
|
||||
status = 0,
|
||||
};
|
||||
|
||||
prdInstockDs.Add(new PrdInstockD()
|
||||
{
|
||||
instock_id = prdInstockH.id,
|
||||
report_id = prdReport.create_id,
|
||||
material_id = prdReport.material_id,
|
||||
material_code = basMaterial.code,
|
||||
unit_id = prdReport.unit_id,
|
||||
barcode = prdReport.barcode,
|
||||
code_batch = prdReport.barcode+"0001",
|
||||
quantity = (int)prdReport.reported_qty,
|
||||
});
|
||||
});
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput();
|
||||
mesCreateInstockInput.instock = new MESWmsInstockHInput()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
bill_date = DateTime.Now,
|
||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||
warehouse_id = basLocation?.wh_id,
|
||||
source_id = prdInstockH.id,
|
||||
create_id = _userManager.UserId,
|
||||
carry_code = prdReport.material_box_code,
|
||||
location_code = basLocation.location_code,
|
||||
is_check = 1,
|
||||
};
|
||||
mesCreateInstockInput.instockds = new List<MESWmsInstockDInput>();
|
||||
mesCreateInstockInput.instockcodes = new List<MESWmsInstockCodeInput>();
|
||||
mesCreateInstockInput.instockds.Add(new MESWmsInstockDInput()
|
||||
{
|
||||
material_id = prdReport.material_id,
|
||||
material_code = basMaterial.code,
|
||||
unit_id = prdReport.unit_id,
|
||||
code_batch = prdReport.barcode,
|
||||
pr_qty = (int)prdReport.reported_qty,
|
||||
});
|
||||
|
||||
mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput()
|
||||
{
|
||||
material_id = prdReport.material_id,
|
||||
material_code = basMaterial.code,
|
||||
unit_id = prdReport.unit_id,
|
||||
barcode = prdReport.barcode,
|
||||
code_batch = prdReport.barcode+"0001",
|
||||
codeqty = (int)prdReport.reported_qty,
|
||||
});
|
||||
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||
Dictionary<string, object> header = new Dictionary<string, object>()
|
||||
{
|
||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header);
|
||||
Log.Information(sendResult);
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if (authResponse.code != 200 || !authResponse.data.ObjToBool())
|
||||
{
|
||||
throw Oops.Bah(authResponse.msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
result2 = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.InsertAsync(prdInstockH);
|
||||
|
||||
if (prdInstockDs.Count > 0)
|
||||
{
|
||||
await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result2.IsSuccess ? "申请成功" : result2.ErrorMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -400,13 +400,14 @@ namespace Tnb.ProductionMgr
|
||||
.LeftJoin<PerProcessStandardsH>((a,b,c,d,e,f,g,h)=>a.material_id==h.output_material_id && a.eqp_id==h.equip_id && a.mold_id==h.molds_id && h.enabled==1)
|
||||
.LeftJoin<BasStandardTime>((a,b,c,d,e,f,g,h,i)=>a.process_id==i.process_id && i.enabled==1)
|
||||
.LeftJoin<PrdMo>((a,b,c,d,e,f,g,h,i,j)=>a.mo_id==j.id)
|
||||
.LeftJoin<BasMaterialUnit>((a,b,c,d,e,f,g,h,i,j,k)=>a.material_id==k.material_id && k.auxiliary_unit_id=="kg")
|
||||
.Where((a, b) => a.workstation_id == input.stationId && (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode || a.mo_task_status == DictConst.InProgressEnCode) )
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_code),a=>a.mo_task_code.Contains(mo_task_code))
|
||||
//.WhereIF(!string.IsNullOrEmpty(mo_task_status),a=>a.mo_task_status==mo_task_status)
|
||||
.WhereIF(statusList.Count>0,a=>statusList.Contains(a.mo_task_status))
|
||||
.WhereIF(status=="3" && start_time!=null,a=>a.act_end_date>=start_time)
|
||||
.WhereIF(status=="3" && end_time!=null,a=>a.act_end_date<=end_time)
|
||||
.Select((a, b, c, d, e,f,g,h,i,j) => new PADPackageTaskPageOutput
|
||||
.Select((a, b, c, d, e,f,g,h,i,j,k) => new PADPackageTaskPageOutput
|
||||
{
|
||||
id = a.id,
|
||||
mo_task_code = a.mo_task_code,
|
||||
@@ -443,6 +444,10 @@ namespace Tnb.ProductionMgr
|
||||
act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
act_end_date = a.act_end_date==null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
tube = f.tube,
|
||||
minpacking = b.minpacking,
|
||||
main_num = k.number_of_primary_unit,
|
||||
deputy_num = k.number_of_auxiliary_unit,
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
private IEventPublisher _eventPublisher;
|
||||
|
||||
|
||||
protected IEventPublisher EventPublisher
|
||||
{
|
||||
set { _eventPublisher = value; }
|
||||
@@ -107,6 +108,23 @@ namespace Tnb.WarehouseMgr
|
||||
return Task.FromResult(curUser);
|
||||
}
|
||||
|
||||
|
||||
protected Task SetUserEntity(IUserManager userManager, ClaimsPrincipal principal)
|
||||
=> Task.Run(() =>
|
||||
{
|
||||
FieldInfo fieldInfo = userManager.GetType().GetField("_user", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (fieldInfo != null)
|
||||
{
|
||||
fieldInfo.SetValue(userManager, principal);
|
||||
}
|
||||
});
|
||||
|
||||
protected Task InvokeGenPretaskExcute()
|
||||
{
|
||||
var wareHouseSvc =App.GetRequiredService<IWareHouseService>();
|
||||
return wareHouseSvc.GenTaskExecute();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断最终目标库位是否可以放置当前载具
|
||||
/// </summary>
|
||||
@@ -368,7 +386,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[NonAction]
|
||||
protected Task<Result> ToApiResult(HttpStatusCode statusCode, object data)
|
||||
protected Task<Result> ToApiResult(HttpStatusCode statusCode, object data)
|
||||
{
|
||||
Result result = new()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
using JNPF.Common.Configuration;
|
||||
using System.Reflection;
|
||||
using System.Security.Claims;
|
||||
using JNPF.Common.Configuration;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.DataEncryption;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.EventBus;
|
||||
using JNPF.TaskScheduler.Entitys;
|
||||
using NetTaste;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Core.EventBus.Constants;
|
||||
using Tnb.Common.Core.EventBus.Sources;
|
||||
@@ -19,12 +24,14 @@ public class TaskStatusChangeSubscriber : IEventSubscriber, ISingleton
|
||||
/// </summary>
|
||||
//private static SqlSugarScope? _sqlSugarClient;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
private readonly IWmskittingOutService _wmskittingOutService;
|
||||
/// <summary>
|
||||
/// 构造函数.
|
||||
/// </summary>
|
||||
public TaskStatusChangeSubscriber(IWareHouseService wareHouseService)
|
||||
public TaskStatusChangeSubscriber(IWareHouseService wareHouseService, IWmskittingOutService wmskittingOutService)
|
||||
{
|
||||
_wareHouseService = wareHouseService;
|
||||
_wmskittingOutService = wmskittingOutService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,13 +42,33 @@ public class TaskStatusChangeSubscriber : IEventSubscriber, ISingleton
|
||||
[EventSubscribe(EventSubscribeEventConsts.TASKSTATUSCHANGE_EVENTID)]
|
||||
public async Task Excute(EventHandlerExecutingContext context)
|
||||
{
|
||||
/*var claims = JWTEncryption.ReadJwtToken(UserManager.AsscessToken)?.Claims;
|
||||
ClaimsIdentity toKen = new ClaimsIdentity();
|
||||
foreach (Claim item in claims)
|
||||
{
|
||||
toKen.AddClaim(item);
|
||||
}
|
||||
var principal = new ClaimsPrincipal(toKen);
|
||||
FieldInfo fieldInfo = _userManager.GetType().GetField("_user", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (fieldInfo != null)
|
||||
{
|
||||
fieldInfo.SetValue(_userManager, principal);
|
||||
}*/
|
||||
|
||||
|
||||
var tscSource = (TaskStatusChangeSource)context.Source;
|
||||
switch (tscSource.Payload)
|
||||
{
|
||||
case nameof(_wareHouseService.GenTaskExecute):
|
||||
await _wareHouseService.GenTaskExecute();
|
||||
break;
|
||||
case nameof(_wmskittingOutService.KittingOutByAdd):
|
||||
await _wmskittingOutService.KittingOutByAdd();
|
||||
break;
|
||||
case nameof(_wmskittingOutService.KittingOutByIsToBeShipped):
|
||||
await _wmskittingOutService.KittingOutByIsToBeShipped();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
public class WareHouseBasedControllerActivator : IControllerActivator
|
||||
{
|
||||
public object Create(ControllerContext context)
|
||||
{
|
||||
if(context == null) { throw new ArgumentNullException("context"); }
|
||||
var controllerType = context.ActionDescriptor.ControllerTypeInfo.AsType();
|
||||
//获取Controller实例
|
||||
var controller =context.HttpContext.RequestServices.GetRequiredService(controllerType);
|
||||
//判断是否继承了自定义Controller基类
|
||||
//if(controller is BaseWareHouseService basedWhSvc)
|
||||
//{
|
||||
// basedWhSvc.WareHouseSrv = context.HttpContext.RequestServices.GetRequiredService<IWareHouseService>();
|
||||
//}
|
||||
return controller;
|
||||
|
||||
}
|
||||
|
||||
public void Release(ControllerContext context, object controller)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -47,17 +47,7 @@ namespace Tnb.WarehouseMgr
|
||||
private IEventPublisher _eventPublisher = default!;
|
||||
private ElevatorControlConfiguration _elevatorControlConfiguration = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private static Dictionary<string, Func<CancellationToken?, Task>> _timedFuncMap = new(StringComparer.OrdinalIgnoreCase);
|
||||
static TimedTaskBackgroundService()
|
||||
{
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// _timedFuncMap = App.EffectiveTypes.AsParallel().Where(t => !t.Namespace.IsNullOrWhiteSpace() && t.Namespace.Equals("Tnb.WarehouseMgr", StringComparison.OrdinalIgnoreCase)).SelectMany(t => t.GetMethods())
|
||||
// .Where(m => m.GetCustomAttribute<TimedAttribute>() != null)
|
||||
// .ToDictionary(x => x.Name, x =>
|
||||
// (Func<CancellationToken?, Task>)Delegate.CreateDelegate(typeof(Func<CancellationToken?, Task>), App.GetService(x.DeclaringType), x));
|
||||
//});
|
||||
}
|
||||
//private static Dictionary<string, Func<CancellationToken?, Task>> _timedFuncMap = new(StringComparer.OrdinalIgnoreCase);
|
||||
public TimedTaskBackgroundService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
@@ -66,30 +56,11 @@ namespace Tnb.WarehouseMgr
|
||||
protected override Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
IsStarted = true;
|
||||
//var queueTask = Task.Run(async () =>
|
||||
// {
|
||||
|
||||
// var channelReader = _serviceProvider.GetRequiredService<ITaskMessageNotify>().Reader;
|
||||
|
||||
// CancellationTokenSource? cts = new();
|
||||
|
||||
// while (channelReader != null && await channelReader.WaitToReadAsync())
|
||||
// {
|
||||
// while (channelReader.TryRead(out var message))
|
||||
// {
|
||||
// if (_timedFuncMap.ContainsKey(message.TaskName))
|
||||
// {
|
||||
// await _timedFuncMap[message.TaskName].Invoke(stoppingToken);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }, stoppingToken);
|
||||
|
||||
var timedTask = Task.Run(() =>
|
||||
{
|
||||
_eventPublisher = App.GetRequiredService<IEventPublisher>();
|
||||
var whSvc = App.GetRequiredService<IWareHouseService>();
|
||||
TimedTask(token => whSvc.GenTaskExecute(), stoppingToken, 1);
|
||||
|
||||
//电梯Agv心跳检测
|
||||
TimedTask(async token =>
|
||||
{
|
||||
@@ -130,6 +101,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
await action(ct).Catch(async ex =>
|
||||
{
|
||||
|
||||
if (ex is TimedTaskException timedTaskEx and not null)
|
||||
{
|
||||
await _eventPublisher.PublishAsync(new LogEventSource("Log:CreateExLog", timedTaskEx.options!, new SysLogEntity
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = CarryMoveIn;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace Tnb.WarehouseMgr
|
||||
finally
|
||||
{
|
||||
//向队列写入消息
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = CarryMoveOut;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Tnb.WarehouseMgr
|
||||
_runService = runService;
|
||||
_billRullService = billRullService;
|
||||
_userManager = userManager;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(row);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -204,7 +204,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = WmsEmptyIn;
|
||||
}
|
||||
private async Task<dynamic> WmsEmptyIn(VisualDevModelDataCrInput input)
|
||||
@@ -189,7 +189,7 @@ namespace Tnb.WarehouseMgr
|
||||
finally
|
||||
{
|
||||
//向队列写入消息
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = WmsEmptyOut;
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Tnb.WarehouseMgr
|
||||
_billRullService = billRullService;
|
||||
_wareHouseService = wareHouseService;
|
||||
_prdInstockService = prdInstockService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据入库申请单ID获取申请单明细信息
|
||||
@@ -482,7 +482,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return isSuccessFul;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = KittingInStk;
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
@@ -248,11 +248,8 @@ namespace Tnb.WarehouseMgr
|
||||
kittingOut.carry_id = kittingIn.carry_id;
|
||||
kittingOut.carry_code = kittingIn.carry_code;
|
||||
await _db.Updateable(kittingOut).UpdateColumns(it => new { it.status, it.carry_id, it.carry_code }).ExecuteCommandAsync();
|
||||
//if (kittingOut.status == WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID)
|
||||
//{
|
||||
// await Publish(nameof(IWmskittingOutService.KittingOutByIsToBeShipped));
|
||||
//}
|
||||
|
||||
await Publish(nameof(IWmskittingOutService.KittingOutByIsToBeShipped));
|
||||
}
|
||||
}
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Tnb.WarehouseMgr
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
_wmsCarryService = wmsCarryService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = CarryOutBale;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Tnb.WarehouseMgr
|
||||
_billRullService = billRullService;
|
||||
_wmsCarryMoveInStockService = wmsCarryMoveInStockService;
|
||||
_wareCarryService = wareCarryService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = OutStockApplyFor;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
@@ -767,7 +767,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return isSuccessful;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = PDACarryMoveIn;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Tnb.WarehouseMgr
|
||||
//}
|
||||
//finally
|
||||
//{
|
||||
// await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
// await InvokeGenPretaskExcute();
|
||||
//}
|
||||
//return Task.FromResult(true);
|
||||
#endregion
|
||||
@@ -276,7 +276,7 @@ namespace Tnb.WarehouseMgr
|
||||
finally
|
||||
{
|
||||
//向队列写入消息
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = PDACarryMoveOut;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Tnb.WarehouseMgr
|
||||
_billRullService = billRullService;
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -193,7 +193,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = PDAWmsEmptyIn;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = PDAWmsEmptyOut;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = ScanCodeInStock;
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = Inbale;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher= eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = PDAOutBale;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Tnb.WarehouseMgr
|
||||
_billRullService = billRullService;
|
||||
_wareHouseService = wareHouseService;
|
||||
_prdInstockService = prdInstockService;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
OverideFuncs.CreateAsync = ScanInStock;
|
||||
}
|
||||
public async Task<dynamic> ScanInStock(VisualDevModelDataCrInput input)
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = publisher;
|
||||
|
||||
OverideFuncs.CreateAsync = CarryTransfer;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Tnb.WarehouseMgr
|
||||
_warehouseService = warehouseService;
|
||||
_billRullService = billRullService;
|
||||
_wmsKittingInStkService = wmsKittingInStkService;
|
||||
EventPublisher = publisher;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 机器人完成任务后回调接口
|
||||
@@ -92,6 +92,11 @@ namespace Tnb.WarehouseMgr
|
||||
var kittingout = await _db.Queryable<WmsKittingoutH>().FirstAsync(it => it.collocation_scheme_id == carry.collocation_scheme_id && it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID);
|
||||
if (kittingout != null)
|
||||
{
|
||||
|
||||
await Publish(nameof(IWmskittingOutService.KittingOutByAdd));
|
||||
await Publish(nameof(IWmskittingOutService.KittingOutByIsToBeShipped));
|
||||
|
||||
|
||||
visualDevModelCrInput.data = new Dictionary<string, object>();
|
||||
visualDevModelCrInput.data[nameof(InStockStrategyQuery.warehouse_id)] = kittingout.warehouse_id;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.carry_id)] = input.carry_id;
|
||||
@@ -147,7 +152,8 @@ namespace Tnb.WarehouseMgr
|
||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||
genPreTaskAfterUpInput.LocationIds = new List<string> { carry.location_id! };
|
||||
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Tnb.WarehouseMgr
|
||||
_cacheManager = cacheManager;
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
EventPublisher = publisher;
|
||||
|
||||
//OverideFuncs.CreateAsync = Create;
|
||||
}
|
||||
|
||||
@@ -99,10 +99,11 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, Timed(Name = nameof(PackSortingByAdd))]
|
||||
public async Task PackSortingByAdd(CancellationToken? ct = default)
|
||||
{
|
||||
//if (UserManager.AsscessToken.IsNullOrWhiteSpace()) return;
|
||||
//var curUser = await GetUserIdentity();
|
||||
|
||||
//Console.WriteLine($"ThreadID:{Thread.CurrentThread.ManagedThreadId}\t Thread pool: {Thread.CurrentThread.IsThreadPoolThread}");
|
||||
if (_userManager.User.IsNull())
|
||||
{
|
||||
var curUser = await GetUserIdentity();
|
||||
await SetUserEntity(_userManager, curUser);
|
||||
}
|
||||
|
||||
var curDb = _db.CopyNew();
|
||||
|
||||
@@ -284,7 +285,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
//await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
EventPublisher = publisher;
|
||||
|
||||
OverideFuncs.CreateAsync = CarryTransfer;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
await InvokeGenPretaskExcute();;
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ namespace Tnb.WarehouseMgr
|
||||
_billRullService = billRullService;
|
||||
_carryService = carryService;
|
||||
_cacheManager = cacheManager;
|
||||
EventPublisher = eventPublisher;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 齐套出库(新增状态)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Timed(Name = nameof(KittingOutByAdd))]
|
||||
[HttpPost]
|
||||
public async Task KittingOutByAdd(CancellationToken? ct = default)
|
||||
{
|
||||
//if (ct?.IsCancellationRequested ?? false)
|
||||
@@ -121,7 +121,7 @@ namespace Tnb.WarehouseMgr
|
||||
ko.carry_id = firstCarry?.id;
|
||||
ko.carry_code = firstCarry?.carry_code;
|
||||
await _db.Updateable(ko).UpdateColumns(it => new { it.status, it.carry_id, it.carry_code }).ExecuteCommandAsync();
|
||||
//await KittingOutByIsToBeShipped();
|
||||
_ = KittingOutByIsToBeShipped();
|
||||
if (firstCarry != null)
|
||||
{
|
||||
firstCarry.source_id = ko.source_id;
|
||||
@@ -188,7 +188,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// 齐套出库,(待配送状态)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Timed(Name = nameof(KittingOutByIsToBeShipped))]
|
||||
[HttpPost]
|
||||
public async Task KittingOutByIsToBeShipped(CancellationToken? ct = default)
|
||||
{
|
||||
//if (UserManager.AsscessToken.IsNullOrWhiteSpace()) return;
|
||||
@@ -296,7 +296,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
//await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||
//await InvokeGenPretaskExcute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,8 @@
|
||||
"txt",
|
||||
"rar",
|
||||
"zip",
|
||||
"csv"
|
||||
"csv",
|
||||
"json"
|
||||
],
|
||||
//过滤上传文件名称特殊字符
|
||||
"SpecialString": [
|
||||
@@ -188,5 +189,5 @@
|
||||
"DoMainApp": "http://localhost:8081", // 前端App外网能访问的地址(域名), 回调的时候拼接接口地址用
|
||||
"AppPushUrl": "https://8e84eea8-6922-4033-8e86-67ad7442e692.bspapp.com/unipush"
|
||||
},
|
||||
"IsStartTimeJob": true //是否开启定时任务
|
||||
"IsStartTimeJob": false //是否开启定时任务
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using IGeekFan.AspNetCore.Knife4jUI;
|
||||
using System.Reflection;
|
||||
using IGeekFan.AspNetCore.Knife4jUI;
|
||||
using JNPF.API.Entry.Handlers;
|
||||
using JNPF.Common.Cache;
|
||||
using JNPF.Common.Core;
|
||||
@@ -62,15 +63,14 @@ public class Startup : AppStartup
|
||||
.AddSenparcWeixinServices(App.Configuration); // Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
|
||||
|
||||
services.AddOverideVisualDev();
|
||||
//注册任务消息通知 added by ly on 20230814
|
||||
//services.AddTaskMessageNotify();
|
||||
|
||||
SnowflakeIdHelper.InitYitIdWorker();
|
||||
//定时任务
|
||||
//services.AddHostedService<TimedTaskBackgroundService>();
|
||||
services.AddHostedService<TimedTaskBackgroundService>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
||||
{
|
||||
// 添加状态码拦截中间件
|
||||
@@ -115,7 +115,7 @@ public class Startup : AppStartup
|
||||
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
|
||||
//SnowflakeIdHelper.InitYitIdWorker();
|
||||
SnowflakeIdHelper.InitYitIdWorker();
|
||||
|
||||
bool isStartTimeJob = App.GetConfig<bool>("IsStartTimeJob");
|
||||
if (isStartTimeJob)
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Import Project="$(SolutionDir)\common.props" />
|
||||
<Import Project="$(SolutionDir)\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="logs\**" />
|
||||
<Content Remove="logs\**" />
|
||||
<EmbeddedResource Remove="logs\**" />
|
||||
<None Remove="logs\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="logs\**" />
|
||||
<Content Remove="logs\**" />
|
||||
<EmbeddedResource Remove="logs\**" />
|
||||
<None Remove="logs\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="wwwroot\Template\VengineSqlSugar\AppService.cshtml" />
|
||||
<None Include="wwwroot\Template\VengineSqlSugar\EntityDto.cshtml" />
|
||||
<None Include="wwwroot\Template\VengineSqlSugar\EntityDtoAcmen.cshtml" />
|
||||
<None Include="wwwroot\Template\VengineSqlSugar\EntityInfo.cshtml" />
|
||||
<None Include="wwwroot\Template\VengineSqlSugar\EntityInfoAcmen.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--<ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="wwwroot\Template\VengineSqlSugar\AppService.cshtml" />
|
||||
<None Include="wwwroot\Template\VengineSqlSugar\EntityDto.cshtml" />
|
||||
<None Include="wwwroot\Template\VengineSqlSugar\EntityDtoAcmen.cshtml" />
|
||||
<None Include="wwwroot\Template\VengineSqlSugar\EntityInfo.cshtml" />
|
||||
<None Include="wwwroot\Template\VengineSqlSugar\EntityInfoAcmen.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--<ItemGroup>
|
||||
<None Remove="lib\regworkerid_lib_v1.3.1\yitidgengo.dll" />
|
||||
<None Remove="lib\regworkerid_lib_v1.3.1\yitidgengo.so" />
|
||||
<None Remove="sensitive-words.txt" />
|
||||
@@ -35,38 +35,38 @@
|
||||
<EmbeddedResource Include="sensitive-words.txt" />
|
||||
</ItemGroup>-->
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IGeekFan.AspNetCore.Knife4jUI" Version="0.0.13" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IGeekFan.AspNetCore.Knife4jUI" Version="0.0.13" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\app\Tnb.Apps\Tnb.Apps.csproj" />
|
||||
<ProjectReference Include="..\..\BasicData\Tnb.BasicData\Tnb.BasicData.csproj" />
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr\Tnb.EquipMgr.csproj" />
|
||||
<ProjectReference Include="..\..\message\Tnb.Message\Tnb.Message.csproj" />
|
||||
<ProjectReference Include="..\..\PerMgr\Tnb.PerMgr\Tnb.PerMgr.csproj" />
|
||||
<ProjectReference Include="..\..\ProductionMgr\Tnb.ProductionMgr\Tnb.ProductionMgr.csproj" />
|
||||
<ProjectReference Include="..\..\QcMgr\Tnb.QcMgr\Tnb.QcMgr.csproj" />
|
||||
<ProjectReference Include="..\..\system\Tnb.OAuth\Tnb.OAuth.csproj" />
|
||||
<ProjectReference Include="..\..\system\Tnb.Systems\Tnb.Systems.csproj" />
|
||||
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.Vengine\Tnb.Vengine.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev\Tnb.VisualDev.csproj" />
|
||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr\Tnb.WarehouseMgr.csproj" />
|
||||
<ProjectReference Include="..\..\workflow\Tnb.WorkFlow\Tnb.WorkFlow.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\app\Tnb.Apps\Tnb.Apps.csproj" />
|
||||
<ProjectReference Include="..\..\BasicData\Tnb.BasicData\Tnb.BasicData.csproj" />
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr\Tnb.EquipMgr.csproj" />
|
||||
<ProjectReference Include="..\..\message\Tnb.Message\Tnb.Message.csproj" />
|
||||
<ProjectReference Include="..\..\PerMgr\Tnb.PerMgr\Tnb.PerMgr.csproj" />
|
||||
<ProjectReference Include="..\..\ProductionMgr\Tnb.ProductionMgr\Tnb.ProductionMgr.csproj" />
|
||||
<ProjectReference Include="..\..\QcMgr\Tnb.QcMgr\Tnb.QcMgr.csproj" />
|
||||
<ProjectReference Include="..\..\system\Tnb.OAuth\Tnb.OAuth.csproj" />
|
||||
<ProjectReference Include="..\..\system\Tnb.Systems\Tnb.Systems.csproj" />
|
||||
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.Vengine\Tnb.Vengine.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev\Tnb.VisualDev.csproj" />
|
||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr\Tnb.WarehouseMgr.csproj" />
|
||||
<ProjectReference Include="..\..\workflow\Tnb.WorkFlow\Tnb.WorkFlow.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot\Template\*.vm">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot\Template\*.vm">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="_install.bat">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="_install.bat">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -25,6 +25,21 @@ namespace Tnb.Common.Extension
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
public static async Task<T> Retry<T>(Func<Task<T>> task, int retries,
|
||||
TimeSpan delay, CancellationToken cts = default) =>
|
||||
await task().ContinueWith(async innerTask =>
|
||||
{
|
||||
cts.ThrowIfCancellationRequested();
|
||||
if (innerTask.Status != TaskStatus.Faulted)
|
||||
return innerTask.Result;
|
||||
if (retries == 0)
|
||||
throw innerTask.Exception ?? throw new Exception();
|
||||
await Task.Delay(delay, cts);
|
||||
return await Retry(task, retries - 1, delay, cts);
|
||||
}).Unwrap();
|
||||
|
||||
|
||||
|
||||
public static async Task Catch(this Task task, Func<Exception,Task> exceptionHandler)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using JNPF.Common.Extension;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace System;
|
||||
|
||||
@@ -183,4 +184,17 @@ public static class StringExtensions
|
||||
public static string ToCamel(this string str) => str.SplitWord().Select((a, i) => i == 0 ? a : a.UpperFirst()).JoinAsString("");
|
||||
|
||||
#endregion
|
||||
|
||||
public static (string, string) LastSplit(this string str, char seperate)
|
||||
{
|
||||
int n = str.LastIndexOf(seperate);
|
||||
if(n > 0)
|
||||
{
|
||||
return (str.Substring(0, n), str.Substring(n + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
return (str, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace Tnb.TaskScheduler.Listener
|
||||
/// <summary>
|
||||
/// 生成质检任务
|
||||
/// </summary>
|
||||
public class QcTaskTimeWorker : ISpareTimeWorker
|
||||
public class QcTaskTimeWorker //u: ISpareTimeWorker
|
||||
{
|
||||
private ISqlSugarRepository<QcCheckPlanH> repository => App.GetService<ISqlSugarRepository<QcCheckPlanH>>();
|
||||
private ITimeTaskService timeTaskService => App.GetService<ITimeTaskService>();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Security.Cryptography.Xml;
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.DependencyInjection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using SqlSugar;
|
||||
@@ -15,7 +17,7 @@ namespace Tnb.Vengine.DataAccess;
|
||||
public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
{
|
||||
private const int MAX_PAGE_SIZE = 1000;
|
||||
private ISqlSugarClient? _db;
|
||||
private static ISqlSugarClient? _db;
|
||||
|
||||
protected ISqlSugarClient Db
|
||||
{
|
||||
@@ -170,14 +172,18 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
private async Task LoadVmodelNavigateAsync(Vmodel vm)
|
||||
{
|
||||
Dictionary<string, Vmodel> dictVm = new();
|
||||
var vmids = vm.navProps.Select(a => a.vmid).Distinct().ToList();
|
||||
var ls = await Db.Queryable<Vmodel>().Where(a => vmids.Contains(a.id)).ToListAsync();
|
||||
var navs = ls.ToDictionary(a => a.id);
|
||||
foreach (var navProp in vm.navProps)
|
||||
{
|
||||
if (!dictVm.ContainsKey(navProp.vmid))
|
||||
{
|
||||
var navModel = await GetVmodelAsync(navProp.vmid);
|
||||
dictVm.Add(navProp.vmid, navModel);
|
||||
}
|
||||
navProp.naviModel = dictVm[navProp.vmid];
|
||||
navProp.naviModel = (Vmodel)navs.GetOrDefault(navProp.vmid);
|
||||
//if (!dictVm.ContainsKey(navProp.vmid))
|
||||
//{
|
||||
// var navModel = await GetVmodelAsync(navProp.vmid);
|
||||
// dictVm.Add(navProp.vmid, navModel);
|
||||
//}
|
||||
//navProp.naviModel = dictVm[navProp.vmid];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,10 +197,8 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
var selProps = vm.GetVmSelectProps(input.o);
|
||||
//处理导航属性联表
|
||||
List<JoinInfoParameter> joins = vm.GetJoinInfos(selProps);
|
||||
query.AddJoinInfo(joins);
|
||||
//if (joins.Count > 0)
|
||||
//{
|
||||
//}
|
||||
query.AddJoinInfo(joins);
|
||||
List<IConditionalModel> wheres = vm.GetConditionalModels(input.q);
|
||||
if (!string.IsNullOrEmpty(input.k))
|
||||
{
|
||||
@@ -208,10 +212,8 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
wheres.Add(new ConditionalCollections() { ConditionalList = lsCondition });
|
||||
}
|
||||
//处理查询参数
|
||||
query.Where(wheres);
|
||||
//if (wheres.Count > 0)
|
||||
//{
|
||||
//}
|
||||
query.Where(wheres);
|
||||
if (!string.IsNullOrEmpty(input.sort))
|
||||
{
|
||||
query.OrderBy(input.sort);
|
||||
@@ -229,7 +231,7 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
//组装输出对象
|
||||
foreach (var data in ls)
|
||||
{
|
||||
DObject ret = await NestedOutputAsync(vm, new DObject(data), selProps);
|
||||
DObject ret = await CombineOutputAsync(vm, new DObject(data), selProps);
|
||||
result.items.Add(ret);
|
||||
}
|
||||
|
||||
@@ -243,11 +245,12 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
/// <param name="src"></param>
|
||||
/// <param name="selProps"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<DObject> NestedOutputAsync(Vmodel vm, DObject src, List<VmSelectProp> selProps)
|
||||
private async Task<DObject> CombineOutputAsync(Vmodel vm, DObject src, List<VmSelectProp> selProps)
|
||||
{
|
||||
DObject ret = new();
|
||||
foreach (var prop in selProps)
|
||||
{
|
||||
// 加载主表字段
|
||||
if (prop.navType == eNavigateType.None || prop.navCode == VmSelectProp.MAIN_ALIES)
|
||||
{
|
||||
if (src.ContainsKey(prop.code))
|
||||
@@ -257,40 +260,14 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
}
|
||||
else
|
||||
{
|
||||
// 加载关联表字段
|
||||
if (prop.navType == eNavigateType.OneToOne)
|
||||
{
|
||||
//以 nav_prop的形式返回
|
||||
var key = prop.navCode + "_" + prop.code;
|
||||
ret.Add(key, src[key]);
|
||||
//以 nav.prop的形式返回
|
||||
//if (!ret.ContainsKey(prop.navCode))
|
||||
//{
|
||||
// ret.Add(prop.navCode, new DObject());
|
||||
//}
|
||||
//var key = prop.navCode + "_" + prop.code;
|
||||
//if (src.ContainsKey(key))
|
||||
//{
|
||||
// ((DObject)ret[prop.navCode]).Add(prop.code, src[key]);
|
||||
//}
|
||||
NestedOutput(vm, src, ret, prop);
|
||||
}
|
||||
else if (prop.navType == eNavigateType.OneToMany)
|
||||
{
|
||||
if (!ret.ContainsKey(prop.navCode))
|
||||
{
|
||||
ret.Add(prop.navCode, new List<DObject>());
|
||||
}
|
||||
var navProp = vm.navProps.First(a => a.code == prop.navCode);
|
||||
if (navProp != null && navProp.naviModel != null && src.ContainsKey(navProp.refField))
|
||||
{
|
||||
VmListInput input = new VmListInput();
|
||||
var fkProp = navProp.naviModel.FieldCodeToPropCode(navProp.fkField);
|
||||
if (!string.IsNullOrEmpty(fkProp))
|
||||
{
|
||||
input.q = new DObject(fkProp, src[navProp.refField]);
|
||||
input.o = string.Join(',', selProps.Where(a => a.navCode == prop.navCode).Select(a => a.code));
|
||||
ret[prop.navCode] = (await QueryDataAsync(navProp.naviModel, input)).items;
|
||||
}
|
||||
}
|
||||
await NestedOneToManyAsync(vm, src, ret, prop, selProps);
|
||||
}
|
||||
else if (prop.navType == eNavigateType.ManyToMany)
|
||||
{
|
||||
@@ -304,6 +281,50 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将一对一的关联表字段嵌入到返回值中
|
||||
/// </summary>
|
||||
private void NestedOutput(Vmodel vm, DObject src, DObject ret, VmSelectProp prop)
|
||||
{
|
||||
// 以 nav_prop的形式返回
|
||||
var key = prop.navCode + "_" + prop.code;
|
||||
ret.Add(key, src[key]);
|
||||
// 以 nav.prop的形式返回
|
||||
//if (!ret.ContainsKey(prop.navCode))
|
||||
//{
|
||||
// ret.Add(prop.navCode, new DObject());
|
||||
//}
|
||||
//var key = prop.navCode + "_" + prop.code;
|
||||
//if (src.ContainsKey(key))
|
||||
//{
|
||||
// ((DObject)ret[prop.navCode]).Add(prop.code, src[key]);
|
||||
//}
|
||||
}
|
||||
|
||||
private async Task NestedOneToManyAsync(Vmodel vm, DObject src, DObject ret, VmSelectProp prop, List<VmSelectProp> selProps)
|
||||
{
|
||||
// 在返回值中增加导航属性
|
||||
if (ret.ContainsKey(prop.navCode))
|
||||
{
|
||||
return;
|
||||
}
|
||||
ret.Add(prop.navCode, new List<DObject>());
|
||||
|
||||
// 找到导航属性的配置
|
||||
var navCfg = vm.navProps.First(a => a.code == prop.navCode);
|
||||
if (navCfg != null && navCfg.naviModel != null && src.ContainsKey(navCfg.refField) && navCfg.refCode == VmSelectProp.MAIN_ALIES)
|
||||
{
|
||||
VmListInput input = new VmListInput();
|
||||
var fkProp = navCfg.naviModel.FieldCodeToPropCode(navCfg.fkField);
|
||||
if (!string.IsNullOrEmpty(fkProp))
|
||||
{
|
||||
input.q = new DObject(fkProp, src[navCfg.refField]);
|
||||
input.o = string.Join(',', selProps.Where(a => a.navCode == prop.navCode).Select(a => a.code));
|
||||
ret[prop.navCode] = (await QueryDataAsync(navCfg.naviModel, input)).items;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增数据 默认方法
|
||||
/// </summary>
|
||||
|
||||
97
visualdev/Tnb.Vengine/Domain/OutputParser.cs
Normal file
97
visualdev/Tnb.Vengine/Domain/OutputParser.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Extension;
|
||||
using Tnb.Vengine.DataAccess;
|
||||
|
||||
namespace Tnb.Vengine.Domain
|
||||
{
|
||||
public class OutputParser
|
||||
{
|
||||
private readonly IDataAccess _dataAccess;
|
||||
private readonly Vmodel _root;
|
||||
private List<string> _outputs;
|
||||
private Dictionary<string, OutputSelect> _selectProps = new Dictionary<string, OutputSelect>();
|
||||
private Dictionary<string, Vmodel?> _navModels = new Dictionary<string, Vmodel?>();
|
||||
public OutputParser(IDataAccess dataAccess, Vmodel rootModel, string output)
|
||||
{
|
||||
_dataAccess = dataAccess;
|
||||
_root = rootModel;
|
||||
_outputs = output.Split(',').Distinct().ToList();
|
||||
ParseOutputStr();
|
||||
}
|
||||
/// <summary>
|
||||
/// 按模型组织要输出的属性
|
||||
/// </summary>
|
||||
private void ParseOutputStr()
|
||||
{
|
||||
foreach (var outStr in _outputs)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(outStr))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string vmPath;
|
||||
int n = outStr.LastIndexOf('.');
|
||||
if (n < 1)
|
||||
{
|
||||
vmPath = Vmodel.MAIN_ALIES;
|
||||
}
|
||||
else
|
||||
{
|
||||
vmPath = outStr.Substring(0, n);
|
||||
}
|
||||
if (!_selectProps.ContainsKey(vmPath))
|
||||
{
|
||||
_selectProps.Add(vmPath, new OutputSelect { navPaths = vmPath.Split(',').ToList(), vmPath = vmPath });
|
||||
}
|
||||
var outSelect = _selectProps[vmPath];
|
||||
outSelect.propCodes.Add(outStr.Substring(n + 1));
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadNavModel()
|
||||
{
|
||||
var navProps = _root.navProps.Where(a => _selectProps.Values.Any(b => b.vmPath.StartsWith(a.code + "."))).ToList();
|
||||
await LoadVmodelNavigateAsync(navProps);
|
||||
}
|
||||
private async Task LoadVmodelNavigateAsync(List<VmNavProp> navProps)
|
||||
{
|
||||
var db = _dataAccess.GetSqlSugar();
|
||||
|
||||
var vmids = navProps.Select(a => a.vmid).Distinct().ToList();
|
||||
var navs = await db.Queryable<Vmodel>().Where(a => vmids.Contains(a.id)).ToDictionaryAsync(a => a.id, a => a);
|
||||
foreach (var navProp in navProps)
|
||||
{
|
||||
navProp.naviModel = (Vmodel)navs.GetOrDefault(navProp.vmid);
|
||||
navProp.naviModel.navProps.Where(a => _selectProps.Values.Any(b => b.vmPath.StartsWith(a.code + "."))).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal class OutputSelect
|
||||
{
|
||||
public string vmId { get; set; } = string.Empty;
|
||||
public string vmCode { get; set; } = string.Empty;
|
||||
public string vmPath { get; set; } = string.Empty;
|
||||
public eNavigateType navType { get; set; } = eNavigateType.None;
|
||||
public List<string> navPaths { get; set; } = new List<string>();
|
||||
|
||||
public List<string> propCodes { get; set; } = new List<string>();
|
||||
public List<string> fieldCodes { get; set; } = new List<string>();
|
||||
|
||||
public OutputSelect()
|
||||
{
|
||||
|
||||
}
|
||||
public OutputSelect(Vmodel model)
|
||||
{
|
||||
vmId = model.id;
|
||||
vmCode = model.vmCode;
|
||||
vmPath = Vmodel.MAIN_ALIES;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,6 +164,7 @@ public class VmSelectProp
|
||||
public const string MAIN_ALIES = "m";
|
||||
public string code { get; set; } = string.Empty;
|
||||
public string field { get; set; } = string.Empty;
|
||||
public List<string> navPath { get; set; } = new List<string>();
|
||||
public string navCode { get; set; } = MAIN_ALIES;
|
||||
public ePropType propType { get; set; }
|
||||
public eNavigateType navType { get; set; }
|
||||
|
||||
@@ -111,7 +111,7 @@ public class VmDbProp : VmBaseProp
|
||||
/// 获取默认值文本
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public object? GetDefaultValueString()
|
||||
public string? GetDefaultValueString()
|
||||
{
|
||||
string val = "";
|
||||
if (!required) return val;
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace Tnb.Vengine.Domain;
|
||||
[SugarTable("sys_vmodel")]
|
||||
public partial class Vmodel : Entity
|
||||
{
|
||||
public const string MAIN_ALIES = "m";
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
@@ -146,7 +148,8 @@ public partial class Vmodel : Entity
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
//private Dictionary<string, string>? _mapField2Prop = null;
|
||||
//private Dictionary<string, string>? _mapProp2Field = null;
|
||||
/// <summary>
|
||||
/// 通过实体创建模型
|
||||
/// </summary>
|
||||
@@ -351,11 +354,30 @@ public partial class Vmodel : Entity
|
||||
if (filter == null) return wheres;
|
||||
foreach (var item in filter)
|
||||
{
|
||||
VmDbProp? prop = null;
|
||||
// TODO 按子表条件查询
|
||||
if (item.Key.Contains("."))
|
||||
{
|
||||
var codes = item.Key.Split('.');
|
||||
if (codes.Length >= 2)
|
||||
{
|
||||
var navProp = navProps.FirstOrDefault(a => a.code == codes[0]);
|
||||
if (navProp != null && navProp.naviModel != null)
|
||||
{
|
||||
var dbProp = navProp.naviModel.dbProps.FirstOrDefault(a => a.code == codes[1]);
|
||||
if (dbProp != null)
|
||||
{
|
||||
prop = new VmDbProp();
|
||||
prop.field = codes[0] + "." + dbProp.field;
|
||||
prop.csType = dbProp.csType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
prop = dbProps.FirstOrDefault(a => a.code == item.Key);
|
||||
}
|
||||
var prop = dbProps.FirstOrDefault(a => a.code == item.Key);
|
||||
if (prop == null) continue;
|
||||
if (item.Value is JArray val)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user