| | |
| | | using Microsoft.AspNetCore.Hosting; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections; |
| | |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Diagnostics.Eventing.Reader; |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Reflection.Metadata; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.Log; |
| | |
| | | { |
| | | GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane); |
| | | |
| | | //读å设å¤å®æä¿¡æ¯ |
| | | if (getStackerObject.StaclerkJobJobStatusValue == RgvJobCraneStatus.Completed && getStackerObject.CurrentRgvtaskid != 0) |
| | | if (getStackerObject.RGVInitializationValue == RGVInitialize.Initialized) |
| | | { |
| | | _taskService.UpdateTaskStatus(getStackerObject.CurrentRgvtaskid); |
| | | } |
| | | |
| | | |
| | | if (getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic && |
| | | getStackerObject.StaclerkJobJobStatusValue == RgvJobCraneStatus.Ready && getStackerObject.RgvCraneWorkStatusValue == RGVStepprocess.NoAction) |
| | | { |
| | | |
| | | //ä¸åRGVä»»å¡ä¹åï¼å
读åä¸ä¸å®å
¨é¨ç¶æ |
| | | |
| | | |
| | | |
| | | |
| | | //æ¥æ¾RGVè¿è¡ä¸åä»»å¡ |
| | | Dt_Task task = GetTask(speStackerCrane.DeviceCode); |
| | | if (task != null) |
| | | //读å设å¤å®æä¿¡æ¯ |
| | | if (getStackerObject.StaclerkJobJobStatusValue == RGV_Rgvtaskstutas.Completed || getStackerObject.StaclerkJobJobStatusValue == RGV_Rgvtaskstutas.AbnormalCompletion) |
| | | { |
| | | //è°ååå
¥RGVå°è½¦ä»»å¡ |
| | | RgvCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | bool sendFlag = getStackerObject.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | //ä¿®æ¹ä»»å¡ç¶æ |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | CommonStackerCrane_AGVTaskCompletedEventHandler(getStackerObject, speStackerCrane); |
| | | } |
| | | |
| | | if (getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic && |
| | | getStackerObject.StaclerkJobJobStatusValue == RGV_Rgvtaskstutas.Ready && getStackerObject.RgvCraneWorkStatusValue == RGVStepprocess.NoAction) |
| | | { |
| | | //æ¥æ¾RGVè¿è¡ä¸åä»»å¡ |
| | | Dt_Task task = GetTask(speStackerCrane.DeviceCode, getStackerObject); |
| | | if (task != null) |
| | | { |
| | | //è°ååå
¥RGVå°è½¦ä»»å¡ |
| | | RgvCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | { |
| | | bool sendFlag = getStackerObject.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | //ä¿®æ¹ä»»å¡ç¶æ |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (GetDeviceAddress.OutbounMotherChildCartbool(speStackerCrane.DeviceCode)) |
| | | { |
| | | //彿²¡ä»»å¡çæ¶åï¼åè¿è¡ç§»å¨ |
| | | Returnposition(speStackerCrane.DeviceCode, getStackerObject.RGVCurrentlocation, (int)getStackerObject.RgvCraneStatusValue); |
| | | |
| | | } |
| | | else if (GetDeviceAddress.OutbounMotherChildCartbool2(speStackerCrane.DeviceCode)) |
| | | { |
| | | InReturnposition(speStackerCrane.DeviceCode, getStackerObject.RGVCurrentlocation, (int)getStackerObject.RgvCraneStatusValue); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | private Dt_Task? GetTask(string DeviceCode) |
| | | #region ä»»å¡å®æ |
| | | private void CommonStackerCrane_AGVTaskCompletedEventHandler(GetStackerObject getStackerObject, SpeStackerCrane speStackerCrane) |
| | | { |
| | | Dt_Task task = _taskService.QueryStackerCraneTask(DeviceCode); |
| | | if (task == null) return null; |
| | | |
| | | return task.TaskType switch |
| | | if (getStackerObject.StaclerkJobJobStatusValue == RGV_Rgvtaskstutas.Completed && getStackerObject.CurrentRgvtaskid == 30001) |
| | | { |
| | | (int)TaskInboundTypeEnum.Inbound => HandleInboundTask(task), |
| | | (int)TaskOutboundTypeEnum.Outbound => HandleOutboundTask(task), |
| | | _ => null |
| | | }; |
| | | } |
| | | |
| | | private Dt_Task? HandleInboundTask(Dt_Task task) |
| | | { |
| | | return task.TaskState switch |
| | | { |
| | | (int)TaskInStatusEnum.RGV_InNew => task, |
| | | (int)TaskInStatusEnum.RGV_InPickupFinish => HandlePickupFinish(task), |
| | | (int)TaskInStatusEnum.RGV_InReleaseFinish => HandInneRouterSides(task), |
| | | (int)TaskInStatusEnum.RGV_InZicheFinish => HandleZicheFinish(task), |
| | | (int)TaskInStatusEnum.RGV_InZicheReleaseFinish => HandleZicheReleaseFinish(task), |
| | | (int)TaskInStatusEnum.RGV_InZichemoveFinish => HandleZicheMoveFinish(task), |
| | | _ => null |
| | | }; |
| | | } |
| | | |
| | | private Dt_Task? HandleOutboundTask(Dt_Task task) |
| | | { |
| | | // åºåºä»»å¡çç¶æå¤æç¸å¯¹ç®åï¼å¯ä»¥ç´æ¥è¿å |
| | | int[] validStates = |
| | | { |
| | | (int)TaskOutStatusEnum.OutNew, |
| | | (int)TaskOutStatusEnum.RGV_OutMothercarFinish, |
| | | (int)TaskOutStatusEnum.RGV_OutZicheFinish, |
| | | (int)TaskOutStatusEnum.RGV_OutZicheReleaseFinish, |
| | | (int)TaskOutStatusEnum.RGV_OutPickupFinish |
| | | }; |
| | | |
| | | return validStates.Contains(task.TaskState) ? task : null; |
| | | } |
| | | |
| | | #region å
¥åºæ¹æ³ |
| | | private Dt_Task? HandInneRouterSides(Dt_Task task) |
| | | { |
| | | // éªè¯è¾å
¥ |
| | | if (task == null) throw new ArgumentNullException(nameof(task)); |
| | | if (string.IsNullOrEmpty(task.CurrentAddress)) return null; |
| | | |
| | | // è·åå½åç«å°ä¿¡æ¯ |
| | | AGVStation currentStation = _agvStationService.GetAllStationByDeviceCode(int.Parse(task.CurrentAddress)); |
| | | if (currentStation == null) return null; |
| | | |
| | | // åªå¤çç¹å®ç±»åçç«å° |
| | | if (currentStation.Station_material != (int)AgvStationEnum.HCJAisleplatform) |
| | | return task; |
| | | |
| | | // è·åå车ä½ç½® |
| | | int zicheAddress = GetZichelocation(task, task.CurrentAddress); |
| | | if (zicheAddress == 0) return null; |
| | | |
| | | AGVStation zicheStation = _agvStationService.GetAllStationByDeviceCode(zicheAddress); |
| | | if (zicheStation == null) return null; |
| | | |
| | | // æ ¹æ®å车ä½ç½®å¤çä¸åæ
åµ |
| | | switch (zicheStation.Station_material) |
| | | { |
| | | case (int)AgvStationEnum.Aisleplatform_Outside: |
| | | // å车å¨å¤ä¾§ - ç´æ¥è¿åä»»å¡ |
| | | return task; |
| | | |
| | | case (int)AgvStationEnum.Aisleplatform_Medial: |
| | | // å车å¨å
ä¾§ - æ£æ¥æ¯è½¦ä½ç½® |
| | | return HandleMedialCase(task, currentStation, zicheStation); |
| | | |
| | | default: |
| | | // æªç¥çå车ä½ç½®ç¶æ |
| | | return null; |
| | | speStackerCrane.SetValue(RGV_taskcoDBName.RGV_taskcomplete, 1); |
| | | speStackerCrane.SetValue(RGV_taskcoDBName.RGV_taskcomplete, 0); |
| | | } |
| | | } |
| | | |
| | | private Dt_Task? HandleMedialCase(Dt_Task task, AGVStation currentStation, AGVStation zicheStation) |
| | | { |
| | | int motherCarAddress = GetMothercarlocation(task.TaskNum, currentStation.MotherCarDeviceCode); |
| | | if (motherCarAddress == 0) return null; |
| | | |
| | | // 妿æ¯è½¦ä¸å¨é¢æä½ç½®ï¼ä¸åç§»å¨ä»»å¡ |
| | | if (motherCarAddress != int.Parse(currentStation.MotherCarDeviceCode)) |
| | | else if (getStackerObject.StaclerkJobJobStatusValue == RGV_Rgvtaskstutas.Completed && getStackerObject.CurrentRgvtaskid != 0 && getStackerObject.CurrentRgvtaskid != 30001) |
| | | { |
| | | RGVMovetask(zicheStation.Motherinlaw, currentStation.ChildPosiDeviceCode, task.TaskId); |
| | | return null; // æ¯è½¦éè¦ç§»å¨ï¼æä¸è¿åä»»å¡ |
| | | _taskService.UpdateTaskStatus(getStackerObject.CurrentRgvtaskid); //æ£å¸¸ä»»å¡å®æ |
| | | speStackerCrane.SetValue(RGV_taskcoDBName.RGV_taskcomplete, 1); |
| | | speStackerCrane.SetValue(RGV_taskcoDBName.RGV_taskcomplete, 0); |
| | | } |
| | | |
| | | // æ¯è½¦å·²å¨æ£ç¡®ä½ç½® |
| | | return task; |
| | | } |
| | | |
| | | private Dt_Task? HandlePickupFinish(Dt_Task task) |
| | | { |
| | | try |
| | | else if (getStackerObject.StaclerkJobJobStatusValue == RGV_Rgvtaskstutas.AbnormalCompletion && getStackerObject.CurrentRgvtaskid != 0 && getStackerObject.CurrentRgvtaskid != 30001) |
| | | { |
| | | //è·åéè¦åºåæ¯å¦å»å
¥åºä¸å»ä¸åæ ¼è½½è´§å°ä»»å¡ |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "HCJ2000"); |
| | | CommonStackerCrane Commonstacker = (CommonStackerCrane)device; |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, task.NextAddress, "HCJ_GoodsStatus"); |
| | | int HCJGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress); |
| | | if (HCJGStatus == 0) //为æ è´§ |
| | | { |
| | | return task; |
| | | } |
| | | //åå
¥å¼å¸¸å®ææ¥è¦ä¿¡æ¯ |
| | | speStackerCrane.Communicator.Write<short>("DB101.36", 1); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //è®°å½å¼å¸¸æ
åµ |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"夿HCJç«å°æ¯å¦æè´§ä¿¡æ¯åºéï¼åºéä¿¡æ¯ï¼{ex.Message}"); |
| | | throw; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | private Dt_Task? HandleZicheFinish(Dt_Task task) |
| | | { |
| | | //è·åæ¾è´§å°å |
| | | AGVStation aGVStation = _agvStationService.GetAllStationByDeviceCode(int.Parse(task.NextAddress)); |
| | | |
| | | //å3åºåè¿è¡æ¾è´§ |
| | | return aGVStation.Station_Area switch |
| | | { |
| | | 1 => CheckMotherCarMove(task, aGVStation, MotherCarMoves), //å¤ä¾§æ¾è´§ |
| | | 2 => CheckMotherCarMove(task, aGVStation, MotherCarMovesinside), //å
ä¾§æ¾è´§ |
| | | 3 => CheckMotherCarMove(task, aGVStation, HCJMotherCarMovesinside), //交æ¥ç¹æ¾è´§ |
| | | _ => null |
| | | }; |
| | | } |
| | | |
| | | private Dt_Task? CheckMotherCarMove(Dt_Task task, AGVStation station, Func<Dt_Task, AGVStation, bool> moveFunc) |
| | | { |
| | | return moveFunc(task, station) ? task : null; |
| | | } |
| | | |
| | | private Dt_Task? HandleZicheReleaseFinish(Dt_Task task) |
| | | { |
| | | AGVStation aGVStation = _agvStationService.GetAllStationByDeviceCode(int.Parse(task.CurrentAddress)); //å½åå°åï¼æ¯è½¦ä¸ï¼ä¸ä¸ä¸ªå°åå åæºåè´§å£ |
| | | if (aGVStation.Station_Area == 1 && aGVStation.Station_Area == 2) |
| | | { |
| | | return task; //è¿åå车移å¨ä»»å¡ |
| | | } |
| | | else if (aGVStation.Station_Area == 3) //å½åå°å为HCJç«å°ï¼ä¸AGVä»»å¡ä¸ºåè´§ |
| | | { |
| | | return task; //å»åè´§ä½ï¼éè¦å¤æå车å½åä½åï¼ï¼åç»ä¼åï¼ |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | private Dt_Task? HandleZicheMoveFinish(Dt_Task task) |
| | | { |
| | | AGVStation aGVStation = _agvStationService.GetAllStationByDeviceCode(int.Parse(task.CurrentAddress)); |
| | | int zicheAddress = GetZichelocation(task, task.CurrentAddress); |
| | | |
| | | //妿åè½¦å¨æ¯è½¦ä¸ï¼åéè¦ç§»åºæ¯è½¦ï¼å¾
ä¼åï¼ |
| | | return zicheAddress != int.Parse(aGVStation.ZicheMotherinlaw) ? task : null; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | private Dt_Task? GetTask(string DeviceCode, GetStackerObject getStackerObject) |
| | | { |
| | | // æ ¹æ®è®¾å¤åç§°ï¼è·åå°è®¾å¤ç¸å
³æ°æ® |
| | | AGVStation RGVTaskdevice = _agvStationService.Corridorequipment(DeviceCode); //æ ¹æ®è®¾å¤è·åå°å
容 |
| | | return RGVTaskdevice.Station_tasktype switch |
| | | { |
| | | (int)RGVTasktype.Inbound => HandleInboundTask(RGVTaskdevice, getStackerObject), |
| | | (int)RGVTasktype.Outbound => OutboundEquipmentTask(RGVTaskdevice, getStackerObject), //åºåº |
| | | _ => null |
| | | }; |
| | | |
| | | |
| | | } |
| | | |
| | | #region å
¥åºæ¹æ³ |
| | | private Dt_Task? HandleInboundTask(AGVStation RGVTaskdevice, GetStackerObject getStackerObject) |
| | | { |
| | | return (RGVTaskdevice.Station_material, getStackerObject.RgvCraneStatusValue) switch |
| | | { |
| | | ((int)RGVEquipment.InRGVForklift, RgvEquipmentStatus.NoCargo) //å车å¼RGVæ è´§,ä¸ååè´§ä»»å¡ |
| | | => _taskService.PickupWarehouse(RGVTaskdevice.ChildPosiDeviceCode), |
| | | |
| | | ((int)RGVEquipment.InRGVForklift, RgvEquipmentStatus.HasCargo) |
| | | => ForkliftUnloading(RGVTaskdevice), //å车å¼è¿è¡æ¾è´§ï¼å·²å®æï¼ |
| | | |
| | | ((int)RGVEquipment.Corridorcar, RgvEquipmentStatus.NoCargo) |
| | | => ZichePickUpAisle(RGVTaskdevice, getStackerObject), //è¿éå车è¿è¡åè´§ï¼å·²å®æï¼ |
| | | |
| | | ((int)RGVEquipment.Corridorcar, RgvEquipmentStatus.HasCargo) |
| | | => GoodsPlacedCorridor(RGVTaskdevice), //å车æ¾è´§ä»»å¡(已宿) |
| | | |
| | | ((int)RGVEquipment.Mothertrailer, RgvEquipmentStatus.HasCargo) |
| | | => MotherVehicleMovement(RGVTaskdevice), //ï¼å·²å®æï¼ |
| | | |
| | | _ => null |
| | | }; |
| | | |
| | | } |
| | | |
| | | #region å车å¼è¿è¡æ¾è´§ï¼å·²å®æï¼ |
| | | public Dt_Task? ForkliftUnloading(AGVStation RGVTaskdevice) |
| | | { |
| | | Dt_Task dt_Task = _taskService.GetInkouFinhuoTask(RGVTaskdevice.ChildPosiDeviceCode); |
| | | |
| | | //夿HCJæ¯å¦æè´§ |
| | | if (GetDeviceAddress.HCJIsstock(dt_Task.NextAddress)) |
| | | { |
| | | //夿å车æ¯å¦å¨æ¥é©³å°ä¸ |
| | | var zichestation = _agvStationService.OutGetZicheDeepHCJ(1061); |
| | | int ziche = GetDeviceAddress.GetEquipmentlocation(zichestation.ChildPosiDeviceCode); |
| | | if ((ziche == zichestation.WaitmomentOne || ziche == zichestation.WaitmomentTwo || ziche == zichestation.MotherCarDeviceCode || ziche == zichestation.MotherCardeputy || ziche == zichestation.HCJStorageaddress) && ziche != 1021) |
| | | { |
| | | //è·åè¿ä¸ªæ¥é©³å°æ¯å¦æåè´§ä»»å¡ |
| | | Dt_Task zitask = _taskService.ViceChariotPickupTask2(RGVTaskdevice.ChildPosiDeviceCode); |
| | | if (zitask == null) |
| | | { |
| | | |
| | | return dt_Task; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | #endregion |
| | | |
| | | #region è¿éå车è¿è¡åè´§ï¼å·²å®æï¼ |
| | | public Dt_Task? ZichePickUpAisle(AGVStation RGVTaskdevice, GetStackerObject getStackerObject) |
| | | { |
| | | //è·åå车åè´§ä»»å¡ |
| | | Dt_Task dt_Task = _taskService.ViceChariotPickupTask(RGVTaskdevice.ChildPosiDeviceCode); |
| | | if (dt_Task == null) return null; |
| | | if (RGVTaskdevice.Station_Area == 6) //å¤ä¾§è¿åè´§ï¼åéè¦å¤æå车å½åä½ç½® |
| | | { |
| | | if (getStackerObject.RGVCurrentlocation == RGVTaskdevice.WaitmomentOne) |
| | | { |
| | | //è¿éè¦å¤æå
¥åºå£å车æ¯å¦æ¶ååè½¦äº |
| | | |
| | | //å¨çå¾
ç¹1ï¼åéè¦å¤æ1å·æ¯è½¦å¨å åæºåè´§å£ |
| | | var mu1rgv = _agvStationService.GetMothervehicle(RGVTaskdevice.MotherCarDeviceCode); |
| | | int mu1 = GetDeviceAddress.GetEquipmentlocation(mu1rgv.ChildPosiDeviceCode); //æ¤æ¶çRGVåºè¯¥æ è´§ |
| | | bool ywh = GetDeviceAddress.Mucheywhaddres(mu1rgv.ChildPosiDeviceCode); |
| | | if (mu1 == mu1rgv.Motherinlaw || (ywh && mu1 == mu1rgv.ZicheMotherinlaw)) //å¨å åæºåè´§å£ |
| | | { |
| | | //=============================æ°å¢å½å»åè´§æ¶è¿è¡å¤æå··éï¼çè½ä¸è½æåæåºæ¯è½¦ |
| | | if (int.Parse(dt_Task.TargetAddress) == (int)StorageAisleEnum.LaneTwo) |
| | | { |
| | | int taraddress = int.Parse(dt_Task.TargetAddress); |
| | | var InMotherVehicle = _agvStationService.ObtainCcordingTunnel(taraddress); //è·åå°éè¦å
¥åºçæ¯è½¦(2å··é) |
| | | int mu2 = GetDeviceAddress.GetEquipmentlocation(InMotherVehicle.ChildPosiDeviceCode); //æ¤æ¶çRGVåºè¯¥æ è´§ |
| | | if (GetDeviceAddress.Mucheywhaddres(InMotherVehicle.ChildPosiDeviceCode)) //夿æ è´§ |
| | | { |
| | | if (mu2 == InMotherVehicle.ZicheMotherinlaw) |
| | | { |
| | | return dt_Task; |
| | | } |
| | | else if (mu2 == InMotherVehicle.Motherinlaw) |
| | | { |
| | | RGVMovetask(InMotherVehicle.ZicheMotherinlaw, InMotherVehicle.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | } |
| | | //=============================æ°å¢å½å»åè´§æ¶è¿è¡å¤æå··éï¼çè½ä¸è½æåæåºæ¯è½¦ |
| | | return dt_Task; |
| | | } |
| | | //廿åå ï¼å¨è¯¥åºå车å»åè´§ï¼å¯ç´æ¥ç©¿è¿æ è´§æ¯è½¦ï¼æè½¦ |
| | | /*else |
| | | { |
| | | Dt_Task task = _taskService.MothermachinemovementTask2(RGVTaskdevice.ChildPosiDeviceCode); |
| | | if (task == null) |
| | | { |
| | | RGVMovetask(mu1rgv.Motherinlaw, mu1rgv.ChildPosiDeviceCode); |
| | | } |
| | | }*/ |
| | | |
| | | } |
| | | else if (getStackerObject.RGVCurrentlocation == RGVTaskdevice.WaitmomentTwo) //åéè¦å¤æä¸¤ä¸ªæ¯è½¦çä½å |
| | | { |
| | | //å¤æä¸¤ä¸ªå车æ¯å¦å¨å åæºåè´§å£ |
| | | |
| | | //æ¯è½¦1 |
| | | var mu1rgv = _agvStationService.GetMothervehicle(RGVTaskdevice.MotherCarDeviceCode); |
| | | int mu1 = GetDeviceAddress.GetEquipmentlocation(mu1rgv.ChildPosiDeviceCode); //æ¤æ¶çRGVåºè¯¥æ è´§ |
| | | bool m1Isitstock1 = GetDeviceAddress.Mucheywhaddres(mu1rgv.ChildPosiDeviceCode); |
| | | |
| | | var mu2rgv = _agvStationService.GetMothervehicle(RGVTaskdevice.MotherCardeputy); |
| | | int mu2 = GetDeviceAddress.GetEquipmentlocation(mu2rgv.ChildPosiDeviceCode); //æ¤æ¶çRGVåºè¯¥æ è´§ |
| | | bool m1Isitstock2 = GetDeviceAddress.Mucheywhaddres(mu2rgv.ChildPosiDeviceCode); |
| | | |
| | | // æåå¯è¯»æ§åé |
| | | bool mu1AtHome = mu1 == mu1rgv.Motherinlaw; |
| | | bool mu2AtHome = mu2 == mu2rgv.Motherinlaw; |
| | | bool mu1Ready = mu1 == mu1rgv.ZicheMotherinlaw && m1Isitstock1; |
| | | bool mu2Ready = mu2 == mu2rgv.ZicheMotherinlaw && m1Isitstock2; |
| | | |
| | | // åå¹¶æææ»¡è¶³æ¡ä»¶çæ
åµ |
| | | if ((mu1AtHome && mu2AtHome) || // é½å¨åå§ä½ç½® |
| | | (mu1Ready && mu2Ready) || // é½å¨å°±ç»ªä½ç½®ä¸æ è´§ |
| | | (mu1AtHome && mu2Ready) || // 1å¨åå§ä½ç½®ï¼2就绪 |
| | | (mu1Ready && mu2AtHome)) // 1就绪ï¼2å¨åå§ä½ç½® |
| | | { |
| | | return dt_Task; |
| | | } |
| | | |
| | | /*else |
| | | { |
| | | //æ éææ¯è½¦ç§»å¨è³åè´§å°,æ è´§ç¶æçå车æ é踩æçè¿å»å»åè´§ |
| | | if (mu1 != mu1rgv.Motherinlaw) |
| | | { |
| | | Dt_Task task = _taskService.MothermachinemovementTask2(mu1rgv.ChildPosiDeviceCode); |
| | | if (task == null) |
| | | { |
| | | RGVMovetask(mu1rgv.Motherinlaw, mu1rgv.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | if (mu2 != mu2rgv.Motherinlaw) |
| | | { |
| | | Dt_Task task2 = _taskService.MothermachinemovementTask2(mu2rgv.ChildPosiDeviceCode); |
| | | if (task2 == null) |
| | | { |
| | | RGVMovetask(mu2rgv.Motherinlaw, mu2rgv.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | }*/ |
| | | } |
| | | } |
| | | else if (RGVTaskdevice.Station_Area == 5) |
| | | { |
| | | if (getStackerObject.RGVCurrentlocation == RGVTaskdevice.WaitmomentOne) |
| | | { |
| | | //éè¦å¤æå¤ä¾§å°è½¦æ¯å¦å¨HCJä¸ |
| | | var zichestation = _agvStationService.OutGetZicheDeepHCJ(RGVTaskdevice.HCJStorageaddress); |
| | | int waiziche = GetDeviceAddress.GetEquipmentlocation(zichestation.ChildPosiDeviceCode); |
| | | |
| | | if ((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode || waiziche == 1021) && waiziche != zichestation.HCJStorageaddress) |
| | | { |
| | | return dt_Task; |
| | | } |
| | | |
| | | } |
| | | else if (getStackerObject.RGVCurrentlocation == RGVTaskdevice.WaitmomentTwo) //éè¦å¤æ3å··éæ¯è½¦æ¯å¦å¨åè´§ç«å° |
| | | { |
| | | //夿å车æ¯å¦å¨HCJç«å° |
| | | var zichestation = _agvStationService.OutGetZicheDeepHCJ(RGVTaskdevice.HCJStorageaddress); |
| | | int waiziche = GetDeviceAddress.GetEquipmentlocation(zichestation.ChildPosiDeviceCode); |
| | | |
| | | if ((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode || waiziche == 1021) && waiziche != zichestation.HCJStorageaddress) |
| | | { |
| | | //æ¯è½¦1 |
| | | var mu1rgv = _agvStationService.GetMothervehicle(RGVTaskdevice.MotherCarDeviceCode); |
| | | int mu1 = GetDeviceAddress.GetEquipmentInformation(mu1rgv.ChildPosiDeviceCode); //æ¤æ¶çRGVåºè¯¥æ è´§ |
| | | if (mu1 == mu1rgv.Motherinlaw) |
| | | { |
| | | return dt_Task; |
| | | } |
| | | else |
| | | { |
| | | Dt_Task task = _taskService.MothermachinemovementTask2(mu1rgv.ChildPosiDeviceCode); |
| | | if (task == null) |
| | | { |
| | | RGVMovetask(mu1rgv.Motherinlaw, mu1rgv.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | /// <summary> |
| | | /// 夿å¤ä¾§æ¯è½¦æ¯å¦å¨å
¥å£å£ |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <param name="currentStation"></param> |
| | | /// <returns></returns> |
| | | private Dt_Task? HandleMedialCase(Dt_Task task, int currentStation) |
| | | { |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(currentStation); |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | if (motherCarAddress == Muche.Motherinlaw) return task; |
| | | RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); |
| | | return null; |
| | | } |
| | | /// <summary> |
| | | /// 夿å
å¤ä¾§æ¯è½¦æ¯å¦å¨å
¥åºå£ |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <param name="currentStation"></param> |
| | | /// <returns></returns> |
| | | private Dt_Task? HandleMedialCase2(Dt_Task task, AGVStation currentStation) |
| | | { |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(currentStation.MotherCarDeviceCode); //å¤ä¾§æ¯è½¦ |
| | | AGVStation Muche2 = _agvStationService.GetMothervehicle(currentStation.MotherCardeputy); //å
ä¾§æ¯è½¦ |
| | | |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | int motherCarAddress2 = GetDeviceAddress.GetEquipmentlocation(Muche2.ChildPosiDeviceCode); |
| | | if (motherCarAddress == 0 || motherCarAddress2 == 0) return null; |
| | | // 妿æ¯è½¦ä¸å¨é¢æä½ç½®ï¼ä¸åç§»å¨ä»»å¡ |
| | | if (motherCarAddress != Muche.Motherinlaw) |
| | | { |
| | | RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); |
| | | } |
| | | if (motherCarAddress2 != Muche2.Motherinlaw) |
| | | { |
| | | RGVMovetask(Muche2.Motherinlaw, Muche2.ChildPosiDeviceCode); |
| | | } |
| | | if (motherCarAddress == Muche.Motherinlaw && motherCarAddress2 == Muche2.Motherinlaw) return task; |
| | | // æ¯è½¦å·²å¨æ£ç¡®ä½ç½® |
| | | return null; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region è¿éå车è¿è¡æ¾è´§ |
| | | public Dt_Task? GoodsPlacedCorridor(AGVStation RGVTaskdevice) |
| | | { |
| | | Dt_Task task = _taskService.ViceChariotPlacingTask(RGVTaskdevice.ChildPosiDeviceCode); //è·åå°æ¾è´§ä»»å¡ |
| | | if (task == null) return null; |
| | | int nexaddres = int.Parse(task.NextAddress); //å¤ææ¯æ¾è´§å¨åªçä»»å¡ |
| | | switch (nexaddres) |
| | | { |
| | | case int Whcjaddress when Whcjaddress == RGVTaskdevice.MotherCarDeviceCode: //æ¾è´§ç¹å¨ç¬¬ä¸ä¸ªè¿éç¹(已宿) |
| | | return MotherCarMoves(task, RGVTaskdevice); |
| | | case int Waddress when Waddress == RGVTaskdevice.MotherCardeputy: //æ¾è´§ç¹å¨ç¬¬äºä¸ªè¿éç¹(已宿) |
| | | return MotherCarMovesinside(task, RGVTaskdevice); |
| | | case int HCJaddress when HCJaddress == RGVTaskdevice.HCJStorageaddress: //æ¾è´§ç¹å¨HCJä¸ï¼å·²å®æï¼ |
| | | return HCJMotherCarMovesinside(task, RGVTaskdevice); |
| | | default: return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | //åºåä¸å¤ææ¯è½¦æ¯å¦å°ä½ï¼å¯ç«å³æ¾è´§ |
| | | private bool MotherCarMoves(Dt_Task _Task, AGVStation aGVStation) |
| | | private Dt_Task? MotherCarMoves(Dt_Task _Task, AGVStation aGVStation) |
| | | { |
| | | int mcadder = GetMothercarlocation(_Task.TaskNum, aGVStation.Motherinlaw); //è·åå°æ¯è½¦å¤ä¾§ä½ç½® |
| | | if (mcadder != 0) |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(aGVStation.MotherCarDeviceCode); |
| | | Dt_Task task = _taskService.MothermachinemovementTask2(Muche.ChildPosiDeviceCode); //è·åå°æ¯è½¦ç§»å¨ä»»å¡ |
| | | if (task == null) |
| | | { |
| | | if (mcadder == int.Parse(_Task.CurrentAddress)) |
| | | GetStackerObject getStackerObject = GetDeviceAddress.GetChildDeviceCode(Muche.ChildPosiDeviceCode); |
| | | if (getStackerObject.RgvCraneStatusValue == RgvEquipmentStatus.NoCargo) //夿æ¯è½¦æ¯å¦æè´§ |
| | | { |
| | | return true; |
| | | if (getStackerObject.RGVCurrentlocation == Muche.ZicheMotherinlaw) //夿æ¯è½¦æ¯å¦å¨è¿éç¹ï¼ |
| | | { |
| | | return _Task; |
| | | } |
| | | else |
| | | { |
| | | RGVMovetask(Muche.ZicheMotherinlaw, Muche.ChildPosiDeviceCode); //å¦ææ²¡æä»»å¡ï¼åå¯ä»¥è¿è¡ç§»å¨åºæ¥ |
| | | } |
| | | } |
| | | RGVMovetask(_Task.CurrentAddress, aGVStation.ChildPosiDeviceCode, _Task.TaskId); |
| | | } |
| | | return false; |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿æ¾ç¬¬äºä¸ªæ¯è½¦ä½ç½® |
| | | /// </summary> |
| | | /// <param name="_Task"></param> |
| | | /// <param name="aGVStation"></param> |
| | | /// <returns></returns> |
| | | private Dt_Task? MotherCarMovesinside(Dt_Task _Task, AGVStation aGVStation) |
| | | { |
| | | |
| | | //夿å¤ä¾§æ¯è½¦æ¯å¦éè¦ç§»å¨è³å åæºåè´§å£ |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(aGVStation.MotherCarDeviceCode); |
| | | int muche1objet = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | |
| | | //夿å
ä¾§æ¯è½¦æ¯å¦å¨æ¾è´§ç¹ |
| | | AGVStation Muche2 = _agvStationService.GetMothervehicle(aGVStation.MotherCardeputy); //å
ä¾§æ¯è½¦ |
| | | int muche2objet = GetDeviceAddress.GetEquipmentlocation(Muche2.ChildPosiDeviceCode); |
| | | bool NoCargobool = GetDeviceAddress.Mucheywhaddres(Muche2.ChildPosiDeviceCode); |
| | | |
| | | //æ£å¸¸æ
åµä¸ï¼æä¿¡æ¯åé¦åºå» |
| | | if (muche1objet == Muche.Motherinlaw && muche2objet == Muche2.ZicheMotherinlaw && NoCargobool) |
| | | { |
| | | return _Task; |
| | | } |
| | | //æ¯è½¦1ä¸å¨åè´§å£ |
| | | if (muche1objet != Muche.Motherinlaw) //夿æ¯è½¦æ¯å¦å¨è¿éç¹ï¼ |
| | | { |
| | | Dt_Task task = _taskService.MothermachinemovementTask2(Muche.ChildPosiDeviceCode); //è·åå°æ¯è½¦ç§»å¨ä»»å¡ |
| | | if (task == null) |
| | | { |
| | | RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); //å¦ææ²¡æä»»å¡ï¼åå¯ä»¥è¿è¡ç§»å¨åºæ¥ |
| | | } |
| | | } |
| | | |
| | | //æ¯è½¦2ä¸å¨è¿éç«ç¹ |
| | | if (muche2objet != Muche2.ZicheMotherinlaw) //夿æ¯è½¦æ¯å¦å¨è¿éç¹ï¼ |
| | | { |
| | | Dt_Task task = _taskService.MothermachinemovementTask2(Muche2.ChildPosiDeviceCode); //è·åå°æ¯è½¦ç§»å¨ä»»å¡ |
| | | if (task == null) |
| | | { |
| | | RGVMovetask(Muche2.ZicheMotherinlaw, Muche2.ChildPosiDeviceCode); //å¦ææ²¡æä»»å¡ï¼åå¯ä»¥è¿è¡ç§»å¨åºæ¥ |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | /// <summary> |
| | | /// 夿æ¾å¨HCJä¸é¢ |
| | | /// </summary> |
| | | /// <param name="_Task"></param> |
| | | /// <param name="aGVStation"></param> |
| | | /// <returns></returns> |
| | | private Dt_Task? HCJMotherCarMovesinside(Dt_Task _Task, AGVStation aGVStation) |
| | | { |
| | | //å
夿HCJç«å°ç¹æ¯å¦æè´§ï¼æä»»å¡ |
| | | if (GetDeviceAddress.HCJIsstock(_Task.NextAddress)) |
| | | { |
| | | //夿å
车å车æ¯å¦å¨çå¾
ç¹ |
| | | AGVStation neiziche = _agvStationService.GetZicheDeep(aGVStation.HCJStorageaddress); //å
ä¾§å车 |
| | | int neizichecurraddres = GetDeviceAddress.GetEquipmentlocation(neiziche.ChildPosiDeviceCode); |
| | | |
| | | |
| | | Dt_Task task = _taskService.ViceChariotPickupTask2(neiziche.ChildPosiDeviceCode); //è·åå°å
ä¾§å车åè´§ä»»å¡ |
| | | if ((neizichecurraddres != neiziche.WaitmomentOne && neizichecurraddres != neiziche.WaitmomentTwo) || task != null) //å
ä¾§å车ä¸å¨ä¸¤ä¸ªç¼åç¹ |
| | | { |
| | | return null; |
| | | } |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(aGVStation.MotherCarDeviceCode); //å¤ä¾§æ¯è½¦ |
| | | int mucheaddre1 = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | AGVStation Muche2 = _agvStationService.GetMothervehicle(aGVStation.MotherCardeputy); //å
ä¾§æ¯è½¦ |
| | | int mucheaddre2 = GetDeviceAddress.GetEquipmentlocation(Muche2.ChildPosiDeviceCode); |
| | | |
| | | if ((neizichecurraddres == neiziche.WaitmomentOne || neizichecurraddres == neiziche.WaitmomentTwo) && task == null && mucheaddre1 == Muche.Motherinlaw && mucheaddre2 == Muche2.Motherinlaw) |
| | | { |
| | | return _Task; |
| | | } |
| | | //å¤æä¸¤ä¸ªæ¯è½¦ä½ç½® |
| | | if (mucheaddre1 != Muche.Motherinlaw) //夿æ¯è½¦æ¯å¦å¨è¿éç¹ï¼ |
| | | { |
| | | Dt_Task muche1task = _taskService.MothermachinemovementTask2(Muche.ChildPosiDeviceCode); //è·åå°æ¯è½¦ç§»å¨ä»»å¡ |
| | | if (muche1task == null) |
| | | { |
| | | RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); //å¦ææ²¡æä»»å¡ï¼åå¯ä»¥è¿è¡ç§»å¨åºæ¥ |
| | | } |
| | | } |
| | | if (mucheaddre2 != Muche2.Motherinlaw) //夿æ¯è½¦æ¯å¦å¨è¿éç¹ï¼ |
| | | { |
| | | Dt_Task muche2task = _taskService.MothermachinemovementTask2(Muche2.ChildPosiDeviceCode); //è·åå°æ¯è½¦ç§»å¨ä»»å¡ |
| | | if (muche2task == null) |
| | | { |
| | | RGVMovetask(Muche2.Motherinlaw, Muche2.ChildPosiDeviceCode); //å¦ææ²¡æä»»å¡ï¼åå¯ä»¥è¿è¡ç§»å¨åºæ¥ |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¯è½¦ç§»å¨ä»»å¡ |
| | | public Dt_Task? MotherVehicleMovement(AGVStation RGVTaskdevice) |
| | | { |
| | | Dt_Task task = _taskService.MothermachinemovementTask(RGVTaskdevice.ChildPosiDeviceCode); |
| | | if (task == null) return null; |
| | | |
| | | AGVStation GdZiche = _agvStationService.GetMotheaisle(RGVTaskdevice.ZicheMotherinlaw); |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(GdZiche.ChildPosiDeviceCode); |
| | | if (GdZiche.WaitmomentOne == motherCarAddress || GdZiche.WaitmomentTwo == motherCarAddress) |
| | | { |
| | | return task; |
| | | } |
| | | return null; |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region åºåºæ¹æ³(å¯è¿è¡æµè¯) |
| | | public Dt_Task? OutboundEquipmentTask(AGVStation RGVTaskdevice, GetStackerObject getStackerObject) |
| | | { |
| | | return (RGVTaskdevice.Station_material, getStackerObject.RgvCraneStatusValue) switch |
| | | { |
| | | ((int)RGVEquipment.Mothertrailer, RgvEquipmentStatus.HasCargo) //ä¸åæ¯è½¦åºæ¥å°è¿éä¸ |
| | | => Mothertaskdistribution(RGVTaskdevice),//已宿 |
| | | |
| | | ((int)RGVEquipment.Corridorcar, RgvEquipmentStatus.NoCargo) //æ¥æ¾åè½¦åºæ¥åè´§ |
| | | => ChildPickupAddres(RGVTaskdevice, getStackerObject.RGVCurrentlocation), //已宿 |
| | | |
| | | ((int)RGVEquipment.Corridorcar, RgvEquipmentStatus.HasCargo) |
| | | => Findshippingtask(RGVTaskdevice, getStackerObject.RGVCurrentlocation), //å车åè´§åï¼è¿è¡æ¾è´§ï¼å·²å®æï¼ |
| | | |
| | | ((int)RGVEquipment.OutRGVForklift, RgvEquipmentStatus.NoCargo) |
| | | => OutboundGateVehicle(RGVTaskdevice), //åºåºå£RGVåè´§ï¼å·²å®æï¼ |
| | | |
| | | ((int)RGVEquipment.OutRGVForklift, RgvEquipmentStatus.HasCargo) |
| | | => _taskService.GetOutkouFinhuoTask(RGVTaskdevice.ChildPosiDeviceCode, |
| | | RGVTaskdevice.HCJStorageaddress.ToString()), |
| | | |
| | | _ => null |
| | | }; |
| | | } |
| | | |
| | | #region ä¸åæ¯è½¦ä»»å¡ï¼éè¦å¤æå½åè¡å°è½¦å¨åªä¸ªä½å(已宿) |
| | | |
| | | private Dt_Task? Mothertaskdistribution(AGVStation GdZiche) |
| | | { |
| | | // æåæ£æ¥æ æçAreaå¼ |
| | | if (GdZiche.Station_Area < 1 || GdZiche.Station_Area > 4) |
| | | return null; |
| | | |
| | | //æ ¹æ®æ¯è½¦å°åï¼è·åå½åè¡éçå车 |
| | | AGVStation ZicheinnerSide = _agvStationService.GetMotheaisle(GdZiche.ZicheMotherinlaw); |
| | | int zichecurraddre = GetDeviceAddress.GetEquipmentlocation(ZicheinnerSide.ChildPosiDeviceCode); //è·åå°å车å®ä¾ |
| | | |
| | | if (zichecurraddre != ZicheinnerSide.WaitmomentOne && zichecurraddre != ZicheinnerSide.WaitmomentTwo) return null; |
| | | |
| | | //夿æ¯åªä¸ªå··éçæ¯è½¦ |
| | | return GdZiche.Station_Area switch |
| | | { |
| | | 4 => OutboundSideAisle4(zichecurraddre, ZicheinnerSide), //å¨4å··éè¿è¡åºåºçä»»å¡ï¼å·²å®æï¼ |
| | | 3 => OutboundSideAisle3(zichecurraddre, ZicheinnerSide), //å¨3å··éè¿è¡åºåºçä»»å¡ï¼å·²å®æï¼ |
| | | 2 => OutboundSideAisle2(ZicheinnerSide), //å¨äºå··éè¿è¡åºåºçä»»å¡ï¼å·²å®æï¼ |
| | | 1 => _taskService.ObtainMuChetask(GdZiche.ZicheMotherinlaw.ToString()), //æ ¹æ®æ¯è½¦åå°åï¼æ¥æ¾æ¯å¦æéè¦ç§»å¨çä»»å¡ï¼å·²å®æï¼ |
| | | _ => null |
| | | }; |
| | | |
| | | } |
| | | |
| | | public Dt_Task? OutboundSideAisle1(AGVStation ZicheinnerSide) |
| | | { |
| | | //è·å1å··éæ¯è½¦æ¯å¦æä»»å¡ |
| | | Dt_Task Muche1Task = _taskService.ObtainMuChetask(ZicheinnerSide.MotherCarDeviceCode.ToString()); |
| | | if (Muche1Task == null) return null; |
| | | |
| | | Dt_Task zicheTASK = _taskService.GetChariotTaskBool(ZicheinnerSide.ChildPosiDeviceCode); |
| | | if (zicheTASK != null) return null; |
| | | |
| | | return Muche1Task; |
| | | } |
| | | |
| | | public Dt_Task? OutboundSideAisle2(AGVStation ZicheinnerSide) |
| | | { |
| | | //è·å2å··éæ¯è½¦æ¯å¦æä»»å¡ |
| | | Dt_Task Muche2Task = _taskService.ObtainMuChetask(ZicheinnerSide.MotherCardeputy.ToString()); |
| | | if (Muche2Task == null) return null; |
| | | |
| | | //è·åå车æ¯å¦æä»»å¡ |
| | | Dt_Task zicheTASK = _taskService.GetChariotTaskBool(ZicheinnerSide.ChildPosiDeviceCode); |
| | | if (zicheTASK != null) return null; |
| | | |
| | | //è·å2å··éå车æ¯å¦æä»»å¡ |
| | | var muche1 = _agvStationService.GetMothervehicle(ZicheinnerSide.MotherCarDeviceCode); |
| | | Dt_Task Muche1 = _taskService.GetChariotTaskBool(muche1.ChildPosiDeviceCode.ToString()); |
| | | if(Muche1!=null) return null; |
| | | |
| | | return Muche2Task; |
| | | } |
| | | public Dt_Task? OutboundSideAisle3(int curraddZiChe, AGVStation ZicheinnerSide) |
| | | { |
| | | //è·å3å··éæ¯è½¦æ¯å¦æä»»å¡ |
| | | Dt_Task Muche3Task = _taskService.ObtainMuChetask(ZicheinnerSide.MotherCarDeviceCode.ToString()); |
| | | if (Muche3Task == null) return null; |
| | | |
| | | //夿å车æ¯å¦æè¦åHCJä»»å¡ |
| | | Dt_Task zicheTASK = _taskService.GetHCJTaskBool(ZicheinnerSide.ChildPosiDeviceCode, ZicheinnerSide.HCJStorageaddress); |
| | | if (zicheTASK != null) return null; |
| | | |
| | | return Muche3Task; |
| | | } |
| | | public Dt_Task? OutboundSideAisle4(int curraddZiChe, AGVStation ZicheinnerSide) |
| | | { |
| | | //è·åå½åæ¯è½¦æ¯å¦æä»»å¡ |
| | | Dt_Task Muche4Task = _taskService.ObtainMuChetask(ZicheinnerSide.MotherCardeputy.ToString()); |
| | | if (Muche4Task == null) return null; |
| | | |
| | | //夿æ¯å¦æéè¦åHCJçä»»å¡ |
| | | Dt_Task zicheTASK = _taskService.GetChariotTaskBool(ZicheinnerSide.ChildPosiDeviceCode); |
| | | if (zicheTASK != null) return null; |
| | | |
| | | //夿3巷鿝妿åºåºçä»»å¡ |
| | | var muche3 = _agvStationService.GetMothervehicle(ZicheinnerSide.MotherCarDeviceCode); |
| | | Dt_Task muchetask = _taskService.OutMothermaTask(muche3.ChildPosiDeviceCode); |
| | | if (muchetask != null) return null; |
| | | |
| | | return Muche4Task; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region å¤æå·²ç§»å¨åºæ¥çæ¯è½¦ï¼å夿å°è½¦ä½ç½®(已宿) |
| | | public Dt_Task? ChildPickupAddres(AGVStation GdZiche, int curraderr) |
| | | { |
| | | if (curraderr == GdZiche.WaitmomentOne || curraderr == GdZiche.WaitmomentTwo) |
| | | { |
| | | Dt_Task dtTasks = _taskService.ChildVehicleMission(GdZiche); |
| | | if (dtTasks == null) return null; |
| | | if (GdZiche.Station_Area == 5) |
| | | { |
| | | if (dtTasks.CurrentAddress == GdZiche.MotherCardeputy.ToString()) //åè´§çç¹å¨2å··éï¼åå车æ 论å¨åªä¸ªçå¾
ç¹ï¼é½å¯ä»¥åè´§ |
| | | { |
| | | return dtTasks; |
| | | } |
| | | else if (dtTasks.CurrentAddress == GdZiche.MotherCarDeviceCode.ToString()) //å1å··éçè´§ |
| | | { |
| | | if (curraderr == GdZiche.WaitmomentOne) //å车åå¥½å¨æè¾¹ï¼å¯ç«é©¬åè´§ |
| | | { |
| | | return dtTasks; |
| | | } |
| | | else if (curraderr == GdZiche.WaitmomentTwo) |
| | | { |
| | | var muchestation = _agvStationService.GetMothervehicle(GdZiche.MotherCardeputy); |
| | | int muche2addres = GetDeviceAddress.GetEquipmentlocation(muchestation.ChildPosiDeviceCode); //è·å2å··éæ¯è½¦å®ä¾ |
| | | if (muche2addres == muchestation.Motherinlaw) |
| | | { |
| | | return dtTasks; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else if (GdZiche.Station_Area == 6) |
| | | { |
| | | //HCJç«å°æ²¡ä»»å¡ |
| | | if (dtTasks.CurrentAddress == GdZiche.MotherCardeputy.ToString()) //ä¼å
夿æ¯å¦æ¯æå¤é¢çä»»å¡ |
| | | { |
| | | if (curraderr == GdZiche.WaitmomentTwo) |
| | | { |
| | | return dtTasks; |
| | | } |
| | | else |
| | | { |
| | | var muchestation = _agvStationService.GetMothervehicle(GdZiche.MotherCarDeviceCode); |
| | | int muche3x = GetDeviceAddress.GetEquipmentlocation(muchestation.ChildPosiDeviceCode); |
| | | if (muche3x == muchestation.Motherinlaw) |
| | | { |
| | | return dtTasks; |
| | | } |
| | | } |
| | | } |
| | | else if (dtTasks.CurrentAddress == GdZiche.MotherCarDeviceCode.ToString()) //该任å¡ä¸ºå3å··é |
| | | { |
| | | if (curraderr == GdZiche.WaitmomentOne) |
| | | { |
| | | return dtTasks; |
| | | } |
| | | else if(curraderr == GdZiche.WaitmomentTwo) |
| | | { |
| | | var muchestation = _agvStationService.GetMothervehicle(GdZiche.MotherCardeputy); |
| | | int muche4x = GetDeviceAddress.GetEquipmentlocation(muchestation.ChildPosiDeviceCode); |
| | | if (muche4x == muchestation.Motherinlaw) |
| | | { |
| | | return dtTasks; |
| | | } |
| | | } |
| | | |
| | | } |
| | | else if (dtTasks.CurrentAddress == GdZiche.HCJStorageaddress.ToString()) |
| | | { |
| | | //夿å
ä¾§å车çä½ç½® |
| | | AGVStation neiziche = _agvStationService.GetOutZicheDeep(GdZiche.HCJStorageaddress); //å
ä¾§å车 |
| | | int neizichecurraddres = GetDeviceAddress.GetEquipmentlocation(neiziche.ChildPosiDeviceCode); |
| | | if ((neiziche.WaitmomentOne == neizichecurraddres || neiziche.WaitmomentTwo == neizichecurraddres || neiziche.MotherCarDeviceCode == neizichecurraddres || neiziche.MotherCardeputy == neizichecurraddres) && neiziche.HCJStorageaddress != neizichecurraddres) |
| | | { |
| | | if (curraderr == GdZiche.WaitmomentTwo) |
| | | { |
| | | var mu1rgv = _agvStationService.GetMothervehicle(GdZiche.MotherCarDeviceCode); |
| | | int mu1 = GetDeviceAddress.GetEquipmentlocation(mu1rgv.ChildPosiDeviceCode); |
| | | |
| | | var mu2rgv = _agvStationService.GetMothervehicle(GdZiche.MotherCardeputy); |
| | | int mu2 = GetDeviceAddress.GetEquipmentlocation(mu2rgv.ChildPosiDeviceCode); |
| | | |
| | | if (mu1 == mu1rgv.Motherinlaw && mu2 == mu2rgv.Motherinlaw) |
| | | { |
| | | return dtTasks; |
| | | } |
| | | } |
| | | else if (curraderr == GdZiche.WaitmomentOne) |
| | | { |
| | | return dtTasks; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥æ¾å车æ¾è´§ä»»å¡(已宿) |
| | | public Dt_Task? Findshippingtask(AGVStation GdZiche, int curraderr) |
| | | { |
| | | Dt_Task task = _taskService.GetFinhuoTask(GdZiche.ChildPosiDeviceCode); |
| | | if (task == null) return null; |
| | | if (GetDeviceAddress.HCJIsstock(task.NextAddress)) |
| | | { |
| | | if (GdZiche.Station_Area == 5) |
| | | { |
| | | //éè¦å¤æå¤ä¾§å°è½¦æ¯å¦å¨HCJä¸ |
| | | var zichestation = _agvStationService.OutGetZicheDeepHCJ(GdZiche.HCJStorageaddress); |
| | | int waiziche = GetDeviceAddress.GetEquipmentlocation(zichestation.ChildPosiDeviceCode); |
| | | if ((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode) && waiziche != zichestation.HCJStorageaddress) |
| | | { |
| | | //夿å½åä½ç½® |
| | | if (task.CurrentAddress == GdZiche.MotherCarDeviceCode.ToString()) |
| | | { |
| | | var muchestation = _agvStationService.GetMothervehicle(GdZiche.MotherCardeputy); |
| | | int muche2 = GetDeviceAddress.GetEquipmentlocation(muchestation.ChildPosiDeviceCode); |
| | | if (muche2 == muchestation.Motherinlaw) |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | else if (task.CurrentAddress == GdZiche.MotherCardeputy.ToString()) |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | } |
| | | else if (GdZiche.Station_Area == 6) |
| | | { |
| | | if (GdZiche.HCJStorageaddress == curraderr) |
| | | { |
| | | //夿3å··éæ¯è½¦ |
| | | var muchestation = _agvStationService.GetMothervehicle(GdZiche.MotherCarDeviceCode); |
| | | int mucboject3 = GetDeviceAddress.GetEquipmentlocation(muchestation.ChildPosiDeviceCode); |
| | | if (mucboject3 == muchestation.Motherinlaw) |
| | | { |
| | | //夿4å··éæ¯è½¦ |
| | | var muchestation2 = _agvStationService.GetMothervehicle(GdZiche.MotherCardeputy); |
| | | int mucboject4 = GetDeviceAddress.GetEquipmentlocation(muchestation2.ChildPosiDeviceCode); |
| | | if (mucboject4 == muchestation2.Motherinlaw) |
| | | { |
| | | return task; |
| | | } |
| | | |
| | | } |
| | | } |
| | | else if (GdZiche.MotherCarDeviceCode == curraderr) |
| | | { |
| | | //夿4å··éæ¯è½¦ |
| | | var muchestation2 = _agvStationService.GetMothervehicle(GdZiche.MotherCardeputy); |
| | | int mucboject4 = GetDeviceAddress.GetEquipmentlocation(muchestation2.ChildPosiDeviceCode); |
| | | if (mucboject4 == muchestation2.Motherinlaw) |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | else if (GdZiche.MotherCardeputy == curraderr) return task; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | #endregion |
| | | |
| | | #region åºåºå£å车åè´§(已宿) |
| | | public Dt_Task OutboundGateVehicle(AGVStation GdZiche) |
| | | { |
| | | //éè¦å¤æå车æ¯å¦å¨HCJä¸ |
| | | var zichestation = _agvStationService.OutGetZicheDeepHCJ(1131); |
| | | int ziche = GetDeviceAddress.GetEquipmentlocation(zichestation.ChildPosiDeviceCode); |
| | | |
| | | if (ziche != GdZiche.HCJStorageaddress && (ziche == zichestation.HCJStorageaddress || ziche == zichestation.WaitmomentOne || ziche == zichestation.WaitmomentTwo || ziche == zichestation.MotherCardeputy || ziche == zichestation.MotherCarDeviceCode)) |
| | | { |
| | | return _taskService.GetOutchachekouFinhuoTask(GdZiche.ChildPosiDeviceCode, GdZiche.HCJStorageaddress.ToString()); |
| | | } |
| | | return null; |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region åºåºå°è½¦ç§»å¨ä»»å¡ä¸å(已宿) |
| | | public void Returnposition(string DeviceCode, int RGVCurrentlocation, int RgvCraneStatusValue) |
| | | { |
| | | AGVStation GdZiche = _agvStationService.Corridorequipment(DeviceCode); |
| | | if (GdZiche.Station_material == (int)RGVEquipment.Mothertrailer) |
| | | { |
| | | if (GdZiche.Motherinlaw == RGVCurrentlocation) return; |
| | | if (RgvCraneStatusValue == (int)RgvEquipmentStatus.HasCargo) return; |
| | | |
| | | //æ¯äº²åå åæºå£ä»»å¡ï¼å¤æå车çä½ç½®æ¯å¦å¨æ¯è½¦ä¸ |
| | | var zichestation = _agvStationService.GetMotheaisle(GdZiche.ZicheMotherinlaw); |
| | | |
| | | //è·åå车æ¯å¦æä»»å¡æ¥è¯¥ä½ç½®åè´§ |
| | | Dt_Task Muche2Task = _taskService.OutPickupZiche(zichestation.ChildPosiDeviceCode.ToString()); |
| | | if (Muche2Task != null) return; |
| | | GetStackerObject getStackerObject = GetDeviceAddress.GetChildDeviceCode(zichestation.ChildPosiDeviceCode); |
| | | |
| | | if (getStackerObject.StaclerkJobJobStatusValue != RGV_Rgvtaskstutas.Executing && getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic |
| | | && (getStackerObject.RGVCurrentlocation == zichestation.WaitmomentOne || getStackerObject.RGVCurrentlocation == zichestation.WaitmomentTwo) && getStackerObject.RGVCurrentlocation != zichestation.ZicheMotherinlaw) |
| | | { |
| | | RGVMovetask(GdZiche.Motherinlaw, GdZiche.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | else if (GdZiche.Station_material == (int)RGVEquipment.Corridorcar) |
| | | { |
| | | if (RgvCraneStatusValue == (int)RgvEquipmentStatus.HasCargo) return; |
| | | if (GdZiche.Station_Area == 5) |
| | | { |
| | | if (GdZiche.MotherCardeputy == RGVCurrentlocation || GdZiche.HCJStorageaddress == RGVCurrentlocation) |
| | | { |
| | | RGVMovetask(GdZiche.WaitmomentTwo, GdZiche.ChildPosiDeviceCode); |
| | | } |
| | | else if (GdZiche.MotherCarDeviceCode == RGVCurrentlocation) |
| | | { |
| | | RGVMovetask(GdZiche.WaitmomentOne, GdZiche.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (GdZiche.MotherCarDeviceCode == RGVCurrentlocation || GdZiche.HCJStorageaddress == RGVCurrentlocation) |
| | | { |
| | | RGVMovetask(GdZiche.WaitmomentOne, GdZiche.ChildPosiDeviceCode); |
| | | } |
| | | else if (GdZiche.MotherCardeputy == RGVCurrentlocation || RGVCurrentlocation == 1171) |
| | | { |
| | | RGVMovetask(GdZiche.WaitmomentTwo, GdZiche.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region å
¥åºå°è½¦ç§»å¨ä»»å¡ä¸å(已宿) |
| | | public void InReturnposition(string DeviceCode, int RGVCurrentlocation, int RgvCraneStatusValue) |
| | | { |
| | | AGVStation GdZiche = _agvStationService.Corridorequipment(DeviceCode);//è·åå°è¦ç§»å¨çå车 |
| | | if (GdZiche.Station_material == (int)RGVEquipment.Corridorcar) |
| | | { |
| | | if (GdZiche.Station_Area == 5) |
| | | { |
| | | Dt_Task task = _taskService.GetChariotTaskBool(GdZiche.ChildPosiDeviceCode); |
| | | if (task == null && RgvCraneStatusValue == (int)RgvEquipmentStatus.NoCargo) |
| | | { |
| | | if (GdZiche.MotherCarDeviceCode == RGVCurrentlocation || GdZiche.HCJStorageaddress == RGVCurrentlocation) |
| | | { |
| | | RGVMovetask(GdZiche.WaitmomentOne, GdZiche.ChildPosiDeviceCode); |
| | | } |
| | | else if (GdZiche.MotherCardeputy == RGVCurrentlocation) |
| | | { |
| | | RGVMovetask(GdZiche.WaitmomentTwo, GdZiche.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | Dt_Task task = _taskService.GetChariotTaskBool(GdZiche.ChildPosiDeviceCode); |
| | | if (task == null && RgvCraneStatusValue == (int)RgvEquipmentStatus.NoCargo) |
| | | { |
| | | if (GdZiche.HCJStorageaddress == RGVCurrentlocation) |
| | | { |
| | | //妿å¨2å··éçæ¯è½¦ï¼åå¯ä»¥æ¾å车æ¥1å·çå¾
ç¹ï¼å¦æå¨HCJåå¯ä»¥è®©å车å»2å· |
| | | RGVMovetask(GdZiche.WaitmomentTwo, GdZiche.ChildPosiDeviceCode); |
| | | } |
| | | else if (GdZiche.MotherCarDeviceCode == RGVCurrentlocation || GdZiche.MotherCardeputy == RGVCurrentlocation) |
| | | { |
| | | RGVMovetask(GdZiche.WaitmomentOne, GdZiche.ChildPosiDeviceCode); |
| | | } |
| | | else if (RGVCurrentlocation == 1021) |
| | | { |
| | | //å å
¥å¤æï¼å¦æå¨1021ç«å°ï¼åéè¦å¤æ1å·å··éæ¯è½¦æ¯å¦å¨å åæºåè´§å£ |
| | | var zichestation = _agvStationService.GetMothervehicle(GdZiche.MotherCarDeviceCode); |
| | | int ziche = GetDeviceAddress.GetEquipmentlocation(zichestation.ChildPosiDeviceCode); |
| | | if (GetDeviceAddress.Mucheywhaddres(zichestation.ChildPosiDeviceCode) && (ziche == zichestation.ZicheMotherinlaw || ziche == zichestation.Motherinlaw)) |
| | | { |
| | | RGVMovetask(GdZiche.WaitmomentOne, GdZiche.ChildPosiDeviceCode); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// åæ¯è½¦ç§»å¨ä»»å¡ |
| | |
| | | /// <param name="RGVAdders">ç®æ å°å</param> |
| | | /// <param name="ChildPosiDeviceCode">设å¤ç¼å·</param> |
| | | /// <returns></returns> |
| | | private bool RGVMovetask(string RGVAdders, string ChildPosiDeviceCode, int taskid) |
| | | private bool RGVMovetask(int RGVAdders, string ChildPosiDeviceCode) |
| | | { |
| | | RgvCraneTaskCommand standardCommands = ConvertMotherCarTaskCommand(RGVAdders); |
| | | bool sendFlag = SendCommand2(standardCommands, ChildPosiDeviceCode); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskid, $"ç³»ç»èªå¨æµç¨ï¼æ§è¡æ¯è½¦ç§»å¨ä»»å¡ï¼æ¯è½¦ç¼å·ï¼{ChildPosiDeviceCode}ï¼ç§»å¨å°åï¼{RGVAdders}ï¼æ¯å¦ä¸åæåï¼{sendFlag}"); |
| | | |
| | | return sendFlag; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 夿å
ä¾§æ¯è½¦ä½ç½® |
| | | /// </summary> |
| | | /// <param name="_Task"></param> |
| | | /// <param name="aGVStation"></param> |
| | | /// <returns></returns> |
| | | private bool MotherCarMovesinside(Dt_Task _Task, AGVStation aGVStation) |
| | | { |
| | | //è·åå¤ä¾§æ¯è½¦ä½ç½® |
| | | int mcadder = GetMothercarlocation(_Task.TaskNum, aGVStation.MotherCarDeviceCode); |
| | | //è·åå
ä¾§æ¯è½¦ä½ç½® |
| | | int ncadder = GetMothercarlocation(_Task.TaskNum, _Task.NextAddress); |
| | | |
| | | if (mcadder != int.Parse(aGVStation.MotherCarDeviceCode) && ncadder == aGVStation.Station_code) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | if (mcadder == int.Parse(aGVStation.MotherCarDeviceCode)) |
| | | { |
| | | AGVStation aGVSta = _agvStationService.GetMothercarCode(aGVStation.MotherCarDeviceCode); |
| | | |
| | | RGVMovetask(aGVSta.ChildPosiDeviceCode, aGVSta.Station_code.ToString(), _Task.TaskId); |
| | | |
| | | } |
| | | |
| | | if (ncadder != aGVStation.Station_code) |
| | | { |
| | | RGVMovetask(aGVStation.ChildPosiDeviceCode, aGVStation.Station_code.ToString(), _Task.TaskId); |
| | | |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | private bool HCJMotherCarMovesinside(Dt_Task _Task, AGVStation aGVStation) |
| | | { |
| | | //è·åå¤ä¾§æ¯è½¦ä½ç½® |
| | | int mcadder = GetMothercarlocation(_Task.TaskNum, aGVStation.MotherCarDeviceCode); |
| | | //è·åå
ä¾§æ¯è½¦ä½ç½® |
| | | int ncadder = GetMothercarlocation(_Task.TaskNum, aGVStation.MotherCardeputy); |
| | | |
| | | if (mcadder != int.Parse(aGVStation.MotherCarDeviceCode) && ncadder != int.Parse(aGVStation.MotherCardeputy)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | if (mcadder == int.Parse(aGVStation.MotherCarDeviceCode)) |
| | | { |
| | | AGVStation aGVSta = _agvStationService.GetMothercarCode(aGVStation.MotherCarDeviceCode); |
| | | |
| | | RGVMovetask(aGVSta.ChildPosiDeviceCode, aGVSta.Station_code.ToString(), _Task.TaskId); |
| | | |
| | | } |
| | | |
| | | if (ncadder == int.Parse(aGVStation.MotherCardeputy)) |
| | | { |
| | | AGVStation aGVSta = _agvStationService.GetMothercarCode(aGVStation.MotherCardeputy); |
| | | |
| | | RGVMovetask(aGVSta.ChildPosiDeviceCode, aGVSta.Station_code.ToString(), _Task.TaskId); |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | //夿æ¯å¦ |
| | | public bool GetMotherCarCurrentAdder(Dt_Task task) |
| | | { |
| | | try |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "HCJ2000"); |
| | | CommonStackerCrane Commonstacker = (CommonStackerCrane)device; |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, task.CurrentAddress, "HCJ_GoodsStatus"); |
| | | int HCJGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress); |
| | | if (HCJGStatus == 0) //为æ è´§ |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //è®°å½å¼å¸¸æ
åµ |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"夿HCJç«å°æ¯å¦æè´§ä¿¡æ¯åºéï¼åºéä¿¡æ¯ï¼{ex.Message}"); |
| | | throw; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// ä¼ å
¥è¿éå°åï¼è·åæ¯è½¦ä½ç½® |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <param name="MotherCarDeviceCode">è¿éå°å</param> |
| | | /// <returns></returns> |
| | | public int GetMothercarlocation(int TaskNum, string MotherCarDeviceCode) |
| | | { |
| | | try |
| | | { |
| | | //å©ç¨å
¥åºç«å°å°åè·åæ¯è½¦plc |
| | | AGVStation aGVStation = _agvStationService.GetMothercarCode(MotherCarDeviceCode); |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == aGVStation.ChildPosiDeviceCode); |
| | | CommonStackerCrane Commonstacker = (CommonStackerCrane)device; |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, aGVStation.ChildPosiDeviceCode, "RGVCurrentlocation"); |
| | | int HCJGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress); |
| | | return HCJGStatus; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //è®°å½å¼å¸¸æ
åµ |
| | | _taskService.UpdateTaskExceptionMessage(TaskNum, $"夿æ¯è½¦ä½ç½®ä¿¡æ¯åºéï¼åºéä¿¡æ¯ï¼{ex.Message}"); |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// ä¼ å
¥è¿éå°åï¼è·åå车车ä½ç½® |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <param name="MotherCarDeviceCode">å
¥åºç«å°å°å</param> |
| | | /// <returns></returns> |
| | | public int GetZichelocation(Dt_Task task, string ChildPosiDeviceCode) |
| | | { |
| | | try |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == ChildPosiDeviceCode); |
| | | CommonStackerCrane Commonstacker = (CommonStackerCrane)device; |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, ChildPosiDeviceCode, "RGVCurrentlocation"); |
| | | int HCJGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress); |
| | | return HCJGStatus; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //è®°å½å¼å¸¸æ
åµ |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"夿å车ä½ç½®ä¿¡æ¯åºéï¼åºéä¿¡æ¯ï¼{ex.Message}"); |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®ä½è½¬æ¢æå½ä»¤Model |
| | | /// </summary> |
| | |
| | | public RgvCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task) |
| | | { |
| | | RgvCraneTaskCommand stackerCraneTaskCommand = new RgvCraneTaskCommand(); |
| | | short locaticurr = task.RGVTaskType switch |
| | | |
| | | short locaticurr = task.TaskType switch |
| | | { |
| | | _ when task.RGVTaskType == (short)RGVTaskTypeEnum.PickingUp || |
| | | task.RGVTaskType == (short)RGVTaskTypeEnum.TravelingOnly |
| | | => short.Parse(task.CurrentAddress), |
| | | _ when task.RGVTaskType == (short)RGVTaskTypeEnum.Placing |
| | | => short.Parse(task.NextAddress), |
| | | _ when task.TaskType == (int)TaskInboundTypeEnum.Inbound |
| | | => InRgvLocaaddres(task), |
| | | _ when task.TaskType == (int)TaskOutboundTypeEnum.Outbound |
| | | => RgvLocaaddres(task), |
| | | _ => (short)0 |
| | | }; |
| | | if (locaticurr == 0) return null; |
| | | |
| | | stackerCraneTaskCommand.RGV_RGVTasklocation = locaticurr; |
| | | stackerCraneTaskCommand.RGV_RGVtasktype = (short)task.RGVTaskType; |
| | | stackerCraneTaskCommand.RGV_Rgvtaskid = (short)task.TaskNum; |
| | | stackerCraneTaskCommand.RGV_Lanjiantaskid = (short)task.TaskNum; |
| | | return stackerCraneTaskCommand; |
| | | } |
| | | |
| | | public short InRgvLocaaddres(Dt_Task dt_Task) |
| | | { |
| | | if (dt_Task.RGVTaskType == (short)RGVTaskTypeEnum.PickingUp) return short.Parse(dt_Task.CurrentAddress); |
| | | else if (dt_Task.RGVTaskType == (short)RGVTaskTypeEnum.Placing) return short.Parse(dt_Task.NextAddress); |
| | | else if (dt_Task.RGVTaskType == (short)RGVTaskTypeEnum.TravelingOnly && dt_Task.TaskState == (int)TaskInStatusEnum.RGV_InZicheReleaseFinish) return short.Parse(dt_Task.NextAddress); |
| | | return 0; |
| | | } |
| | | public short RgvLocaaddres(Dt_Task dt_Task) |
| | | { |
| | | if (dt_Task.RGVTaskType == (short)RGVTaskTypeEnum.PickingUp) return short.Parse(dt_Task.CurrentAddress); |
| | | else if (dt_Task.RGVTaskType == (short)RGVTaskTypeEnum.Placing) return short.Parse(dt_Task.NextAddress); |
| | | else if (dt_Task.RGVTaskType == (short)RGVTaskTypeEnum.TravelingOnly && dt_Task.TaskState == (int)TaskOutStatusEnum.OutNew) return short.Parse(dt_Task.NextAddress); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public RgvCraneTaskCommand? ConvertMotherCarTaskCommand(string RGVAddress) |
| | | public RgvCraneTaskCommand? ConvertMotherCarTaskCommand(int RGVAddress) |
| | | { |
| | | RgvCraneTaskCommand stackerCraneTaskCommand = new RgvCraneTaskCommand(); |
| | | stackerCraneTaskCommand.RGV_RGVTasklocation = short.Parse(RGVAddress); |
| | | stackerCraneTaskCommand.RGV_RGVTasklocation = (short)RGVAddress; |
| | | stackerCraneTaskCommand.RGV_RGVtasktype = 3; |
| | | stackerCraneTaskCommand.RGV_Rgvtaskid = 999; //rgvä»»å¡å· |
| | | stackerCraneTaskCommand.RGV_Lanjiantaskid = 999; //å
°åä»»å¡id |
| | | stackerCraneTaskCommand.RGV_Rgvtaskid = 30001; //rgvä»»å¡å· |
| | | stackerCraneTaskCommand.RGV_Lanjiantaskid = 30001; //å
°åä»»å¡id |
| | | return stackerCraneTaskCommand; |
| | | } |
| | | |
| | | |
| | | public void wcsWriteLog(string SCLLinStack, string Logtype, string Magessadd) |
| | | { |
| | | WriteLog.Write_Log("RGV", SCLLinStack + "å·RGV", Logtype, new { ä¿¡æ¯ = Magessadd }); |
| | | } |
| | | |
| | | |
| | | |
| | | //===========================================================HCJåè®®è¯»åæ¥============================================================================= |
| | | /// <summary> |
| | | /// æ¥è¯¢å
·ä½å°å |
| | | /// </summary> |
| | | /// <param name="Commonstacker"></param> |
| | | /// <param name="SCAddress"></param> |
| | | /// <param name="Interactivet"></param> |
| | | /// <returns></returns> |
| | | public DeviceProDTO? GetDeviceProDTO(CommonStackerCrane Commonstacker, string SCAddress, string Interactivet) |
| | | { |
| | | return Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet && x.DeviceProParamType == "ReadDeviceCommand"); |
| | | } |
| | | /// <summary> |
| | | /// æ ¹å°å读åè¾éçº¿ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="conveyorLine"></param> |
| | | /// <param name="DeviceProDataBlock"></param> |
| | | /// <returns></returns> |
| | | public int GetLine(CommonStackerCrane Commonstacker, string DeviceProDataBlock) |
| | | { |
| | | return Commonstacker.Communicator.Read<short>(DeviceProDataBlock); |
| | | } |
| | | //===========================================================HCJåè®®è¯»åæ¥=============================================================================== |
| | | |
| | | |
| | | public bool SendCommand2(RgvCraneTaskCommand command, string DeviceCode) |
| | | { |
| | | try |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceCode); |
| | | CommonStackerCrane Commonstacker = (CommonStackerCrane)device; |
| | | SpeStackerCrane Commonstacker = (SpeStackerCrane)device; |
| | | |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, DeviceCode, "RGV_Rgvtaskstutas"); |
| | | int MCGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress); |
| | | if (Commonstacker.IsConnected) |
| | | DeviceProDTO? deviceProDTO = GetDeviceAddress.GetRGVDeviceProDTO(Commonstacker, DeviceCode, "RGV_Rgvtaskstutas"); |
| | | int MCGStatus = GetDeviceAddress.RGVGetLine(Commonstacker, deviceProDTO.DeviceProAddress); |
| | | |
| | | |
| | | if (MCGStatus == 0) |
| | | { |
| | | if (MCGStatus == (int)RgvJobCraneStatus.Ready) |
| | | if (MCGStatus == (int)RGV_Rgvtaskstutas.Ready) |
| | | { |
| | | Commonstacker.SetValue(RgvCraneDBName.RGV_RGVTasklocation, command.RGV_RGVTasklocation); |
| | | Commonstacker.SetValue(RgvCraneDBName.RGV_RGVtasktype, command.RGV_RGVtasktype); |
| | | Commonstacker.SetValue(RgvCraneDBName.RGV_Rgvtaskid, command.RGV_Rgvtaskid); |
| | | Commonstacker.SetValue(RgvCraneDBName.RGV_Lanjiantaskid, command.RGV_Lanjiantaskid); |
| | | Commonstacker.SetValue(RgvCraneDBName.RGV_RGVTasklocationt, command.RGV_RGVTasklocation); |
| | | Commonstacker.SetValue(RgvCraneDBName.RGV_RGVtasktypet, command.RGV_RGVtasktype); |
| | | Commonstacker.SetValue(RgvCraneDBName.RGV_Rgvtaskidt, command.RGV_Rgvtaskid); |
| | | Commonstacker.SetValue(RgvCraneDBName.RGV_Lanjiantaskidt, command.RGV_Lanjiantaskid); |
| | | return true; |
| | | } |
| | | } |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |