WMS 库房业务,生成任务,任务执行
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Templates;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
@@ -16,9 +17,11 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
public class Dp
|
||||
{
|
||||
private HashSet<string> set = new HashSet<string>();
|
||||
private const int Max = int.MaxValue;
|
||||
private int Min = int.MaxValue;
|
||||
private int Deep = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 动态规划函数
|
||||
/// </summary>
|
||||
@@ -26,43 +29,46 @@ namespace Tnb.WarehouseMgr
|
||||
/// <param name="sPointId"></param>
|
||||
/// <param name="ePointId"></param>
|
||||
/// <returns></returns>
|
||||
public void DpFunc(List<WmsRoad> roads, List<WmsRoad> subRoads, List<string> pointIds, Dictionary<string, bool> isVisited, string sPointId, string ePointId)
|
||||
public void DpFunc(List<WmsRoad> roads, List<string> pointIds, Dictionary<string, bool> isVisited, string sPointId, string ePointId, dynamic ArrivedEpoint)
|
||||
{
|
||||
Deep++;
|
||||
|
||||
var sRoads = roads.FindAll(x => x.startpoint_id == sPointId).ToList();
|
||||
var sRoads_EPointIds = sRoads.Select(x => x.endpoint_id).ToList();
|
||||
|
||||
|
||||
if (!isVisited[sPointId])
|
||||
{
|
||||
Console.WriteLine($"code={roads.Find(x => x.startpoint_id == sPointId).startpoint_code}");
|
||||
pointIds.Add(sPointId);
|
||||
set.Add(roads.Find(x => x.startpoint_id == sPointId).startpoint_code);
|
||||
isVisited[sPointId] = true;
|
||||
}
|
||||
var eSubRoads = sRoads.FindAll(x => x.endpoint_id == ePointId);
|
||||
if (eSubRoads?.Count > 0)
|
||||
|
||||
if (sRoads_EPointIds.Contains(ePointId)) //判断是否到达终点
|
||||
{
|
||||
ArrivedEpoint.isArrivedEpoint = true;
|
||||
pointIds.Add(ePointId);
|
||||
Console.WriteLine($"Deep={Deep}");
|
||||
foreach (var kvp in isVisited)
|
||||
{
|
||||
isVisited[kvp.Key] = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
subRoads = roads.FindAll(x => sRoads_EPointIds.Contains(x.startpoint_id)).ToList();
|
||||
if (subRoads?.Count > 0 && !isVisited[sPointId])
|
||||
if (sRoads_EPointIds?.Count > 0)
|
||||
{
|
||||
isVisited[sPointId] = true;
|
||||
for (int i = 0; i < subRoads.Count; i++)
|
||||
var subRoads = roads.FindAll(x => sRoads_EPointIds.Contains(x.startpoint_id) && !isVisited[x.endpoint_id]);
|
||||
if (subRoads?.Count > 0)
|
||||
{
|
||||
var sIdx = subRoads[i].startpoint_id;
|
||||
if (!isVisited[sIdx])
|
||||
for (int i = 0; i < subRoads.Count; i++)
|
||||
{
|
||||
DpFunc(roads, subRoads, pointIds, isVisited, sIdx, ePointId);
|
||||
var sIdx = subRoads[i].startpoint_id;
|
||||
if (!isVisited[sIdx])
|
||||
{
|
||||
DpFunc(roads, pointIds, isVisited, sIdx, ePointId, ArrivedEpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!ArrivedEpoint.isArrivedEpoint)
|
||||
{
|
||||
pointIds.Remove(sPointId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user