Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<NoWarn>$(NoWarn);CS1570;CS1587;CS1591;CS8601;CS8602;CS8603;CS8618;</NoWarn>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
|
||||
@@ -20,5 +20,6 @@
|
||||
/// </summary>
|
||||
public string WriteTagUrl { get; set; }
|
||||
|
||||
public string Environment { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,5 +50,11 @@
|
||||
/// AGV心跳
|
||||
/// </summary>
|
||||
public const string AGVKeepalive = "AGVKeepalive";
|
||||
/// <summary>
|
||||
/// 运行环境名称
|
||||
/// </summary>
|
||||
public const string EnvironmentName = "TIANYI";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'" />
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" />
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\BasicData\Tnb.BasicData.Interfaces\Tnb.BasicData.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Entities\Tnb.EquipMgr.Entities.csproj" />
|
||||
|
||||
@@ -263,9 +263,12 @@ namespace Tnb.WarehouseMgr
|
||||
.Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) &&
|
||||
!it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
preTasks = preTasks.Where(it => !agvElevatorTasks.Select(x=>x.endlocation_code).Contains(it.endlocation_code)).ToList();
|
||||
|
||||
IEnumerable<WmsPretaskH?> firstEleGrp = agvElevatorTasks.GroupBy(g => g.endlocation_code).Select(t => t.OrderBy(o => o.bill_code).FirstOrDefault());
|
||||
agvElevatorTasks = agvElevatorTasks.FindAll(x => firstEleGrp.Select(y => y.endlocation_code).Contains(x.endlocation_code));
|
||||
preTasks = preTasks.Where(it => !it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase)).Concat(agvElevatorTasks).ToList();
|
||||
preTasks = preTasks.Concat(agvElevatorTasks).ToList();
|
||||
|
||||
|
||||
List<string> ids = preTasks.Select(x => x.id).Distinct().ToList();
|
||||
List<WmsPretaskCode>? preTaskCodes = await db.Queryable<WmsPretaskCode>().Where(it => ids.Contains(it.bill_id)).ToListAsync();
|
||||
@@ -382,38 +385,42 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
await db.Ado.CommitTranAsync();
|
||||
|
||||
//呼梯操作
|
||||
//获取目标库位为电梯库位的任务
|
||||
List<(string endlocation_code, string device_id, string id, string? start_floor)> endLocCodes = disTasks
|
||||
.Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) &&
|
||||
!it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase))
|
||||
.Select(it => (it.endlocation_code, it.device_id, it.id, it.start_floor)).ToList();
|
||||
if (endLocCodes?.Count > 0)
|
||||
if(_eleCtlCfg.Environment == ElevatorConsts.EnvironmentName)
|
||||
{
|
||||
|
||||
await CallingLanding(endLocCodes);
|
||||
}
|
||||
//执行电梯任务
|
||||
List<WmsDistaskH>? elevatorTasks = disTasks.Where(it => it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
|
||||
if (elevatorTasks?.Count > 0)
|
||||
{
|
||||
Logger.Information($"当前电梯任务数:{elevatorTasks?.Count ?? 0}");
|
||||
Logger.Information("准备执行电梯任务");
|
||||
Logger.Information("执行电梯任务");
|
||||
|
||||
foreach (WmsDistaskH? elevatorTask in elevatorTasks)
|
||||
//呼梯操作
|
||||
//获取目标库位为电梯库位的任务
|
||||
List<(string endlocation_code, string device_id, string id, string? start_floor)> endLocCodes = disTasks
|
||||
.Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) &&
|
||||
!it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase))
|
||||
.Select(it => (it.endlocation_code, it.device_id, it.id, it.start_floor)).ToList();
|
||||
if (endLocCodes?.Count > 0)
|
||||
{
|
||||
await ExecuteTargetFloorTask(elevatorTask);
|
||||
}
|
||||
|
||||
await CallingLanding(endLocCodes);
|
||||
}
|
||||
//执行电梯任务
|
||||
List<WmsDistaskH>? elevatorTasks = disTasks.Where(it => it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
|
||||
if (elevatorTasks?.Count > 0)
|
||||
{
|
||||
Logger.Information($"当前电梯任务数:{elevatorTasks?.Count ?? 0}");
|
||||
Logger.Information("准备执行电梯任务");
|
||||
Logger.Information("执行电梯任务");
|
||||
|
||||
foreach (WmsDistaskH? elevatorTask in elevatorTasks)
|
||||
{
|
||||
await ExecuteTargetFloorTask(elevatorTask);
|
||||
}
|
||||
|
||||
}
|
||||
////调用AGV创建任务链接口
|
||||
List<WmsDistaskH> agvTasks = disTasks.Where(it => !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
if (agvTasks?.Count > 0)
|
||||
{
|
||||
await AgvDispatch(agvTasks, agvCts.Token);
|
||||
}
|
||||
}
|
||||
////调用AGV创建任务链接口
|
||||
List<WmsDistaskH> agvTasks = disTasks.Where(it => !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
if (agvTasks?.Count > 0)
|
||||
{
|
||||
await AgvDispatch(agvTasks, agvCts.Token);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (ex is HttpRequestException hReqEx)
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
"token": "780BE4144636CF47DDF3920B0F1D069B",
|
||||
"GetTagListUrl": "http://192.168.11.110:9100/Dev/GetTagList",
|
||||
"GetTagUrl": "http://192.168.11.110:9100/Dev/GetTag",
|
||||
"WriteTagUrl": "http://192.168.11.110:9100/Dev/writeTag"
|
||||
"WriteTagUrl": "http://192.168.11.110:9100/Dev/writeTag",
|
||||
"Environment": ""
|
||||
}
|
||||
@@ -184,7 +184,10 @@ public static class StringExtensions
|
||||
|
||||
#endregion
|
||||
|
||||
public static (string, string) LastSplit(this string str, char seperate)
|
||||
/// <summary>
|
||||
/// 查找路径的上一级
|
||||
/// </summary>
|
||||
public static (string?, string) LastSplitOnce(this string str, char seperate)
|
||||
{
|
||||
int n = str.LastIndexOf(seperate);
|
||||
if (n > 0)
|
||||
@@ -193,7 +196,8 @@ public static class StringExtensions
|
||||
}
|
||||
else
|
||||
{
|
||||
return (str, null);
|
||||
return (null, str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,52 +8,57 @@ namespace Tnb.Vengine.Domain
|
||||
private readonly IDataAccess _dataAccess;
|
||||
private readonly Vmodel _root;
|
||||
private List<string> _outputs;
|
||||
private Dictionary<string, OutputSelect> _selectProps = new Dictionary<string, OutputSelect>();
|
||||
private Dictionary<string, VmSelect> _selectProps = new Dictionary<string, VmSelect>();
|
||||
private Dictionary<string, Vmodel?> _navModels = new Dictionary<string, Vmodel?>();
|
||||
public VmQueryParser(IDataAccess dataAccess, Vmodel rootModel, string output)
|
||||
{
|
||||
_dataAccess = dataAccess;
|
||||
_root = rootModel;
|
||||
_outputs = output.Split(',').Distinct().ToList();
|
||||
ParseOutputStr();
|
||||
ParseOutputStr(output);
|
||||
}
|
||||
/// <summary>
|
||||
/// 按模型组织要输出的属性
|
||||
/// </summary>
|
||||
private void ParseOutputStr()
|
||||
private void ParseOutputStr(string output)
|
||||
{
|
||||
_outputs = output.Split(',').Distinct().ToList();
|
||||
_selectProps.Add(Vmodel.MAIN_ALIES, new VmSelect() { navModel = _root });
|
||||
foreach (var outStr in _outputs)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(outStr))
|
||||
if (string.IsNullOrWhiteSpace(outStr)) continue;
|
||||
var codes = outStr.Split('.');
|
||||
if (codes.Length == 1)
|
||||
{
|
||||
_selectProps[Vmodel.MAIN_ALIES].propCodes.Add(outStr);
|
||||
continue;
|
||||
}
|
||||
string vmPath;
|
||||
int n = outStr.LastIndexOf('.');
|
||||
if (n < 1)
|
||||
var vmPath = "";
|
||||
for (int i = 0; i < codes.Length - 1; i++)
|
||||
{
|
||||
vmPath = Vmodel.MAIN_ALIES;
|
||||
vmPath = i == 0 ? codes[i] : vmPath + "." + codes[i];
|
||||
if (!_selectProps.ContainsKey(vmPath))
|
||||
{
|
||||
_selectProps.Add(vmPath, new VmSelect(vmPath, i + 2));
|
||||
}
|
||||
if (i == codes.Length - 2)
|
||||
{
|
||||
_selectProps[vmPath].propCodes.Add(codes[i + 1]);
|
||||
}
|
||||
}
|
||||
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 keys = _selectProps.Keys.Where(a => a != Vmodel.MAIN_ALIES).OrderBy(a => a).ToList();
|
||||
foreach (var selVm in _selectProps.Values)
|
||||
{
|
||||
//if(selVm.navModel != null)
|
||||
if (_navModels.ContainsKey(selVm.path))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
var navProps = _root.navProps.Where(a => _selectProps.Values.Any(b => b.vmPath.StartsWith(a.code + "."))).ToList();
|
||||
var navProps = _root.navProps.Where(a => _selectProps.Values.Any(b => b.path.StartsWith(a.code + "."))).ToList();
|
||||
await LoadVmodelNavigateAsync(navProps);
|
||||
}
|
||||
private async Task LoadVmodelNavigateAsync(List<VmNavProp> navProps)
|
||||
@@ -65,30 +70,30 @@ namespace Tnb.Vengine.Domain
|
||||
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();
|
||||
navProp.naviModel.navProps.Where(a => _selectProps.Values.Any(b => b.path.StartsWith(a.code + "."))).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal class OutputSelect
|
||||
internal class VmSelect
|
||||
{
|
||||
public Vmodel? navModel { get; set; }
|
||||
public string navPath { get; set; } = string.Empty;
|
||||
public string vmPath { get; set; } = string.Empty;
|
||||
public string path { get; set; } = Vmodel.MAIN_ALIES;
|
||||
public int level { get; set; } = 1;
|
||||
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 VmSelect()
|
||||
{
|
||||
|
||||
}
|
||||
public OutputSelect(Vmodel model)
|
||||
public VmSelect(string vmPath, int vmLevel)
|
||||
{
|
||||
vmPath = Vmodel.MAIN_ALIES;
|
||||
path = vmPath;
|
||||
level = vmLevel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -332,7 +332,7 @@ public partial class Vmodel : Entity
|
||||
if (navCode == VmSelectProp.MAIN_ALIES) continue;
|
||||
var navProp = navProps.First(a => a.code == navCode);
|
||||
if (navProp.naviModel == null || navProp.navType != eNavigateType.OneToOne) continue;
|
||||
JoinInfoParameter join = new JoinInfoParameter { TableName = navProp.naviModel.tableName, ShortName = navCode, Type = JoinType.Inner };
|
||||
JoinInfoParameter join = new JoinInfoParameter { TableName = navProp.naviModel.tableName, ShortName = navCode, Type = JoinType.Left };
|
||||
var fkField = navProp.naviModel.PropCodeToFieldCode(navProp.fkField);
|
||||
var refField = navProp.refField;
|
||||
if (navProp.refCode != VmSelectProp.MAIN_ALIES)
|
||||
|
||||
Reference in New Issue
Block a user