| | |
| | | public partial class TaskService |
| | | { |
| | | public string url = AppSettings.Configuration["WCS"]; |
| | | /// <summary> |
| | | /// PDAç³è¯·å
¥åº--å åæºç«åºå
¥åº |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="taskType">ä»»å¡ç±»å--å
¥ç©ºï¼å
¥æ</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent GenerateInboundTask(string stationCode, int taskType, string palletCode) |
| | | { |
| | | string? name = Enum.GetName(typeof(TaskTypeEnum), taskType); |
| | | MethodInfo? methodInfo = GetType().GetMethod(name + "Request"); |
| | | if (methodInfo != null) |
| | | { |
| | | WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { stationCode, palletCode }); |
| | | if (responseContent != null) |
| | | { |
| | | return responseContent; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°è¯¥ä»»å¡ç±»åä¸å¡"); |
| | | } |
| | | return WebResponseContent.Instance.Error($"é误"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空æçå
¥åº |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent PalletInboundRequest(string stationCode, string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | (bool, string) result = CheckRequestInbound(stationCode, palletCode, false); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | content = AssignLocUpdateData(stationCode, TaskTypeEnum.PalletInbound.ObjToInt(), palletCode, false); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error($"{ex.Message}"); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç©æå
¥åº |
| | |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskStatus = InTaskStatusEnum.InNew.ObjToInt(), |
| | | TaskType = taskType, |
| | | Depth= locationInfo.Depth, |
| | | Depth = locationInfo.Depth, |
| | | }; |
| | | BaseDal.AddData(task); |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | |
| | | } |
| | | else |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt(); |
| | | locationInfo.LocationStatus = StatusEnum.PalletLock.ObjToInt(); |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false); |
| | |
| | | task.Grade = 1; |
| | | } |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | |
| | | tasks.Add(task); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), orderNo, task.TaskNum); |
| | | |
| | |
| | | |
| | | return (true, "æå!"); |
| | | } |
| | | //private static readonly object text = new object(); |
| | | |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent InboundTask(SaveModel saveModel) |
| | | { |
| | | lock (text) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string stationcode = saveModel.MainData["stationcode"].ToString(); |
| | | string PalletCode = saveModel.MainData["PalletCode"].ToString();//éåºååºåï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ |
| | | //string PointName = saveModel.MainData["PointName"].ToString(); |
| | | if (stationcode == "" || PalletCode == "")//å¼å¸¸è¿åãããããã|| PointName == "" && x.PointName.Contains(PointName) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{"æ«ç æ°æ®ä¸è½ä¸ºç©º"}"); |
| | | } |
| | | Dt_CachePoint endCachePoint = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode.Contains("æååº") && x.PointStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt().ObjToInt()); |
| | | if (endCachePoint == null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{"æªæ¾å°æååºå¯ç¨åæ¾ç¼åæ¶"}"); |
| | | } |
| | | Dt_CachePoint point = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == stationcode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt());//&& x.Materialtype == PalletCode |
| | | if (point == null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{"æ«ç æ°æ®å¼å¸¸ï¼æªæ¾å°æ¤ç¼åæ¶æå·²ç¦ç¨"}"); |
| | | } |
| | | Dt_CachePoint points = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == stationcode && x.PointStatus == LocationStatusEnum.Free.ObjToInt()); |
| | | if (points == null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{"æ«ç æ°æ®å¼å¸¸ï¼æ¤ç¼åç¹å·²è¢«éå®"}"); |
| | | } |
| | | Dt_Task taskcode = BaseDal.QueryFirst(x => x.SourceAddress == stationcode || x.TargetAddress == stationcode); |
| | | if (taskcode != null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:该ç«ç¹å·²åå¨ä»»å¡"); |
| | | } |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | Dt_Task task = new Dt_Task() |
| | | { |
| | | CurrentAddress = "", |
| | | Grade = 1, |
| | | NextAddress = "", |
| | | PalletCode = "", |
| | | Roadway = "", |
| | | SourceAddress = stationcode, |
| | | TargetAddress = endCachePoint.PointCode, |
| | | TaskStatus = AGVTaskStatusEnum.AGV_Wait.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | Materialtype = PalletCode, |
| | | Depth = 1, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | }; |
| | | tasks.Add(task); |
| | | Repository.AddData(tasks); |
| | | HCJLock(task); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{ex.Message}"); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | | } |