| | |
| | | [Description("AGVå¾
æ§è¡")] |
| | | AGV_Execute = 300, |
| | | /// <summary> |
| | | /// AGVåè´§ä¸ |
| | | /// AGVåè´§å®æ |
| | | /// </summary> |
| | | [Description("AGVåè´§ä¸")] |
| | | AGV_Takeing = 305, |
| | | [Description("AGVåè´§å®æ")] |
| | | AGV_TakeFinish = 305, |
| | | /// <summary> |
| | | /// AGVæ§è¡ä¸ |
| | | /// </summary> |
| | |
| | | RGV_Executing = 510, |
| | | |
| | | /// <summary> |
| | | /// ç åæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("ç åæ§è¡ä¸")] |
| | | MD_Executing = 520, |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("ä»»å¡å®æ")] |
| | |
| | | /// </summary> |
| | | [Description("æåMESæåº")] |
| | | OutMesRworkProduct = 250, |
| | | |
| | | /// <summary> |
| | | /// å°å·åºåº |
| | | /// </summary> |
| | | [Description("å°å·åºåº")] |
| | | PrintOutbound = 310, |
| | | |
| | | /// <summary> |
| | | /// æ 纺å¸åºåº |
| | | /// </summary> |
| | | [Description("æ 纺å¸åºåº")] |
| | | OutWFB = 320, |
| | | |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | |
| | | EmptyProductBack = 630, |
| | | |
| | | /// <summary> |
| | | /// æåç å |
| | | /// </summary> |
| | | [Description("æåç å")] |
| | | ProductMD = 640, |
| | | |
| | | /// <summary> |
| | | /// å°å·åæåå
¥åº |
| | | /// </summary> |
| | | [Description("å°å·åæåå
¥åº")] |
| | | PrintInbound = 710, |
| | | |
| | | /// <summary> |
| | | /// å°å·åæä½æéåº |
| | | /// </summary> |
| | | [Description("å°å·åæä½æéåº")] |
| | | PrintBackInbound = 720, |
| | | |
| | | /// <summary> |
| | | /// å··éå
ç§»åº |
| | | /// </summary> |
| | | [Description("å··éå
ç§»åº")] |
| | |
| | | /// </summary> |
| | | public string ReceiveTaskID { get; set; } |
| | | /// <summary> |
| | | /// æ¹æ¬¡ |
| | | /// å°å¾å· |
| | | /// </summary> |
| | | public string WbCode { get; set; } |
| | | } |
| | |
| | | public class PointDetail |
| | | { |
| | | public string Code { get; set; } |
| | | public string Value { get; set; } |
| | | public string? Value { get; set; } |
| | | } |
| | | } |
| | |
| | | /// <param name="palletCode">æç</param> |
| | | /// <param name="sourceAddress">èµ·ç¹</param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestYLWMSTaskSimple(string palletCode, string sourceAddress); |
| | | WebResponseContent RequestYLWMSTaskSimple(string palletCode, string sourceAddress, int taskNum = 0); |
| | | |
| | | WebResponseContent AssignCPRoadwayNo(); |
| | | |
| | | // <summary> |
| | | /// 请æ±åæå
¥åºå··é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent AssignYLRoadwayNo(string palletCode); |
| | | /// <summary> |
| | | /// 请æ±å
¥åºä»»å¡ |
| | | /// </summary> |
| | |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// /// <param name="roadWay">å··é</param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress, string roadWay="", int taskType = 630); |
| | | WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress, string roadWay="", int taskType = 630,int taskNum=0,string targetAddress=""); |
| | | |
| | | /// <summary> |
| | | /// åWMSç³è¯·ä»»å¡ |
| | |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <returns></returns> |
| | | string? RequestAssignLocation(int taskNum, string roadwayNo); |
| | | |
| | | /// <summary> |
| | | /// åWMSç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="heightType">é«åº¦</param> |
| | | /// <returns></returns> |
| | | string? RequestAssignLocationByHeight(int taskNum, string roadwayNo, int heightType); |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æ |
| | |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_Tasks; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_Tasks.DBNames; |
| | | using static Dm.net.buffer.ByteArrayBuffer; |
| | | |
| | | namespace WIDESEAWCS_Server.Controllers |
| | | { |
| | |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | |
| | | public AGVController(IStationMangerRepository stationMangerRepository, ITaskService taskService, ITaskRepository taskRepository) |
| | | public AGVController(IStationMangerRepository stationMangerRepository, ITaskService taskService, ITaskRepository taskRepository,IRouterRepository routerRepository) |
| | | { |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _taskService = taskService; |
| | | _taskRepository = taskRepository; |
| | | _routerRepository = routerRepository; |
| | | } |
| | | |
| | | |
| | |
| | | if (task == null) throw new Exception("æªæ¾å°ä»»å¡"); |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | var content = TakeRequest(task.CurrentAddress); |
| | | if (!content.Status) |
| | | if (task.TaskState==TaskStatusEnum.AGV_Executing.ObjToInt())//åºåºåè´§è¯·æ± |
| | | { |
| | | throw new Exception(content.Message); |
| | | var content = TakeRequest(secureApplyModel.WbCode); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | | } |
| | | } |
| | | else//åºåºæ¾è´§è¯·æ± |
| | | { |
| | | var content = PutRequest(secureApplyModel.WbCode, task.PalletType); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var content = PutRequest(task.NextAddress, task.PalletType); |
| | | if (!content.Status) |
| | | if (task.TaskState == TaskStatusEnum.AGV_Executing.ObjToInt())//å
¥åºåè´§è¯·æ± |
| | | { |
| | | throw new Exception(content.Message); |
| | | var content = TakeRequest(secureApplyModel.WbCode); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | | } |
| | | } |
| | | else//å
¥åºæ¾è´§è¯·æ± |
| | | { |
| | | var content = PutRequest(secureApplyModel.WbCode, task.TaskNum); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | | } |
| | | } |
| | | } |
| | | task.TaskState = TaskStatusEnum.AGV_Puting.ObjToInt(); |
| | | var up = _taskRepository.UpdateData(task); |
| | | agvResponse.OK("æå","0"); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | switch (agvUpdateModel.GoodsState) |
| | | { |
| | | case "1"://åºåºæ ¹æ®è¿ä¸ªä¿¡å·å¤æåè´§å®æ |
| | | |
| | | //æ´æ°ä»»å¡ç¶æ |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_TakeFinish); |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | var content = TakeFinish(task.CurrentAddress); |
| | |
| | | { |
| | | throw new Exception(content.Message); |
| | | }; |
| | | return agvResponse.OK("æå", "0"); |
| | | } |
| | | break; |
| | | else |
| | | { |
| | | if (task.TaskType == TaskTypeEnum.PrintInbound.ObjToInt() || task.TaskType == TaskTypeEnum.PrintBackInbound.ObjToInt()) |
| | | { |
| | | var content = TakeFinish(task.CurrentAddress); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | | }; |
| | | } |
| | | } |
| | | return agvResponse.OK("æå", "0"); |
| | | case "2"://å
¥åºæ ¹æ®è¿ä¸ªä¿¡å·å¤ææ¾è´§å®æ |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | |
| | | { |
| | | throw new Exception($"{task.NextAddress}AGVç«å°æªå®ä¹"); |
| | | } |
| | | task.CurrentAddress = dt_Station.StationCode; |
| | | task.NextAddress = ""; |
| | | task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); |
| | | task.DeviceCode = dt_Station.StationDeviceCode; |
| | | var up = _taskRepository.UpdateData(task); |
| | | if (task.TaskType == TaskTypeEnum.PrintInbound.ObjToInt() || task.TaskType == TaskTypeEnum.PrintBackInbound.ObjToInt()) |
| | | { |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.NextAddress == x.StartPosi); |
| | | Dt_Router router = routers.FirstOrDefault(); |
| | | if (router == null) |
| | | { |
| | | throw new Exception($"ä»»å¡å·:{task.TaskNum}æªæ¾å°è·¯ç±é
置信æ¯"); |
| | | } |
| | | string oldAddress = task.NextAddress; |
| | | //æ´æ°ä»»å¡ç¶æ |
| | | task.CurrentAddress = router.NextPosi; |
| | | task.NextAddress = ""; |
| | | task.DeviceCode = router.ChildPosiDeviceCode; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Finish); |
| | | PutFinish(oldAddress, task.TaskNum); |
| | | } |
| | | else |
| | | { |
| | | task.CurrentAddress = dt_Station.StationCode; |
| | | task.NextAddress = ""; |
| | | task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); |
| | | task.DeviceCode = dt_Station.StationDeviceCode; |
| | | _taskRepository.UpdateData(task); |
| | | } |
| | | return agvResponse.OK("æå","0"); |
| | | } |
| | | else if(task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | else |
| | | { |
| | | _taskService.TaskCompleted(task.TaskNum); |
| | | if (task.TaskType==TaskTypeEnum.PrintOutbound.ObjToInt()) |
| | | { |
| | | PutFinish(task.NextAddress); |
| | | } |
| | | return agvResponse.OK("æå", "0"); |
| | | } |
| | | break; |
| | | default: |
| | | throw new Exception($"æªå®ä¹æ¹æ³åã{agvUpdateModel.TaskState}ã"); |
| | | } |
| | |
| | | agvResponse.Error(ex.Message); |
| | | } |
| | | return agvResponse; |
| | | //return _taskService.AgvUpdateTask(agvUpdateModel); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PutRequest"), AllowAnonymous] |
| | | public WebResponseContent PutRequest(string code, int palletType) |
| | | public WebResponseContent PutRequest(string code, int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == code); |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); |
| | | if (stationManger == null) |
| | | { |
| | | return content.Error($"æªæ¾å°ç«å°é
ç½®"); |
| | |
| | | |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | |
| | | short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode); |
| | | if (Command == 3) |
| | | if (device.DeviceCode.Contains("CP"))//æåè¾é线 |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode); |
| | | if (Command == 3) |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | else |
| | | else if (device.DeviceCode.Contains("Coveryor"))//æ¥é©³å° |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | bool RequestPut = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestPut, stationManger.StationDeviceCode); |
| | | if (!RequestPut) |
| | | { |
| | | otherDevice.SetValue(CoveryorDB.C_InTaskNum, taskNum, stationManger.StationDeviceCode); |
| | | otherDevice.SetValue(CoveryorDB.C_RequestPut, true, stationManger.StationDeviceCode); |
| | | Thread.Sleep(1000); |
| | | } |
| | | bool AllowFinish = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowFinish, stationManger.StationDeviceCode); |
| | | if (AllowFinish) |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | bool RequestPut = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_RequestPut, stationManger.StationDeviceCode); |
| | | if (!RequestPut) |
| | | { |
| | | otherDevice.SetValue(RetractDB.Ret_TargetAddress, Convert.ToInt16(stationManger.StationCode), stationManger.StationDeviceCode); |
| | | otherDevice.SetValue(RetractDB.Ret_RequestPut, true, stationManger.StationDeviceCode); |
| | | Thread.Sleep(1000); |
| | | } |
| | | bool AllowFinish = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowFinish, stationManger.StationDeviceCode); |
| | | if (AllowFinish) |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | /// <param name="code"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PutFinish"), AllowAnonymous] |
| | | public WebResponseContent PutFinish(string code) |
| | | public WebResponseContent PutFinish(string code,int taskNum=0) |
| | | { |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == code); |
| | | if (stationManger == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°é
ç½®"); |
| | |
| | | } |
| | | |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | otherDevice.SetValue(GroundStationDBName.W_PutFinish, true, stationManger.StationCode); |
| | | if (device.DeviceCode.Contains("Coveryor"))//æ¥é©³å° |
| | | { |
| | | otherDevice.SetValue(CoveryorDB.C_PutFinish, true, stationManger.StationDeviceCode); |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | otherDevice.SetValue(RetractDB.Ret_PutFinish, true, stationManger.StationDeviceCode); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == code); |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); |
| | | if (stationManger == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°é
ç½®{code}"); |
| | |
| | | |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | |
| | | short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode); |
| | | if (Command == 2) |
| | | if (otherDevice.DeviceCode.Contains("CP"))//æåè¾é线 |
| | | { |
| | | content.OK("å
许åæ"); |
| | | short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode); |
| | | if (Command == 2) |
| | | { |
| | | content.OK("å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢åæ"); |
| | | } |
| | | } |
| | | else |
| | | else if (device.DeviceCode.Contains("Coveryor"))//æ¥é©³å° |
| | | { |
| | | return content.Error("ç¦æ¢åæ"); |
| | | bool AllowTake = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowTake, stationManger.StationDeviceCode); |
| | | if (AllowTake) |
| | | { |
| | | content.OK("å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢åæ"); |
| | | } |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | bool AllowTake = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowTake, stationManger.StationDeviceCode); |
| | | if (AllowTake) |
| | | { |
| | | content.OK("å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢åæ"); |
| | | } |
| | | } |
| | | |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | otherDevice.SetValue(W_ConveyorLineCPDB.W_Command, 2, stationManger.StationCode); |
| | | } |
| | | else if (device.DeviceCode.Contains("Coveryor")) |
| | | { |
| | | otherDevice.SetValue(CoveryorDB.C_TakeFinish, true, stationManger.StationDeviceCode); |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | otherDevice.SetValue(RetractDB.Ret_TakeFinish, true, stationManger.StationDeviceCode); |
| | | } |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | }; |
| | | return Service.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | [HttpPost, HttpGet, Route("AssignCPRoadwayNo"), AllowAnonymous] |
| | | public WebResponseContent AssignCPRoadwayNo() |
| | | { |
| | | return Service.AssignCPRoadwayNo(); |
| | | } |
| | | /// <summary> |
| | | /// 请æ±å
¥åºä»»å¡ |
| | | /// </summary> |
| | |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList().Where(x => x >= 100 && x < 500).ToList(); |
| | | |
| | | public List<int> TaskRelocationTypes => typeof(TaskTypeEnum).GetEnumIndexList().Where(x => x >= 900 && x < 1000).ToList(); |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, ICacheService cacheService, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IApiInfoRepository apiInfoRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | |
| | | task.CurrentAddress = router.StartPosi; |
| | | task.NextAddress = router.NextPosi; |
| | | task.DeviceCode = router.ChildPosiDeviceCode; |
| | | if (task.TaskType == TaskTypeEnum.ProductMD.ObjToInt()) |
| | | { |
| | | task.TaskState = TaskStatusEnum.Line_Executing.ObjToInt(); |
| | | } |
| | | } |
| | | else //åºåº |
| | | { |
| | |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// /// <param name="roadWay">å··é</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestYLWMSTaskSimple(string palletCode, string sourceAddress) |
| | | public WebResponseContent RequestYLWMSTaskSimple(string palletCode, string sourceAddress,int taskNum=0) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/RequestYLWMSTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}"); |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/RequestYLWMSTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}&taskNum{taskNum}"); |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | // <summary> |
| | | /// è¯·æ±æåå
¥åºå··é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent AssignCPRoadwayNo() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/AssignCPRoadwayNo"); |
| | | |
| | | if (!responseStr.IsNullOrEmpty()) |
| | | { |
| | | content.OK("æå", responseStr); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | // <summary> |
| | | /// 请æ±åæå
¥åºå··é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent AssignYLRoadwayNo(string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/AssignYLRoadwayNo?palletCode={palletCode}"); |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | content = responseContent; |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | // <summary> |
| | | /// 请æ±å
¥åºä»»å¡ |
| | | /// </summary> |
| | |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// /// <param name="roadWay">å··é</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress, string roadWay="", int taskType=630) |
| | | public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress,string roadWay="", int taskType=630, int taskNum = 0, string targetAddress = "") |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | // { |
| | | WMSTaskDTO? taskDTO = new WMSTaskDTO() |
| | | { |
| | | Id = 1, |
| | | TaskNum = DateTime.Now.ToString("mmss").ObjToInt(), |
| | | TaskNum = taskNum ==0 ? DateTime.Now.ToString("mmss").ObjToInt(): taskNum, |
| | | PalletCode= palletCode, |
| | | RoadWay= roadWay ?? "", |
| | | RoadWay= roadWay, |
| | | TaskType= taskType, |
| | | PalletType=1, |
| | | TaskStatus=TaskStatusEnum.New.ObjToInt(), |
| | | TaskStatus= TaskStatusEnum.New.ObjToInt(), |
| | | SourceAddress= sourceAddress, |
| | | TargetAddress="", |
| | | WarehouseId=1, |
| | | TargetAddress= targetAddress, |
| | | WarehouseId=2, |
| | | Grade=0, |
| | | }; |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åWMSç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public string? RequestAssignLocationByHeight(int taskNum, string roadwayNo, int heightType) |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) throw new Exception("æªæ¾å°WMSApiå°å"); |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/AssignInboundTaskLocationByHeight?taskNum={taskNum}&roadwayNo={roadwayNo}&heightType={heightType}"); |
| | | |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | return responseContent.Data.ToString(); |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®è®¾å¤ç¼å·ãä»»å¡ç±»ååç»(å¯é)æç
§ä¼å
级以åå建æ¶é´æåºæ¥è¯¢ä»»å¡æ± æ°å¢çä»»å¡ |
| | | /// </summary> |
| | | /// <param name="deviceNo">设å¤ç¼å·</param> |
| | |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.SC_Execute, TaskOrderBy); |
| | | if (taskTypeGroup.Value == TaskTypeGroup.OutbondGroup) |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.SC_Execute, TaskOrderBy); |
| | | if (taskTypeGroup.Value == TaskTypeGroup.RelocationGroup) |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && TaskRelocationTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.SC_Execute, TaskOrderBy); |
| | | return null; |
| | | } |
| | | |
| | |
| | | ///7ï¼ç³è¯·ææ¡ |
| | | ///8ï¼ææ¡å°ä½ |
| | | ///9ï¼æ§è¡å½ä»¤ä¸ |
| | | ///11ï¼å¼å¸¸ |
| | | ///11ï¼æ»¡çåå¤ |
| | | /// </summary> |
| | | public short Command { get; set; } |
| | | /// <summary> |
| | |
| | | public short WR_Height { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç³è¯· |
| | | /// ç³è¯·<br/> |
| | | /// 86为ç³è¯· |
| | | /// </summary> |
| | | public short WR_Request { get; set; } |
| | | |
| | |
| | | /// </summary> |
| | | public short TaskReceivedDone { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥é©³å°ææ è´§ |
| | | /// </summary> |
| | | public class C_RequestTakeStatus |
| | | { |
| | | /// <summary> |
| | | /// æªç³è¯·åæ |
| | | /// </summary> |
| | | [BoolIndex(0)] |
| | | public bool NoTakeRequest { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å·²ç³è¯·åæ |
| | | /// </summary> |
| | | [BoolIndex(1)] |
| | | public bool OkTakeRequest { get; set; } |
| | | } |
| | | |
| | | public class CoveryorInfo : DeviceCommand |
| | | { |
| | | /// <summary> |
| | | /// ææ è´§ç¶æ |
| | | /// </summary> |
| | | public byte C_GoodsStatus { get; set; } |
| | | /// <summary> |
| | | /// æ
éç¶æ |
| | | /// </summary> |
| | | public short C_Error { get; set; } |
| | | /// <summary> |
| | | /// å
¥åºç³è¯·æ¾è´§ |
| | | /// </summary> |
| | | public byte C_RequestPut { get; set; } |
| | | /// <summary> |
| | | /// å
¥åºæ¾è´§å®æ |
| | | /// </summary> |
| | | public byte C_PutFinish { get; set; } |
| | | /// <summary> |
| | | /// å
¥åºå
许æ¾è´§ |
| | | /// </summary> |
| | | public byte C_AllowFinish { get; set; } |
| | | /// <summary> |
| | | /// åºåºç³è¯·åè´§ |
| | | /// </summary> |
| | | public byte C_RequestTake { get; set; } |
| | | /// <summary> |
| | | /// åºåºå
许åè´§ |
| | | /// </summary> |
| | | public byte C_AllowTake { get; set; } |
| | | /// <summary> |
| | | /// åºåºä»»å¡å· |
| | | /// </summary> |
| | | public int C_OutTaskNum { get; set; } |
| | | /// <summary> |
| | | /// åºåºç³è¯·ååº |
| | | /// </summary> |
| | | public byte C_OutResponse { get; set; } |
| | | /// <summary> |
| | | /// åºåºåæå®æ |
| | | /// </summary> |
| | | public byte C_TakeFinish { get; set; } |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡å· |
| | | /// </summary> |
| | | public int C_InTaskNum { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Tasks.DBNames |
| | | { |
| | | /// <summary> |
| | | /// æ¥é©³å°ä¿¡å· |
| | | /// </summary> |
| | | public enum CoveryorDB |
| | | { |
| | | /// <summary> |
| | | /// ææ è´§ç¶æ |
| | | /// </summary> |
| | | C_GoodsStatus, |
| | | /// <summary> |
| | | /// æ
éç¶æ |
| | | /// </summary> |
| | | C_Error, |
| | | /// <summary> |
| | | /// å
¥åºç³è¯·æ¾è´§ |
| | | /// </summary> |
| | | C_RequestPut, |
| | | /// <summary> |
| | | /// å
¥åºæ¾è´§å®æ |
| | | /// </summary> |
| | | C_PutFinish, |
| | | /// <summary> |
| | | /// å
¥åºå
许æ¾è´§ |
| | | /// </summary> |
| | | C_AllowFinish, |
| | | /// <summary> |
| | | /// åºåºç³è¯·åè´§ |
| | | /// </summary> |
| | | C_RequestTake, |
| | | /// <summary> |
| | | /// åºåºå
许åè´§ |
| | | /// </summary> |
| | | C_AllowTake, |
| | | /// <summary> |
| | | /// åºåºä»»å¡å· |
| | | /// </summary> |
| | | C_OutTaskNum, |
| | | /// <summary> |
| | | /// åºåºç³è¯·ååº |
| | | /// </summary> |
| | | C_OutResponse, |
| | | /// <summary> |
| | | /// åºåºåæå®æ |
| | | /// </summary> |
| | | C_TakeFinish, |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡å· |
| | | /// </summary> |
| | | C_InTaskNum, |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Tasks.DBNames |
| | | { |
| | | public enum R_MDDB |
| | | { |
| | | /// <summary> |
| | | /// 1å
许ç å |
| | | /// </summary> |
| | | R_MDAllow, |
| | | /// <summary> |
| | | /// ç å1ç¶æ<br/> |
| | | /// 1ç åä¸<br/> |
| | | /// 2ç å宿<br/> |
| | | /// 4ç 忏
æ<br/> |
| | | /// </summary> |
| | | R_MDStatus1, |
| | | /// <summary> |
| | | /// ç å2ç¶æ<br/> |
| | | /// 1ç åä¸<br/> |
| | | /// 2ç å宿<br/> |
| | | /// 4ç 忏
æ<br/> |
| | | /// </summary> |
| | | R_MDStatus2, |
| | | /// <summary> |
| | | /// ç å3ç¶æ<br/> |
| | | /// 1ç åä¸<br/> |
| | | /// 2ç å宿<br/> |
| | | /// 4ç 忏
æ<br/> |
| | | /// </summary> |
| | | R_MDStatus3, |
| | | /// <summary> |
| | | /// ç å4ç¶æ<br/> |
| | | /// 1ç åä¸<br/> |
| | | /// 2ç å宿<br/> |
| | | /// 4ç 忏
æ<br/> |
| | | /// </summary> |
| | | R_MDStatus4, |
| | | /// <summary> |
| | | /// ç å1æ°é |
| | | /// </summary> |
| | | R_MDQtys1, |
| | | /// <summary> |
| | | /// ç å2æ°é |
| | | /// </summary> |
| | | R_MDQtys2, |
| | | /// <summary> |
| | | /// ç å3æ°é |
| | | /// </summary> |
| | | R_MDQtys3, |
| | | /// <summary> |
| | | /// ç å4æ°é |
| | | /// </summary> |
| | | R_MDQtys4 |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Tasks.DBNames |
| | | { |
| | | /// <summary> |
| | | /// 伸缩货åä¿¡å· |
| | | /// </summary> |
| | | public enum RetractDB |
| | | { |
| | | /// <summary> |
| | | /// ææ è´§ç¶æ |
| | | /// </summary> |
| | | Ret_GoodsStatus, |
| | | /// <summary> |
| | | /// æ
éç¶æ |
| | | /// </summary> |
| | | Ret_Error, |
| | | /// <summary> |
| | | /// 䏿ç³è¯·æ¾è´§ |
| | | /// </summary> |
| | | Ret_RequestPut, |
| | | /// <summary> |
| | | /// 䏿æ¾è´§å®æ |
| | | /// </summary> |
| | | Ret_PutFinish, |
| | | /// <summary> |
| | | /// 䏿ç®çç«å° |
| | | /// </summary> |
| | | Ret_TargetAddress, |
| | | /// <summary> |
| | | /// 䏿å
许æ¾è´§ |
| | | /// </summary> |
| | | Ret_AllowFinish, |
| | | /// <summary> |
| | | /// 䏿ç³è¯·åè´§ |
| | | /// </summary> |
| | | Ret_RequestTake, |
| | | /// <summary> |
| | | /// 䏿å
许åè´§ |
| | | /// </summary> |
| | | Ret_AllowTake, |
| | | /// <summary> |
| | | /// ä¸ææ¥æºç«å° |
| | | /// </summary> |
| | | Ret_SourceAddress, |
| | | /// <summary> |
| | | /// 䏿ç³è¯·ååº |
| | | /// </summary> |
| | | Ret_OutResponse, |
| | | /// <summary> |
| | | /// 䏿åæå®æ |
| | | /// </summary> |
| | | Ret_TakeFinish |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Tasks.DBNames |
| | | { |
| | | public enum W_MDDB |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡ä¸åæ è¯ |
| | | /// </summary> |
| | | W_MDReceiveDone, |
| | | /// <summary> |
| | | /// ä»»å¡å·¥ä½1 |
| | | /// </summary> |
| | | W_MDSend1, |
| | | /// <summary> |
| | | /// ä»»å¡å·¥ä½2 |
| | | /// </summary> |
| | | W_MDSend2, |
| | | /// <summary> |
| | | /// ä»»å¡å·¥ä½3 |
| | | /// </summary> |
| | | W_MDSend3, |
| | | /// <summary> |
| | | /// ä»»å¡å·¥ä½4 |
| | | /// </summary> |
| | | W_MDSend4, |
| | | /// <summary> |
| | | /// ä»»å¡å·¥ä½å· |
| | | /// </summary> |
| | | W_MDSendID, |
| | | /// <summary> |
| | | /// ä»»å¡å·¥ä½X |
| | | /// </summary> |
| | | W_MDX, |
| | | /// <summary> |
| | | /// ä»»å¡å·¥ä½Y |
| | | /// </summary> |
| | | W_MDY, |
| | | /// <summary> |
| | | /// ä»»å¡å·¥ä½Z |
| | | /// </summary> |
| | | W_MDZ, |
| | | /// <summary> |
| | | /// ä»»å¡å·¥ä½A |
| | | /// </summary> |
| | | W_MDA |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.Helper; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.ConveyorLine.Enum; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_Tasks.DBNames; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class RetractYSJob : JobBase, IJob |
| | | { |
| | | private readonly ICacheService _cacheService; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IRouterExtension _routerExtension; |
| | | private readonly List<Dt_WarehouseDevice> warehouseDevices; |
| | | |
| | | public RetractYSJob(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension) |
| | | { |
| | | _cacheService = cacheService; |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _routerRepository = routerRepository; |
| | | _routerService = routerService; |
| | | _routerExtension = routerExtension; |
| | | |
| | | string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); |
| | | if (!string.IsNullOrEmpty(warehouseDevicesStr)) |
| | | { |
| | | warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); |
| | | } |
| | | else |
| | | { |
| | | warehouseDevices = new List<Dt_WarehouseDevice>(); |
| | | } |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value); |
| | | if (flag && value != null) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | foreach (var item in stationMangers) |
| | | { |
| | | //è·ååè®® |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationDeviceCode && x.DeviceProParamType == nameof(RetractDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (deviceProRead != null) |
| | | { |
| | | bool RequestTake = device.GetValue<RetractDB, bool>(RetractDB.Ret_RequestTake, item.StationDeviceCode); |
| | | short SourceAddress = device.GetValue<RetractDB, short>(RetractDB.Ret_SourceAddress, item.StationDeviceCode); |
| | | if (RequestTake && SourceAddress > 0) //䏿¥¼å°å·ä¸æç³è¯· |
| | | { |
| | | //è·åå½åä»»å¡ |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == SourceAddress.ToString() && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.DeviceCode== device.DeviceCode); |
| | | if (task != null) |
| | | { |
| | | //åé
å··é åå
¥æçæ°æ® |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.CurrentAddress == x.StartPosi && x.ChildPosi==device.DeviceCode); |
| | | Dt_Router router = routers.FirstOrDefault(); |
| | | if (router == null) |
| | | { |
| | | WriteError(item.StationName, $"ä»»å¡å·:{task.TaskNum}æªæ¾å°è·¯ç±é
置信æ¯"); |
| | | return Task.CompletedTask; |
| | | } |
| | | device.SetValue(RetractDB.Ret_OutResponse, true, item.StationDeviceCode); |
| | | //æ´æ°ä»»å¡ä¿¡æ¯ |
| | | task.DeviceCode = item.StackerCraneCode; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Execute); |
| | | WriteInfo(item.StationName, $"ä»»å¡å·{task.TaskNum}伸缩货å䏿"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°è®¾å¤åç¼å·{item.StationCode}çå议信æ¯"); |
| | | } |
| | | } |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
| | |
| | | device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode); |
| | | WriteInfo(item.StationCode, $"请æ±å
¥åºæ¡ç :{conveyorLineInfoRead.WR_TMID}"); |
| | | } |
| | | else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && !string.IsNullOrEmpty(conveyorLineInfoRead.WR_TMID)) //䏿¥¼åé
ç«å°å
¥åºåé
ç®æ ç¹ |
| | | else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && conveyorLineInfoRead.WR_Task <= 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.WR_TMID)) //䏿¥¼åé
ç«å°å
¥åºåé
ç®æ ç¹ |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == conveyorLineInfoRead.WR_TMID && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.DeviceCode == device.DeviceCode); |
| | | if (task == null) |
| | |
| | | device.SetValue(WR_CLineYLDB.WR_ToHode, task.NextAddress, item.StationCode); |
| | | device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | WriteInfo(item.StationCode, conveyorLineInfoRead.Serialize()); |
| | | WriteInfo(item.StationCode, $"{conveyorLineInfoRead.Serialize()}"); |
| | | } |
| | | } |
| | | else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && conveyorLineInfoRead.WR_Task > 0) //䏿¥¼åé
ç«å°å
¥åºåé
ç®æ ç¹ |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.WR_Task && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.AGV_Finish.ObjToInt() && x.DeviceCode == device.DeviceCode); |
| | | //åéä»»å¡ |
| | | if (task != null) |
| | | { |
| | | if (string.IsNullOrEmpty(task.Roadway) && string.IsNullOrEmpty(task.NextAddress)) |
| | | { |
| | | WebResponseContent content = _taskService.AssignYLRoadwayNo(task.PalletCode); |
| | | if (!content.Status) |
| | | { |
| | | WriteError(item.StationCode, $"请æ±å
¥åºå¤±è´¥ï¼{content.Message}"); |
| | | } |
| | | string roadWay = content.Data.ToString(); |
| | | //è·åè·¯ç±é
ç½® |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.CurrentAddress == x.StartPosi && x.ChildPosiDeviceCode== roadWay); |
| | | Dt_Router router = routers.FirstOrDefault(); |
| | | if (router == null) |
| | | { |
| | | WriteError(item.StationName, $"ä»»å¡å·:{task.TaskNum}æªæ¾å°è·¯ç±é
置信æ¯"); |
| | | return Task.CompletedTask; |
| | | } |
| | | task.Roadway = roadWay; |
| | | task.NextAddress = router.NextPosi; |
| | | _taskService.UpdateTask(task,TaskStatusEnum.AGV_Finish); |
| | | } |
| | | else |
| | | { |
| | | device.SetValue(WR_CLineYLDB.WR_Task, task.TaskNum, item.StationCode); |
| | | device.SetValue(WR_CLineYLDB.WR_ToHode, task.NextAddress, item.StationCode); |
| | | device.SetValue(WR_CLineYLDB.WR_Width, task.TaskLength, item.StationCode); |
| | | device.SetValue(WR_CLineYLDB.WR_TMID, task.PalletCode, item.StationCode); |
| | | device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | WriteInfo(item.StationCode, $"请æ±å
¥åºæå:{conveyorLineInfoRead.Serialize()}"); |
| | | } |
| | | } |
| | | } |
| | | else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode > 0 && conveyorLineInfoRead.WR_Request == 86 && !string.IsNullOrEmpty(conveyorLineInfoRead.WR_TMID) && conveyorLineInfoRead.WR_Task>0) //å
¥åºç«å°ç³è¯· |
| | |
| | | device.SetValue(WR_CLineYLDB.WR_TMID, task.PalletCode, item.StationCode); |
| | | device.SetValue(WR_CLineYLDB.WR_ToHode, task.NextAddress, item.StationCode); |
| | | device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode); |
| | | if (task.TaskType==TaskTypeEnum.OutPick.ObjToInt()) |
| | | { |
| | | task.Roadway = task.TargetAddress; |
| | | task.TargetAddress = ""; |
| | | task.TaskType=TaskTypeEnum.InPick.ObjToInt(); |
| | | } |
| | | _taskService.UpdateTask(task,TaskStatusEnum.Line_Executing); |
| | | WriteInfo(item.StationCode, $"ä»»å¡å·:{task.TaskNum}åºåºè³{task.NextAddress}"); |
| | | } |
| | | } |
| | | else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_Task > 0 && conveyorLineInfoRead.WR_Request == 98) //䏿¥¼èååºåºå£å®æ |
| | |
| | | commonStackerCrane.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal && commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | short stackerError = commonStackerCrane.Communicator.Read<short>("DB1000.54.0"); |
| | | if (stackerError==0) |
| | | { |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | { |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | commonStackerCrane.Communicator.Write("DB1000.20.0", true); |
| | | //å»¶æ¶1s |
| | | Thread.Sleep(1000); |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | commonStackerCrane.Communicator.Write("DB1000.20.0", true); |
| | | //å»¶æ¶1s |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum && x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è·¯ç±ä¿¡æ¯,{task.NextAddress}"); |
| | | } |
| | | int oldStatus = task.TaskState; |
| | | //todo å åæºå®æå®æ |
| | | // å åæºå®æ |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"ç³»ç»èªå¨æµç¨,ä»»å¡ç¶æä»ã{oldStatus}ã转å°ã{task.TaskState}ã"); |
| | | WriteInfo(deviceCode, $"å åæºåºåºä»»å¡å®æ,ä»»å¡å·:{taskNum}"); |
| | |
| | | /// <returns></returns> |
| | | private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane) |
| | | { |
| | | Dt_Task task; |
| | | Dt_Task? task; |
| | | if (commonStackerCrane.LastTaskType == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); |
| | |
| | | { |
| | | if (commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | //ä¸ä¸ä¸ªä¸ºåºåºåæ¥æ¯å¦åå¨å
¥åºä»»å¡ äº¤æ¿æ§è¡ |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | //ä¸ä¸ä¸ªä¸ºå
¥åºåæ¥æ¯å¦åå¨åºåºä»»å¡ äº¤æ¿æ§è¡ |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | //夿åºåºç«å°å ç¨ |
| | | if (OutTaskStationIsOccupied(task) == null) |
| | | { |
| | | bool flag = false; |
| | |
| | | } |
| | | } |
| | | } |
| | | task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | | task = _taskService.QuertStackerCraneTask(commonStackerCrane.DeviceCode, TaskTypeGroup.RelocationGroup); |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | |
| | | return null; |
| | | } |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)//夿æ¯å¦æ¯åºåºä»»å¡ |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | |
| | | return null; |
| | | } |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)//夿æ¯å¦æ¯ç§»åºä»»å¡ |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 5) |
| | |
| | | { |
| | | try |
| | | { |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()|| x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.DeviceCode=="AGV" && x.TaskType!=999).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()|| x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.DeviceCode=="AGV").ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | |
| | | if (newTasks.Count>0) |
| | | { |
| | |
| | | Code= "GoodPoint", |
| | | Value=stationMangerStart.AGVStationCode |
| | | }; |
| | | //夿æ¯å¦æåç½®ç¹ |
| | | if (!string.IsNullOrEmpty(stationMangerStart.AGVFrontCode)) |
| | | { |
| | | PointDetail pointDetail2 = new PointDetail() |
| | |
| | | Code = "PointB", |
| | | Value = stationMangerEnd.AGVStationCode |
| | | }; |
| | | if (!string.IsNullOrEmpty(stationMangerStart.AGVFrontCode)) |
| | | //夿æ¯å¦æåç½®ç¹ |
| | | if (!string.IsNullOrEmpty(stationMangerEnd.AGVFrontCode)) |
| | | { |
| | | PointDetail pointDetail4 = new PointDetail() |
| | | { |
| | |
| | | { |
| | | throw new Exception("æªæ¾å°AGVç«ç¹"); |
| | | } |
| | | if (!stationMangerStart.StationCode.Contains("PNT") && stationMangerEnd.StationCode.Contains("PNT")) |
| | | //忾任塿¨¡ç |
| | | if (stationMangerStart.StationCode.Contains("PNT") && !stationMangerEnd.StationCode.Contains("PNT"))//è¯·æ±æ¾ |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO1"; |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | | { |
| | | agvTaskSend.TaskCode = "DUOLUN1"; |
| | | } |
| | | } |
| | | else if (!stationMangerStart.StationCode.Contains("PNT") && stationMangerEnd.StationCode.Contains("PNT"))//请æ±å |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO2"; |
| | | if (stationMangerStart.StationType==998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | | { |
| | | agvTaskSend.TaskCode = "DUOLUN2"; |
| | | } |
| | | } |
| | | else if (!stationMangerStart.StationCode.Contains("PNT") && !stationMangerEnd.StationCode.Contains("PNT"))//请æ±åæ¾ |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO3"; |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | | { |
| | | agvTaskSend.TaskCode = "DUOLUN3"; |
| | | } |
| | | } |
| | | else if (stationMangerStart.StationCode.Contains("PNT") && stationMangerEnd.StationCode.Contains("PNT"))//æ è¯·æ± |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO4"; |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | | { |
| | | agvTaskSend.TaskCode = "DUOLUN4"; |
| | | } |
| | | } |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | | { |
| | | agvTaskSend.Variables.FirstOrDefault(x => x.Code == "FHMH").Value = "0"; |
| | | agvTaskSend.Variables.FirstOrDefault(x => x.Code == "GoodPoint").Value = ""; |
| | | //ä¸åä»»å¡AGVä»»å¡é群 |
| | | agvTaskSend.AgvGroupCode = "QianF"; |
| | | PointDetail pointDetail2 = new PointDetail() |
| | | { |
| | | Code = "CostPoint", |
| | | Value = stationMangerStart.AGVStationCode |
| | | }; |
| | | agvTaskSend.Variables.Add(pointDetail2); |
| | | } |
| | | //å»¶æ¶ |
| | | Thread.Sleep(500); |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(agvTaskSend, APIEnum.AgvSendTask); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); |
| | | Thread.Sleep(500); |
| | | Thread.Sleep(200); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | task.ExceptionMessage = ex.Message; |
| | | } |
| | | } |
| | | //æ´æ°ä»»å¡ |
| | | if (newTasks.Count > 0) |
| | | { |
| | | _taskService.UpdateData(newTasks); |
| | |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList(); |
| | | //è·åæåè®®çè¾é线-z |
| | | //è·åæåè®®çè¾é线 |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | //让æ¯ä¸ªè¾é线å¯å¨-z |
| | | foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode))) |
| | | { |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode); |
| | | if (task != null) |
| | | { |
| | | string local = ""; |
| | | //åé
è´§ä½ |
| | | if (task.HeightType==1) |
| | | string? local = _taskService.RequestAssignLocation(task.TaskNum, task.Roadway); |
| | | if (!string.IsNullOrEmpty(local)) |
| | | { |
| | | local = "SC02_CP-001-064-001-01"; |
| | | task.CurrentAddress = item.StackerCraneStationCode; |
| | | task.TargetAddress = local; |
| | | task.NextAddress = local; |
| | | task.DeviceCode = item.StackerCraneCode; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute); |
| | | WriteInfo(item.StationName, $"ä»»å¡å·:{task.TaskNum}è¿è¡å åæºå
¥åº"); |
| | | } |
| | | else if (task.HeightType == 2) |
| | | { |
| | | local = "SC02_CP-001-063-001-01"; |
| | | } |
| | | task.CurrentAddress = item.StackerCraneStationCode; |
| | | task.TargetAddress= local; |
| | | task.NextAddress = local; |
| | | task.DeviceCode = item.StackerCraneCode; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute); |
| | | WriteInfo(item.StationName, $"ä»»å¡å·:{task.TaskNum}è¿è¡å åæºå
¥åº"); |
| | | } |
| | | } |
| | | else if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo <= 0 && item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) //äºæ¥¼çº¿ä½åºåºç«å° |
| | |
| | | { |
| | | R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); |
| | | //äºæ¥¼å
¥åºæ«ç 请æ±å·¥ä½ |
| | | if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 5 && conveyorLineInfoRead.TaskNo > 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode)) |
| | | if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 5 && conveyorLineInfoRead.TaskNo > 0)//&& !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode) todo临æ¶å 餿¡ä»¶éå¶ |
| | | { |
| | | //æ¥æ¾å¯¹åºä»»å¡ |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode); |
| | | if (task != null) |
| | | { |
| | | //åé
å··é åå
¥æçæ°æ® |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, "SC02_CP", task.TaskType); |
| | | Dt_Router? router = routers.FirstOrDefault(); |
| | | if (routers == null || routers.Count == 0 || router == null) |
| | | string roadWay = _taskService.AssignCPRoadwayNo().Data.ToString(); |
| | | if (!string.IsNullOrEmpty(roadWay)) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºè·¯ç±ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, roadWay, task.TaskType); |
| | | Dt_Router? router = routers.FirstOrDefault(); |
| | | if (routers == null || routers.Count == 0 || router == null) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºè·¯ç±ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | if (routers.Count > 1) |
| | | { |
| | | WriteError(item.StationName, $"è·¯ç±ä¿¡æ¯é
ç½®é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | device.SetValue(W_ConveyorLineCPDB.W_TargetAddress, router.NextPosi, item.StationCode); |
| | | device.SetValue(W_ConveyorLineCPDB.W_TaskNo, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode); |
| | | task.CurrentAddress = item.StationCode; |
| | | task.NextAddress = router.NextPosi; |
| | | task.PalletCode = DateTime.Now.ToString("yyMMddHHmmss");//todoä¸´æ¶ |
| | | task.Roadway = roadWay; |
| | | task.DeviceCode = router.ChildPosiDeviceCode; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | WriteInfo(item.StationName, $"ä»»å¡å·{conveyorLineInfoRead.TaskNo}ä¸ä¸æ¥"); |
| | | } |
| | | if (routers.Count > 1) |
| | | { |
| | | WriteError(item.StationName, $"è·¯ç±ä¿¡æ¯é
ç½®é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | device.SetValue(W_ConveyorLineCPDB.W_TargetAddress, router.NextPosi, item.StationCode); |
| | | device.SetValue(W_ConveyorLineCPDB.W_TaskNo, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode); |
| | | task.CurrentAddress = item.StationCode; |
| | | task.NextAddress = router.NextPosi; |
| | | task.PalletType = 1; |
| | | task.PalletCode = conveyorLineInfoRead.PalletCode; |
| | | task.Roadway = "SC02_CP"; |
| | | task.DeviceCode = router.ChildPosiDeviceCode; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | WriteInfo(item.StationName, $"ä»»å¡å·{conveyorLineInfoRead.TaskNo}ä¸ä¸æ¥"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (task == null) |
| | | { |
| | | //è·åç«å°çæä»»å¡ |
| | | WebResponseContent content = _taskService.RequestWMSTaskSimple("", item.StationCode); |
| | | WebResponseContent content = _taskService.RequestWMSTaskSimple("", item.StationCode,taskType:TaskTypeEnum.InProduct.ObjToInt()); |
| | | if (content.Status) |
| | | { |
| | | Dt_Task taskNew = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && (x.TaskState == TaskStatusEnum.New.ObjToInt())); |
| | |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | if (conveyorLineInfoRead != null && conveyorLineInfoRead.StatusPV == 2 && conveyorLineInfoRead.Command == 10) |
| | | { |
| | | item.IsOccupied = 0; |
| | | } |
| | | else |
| | | { |
| | | item.IsOccupied = 1; |
| | | } |
| | | } |
| | | |
| | | } |
| | | _stationMangerRepository.UpdateData(stationMangers); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using Quartz; |
| | | using SqlSugar.Extensions; |
| | | using System; |
| | |
| | | //ç åç¯çº¿è¯·æ±ä»»å¡ |
| | | if (conveyorLineInfoRead != null && (conveyorLineInfoRead.R_State == 2 || conveyorLineInfoRead.R_State == 3) && conveyorLineInfoRead.R_TaskNo <= 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.R_BoxCode) && conveyorLineInfoRead.R_Request==1) |
| | | { |
| | | WebResponseContent content = _taskService.RequestWMSTaskSimple(conveyorLineInfoRead.R_BoxCode, item.StationCode); |
| | | //åWMS请æ±ä»»å¡ |
| | | if (true) |
| | | { |
| | | //WebResponseContent content = _taskService.RequestWMSTaskSimple(conveyorLineInfoRead.R_BoxCode, item.StationCode); |
| | | ////åWMS请æ±ä»»å¡ |
| | | //if (true) |
| | | //{ |
| | | |
| | | //} |
| | | if (conveyorLineInfoRead.R_BoxCode=="1") |
| | | { |
| | | int taskNum = Convert.ToInt32(DateTime.Now.ToString("ddHHmmss")); |
| | | WebResponseContent content = _taskService.RequestWMSTaskSimple(taskNum.ToString(), item.StationCode,taskType:TaskTypeEnum.ProductMD.ObjToInt(),taskNum: taskNum, targetAddress:"2554"); |
| | | //请æ±ä»»å¡ |
| | | if (content.Status) |
| | | { |
| | | //åå
¥åºåºçº¿ä½å°å |
| | | device.SetValue(W_CLineCPHDB.W_TaskNo, 5, item.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_TaskNo, taskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | //è·åç åå£ä»»å¡æ´æ°ä»»å¡ç¶æ |
| | | if (conveyorLineInfoRead != null && (conveyorLineInfoRead.R_State == 2 || conveyorLineInfoRead.R_State == 3) && conveyorLineInfoRead.R_TaskNo > 0) |
| | | { |
| | | |
| | | } |
| | | } |
| | | else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && deviceProRead != null) |
| | | { |
| | | R_CLineCPHInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_CLineCPHInfo>(deviceProRead.DeviceProAddress); |
| | | //ç åç¯çº¿æåºå£è¯·æ±åæ¶ä»»å¡ |
| | | if (conveyorLineInfoRead != null && (conveyorLineInfoRead.R_State == 2 || conveyorLineInfoRead.R_State == 3) && conveyorLineInfoRead.R_TaskNo > 0 && conveyorLineInfoRead.R_Request == 2) |
| | | { |
| | | |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.R_TaskNo && x.NextAddress==item.StationCode && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | task.CurrentAddress = item.StationCode; |
| | | task.NextAddress = task.TargetAddress; |
| | | task.DeviceCode = item.StackerCraneCode; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.MD_Executing); |
| | | } |
| | | } |
| | | } |
| | | else |
| | |
| | | W_RGVCPInfo rgvInfoWrite = device.Communicator.ReadCustomer<W_RGVCPInfo>(deviceProWrite.DeviceProAddress); |
| | | if ((rgvInfoRead.Mode == 5 || rgvInfoRead.Mode == 4) && rgvInfoRead.State == 0 && rgvInfoRead.TaskDone==1) |
| | | { |
| | | //è·åä»»å¡ æ¯å¦æRGVæ§è¡çä»»å¡ |
| | | List<Dt_Task> tasks = _taskRepository.QueryData(x => _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState != TaskStatusEnum.RGV_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode); |
| | | //è·åä»»å¡ |
| | | |
| | | Dt_Task? task1 = tasks.FirstOrDefault(x => x.HeightType == 1); |
| | | Dt_Task? task2 = tasks.FirstOrDefault(x => x.HeightType == 2); |
| | | Dt_Task? task3 = tasks.FirstOrDefault(x => x.HeightType == 3); |
| | | List<Dt_Task> tasksDown = _taskRepository.QueryData(x => _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.RGV_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode).OrderBy(x=>x.CreateDate).Take(3).ToList(); |
| | | //åé
RGVå·¥ä½ä»»å¡ |
| | | if (tasksDown.Count>=2) |
| | | if (tasksDown.Count>0) |
| | | { |
| | | device.SetValue(W_RgvCPDB.TaskType, 4); |
| | | //å ç¨ä¸¤ä¸ªå·¥ä½ |
| | | if (tasksDown.Count==2) |
| | | bool ReceivedDone = false; |
| | | //åé
RGVå·¥ä½ä»»å¡å ç¨ä¸ä¸ªå·¥ä½ |
| | | if (tasksDown.Count == 1) |
| | | { |
| | | device.SetValue(W_RgvCPDB.WorkStation, 4); |
| | | if (task1 == null) |
| | | { |
| | | //ä¸åæ§è¡å·¥ä½ |
| | | device.SetValue(W_RgvCPDB.WorkStation, 1); |
| | | device.SetValue(W_RgvCPDB.WcsTask1, tasksDown[0].TaskNum); |
| | | device.SetValue(W_RgvCPDB.Qu1, tasksDown[0].CurrentAddress); |
| | | device.SetValue(W_RgvCPDB.Fang1, tasksDown[0].NextAddress); |
| | | tasksDown[0].HeightType = 1; |
| | | _taskService.UpdateTask(tasksDown[0], TaskStatusEnum.RGV_Executing); |
| | | Thread.Sleep(100); |
| | | ReceivedDone=true; |
| | | } |
| | | if (task2 == null) |
| | | } |
| | | else if (tasksDown.Count == 2)//å ç¨ä¸¤ä¸ªå·¥ä½ |
| | | { |
| | | |
| | | if (task1 == null && task2 == null) |
| | | { |
| | | //ä¸åæ§è¡å·¥ä½ |
| | | device.SetValue(W_RgvCPDB.WorkStation, 4); |
| | | |
| | | device.SetValue(W_RgvCPDB.WcsTask1, tasksDown[0].TaskNum); |
| | | device.SetValue(W_RgvCPDB.Qu1, tasksDown[0].CurrentAddress); |
| | | device.SetValue(W_RgvCPDB.Fang1, tasksDown[0].NextAddress); |
| | | tasksDown[0].HeightType = 1; |
| | | _taskService.UpdateTask(tasksDown[0], TaskStatusEnum.RGV_Executing); |
| | | Thread.Sleep(100); |
| | | device.SetValue(W_RgvCPDB.WcsTask2, tasksDown[1].TaskNum); |
| | | device.SetValue(W_RgvCPDB.Qu2, tasksDown[1].CurrentAddress); |
| | | device.SetValue(W_RgvCPDB.Fang2, tasksDown[1].NextAddress); |
| | | tasksDown[1].HeightType = 2; |
| | | _taskService.UpdateTask(tasksDown[1], TaskStatusEnum.RGV_Executing); |
| | | Thread.Sleep(100); |
| | | ReceivedDone = true; |
| | | } |
| | | } |
| | | else //å ç¨ä¸ä¸ªå·¥ä½ |
| | | { |
| | | device.SetValue(W_RgvCPDB.WorkStation, 7); |
| | | if ( task1 == null) |
| | | if (task1 == null && task2 == null && task3 == null) |
| | | { |
| | | //ä¸åæ§è¡å·¥ä½ |
| | | device.SetValue(W_RgvCPDB.WorkStation, 7); |
| | | |
| | | device.SetValue(W_RgvCPDB.WcsTask1, tasksDown[0].TaskNum); |
| | | device.SetValue(W_RgvCPDB.Qu1, tasksDown[0].CurrentAddress); |
| | | device.SetValue(W_RgvCPDB.Fang1, tasksDown[0].NextAddress); |
| | | tasksDown[0].HeightType = 1; |
| | | _taskService.UpdateTask(tasksDown[0], TaskStatusEnum.RGV_Executing); |
| | | } |
| | | if (task2 == null) |
| | | { |
| | | Thread.Sleep(100); |
| | | device.SetValue(W_RgvCPDB.WcsTask2, tasksDown[1].TaskNum); |
| | | device.SetValue(W_RgvCPDB.Qu2, tasksDown[1].CurrentAddress); |
| | | device.SetValue(W_RgvCPDB.Fang2, tasksDown[1].NextAddress); |
| | | tasksDown[1].HeightType = 2; |
| | | _taskService.UpdateTask(tasksDown[1], TaskStatusEnum.RGV_Executing); |
| | | } |
| | | if (task3 == null) |
| | | { |
| | | Thread.Sleep(100); |
| | | device.SetValue(W_RgvCPDB.WcsTask3, tasksDown[2].TaskNum); |
| | | device.SetValue(W_RgvCPDB.Qu3, tasksDown[2].CurrentAddress); |
| | | device.SetValue(W_RgvCPDB.Fang3, tasksDown[2].NextAddress); |
| | | tasksDown[2].HeightType = 3; |
| | | _taskService.UpdateTask(tasksDown[2], TaskStatusEnum.RGV_Executing); |
| | | Thread.Sleep(100); |
| | | ReceivedDone = true; |
| | | } |
| | | } |
| | | device.SetValue(W_RgvCPDB.TaskReceivedDone, 1); |
| | | if (ReceivedDone) |
| | | { |
| | | device.SetValue(W_RgvCPDB.TaskType, 4); |
| | | device.SetValue(W_RgvCPDB.TaskReceivedDone, 1); |
| | | } |
| | | } |
| | | } |
| | | else if((rgvInfoRead.Mode == 5 || rgvInfoRead.Mode == 4) && rgvInfoRead.TaskDone == 3) |
| | |
| | | commonStackerCrane.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal && commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | short stackerError = commonStackerCrane.Communicator.Read<short>("DB1000.54.0"); |
| | | if (stackerError == 0) |
| | | { |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | { |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | commonStackerCrane.Communicator.Write("DB1000.20.0", true); |
| | | //å»¶æ¶1s |
| | | Thread.Sleep(1000); |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | commonStackerCrane.Communicator.Write("DB1000.20.0", true); |
| | | //å»¶æ¶1s |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum && x.TaskState==TaskStatusEnum.SC_Executing.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | |
| | | WriteError(deviceCode, $"æªæ¾å°è·¯ç±ä¿¡æ¯,{task.NextAddress}"); |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è·¯ç±ä¿¡æ¯,{task.NextAddress}"); |
| | | } |
| | | //å åæºå®æå®æ |
| | | int oldStatus = task.TaskState; |
| | | task.DeviceCode = stationManger.StationDeviceCode; |
| | | task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt(); |
| | | task.CurrentAddress = stationManger.StationCode; |
| | | task.NextAddress = router.NextPosi; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute); |
| | | //todo å åæºå®æå®æ |
| | | |
| | | //_taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi, targetAddress: router.NextPosi); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"ç³»ç»èªå¨æµç¨,ä»»å¡ç¶æä»ã{oldStatus}ã转å°ã{task.TaskState}ã"); |
| | | WriteInfo(deviceCode, $"å åæºä»»å¡å®æ,ä»»å¡å·:{taskNum}"); |
| | |
| | | { |
| | | if (commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | //ä¸ä¸ä¸ªä¸ºåºåºåæ¥æ¯å¦åå¨å
¥åºä»»å¡ äº¤æ¿æ§è¡ |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | //ä¸ä¸ä¸ªä¸ºå
¥åºåæ¥æ¯å¦åå¨åºåºä»»å¡ äº¤æ¿æ§è¡ |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | //夿åºåºç«å°å ç¨ |
| | | if (OutTaskStationIsOccupied(task) == null) |
| | | { |
| | | bool flag = false; |
| | |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode == task.DeviceCode); |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => (x.StationCode == task.NextAddress) && x.StackerCraneCode == task.DeviceCode); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | |
| | | return null; |
| | | } |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)//夿æ¯å¦æ¯åºåºä»»å¡ |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | |
| | | return null; |
| | | } |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)//夿æ¯å¦æ¯ç§»åºä»»å¡ |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 5) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.Helper; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.ConveyorLine.Enum; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_Tasks.DBNames; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class CoveryorJobYL : JobBase, IJob |
| | | { |
| | | private readonly ICacheService _cacheService; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IRouterExtension _routerExtension; |
| | | private readonly List<Dt_WarehouseDevice> warehouseDevices; |
| | | |
| | | public CoveryorJobYL(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension) |
| | | { |
| | | _cacheService = cacheService; |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _routerRepository = routerRepository; |
| | | _routerService = routerService; |
| | | _routerExtension = routerExtension; |
| | | |
| | | string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); |
| | | if (!string.IsNullOrEmpty(warehouseDevicesStr)) |
| | | { |
| | | warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); |
| | | } |
| | | else |
| | | { |
| | | warehouseDevices = new List<Dt_WarehouseDevice>(); |
| | | } |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value); |
| | | if (flag && value != null) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | foreach (var item in stationMangers) |
| | | { |
| | | //è·ååè®® |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationDeviceCode && x.DeviceProParamType == nameof(CoveryorDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (deviceProRead != null) |
| | | { |
| | | bool RequestTake = device.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestTake, item.StationDeviceCode); |
| | | int OutTaskNum = device.GetValue<CoveryorDB, int>(CoveryorDB.C_OutTaskNum, item.StationDeviceCode); |
| | | if (RequestTake && OutTaskNum>0) //䏿¥¼åºåºç³è¯· |
| | | { |
| | | //è·åå½åä»»å¡ |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum ==OutTaskNum && x.NextAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | //åé
å··é åå
¥æçæ°æ® |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.NextAddress == x.StartPosi); |
| | | Dt_Router router = routers.FirstOrDefault(); |
| | | if (router == null) |
| | | { |
| | | WriteError(item.StationName, $"ä»»å¡å·:{task.TaskNum}æªæ¾å°è·¯ç±é
置信æ¯"); |
| | | return Task.CompletedTask; |
| | | } |
| | | device.SetValue(CoveryorDB.C_OutResponse, true, item.StationDeviceCode); |
| | | //æ´æ°ä»»å¡ä¿¡æ¯ |
| | | task.CurrentAddress = router.StartPosi; |
| | | task.NextAddress = task.TargetAddress; |
| | | task.DeviceCode = router.NextPosi; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Execute); |
| | | WriteInfo(item.StationName, $"ä»»å¡å·{OutTaskNum}æ¥é©³å°åºåº"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°è®¾å¤åç¼å·{item.StationCode}çå议信æ¯"); |
| | | } |
| | | } |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.Helper; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.ConveyorLine.Enum; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_Tasks.DBNames; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class MDJob_CP : JobBase, IJob |
| | | { |
| | | private readonly ICacheService _cacheService; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IRouterExtension _routerExtension; |
| | | private readonly List<Dt_WarehouseDevice> warehouseDevices; |
| | | |
| | | public MDJob_CP(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension) |
| | | { |
| | | _cacheService = cacheService; |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _routerRepository = routerRepository; |
| | | _routerService = routerService; |
| | | _routerExtension = routerExtension; |
| | | |
| | | string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); |
| | | if (!string.IsNullOrEmpty(warehouseDevicesStr)) |
| | | { |
| | | warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); |
| | | } |
| | | else |
| | | { |
| | | warehouseDevices = new List<Dt_WarehouseDevice>(); |
| | | } |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value); |
| | | if (flag && value != null) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StackerCraneCode == device.DeviceCode); |
| | | foreach (var item in stationMangers) |
| | | { |
| | | //è·ååè®® |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StackerCraneCode && x.DeviceProParamType == nameof(R_MDDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StackerCraneCode && x.DeviceProParamType == nameof(W_MDDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (deviceProRead != null && deviceProWrite != null && item.IsOccupied==0) |
| | | { |
| | | short Allow = device.GetValue<R_MDDB, short>(R_MDDB.R_MDAllow, item.StackerCraneCode); |
| | | short R_MDStatus1 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus1, item.StackerCraneCode); |
| | | short R_MDStatus2 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus2, item.StackerCraneCode); |
| | | short R_MDStatus3 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus3, item.StackerCraneCode); |
| | | short R_MDStatus4 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus4, item.StackerCraneCode); |
| | | short R_MDQtys1 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDQtys1, item.StackerCraneCode); |
| | | short R_MDQtys2 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDQtys2, item.StackerCraneCode); |
| | | short R_MDQtys3 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDQtys3, item.StackerCraneCode); |
| | | short R_MDQtys4 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDQtys4, item.StackerCraneCode); |
| | | if (R_MDStatus1 == 1 || R_MDStatus2 == 1 || R_MDStatus3 == 1 || R_MDStatus4 == 1) |
| | | { |
| | | Thread.Sleep(500); |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDReceiveDone.ToString()).DeviceProDataBlock, 0); |
| | | } |
| | | //è·åå½åä»»å¡ |
| | | Dt_Task task = _taskRepository.QueryData(x => x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.MD_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode).OrderBy(x=>x.TaskNum).First(); |
| | | if (task!=null) //ç åç³è¯· |
| | | { |
| | | if ((Allow==3 || Allow == 7)&& item.StackerCraneStationCode == "1") |
| | | { |
| | | if ( R_MDQtys1 / 6 ==1) |
| | | { |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDZ.ToString()).DeviceProDataBlock, 400); |
| | | } |
| | | else if (R_MDQtys1 / 6 == 2) |
| | | { |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDZ.ToString()).DeviceProDataBlock, 800); |
| | | } |
| | | else |
| | | { |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDZ.ToString()).DeviceProDataBlock, 0); |
| | | } |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x=>x.DeviceProParamName== W_MDDB.W_MDSend1.ToString()).DeviceProDataBlock,1); |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDSendID.ToString()).DeviceProDataBlock, 1); |
| | | if (R_MDQtys1 % 6==0) |
| | | { |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDX.ToString()).DeviceProDataBlock, 1675); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDY.ToString()).DeviceProDataBlock, 1137); |
| | | } |
| | | else if (R_MDQtys1 % 6 == 1) |
| | | { |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDX.ToString()).DeviceProDataBlock, 1675); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDY.ToString()).DeviceProDataBlock, 1462); |
| | | } |
| | | else if (R_MDQtys1 % 6 == 2) |
| | | { |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDX.ToString()).DeviceProDataBlock, 1675); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDY.ToString()).DeviceProDataBlock, 1787); |
| | | } |
| | | else if (R_MDQtys1 % 6 == 3) |
| | | { |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDX.ToString()).DeviceProDataBlock, 1250); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDY.ToString()).DeviceProDataBlock, 1137); |
| | | } |
| | | else if (R_MDQtys1 % 6 == 4) |
| | | { |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDX.ToString()).DeviceProDataBlock, 1250); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDY.ToString()).DeviceProDataBlock, 1462); |
| | | } |
| | | else if (R_MDQtys1 % 6 == 5) |
| | | { |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDX.ToString()).DeviceProDataBlock, 1250); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDY.ToString()).DeviceProDataBlock, 1787); |
| | | } |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDA.ToString()).DeviceProDataBlock, 1); |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDReceiveDone.ToString()).DeviceProDataBlock, 3); |
| | | //æ´æ°ä»»å¡ä¿¡æ¯ |
| | | //_taskService.TaskCompleted(task.TaskNum); |
| | | task.TaskState = TaskStatusEnum.Finish.ObjToInt(); |
| | | _taskRepository.UpdateData(task); |
| | | Thread.Sleep(1500); |
| | | WriteInfo(item.StationName, $"ä»»å¡å·{task.TaskNum}ç å"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°è®¾å¤åç¼å·{item.StationCode}çå议信æ¯"); |
| | | } |
| | | } |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | public partial class LocationInfoService |
| | | { |
| | | |
| | | /// <summary> |
| | | /// åé
è´§ä½ |
| | | /// </summary> |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId, string beRelocationCode = "", int heightType = 0) |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); |
| | |
| | | SC_Finish = 220, |
| | | |
| | | /// <summary> |
| | | /// è¾é线å¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("è¾é线å¾
æ§è¡")] |
| | | Line_Execute = 400, |
| | | |
| | | /// <summary> |
| | | /// è¾é线æ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("è¾é线æ§è¡ä¸")] |
| | | Line_Executing = 410, |
| | | |
| | | /// <summary> |
| | | /// è¾éçº¿å®æ |
| | | /// </summary> |
| | | [Description("è¾éçº¿å®æ")] |
| | | Line_Finish = 420, |
| | | |
| | | /// <summary> |
| | | /// AGVå¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("AGVå¾
æ§è¡")] |
| | | AGV_Execute = 300, |
| | | |
| | | /// <summary> |
| | | /// AGVåè´§ä¸ |
| | | /// AGVåè´§å®æ |
| | | /// </summary> |
| | | [Description("AGVåè´§ä¸")] |
| | | AGV_Takeing =305, |
| | | [Description("AGVåè´§å®æ")] |
| | | AGV_TakeFinish = 305, |
| | | |
| | | /// <summary> |
| | | /// AGVæ§è¡ä¸ |
| | | /// </summary> |
| | |
| | | AGV_Finish = 330, |
| | | |
| | | /// <summary> |
| | | /// è¾é线å¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("è¾é线å¾
æ§è¡")] |
| | | Line_Execute = 400, |
| | | |
| | | /// <summary> |
| | | /// è¾é线æ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("è¾é线æ§è¡ä¸")] |
| | | Line_Executing = 410, |
| | | |
| | | /// <summary> |
| | | /// è¾éçº¿å®æ |
| | | /// </summary> |
| | | [Description("è¾éçº¿å®æ")] |
| | | Line_Finish = 420, |
| | | |
| | | /// <summary> |
| | | /// RGVå¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("RGVå¾
æ§è¡")] |
| | | RGV_Execute = 500, |
| | | /// <summary> |
| | | /// RGVæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("RGVæ§è¡ä¸")] |
| | | RGV_Executing = 510, |
| | | |
| | | /// <summary> |
| | | /// ç åæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("ç åæ§è¡ä¸")] |
| | | MD_Executing = 520, |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("ä»»å¡å®æ")] |
| | |
| | | /// </summary> |
| | | [Description("æåMESæåº")] |
| | | OutMesRworkProduct =250, |
| | | |
| | | /// <summary> |
| | | /// å°å·åºåº |
| | | /// </summary> |
| | | [Description("å°å·åºåº")] |
| | | PrintOutbound = 310, |
| | | |
| | | /// <summary> |
| | | /// æ 纺å¸åºåº |
| | | /// </summary> |
| | | [Description("æ 纺å¸åºåº")] |
| | | OutWFB = 320, |
| | | |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | | [Description("éè´å
¥åº")] |
| | | Inbound = 510, |
| | | |
| | | /// <summary> |
| | | /// çç¹å
¥åº |
| | | /// </summary> |
| | | [Description("çç¹å
¥åº")] |
| | | InInventory = 520, |
| | | |
| | | /// <summary> |
| | | /// 忣å
¥åº |
| | | /// </summary> |
| | | [Description("忣å
¥åº")] |
| | | InPick = 530, |
| | | |
| | | /// <summary> |
| | | /// è´¨æ£å
¥åº |
| | | /// </summary> |
| | |
| | | EmptyProductBack = 630, |
| | | |
| | | /// <summary> |
| | | /// æåç å |
| | | /// </summary> |
| | | [Description("æåç å")] |
| | | ProductMD = 640, |
| | | |
| | | /// <summary> |
| | | /// å°å·åæåå
¥åº |
| | | /// </summary> |
| | | [Description("å°å·åæåå
¥åº")] |
| | | PrintInbound = 710, |
| | | |
| | | /// <summary> |
| | | /// å°å·åæä½æéåº |
| | | /// </summary> |
| | | [Description("å°å·åæä½æéåº")] |
| | | PrintBackInbound = 720, |
| | | |
| | | /// <summary> |
| | | /// å··éå
ç§»åº |
| | | /// </summary> |
| | | [Description("å··éå
ç§»åº")] |
| | |
| | | /// <param name="Count"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestCPWMSTaskOut(int Count); |
| | | |
| | | /// <summary> |
| | | /// æ 纺å¸åºåº |
| | | /// </summary> |
| | | /// <param name="Count"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWFBWMSTaskOut(int Count); |
| | | |
| | | /// <summary> |
| | | /// åæåºåºä»»å¡ |
| | | /// </summary> |
| | |
| | | /// <param name="materielWide">ç©æå¹
宽</param> |
| | | /// <param name="Count">å·æ°</param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestYLWMSTaskOut(string materielCode, int materielWide, int Count); |
| | | WebResponseContent RequestYLWMSTaskOut(string materielCode, int materielWide, int Count, string address = ""); |
| | | |
| | | /// <summary> |
| | | /// åæç§»åº |
| | | /// </summary> |
| | | /// <param name="startAddress"></param> |
| | | /// <param name="endAddress"></param> |
| | | /// <param name="roadWay"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent IsRelocation(string startAddress, string endAddress, string roadWay); |
| | | /// <summary> |
| | | /// åæå··éé´ç§»åºä»»å¡ |
| | | /// </summary> |
| | | WebResponseContent RelocationRoadWay(string roadWay,int Count); |
| | | |
| | | /// <summary> |
| | | /// åé
å··é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | string AssignCPRoadwayNo(); |
| | | /// <summary> |
| | | /// å°å·ä½æéæä»»å¡ |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent PrintBackInbound(SaveModel saveModel); |
| | | |
| | | /// <summary> |
| | | /// å°å·ä¸æä»»å¡ |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent PrintInbound(SaveModel saveModel); |
| | | } |
| | | } |
| | |
| | | public string MdQtys { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç å䏿°éï¼å«å·²ç åï¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç å䏿°é")] |
| | | public string MdingQtys { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç åç»ææ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç åç»ææ°é")] |
| | | public string MdEndQtys { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 30, ColumnDescription = "åå·")] |
| | |
| | | Dt_Task wmsTask = BaseDal.QueryFirst(x=>x.TaskNum == task.TaskNum); |
| | | if (wmsTask != null) |
| | | { |
| | | wmsTask.PalletCode= task.PalletCode; |
| | | wmsTask.Roadway = task.Roadway; |
| | | wmsTask.TaskStatus = task.TaskState; |
| | | wmsTask.CurrentAddress = task.CurrentAddress; |
| | | wmsTask.NextAddress = task.NextAddress; |
| | | wmsTask.Dispatchertime = task.Dispatchertime; |
| | | wmsTask.TaskType = task.TaskType; |
| | | wmsTask.TargetAddress = task.TargetAddress; |
| | | BaseDal.UpdateData(wmsTask); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.MaterielEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestYLWMSTaskSimple(string stationCode, string palletCode) |
| | | { |
| | | Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (task != null) |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | PushTasksToWCS(new List<Dt_Task> { task }); |
| | | return WebResponseContent.Instance.OK($"该æçå·²çæä»»å¡", _mapper.Map<WMSTaskDTO>(task)); |
| | | } |
| | | Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (task != null) |
| | | { |
| | | PushTasksToWCS(new List<Dt_Task> { task }); |
| | | return content.OK($"该æçå·²çæä»»å¡", _mapper.Map<WMSTaskDTO>(task)); |
| | | } |
| | | |
| | | if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该ç«ç¹å·²ææªæ§è¡çä»»å¡"); |
| | | } |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | | string rowWay = AssignYLRoadwayNo(stockInfo.PalletCode); |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = palletCode, |
| | | Roadway = rowWay, |
| | | SourceAddress = stationCode, |
| | | TargetAddress = "", |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType, |
| | | }; |
| | | if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null) |
| | | { |
| | | return content.Error($"该ç«ç¹å·²ææªæ§è¡çä»»å¡"); |
| | | } |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (stockInfo == null) |
| | | { |
| | | return content.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | return content.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | | string rowWay = AssignYLRoadwayNo(stockInfo.PalletCode); |
| | | if (string.IsNullOrEmpty(rowWay)) |
| | | { |
| | | return content.Error($"æªæ¾å°å¯åé
å··é"); |
| | | } |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = palletCode, |
| | | Roadway = rowWay, |
| | | SourceAddress = stationCode, |
| | | TargetAddress = "", |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType, |
| | | }; |
| | | |
| | | if (stockInfo.StockStatus == StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(); |
| | | if (stockInfo.StockStatus == StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); |
| | | return content.OK(data: wMSTaskDTO); |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); |
| | | return WebResponseContent.Instance.OK(data: wMSTaskDTO); |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | public string AssignYLRoadwayNo(string palletCode) |
| | | { |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); |
| | | |
| | | if (stockInfo==null) |
| | | { |
| | | throw new Exception($"ç»çåºåä¸åå¨"); |
| | | } |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == stockInfo.WarehouseId); |
| | | |
| | | if (warehouse == null) |
| | |
| | | string roadwayNo = ""; |
| | | if (stockInfo.MaterielThickness > 800) |
| | | { |
| | | List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.RoadwayNo.Contains("YL")).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.RoadwayNo.Contains("YL")).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | roadwayNo = locationCounts.OrderByDescending(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; |
| | | if (stockInfo.MaterielWide > 2200) |
| | | { |
| | | locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && !x.RoadwayNo.Contains("SC01_YL")).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.RoadwayNo=="SC02_YL").GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | roadwayNo = locationCounts.OrderByDescending(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; |
| | | } |
| | | } |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½ä¿¡æ¯"); |
| | | } |
| | | Dt_AGVStationInfo agvstation = _agvStationInfoRepository.QueryFirst(x => x.AGVStationCode == task.SourceAddress && x.StationArea == AGVStationAreaEnum.AreaA.ObjToInt()); |
| | | Dt_AGVStationInfo agvstation = _agvStationInfoRepository.QueryFirst(x => x.AGVStationCode == task.SourceAddress && ( x.StationArea == AGVStationAreaEnum.AreaA.ObjToInt() || x.StationArea == AGVStationAreaEnum.AreaC.ObjToInt())); |
| | | if (agvstation != null) |
| | | { |
| | | agvstation.IsOccupied = WhetherEnum.False.ObjToInt(); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½ä¿¡æ¯"); |
| | | } |
| | | |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | if (task.TaskType == TaskTypeEnum.InPick.ObjToInt()) |
| | | { |
| | | Dt_LocationInfo locationInfoStart = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId); |
| | | } |
| | | stockInfo.LocationCode = locationInfoEnd.LocationCode; |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | |
| | | } |
| | | |
| | | string roadwayNo = ""; |
| | | List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.RoadwayNo.Contains("CP")).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | |
| | | //è·åå½åå
¥åºä»»å¡ä¸å·²åé
å··é任塿°é |
| | | List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.RoadwayNo.Contains("CP")).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | //çéå½åå
¥åºä»»å¡ä¸å·²åé
å··é任塿°é |
| | | List<LocationCount> useLocationCounts = Db.Queryable<Dt_Task>().Where(x => x.WarehouseId == warehouse.WarehouseId |
| | | && locationCounts.Select(j=>j.RoadwayNo).Contains(x.Roadway) |
| | | && TaskInboundTypes.Contains(x.TaskType)).GroupBy(x => x.Roadway).Select(x => new LocationCount { RoadwayNo = x.Roadway, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | |
| | | { |
| | | return WebResponseContent.Instance.OK(data: task.TargetAddress); |
| | | } |
| | | |
| | | //åé
è´§ä½ |
| | | Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, task.PalletType, task.WarehouseId); |
| | | if (locationInfo == null) |
| | | { |
| | |
| | | |
| | | |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | |
| | | //æ´æ°éå®è´§ä½ |
| | | _unitOfWorkManage.BeginTran(); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, task.PalletType, LocationStatusEnum.Lock, task.WarehouseId); |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | public readonly string[] OutStartPonits = { "5230", "5237", "5244" }; |
| | | /// <summary> |
| | | /// æå使éåºå
¥ä» |
| | | /// </summary> |
| | | /// <param name="barCode"></param> |
| | | /// <param name="startPoint"></param> |
| | | /// <returns></returns> |
| | | //public WebResponseContent BackProductTask(string barCode, string startPoint) |
| | | //{ |
| | | // WebResponseContent content = new WebResponseContent(); |
| | | // try |
| | | // { |
| | | // string palletCode = @"^C\d{5}$"; // æ£åè¡¨è¾¾å¼ |
| | | // bool isValid = Regex.IsMatch(barCode, palletCode); |
| | | // if (!isValid) |
| | | // { |
| | | // return content.Error($"æ¡ç æ ¼å¼é误{barCode}"); |
| | | // } |
| | | // if (!OutStartPonits.Contains(startPoint)) |
| | | // { |
| | | // return content.Error($"èµ·ç¹é误{startPoint}"); |
| | | // } |
| | | // //夿å½åç¹ä½æ¯å¦éå¤ |
| | | // Dt_Task taskOldPoint = BaseDal.QueryFirst(x=>x.SourceAddress==startPoint && (x.TaskStatus == TaskStatusEnum.New.ObjToInt()||x.TaskStatus==TaskStatusEnum.Line_Execute.ObjToInt()|| x.TaskStatus == TaskStatusEnum.Line_Executing.ObjToInt() || x.TaskStatus == TaskStatusEnum.AGV_Takeing.ObjToInt())); |
| | | // if (taskOldPoint != null) |
| | | // { |
| | | // return content.Error($"ç«ç¹{startPoint}å·²åå¨ä»»å¡"); |
| | | // } |
| | | // Dt_Task taskOld = BaseDal.QueryFirst(x => x.PalletCode == barCode); |
| | | // if (taskOld != null) |
| | | // { |
| | | // return content.Error($"è¶æ¡{barCode}ä»»å¡å·²åå¨"); |
| | | // } |
| | | // //è·åè¶æ¡ä½æ |
| | | // Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x=>x.PalletCode== barCode).Includes(x=>x.proStockInfoDetails).First(); |
| | | // if (proStockInfo==null) |
| | | // { |
| | | // return content.Error($"æªæ¾å°{barCode}è¶æ¡ä¿¡æ¯"); |
| | | // } |
| | | // if (proStockInfo.proStockInfoDetails==null || proStockInfo.proStockInfoDetails.Count<=0) |
| | | // { |
| | | // return content.Error($"{barCode}è¶æ¡ä¿¡æ¯ä¸ºç©º"); |
| | | // } |
| | | // if (proStockInfo.StockStatus!=StockStatusEmun.åºåºå®æ.ObjToInt()) |
| | | // { |
| | | // return content.Error($"{barCode}è¶æ¡ä¿¡æ¯ç¶æå¼å¸¸"); |
| | | // } |
| | | // //è·åæåå¹³åº |
| | | // Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString()); |
| | | // if (proStockInfo.WarehouseId != warehouse.WarehouseId && proStockInfo.LocationCode!= "æåå
è£
æ£è´§åº") |
| | | // { |
| | | // return content.Error($"{barCode}è¶æ¡ä¿¡æ¯ä¸å¨æ£è´§åº"); |
| | | // } |
| | | // //è·åå½åçåºå屿§ |
| | | // Dt_Warehouse? warePoint = null; |
| | | // switch (proStockInfo.ProStockAttribute) |
| | | // { |
| | | // case (int)ProStockAttributeEnum.æå: |
| | | // warePoint = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA71.ToString()); |
| | | // break; |
| | | // case (int)ProStockAttributeEnum.å°¾æ°: |
| | | // warePoint = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString()); |
| | | // break; |
| | | // case (int)ProStockAttributeEnum.ç å: |
| | | // warePoint = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA73.ToString()); |
| | | // break; |
| | | // default: |
| | | // throw new Exception($"æªæ¾å°{barCode}è¶æ¡ä¿¡æ¯åºå屿§"); |
| | | // } |
| | | // Dt_Warehouse warehouseLocation = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA71.ToString()); |
| | | // Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouseLocation.WarehouseId); |
| | | // if (locationInfo == null) |
| | | // { |
| | | // return content.Error($"æªæ¾å°{warehouse.WarehouseCode}è´§ä½ä¿¡æ¯"); |
| | | // } |
| | | // proStockInfo.StockStatus = StockStatusEmun.æå使ååº.ObjToInt(); |
| | | // proStockInfo.proStockInfoDetails.ForEach(x => |
| | | // { |
| | | // x.ProOutDetailStatus = StockStatusEmun.æå使ååº.ObjToInt(); |
| | | // }); |
| | | // Dt_Task newTask = new Dt_Task() |
| | | // { |
| | | // CurrentAddress = startPoint, |
| | | // Grade = 0, |
| | | // NextAddress = "", |
| | | // PalletCode = proStockInfo.PalletCode, |
| | | // Roadway = locationInfo.RoadwayNo, |
| | | // SourceAddress = startPoint, |
| | | // TargetAddress = "", |
| | | // TaskType = TaskTypeEnum.InProductBack.ObjToInt(), |
| | | // TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | // WarehouseId = warePoint.WarehouseId, |
| | | // PalletType = proStockInfo.PalletType, |
| | | // MaterielCode = proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).FirstOrDefault()?.ProductCode, |
| | | // Quantity = (float)proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).Sum(x => x.StockPcsQty) |
| | | // }; |
| | | // _unitOfWorkManage.BeginTran(); |
| | | // int taskId = BaseDal.AddData(newTask); |
| | | // newTask.TaskId = taskId; |
| | | // _stockRepository.ProStockInfoRepository.UpdateData(proStockInfo); |
| | | // _stockRepository.ProStockInfoDetailRepository.UpdateData(proStockInfo.proStockInfoDetails); |
| | | // _unitOfWorkManage.CommitTran(); |
| | | // //æ¨éä»»å¡ |
| | | // PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | // content.OK("åéæå"); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // content.Error(ex.Message); |
| | | // } |
| | | // return content; |
| | | //} |
| | | /// <summary> |
| | | /// 空æ¡ååº |
| | | /// </summary> |
| | |
| | | return content.Error($"èµ·ç¹é误{startPoint}"); |
| | | } |
| | | //夿å½åç¹ä½æ¯å¦éå¤ |
| | | Dt_Task taskOldPoint = BaseDal.QueryFirst(x => x.SourceAddress == startPoint && x.TaskStatus == TaskStatusEnum.New.ObjToInt()); |
| | | Dt_Task taskOldPoint = BaseDal.QueryFirst(x => x.SourceAddress == startPoint &&( x.TaskStatus == TaskStatusEnum.New.ObjToInt() || x.TaskStatus==TaskStatusEnum.AGV_Executing.ObjToInt())); |
| | | if (taskOldPoint != null) |
| | | { |
| | | return content.Error($"ç«ç¹{startPoint}å·²åå¨ä»»å¡"); |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// å°å·ä½æéæä»»å¡ |
| | | /// </summary> |
| | | public WebResponseContent PrintBackInbound(SaveModel saveModel) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var barcode = saveModel.MainData["palletCode"].ToString(); |
| | | var warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); |
| | | var materSn = saveModel.MainData["materSn"]; |
| | | //ç´å¾ |
| | | var thickness = saveModel.MainData["thickness"].ObjToInt(); |
| | | var weight = saveModel.MainData["weight"].ObjToInt(); |
| | | var address = saveModel.MainData["address"].ToString(); |
| | | //å¹
宽 |
| | | var wide = saveModel.MainData["wide"].ObjToInt(); |
| | | Dt_MaterielInfo? materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == materSn); |
| | | if (materielInfo == null) |
| | | { |
| | | return content.Error("æªæ¾å°ç©æä¿¡æ¯"); |
| | | } |
| | | Dt_StockInfo stockInfoOld = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == barcode); |
| | | if (stockInfoOld != null) |
| | | { |
| | | return content.Error("æçä¿¡æ¯å·²åå¨"); |
| | | } |
| | | //çæåºåç»çä¿¡æ¯ |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | | { |
| | | MaterielInvOrgId = materielInfo.MaterielInvOrgId, |
| | | PalletCode = barcode, |
| | | LocationCode = "", |
| | | PalletType = 1, |
| | | WarehouseId = warehouseId, |
| | | StockAttribute = materielInfo.MaterielSourceType, |
| | | StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(), |
| | | MaterielSpec = materielInfo.MaterielSpec, |
| | | Unit = materielInfo.MaterielUnit, |
| | | MaterielThickness = thickness, |
| | | MaterielWide = wide, |
| | | MaterielWeight = weight, |
| | | MaterielCode = materielInfo.MaterielCode, |
| | | MaterielName = materielInfo.MaterielName, |
| | | }; |
| | | if (wide > 1200) |
| | | { |
| | | stockInfo.PalletType = 2; |
| | | } |
| | | |
| | | //çæå°å·ä½æéæä»»å¡ |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = address, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = barcode, |
| | | Roadway = "", |
| | | SourceAddress = address, |
| | | TargetAddress = "", |
| | | TaskType = TaskTypeEnum.PrintBackInbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = warehouseId, |
| | | PalletType = 1, |
| | | TaskLength= wide |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | _stockRepository.StockInfoRepository.AddData(stockInfo); |
| | | newTask.TaskId = taskId; |
| | | _unitOfWorkManage.CommitTran(); |
| | | //æ¨éä»»å¡ |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | content.OK("åéæå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// å°å·ä¸æä»»å¡ |
| | | /// </summary> |
| | | public WebResponseContent PrintInbound(SaveModel saveModel) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var barcode = saveModel.MainData["palletCode"].ToString(); |
| | | var warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); |
| | | var materSn = saveModel.MainData["materSn"]; |
| | | //ç´å¾ |
| | | var thickness = saveModel.MainData["thickness"].ObjToInt(); |
| | | var weight = saveModel.MainData["weight"].ObjToInt(); |
| | | var address = saveModel.MainData["address"].ToString(); |
| | | //å¹
宽 |
| | | var wide = saveModel.MainData["wide"].ObjToInt(); |
| | | Dt_MaterielInfo? materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == materSn); |
| | | if (materielInfo == null) |
| | | { |
| | | return content.Error("æªæ¾å°ç©æä¿¡æ¯"); |
| | | } |
| | | if (materielInfo.MaterielSourceType!=MaterielTypeEnum.åæå.ObjToInt()) |
| | | { |
| | | return content.Error($"æªæ¾å°ç©æ{materielInfo.MaterielCode}åæåä¿¡æ¯"); |
| | | } |
| | | Dt_StockInfo stockInfoOld = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == barcode); |
| | | if (stockInfoOld != null) |
| | | { |
| | | return content.Error("æçä¿¡æ¯å·²åå¨"); |
| | | } |
| | | //çæåºåç»çä¿¡æ¯ |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | | { |
| | | MaterielInvOrgId = materielInfo.MaterielInvOrgId, |
| | | PalletCode = barcode, |
| | | LocationCode = "", |
| | | PalletType = 1, |
| | | WarehouseId = warehouseId, |
| | | StockAttribute = materielInfo.MaterielSourceType, |
| | | StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(), |
| | | MaterielSpec = materielInfo.MaterielSpec, |
| | | Unit = materielInfo.MaterielUnit, |
| | | MaterielThickness = thickness, |
| | | MaterielWide = wide, |
| | | MaterielWeight = weight, |
| | | MaterielCode = materielInfo.MaterielCode, |
| | | MaterielName = materielInfo.MaterielName, |
| | | }; |
| | | if (wide > 1200) |
| | | { |
| | | stockInfo.PalletType = 2; |
| | | } |
| | | |
| | | //çæå°å·åæåå
¥åºä»»å¡ |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = address, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = barcode, |
| | | Roadway = "", |
| | | SourceAddress = address, |
| | | TargetAddress = "", |
| | | TaskType = TaskTypeEnum.PrintInbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = warehouseId, |
| | | PalletType = 1, |
| | | TaskLength = wide |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | _stockRepository.StockInfoRepository.AddData(stockInfo); |
| | | newTask.TaskId = taskId; |
| | | _unitOfWorkManage.CommitTran(); |
| | | //æ¨éä»»å¡ |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | content.OK("åéæå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// æ 纺å¸åºåº |
| | | /// </summary> |
| | | /// <param name="Count"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestWFBWMSTaskOut(int Count) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<Dt_AGVStationInfo> aGVStationInfos = _agvStationInfoRepository.QueryData(x => x.StationArea == AGVStationAreaEnum.AreaC.ObjToInt() && x.IsOccupied == WhetherEnum.False.ObjToInt()); |
| | | if (aGVStationInfos.Count < Count) |
| | | { |
| | | return content.Error($"å¯ç¨ç¼åæ°ä¸è¶³"); |
| | | } |
| | | List<Dt_ProStockInfo> stockInfos = _stockRepository.ProStockInfoRepository.QueryData(x => x.ProStockAttribute == ProStockAttributeEnum.空æ.ObjToInt() && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt()).OrderBy(x => x.CreateDate).Take(Count).ToList(); |
| | | List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => stockInfos.Select(x => x.LocationCode).Contains(x.LocationCode)); |
| | | if (stockInfos.Count < Count) |
| | | { |
| | | return content.Error($"åºåæ°éä¸è¶³"); |
| | | } |
| | | foreach (var item in stockInfos) |
| | | { |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode); |
| | | if (locationInfo != null && (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || locationInfo.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | item.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | return content.Error($"è´§ä½ç¶æä¸æ£ç¡®"); |
| | | } |
| | | } |
| | | List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutWFB); |
| | | if (tasks == null || tasks.Count <= 0) |
| | | { |
| | | return content.Error($"çæä»»å¡å¤±è´¥"); |
| | | } |
| | | for (int i = 0; i < tasks.Count; i++) |
| | | { |
| | | aGVStationInfos[i].IsOccupied = WhetherEnum.True.ObjToInt(); |
| | | tasks[i].TargetAddress = aGVStationInfos[i].AGVStationCode; |
| | | } |
| | | //夿æ¯å¦æåºåºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.ProStockInfoRepository.UpdateData(stockInfos); |
| | | _agvStationInfoRepository.UpdateData(aGVStationInfos); |
| | | //æ´æ°è´§ä½ç¶æ |
| | | _basicRepository.LocationInfoRepository.UpdateLocationStatus(locationInfos, LocationStatusEnum.Lock); |
| | | //å å
¥è´§ä½åå¨è®°å½ |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, taskNums: tasks.Select(x => x.TaskNum).ToList()); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(tasks); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(tasks); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// åæåºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="materielCode">ç©æä»£ç </param> |
| | | /// <param name="materielWide">ç©æå¹
宽</param> |
| | | /// <param name="Count">å·æ°</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestYLWMSTaskOut(string materielCode, int materielWide, int Count) |
| | | public WebResponseContent RequestYLWMSTaskOut(string materielCode, int materielWide, int Count, string address = "") |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | } |
| | | else |
| | | { |
| | | taskTypeEnum = TaskTypeEnum.Outbound; |
| | | taskTypeEnum = TaskTypeEnum.PrintOutbound; |
| | | } |
| | | List<Dt_Task> tasks = GetTasks(stockInfos, taskTypeEnum); |
| | | if (tasks == null || tasks.Count <= 0) |
| | | { |
| | | return content.Error($"çæä»»å¡å¤±è´¥"); |
| | | } |
| | | if (!string.IsNullOrEmpty(address)) |
| | | { |
| | | tasks.ForEach(x => |
| | | { |
| | | x.TargetAddress= address; |
| | | }); |
| | | } |
| | | //夿æ¯å¦æåºåºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | |
| | | using System; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.MaterielEnum; |
| | | using WIDESEA_Common.OtherEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | |
| | | Dt_LocationInfo startLocationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == startAddress); |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.LocationCode == startAddress); |
| | | Dt_LocationInfo endLocationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == endAddress); |
| | | //夿æ¡ä»¶ |
| | | if (startLocationInfo != null && startLocationInfo.LocationStatus==LocationStatusEnum.InStock.ObjToInt() && endLocationInfo != null && endLocationInfo.LocationStatus==LocationStatusEnum.Free.ObjToInt() && endLocationInfo.EnableStatus==EnableStatusEnum.Normal.ObjToInt() && stockInfo!=null) |
| | | { |
| | | //çæä»»å¡ |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | Roadway = roadWay, |
| | |
| | | SourceAddress = startLocationInfo.LocationCode, |
| | | TargetAddress = endLocationInfo.LocationCode, |
| | | TaskNum = Repository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | TaskStatus = 0, |
| | | TaskStatus = TaskStatusEnum.SC_Execute.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Relocation.ObjToInt() |
| | | }; |
| | | stockInfo.StockStatus = StockStatusEmun.ç§»åºéå®.ObjToInt(); |
| | |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// åæå··éé´ç§»åºä»»å¡ todo:ä¸´æ¶ |
| | | /// </summary> |
| | | public WebResponseContent RelocationRoadWay(string roadWay, int Count) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·å对åºåºå |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.QueryData(x => x.MaterielWide <2200 && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt()).OrderBy(x => x.CreateDate).Take(Count).ToList(); |
| | | |
| | | //è·åè´§ä½ |
| | | List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => stockInfos.Select(x => x.LocationCode).Contains(x.LocationCode)); |
| | | foreach (var item in stockInfos) |
| | | { |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode); |
| | | if (locationInfo != null && (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || locationInfo.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | item.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | return content.Error($"è´§ä½ç¶æä¸æ£ç¡®"); |
| | | } |
| | | } |
| | | |
| | | List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutPick); |
| | | if (tasks == null || tasks.Count <= 0) |
| | | { |
| | | return content.Error($"çæä»»å¡å¤±è´¥"); |
| | | } |
| | | tasks.ForEach(x => |
| | | { |
| | | x.TargetAddress = roadWay; |
| | | }); |
| | | //夿æ¯å¦æåºåºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfos); |
| | | //æ´æ°è´§ä½ç¶æ |
| | | _basicRepository.LocationInfoRepository.UpdateLocationStatus(locationInfos, LocationStatusEnum.Lock); |
| | | //å å
¥è´§ä½åå¨è®°å½ |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, taskNums: tasks.Select(x => x.TaskNum).ToList()); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(tasks); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(tasks); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | return Service.RequestYLWMSTaskSimple(stationCode,palletCode); |
| | | } |
| | | /// <summary> |
| | | /// åé
åæå
¥åºå··é |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("AssignYLRoadwayNo"), AllowAnonymous] |
| | | public WebResponseContent AssignYLRoadwayNo(string palletCode) |
| | | { |
| | | string roadWay= Service.AssignYLRoadwayNo(palletCode); |
| | | if (string.IsNullOrEmpty(roadWay)) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°å¯åé
å··é"); |
| | | } |
| | | return WebResponseContent.Instance.OK(data: roadWay); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æååºåºä»»å¡è¯·æ± |
| | |
| | | { |
| | | return Service.RequestCPWMSTaskOut(Count); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ 纺å¸åºåº |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("RequestWFBWMSTaskOut"), AllowAnonymous] |
| | | public WebResponseContent RequestWFBWMSTaskOut(int Count) |
| | | { |
| | | return Service.RequestWFBWMSTaskOut(Count); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åæåºåºä»»å¡ |
| | | /// </summary> |
| | |
| | | /// <param name="Count">å·æ°</param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("RequestYLWMSTaskOut"), AllowAnonymous] |
| | | public WebResponseContent RequestYLWMSTaskOut(string materielCode,int materielWide, int Count) |
| | | public WebResponseContent RequestYLWMSTaskOut(string materielCode,int materielWide, int count,string address="") |
| | | { |
| | | return Service.RequestYLWMSTaskOut(materielCode, materielWide, Count); |
| | | return Service.RequestYLWMSTaskOut(materielCode, materielWide, count, address); |
| | | } |
| | | /// <summary> |
| | | /// åæç§»åºä»»å¡ |
| | |
| | | { |
| | | return Service.IsRelocation(startAddress, endAddress, roadWay); |
| | | } |
| | | /// <summary> |
| | | /// åæå··éé´ç§»åºä»»å¡ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("RelocationRoadWay"), AllowAnonymous] |
| | | public WebResponseContent RelocationRoadWay(string roadWay,int Count) |
| | | { |
| | | return Service.RelocationRoadWay(roadWay, Count); |
| | | } |
| | | /// <summary> |
| | | /// åé
æåå··é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("AssignCPRoadwayNo"), AllowAnonymous] |
| | | public string AssignCPRoadwayNo() |
| | | { |
| | | return Service.AssignCPRoadwayNo(); |
| | | } |
| | | /// <summary> |
| | | /// å°å·ä½æéæä»»å¡ |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PrintBackInbound"), AllowAnonymous] |
| | | public WebResponseContent PrintBackInbound([FromBody]SaveModel saveModel) |
| | | { |
| | | return Service.PrintBackInbound(saveModel); |
| | | } |
| | | /// <summary> |
| | | /// å°å·ä¸æä»»å¡ |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PrintInbound"), AllowAnonymous] |
| | | public WebResponseContent PrintInbound([FromBody] SaveModel saveModel) |
| | | { |
| | | return Service.PrintInbound(saveModel); |
| | | } |
| | | } |
| | | } |
| | |
| | | let config = { |
| | | baseUrl: 'http://127.0.0.1:9293', |
| | | baseUrl: 'http://192.168.35.3:9283', |
| | | urls: [ |
| | | 'http://192.168.35.3:9283', |
| | | 'http://192.168.35.3:9283' |