| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WCS.Application.Entity; |
| | | using static Elastic.Clients.Elasticsearch.JoinField; |
| | | using static SKIT.FlurlHttpClient.Wechat.Api.Models.CustomServiceKfSessionGetWaitCaseResponse.Types; |
| | | |
| | | namespace WCS.Application.Util; |
| | |
| | | /// <returns></returns> |
| | | public static List<CarModel> GetCarPathUp(List<CarModel> list, int moveType) |
| | | { |
| | | if (list == null) |
| | | { |
| | | return null; |
| | | } |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | if (i >= 0 && i < list.Count - 1) |
| | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="data">当前任务总路径</param> |
| | | /// <param name="kXCarList">所有小车</param> |
| | | /// <param name="assignCar">当前分配小车</param> |
| | | /// <param name="waitTask">当前总任务</param> |
| | | /// <param name="moveType">0去取货任务 1去放货</param> |
| | | /// <returns></returns> |
| | | public static bool AddCarTask(List<CarModel> data, List<CarInfo> kXCarList, CarInfo assignCar, WcsTask waitTask,int moveType) |
| | | { |
| | | #region 获取适合执行当前任务的小车 生成路径(需考虑小车阻阻挡) |
| | |
| | | var lastPath = lastPathList[lastPathList.Length - 2]; |
| | | var lastPath2 = lastPath.Substring(0,6); |
| | | |
| | | //如果此此分配路径包含醉舞中最终节点路径,添加移走小车 |
| | | //如果此此分配路径包含任务中最终节点路径,添加移走小车 |
| | | if (path.Contains(lastPath2)) |
| | | { |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取小车路径 |
| | | /// </summary> |
| | |
| | | |
| | | if (current.Equals(end)) |
| | | { |
| | | Log.Error(ReconstructPath(cameFrom, current).ToString()); |
| | | Log.Error("小车路径分配:" +ReconstructPath(cameFrom, current).ToString()); |
| | | return ReconstructPath(cameFrom, current); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取总任务表下发ID主键 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static int GetTaskId() |
| | | { |
| | | var list = _db.Queryable<WcsTask>().ToList(); |
| | | var maxNo = list.Max(m => m.TaskId); |
| | | |
| | | if (maxNo != null && maxNo > 0) |
| | | { |
| | | if (maxNo++ > 99999999) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | return (int)maxNo++; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 计算曼哈顿距离 |
| | | /// </summary> |
| | | /// <param name="start">起始位置</param> |