| | |
| | | { |
| | | private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="list">集合</param> |
| | | /// <param name="moveType">移动类型 0:移动 1:移货 </param> |
| | | /// <returns></returns> |
| | | public static List<CarModel> GetCarPathUp(List<CarModel> list,int moveType) |
| | | { |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | if (i > 0 && i < list.Count - 1) |
| | | { |
| | | if (list[i].X == list[i + 1].X) |
| | | { |
| | | list[i].NodeCom = 2; |
| | | } |
| | | else if (list[i].Y == list[i + 1].Y) |
| | | { |
| | | list[i].NodeCom = 3; |
| | | } |
| | | } |
| | | if (i== 0) |
| | | { |
| | | list[i].IsSendPlc = true; |
| | | if (moveType == 0) |
| | | { |
| | | if (list[i + 1] == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | list[i].NodeCom = 1; |
| | | } |
| | | } |
| | | if (i == list.Count-1) |
| | | { |
| | | list[i].IsSendPlc = true; |
| | | if (moveType == 0) |
| | | { |
| | | list[i].NodeCom = list[i + 1].NodeCom; |
| | | } |
| | | else |
| | | { |
| | | list[i].NodeCom = 4; |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取小车路径 |
| | | /// </summary> |
| | | /// <param name="startLocation">起始位置</param> |
| | | /// <param name="endLocation">目标位置</param> |
| | | /// <param name="moveType">移动类型 0:移动 1:取货 2:放货</param> |
| | | /// <param name="isLoad">是否载货0:未载货 1:已载货</param> |
| | | /// <returns></returns> |
| | | public static List<CarModel> GetCarPath(string startLocation, string endLocation, int moveType, string isLoad = "0") |
| | | public static List<CarModel> GetCarPath(string startLocation, string endLocation, string isLoad = "0") |
| | | { |
| | | if (string.IsNullOrEmpty(startLocation) || string.IsNullOrEmpty(endLocation)) |
| | | { |
| | |
| | | if (!gScore.ContainsKey(neighbor) || tentativeGScore < gScore[neighbor]) |
| | | { |
| | | neighbor.IsSendPlc = false; |
| | | // 补充参数 |
| | | if (neighbor.Equals(end)) |
| | | |
| | | //if (current.X == neighbor.X) |
| | | //{ |
| | | // current.NodeCom = 2; |
| | | //} |
| | | //else if (current.Y == neighbor.Y) |
| | | //{ |
| | | // current.NodeCom = 3; |
| | | //} |
| | | |
| | | //// 补充参数 |
| | | //if (current.Equals(start)) |
| | | //{ |
| | | // current.NodeCom = moveType; |
| | | // current.IsSendPlc = true; |
| | | //} |
| | | //if (neighbor.Equals(end)) |
| | | //{ |
| | | // //neighbor.NodeCom = moveType != 0 ? 2:0 ; |
| | | // if (moveType == 1) |
| | | // { |
| | | // neighbor.NodeCom = 4; |
| | | // } |
| | | // else |
| | | // { |
| | | // neighbor.NodeCom = current.NodeCom; |
| | | // } |
| | | |
| | | // neighbor.IsSendPlc = true; |
| | | //} |
| | | if (currentModel.Make != locationModel.Make) |
| | | { |
| | | neighbor.NodeCom = moveType; |
| | | neighbor.IsSendPlc = true; |
| | | } |
| | | else if (currentModel.Make != locationModel.Make) |
| | | { |
| | | if (current.X == neighbor.X) |
| | | { |
| | | neighbor.NodeCom = 3; |
| | | } |
| | | else if (current.Y == neighbor.Y) |
| | | { |
| | | neighbor.NodeCom = 2; |
| | | } |
| | | |
| | | neighbor.IsSendPlc = true; |
| | | } |
| | | |
| | | // 更新实际距离与预估距离 |
| | | cameFrom[neighbor] = current; |