| | |
| | | using System.Diagnostics.Eventing.Reader; |
| | | using System.Linq; |
| | | 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.StaclerkJobJobStatusValue == RgvJobCraneStatus.Completed && getStackerObject.CurrentRgvtaskid != 0) |
| | | { |
| | | _taskService.UpdateTaskStatus(getStackerObject.CurrentRgvtaskid); |
| | | _taskService.UpdateTaskStatus(getStackerObject.CurrentRgvtaskid,2); |
| | | } |
| | | |
| | | |
| | | |
| | | if (getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic && |
| | | getStackerObject.StaclerkJobJobStatusValue == RgvJobCraneStatus.Ready && getStackerObject.RgvCraneWorkStatusValue == RGVStepprocess.NoAction) |
| | | { |
| | | |
| | | //ä¸åRGVä»»å¡ä¹åï¼å
读åä¸ä¸å®å
¨é¨ç¶æ |
| | | |
| | | |
| | | |
| | | //æ¥æ¾RGVè¿è¡ä¸åä»»å¡ |
| | | Dt_Task task = GetTask(speStackerCrane.DeviceCode); |
| | |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int HCJGoodsplatform = 1170; //å®ä¹çæ¾è´§ç«å° |
| | | |
| | | //夿æ¯è½¦æ¯å¦éè¦è¿è¡ç§»å¨ |
| | | AGVStation GdZiche = _agvStationService.Corridorequipment(speStackerCrane.DeviceCode); |
| | | if(GdZiche.Station_Area == 1) |
| | | { |
| | | switch (getStackerObject.RGVCurrentlocation) |
| | | { |
| | | case int Whcjaddress when Whcjaddress == GdZiche.MotherCarDeviceCode: //å¨ç¬¬ä¸ä¸ªæ¯è½¦ä¸ |
| | | RGVMovetask(HCJGoodsplatform, GdZiche.ChildPosiDeviceCode); |
| | | break; |
| | | case int Waddress when Waddress == GdZiche.MotherCardeputy: //å¨ç¬¬äºä¸ªæ¯è½¦ä¸ |
| | | OutNMotherCar(GdZiche.MotherCarDeviceCode); |
| | | break; |
| | | case int HCJaddress when HCJaddress == GdZiche.HCJStorageaddress: //å¨HCJç«å°ä¸ |
| | | OutHCJMotherCar(GdZiche); |
| | | break; |
| | | default: return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | switch (getStackerObject.RGVCurrentlocation) |
| | | { |
| | | case int Whcjaddress when Whcjaddress == GdZiche.MotherCarDeviceCode: //å¨ç¬¬ä¸ä¸ªæ¯è½¦ä¸ï¼éè¦å¤æå¤ä¾§å车æ¯å¦å¨HCJä¸ |
| | | OutinnerSideNMotherCar(GdZiche); |
| | | break; |
| | | case int Waddress when Waddress == GdZiche.MotherCardeputy: //å¨ç¬¬äºä¸ªæ¯è½¦ä¸ï¼éè¦å¤æå车ä¸å¤ä¾§æ¯è½¦æ¯å¦å¨è¿éä¸ |
| | | OutNMotherCar(GdZiche.MotherCarDeviceCode); |
| | | break; |
| | | default: return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | { |
| | | (int)TaskInStatusEnum.RGV_InNew => task, |
| | | (int)TaskInStatusEnum.RGV_InPickupFinish => HandlePickupFinish(task), |
| | | (int)TaskInStatusEnum.RGV_InReleaseFinish => task, //éè¦å¤æå车æ¯å
ä¾§åºè¿æ¯å¤ä¾§åè´§ï¼å¾
å®æï¼ |
| | | (int)TaskInStatusEnum.RGV_InReleaseFinish => HandInneRouterSides(task), |
| | | (int)TaskInStatusEnum.RGV_InZicheFinish => HandleZicheFinish(task), |
| | | (int)TaskInStatusEnum.RGV_InZicheReleaseFinish => HandleZicheReleaseFinish(task), |
| | | (int)TaskInStatusEnum.RGV_InZicheReleaseFinish => task, |
| | | (int)TaskInStatusEnum.RGV_InZichemoveFinish => HandleZicheMoveFinish(task), |
| | | _ => null |
| | | }; |
| | |
| | | } |
| | | |
| | | #region å
¥åºæ¹æ³ |
| | | |
| | | #region å
¥åºå£åè´§å®æåï¼è¿è¡æ¾è´§ï¼HCJ,å¼å¸¸åºåºå£ï¼ |
| | | private Dt_Task? HandlePickupFinish(Dt_Task task) |
| | | { |
| | | try |
| | |
| | | //è·åéè¦åºåæ¯å¦å»å
¥åºä¸å»ä¸åæ ¼è½½è´§å°ä»»å¡ |
| | | 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); |
| | | DeviceProDTO? deviceProDTO = GetDeviceAddress.GetDeviceProDTO(Commonstacker, task.NextAddress, "HCJ_GoodsStatus"); |
| | | int HCJGStatus = GetDeviceAddress.GetLine(Commonstacker, deviceProDTO.DeviceProAddress); |
| | | if (HCJGStatus == 0) //为æ è´§ |
| | | { |
| | | return task; |
| | |
| | | return null; |
| | | } |
| | | |
| | | private Dt_Task? HandleZicheFinish(Dt_Task task) |
| | | { |
| | | //è·åæ¾è´§å°å |
| | | AGVStation aGVStation = _agvStationService.GetAllStationByDeviceCode(int.Parse(task.NextAddress)); |
| | | #endregion |
| | | |
| | | //å3åºåè¿è¡æ¾è´§ |
| | | return aGVStation.Station_Area switch |
| | | #region å
¥åºå£æ¾è´§å®æåï¼è¿è¡åè´§å
容 |
| | | private Dt_Task? HandInneRouterSides(Dt_Task task) |
| | | { |
| | | // æ ¹æ®è®¾å¤åç§°ï¼è·åå°è®¾å¤ç¸å
³æ°æ® |
| | | AGVStation currentStation = _agvStationService.Corridorequipment(task.Roadway); |
| | | |
| | | // è·åå车ä½ç½® |
| | | int zicheAddress = GetDeviceAddress.GetEquipmentlocation(currentStation.ChildPosiDeviceCode); |
| | | if (currentStation.Station_Area == 1) |
| | | { |
| | | 1 => CheckMotherCarMove(task, aGVStation, MotherCarMoves), //å¤ä¾§æ¾è´§ |
| | | 2 => CheckMotherCarMove(task, aGVStation, MotherCarMovesinside), //å
ä¾§æ¾è´§ |
| | | 3 => CheckMotherCarMove(task, aGVStation, HCJMotherCarMovesinside), //交æ¥ç¹æ¾è´§ |
| | | _ => null |
| | | }; |
| | | // æ ¹æ®å车ä½ç½®å¤çä¸åæ
åµ |
| | | switch (zicheAddress) |
| | | { |
| | | case int Whcjaddress when Whcjaddress == int.Parse(task.CurrentAddress): |
| | | return task; |
| | | case int Waddress when Waddress == currentStation.MotherCarDeviceCode: |
| | | return task; |
| | | case int Naddress when Naddress == currentStation.MotherCardeputy: |
| | | return HandleMedialCase(task, currentStation.MotherCarDeviceCode); |
| | | case int HCJaddress when HCJaddress == currentStation.HCJStorageaddress: |
| | | return HandleMedialCase2(task, currentStation); |
| | | default: return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //åHCJä½çæå¤æ |
| | | switch (zicheAddress) |
| | | { |
| | | case int Whcjaddress when Whcjaddress == int.Parse(task.CurrentAddress): |
| | | return task; |
| | | case int Waddress when Waddress == currentStation.MotherCarDeviceCode: |
| | | return task; |
| | | case int Naddress when Naddress == currentStation.MotherCardeputy: |
| | | return HandleMedialCase(task, currentStation.MotherCarDeviceCode); |
| | | default: return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Dt_Task? CheckMotherCarMove(Dt_Task task, AGVStation station, Func<Dt_Task, AGVStation, bool> moveFunc) |
| | | /// <summary> |
| | | /// 夿å¤ä¾§æ¯è½¦æ¯å¦å¨å
¥å£å£ |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <param name="currentStation"></param> |
| | | /// <returns></returns> |
| | | private Dt_Task? HandleMedialCase(Dt_Task task, int currentStation) |
| | | { |
| | | return moveFunc(task, station) ? task : null; |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(currentStation); |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | if (motherCarAddress == Muche.Motherinlaw) return task; |
| | | RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); |
| | | return null; |
| | | } |
| | | |
| | | private Dt_Task? HandleZicheReleaseFinish(Dt_Task task) |
| | | /// <summary> |
| | | /// 夿å
å¤ä¾§æ¯è½¦æ¯å¦å¨å
¥åºå£ |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <param name="currentStation"></param> |
| | | /// <returns></returns> |
| | | private Dt_Task? HandleMedialCase2(Dt_Task task, AGVStation currentStation) |
| | | { |
| | | 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; //å»åè´§ï¼éè¦å¤æå车å½åä½åï¼ï¼åç»ä¼åï¼ |
| | | } |
| | | 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 åè´§å®æåï¼è¿è¡æ¾è´§æä½ |
| | | private Dt_Task? HandleZicheFinish(Dt_Task task) |
| | | { |
| | | // æ ¹æ®è®¾å¤åç§°ï¼è·åå°è®¾å¤ç¸å
³æ°æ® |
| | | AGVStation GdaoRgvStation = _agvStationService.Corridorequipment(task.Roadway); |
| | | int nexaddres = int.Parse(task.NextAddress); |
| | | switch (nexaddres) |
| | | { |
| | | case int Whcjaddress when Whcjaddress == GdaoRgvStation.MotherCarDeviceCode: //æ¾è´§ç¹å¨ç¬¬ä¸ä¸ªè¿éç¹ |
| | | return MotherCarMoves(task, GdaoRgvStation); |
| | | case int Waddress when Waddress == GdaoRgvStation.MotherCardeputy: //æ¾è´§ç¹å¨ç¬¬äºä¸ªè¿éç¹ |
| | | return MotherCarMovesinside(task, GdaoRgvStation); |
| | | case int HCJaddress when HCJaddress == GdaoRgvStation.HCJStorageaddress: //æ¾è´§ç¹å¨HCJä¸ |
| | | return HCJMotherCarMovesinside(task, GdaoRgvStation); |
| | | default: return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | //åºåä¸å¤ææ¯è½¦æ¯å¦å°ä½ï¼å¯ç«å³æ¾è´§ |
| | | private Dt_Task? MotherCarMoves(Dt_Task _Task, AGVStation aGVStation) |
| | | { |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(aGVStation.ZicheMotherinlaw); |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | if (motherCarAddress == Muche.ZicheMotherinlaw) return _Task; |
| | | RGVMovetask(Muche.ZicheMotherinlaw, aGVStation.ChildPosiDeviceCode); |
| | | 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); //å¤ä¾§æ¯è½¦ |
| | | AGVStation Muche2 = _agvStationService.GetMothervehicle(aGVStation.MotherCardeputy); //å
ä¾§æ¯è½¦ |
| | | |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | int motherCarAddress2 = GetDeviceAddress.GetEquipmentlocation(Muche2.ChildPosiDeviceCode); |
| | | // 妿æ¯è½¦ä¸å¨é¢æä½ç½®ï¼ä¸åç§»å¨ä»»å¡ |
| | | if (motherCarAddress != Muche.Motherinlaw) |
| | | { |
| | | RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); |
| | | } |
| | | if (motherCarAddress2 != Muche2.ZicheMotherinlaw) |
| | | { |
| | | RGVMovetask(Muche2.ZicheMotherinlaw, Muche2.ChildPosiDeviceCode); |
| | | } |
| | | if (motherCarAddress == Muche.Motherinlaw && motherCarAddress2 == Muche2.ZicheMotherinlaw) return _Task; |
| | | // æ¯è½¦å·²å¨æ£ç¡®ä½ç½® |
| | | return null; |
| | | } |
| | | private Dt_Task? HCJMotherCarMovesinside(Dt_Task _Task, AGVStation aGVStation) |
| | | { |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(aGVStation.MotherCarDeviceCode); //å¤ä¾§æ¯è½¦ |
| | | AGVStation Muche2 = _agvStationService.GetMothervehicle(aGVStation.MotherCardeputy); //å
ä¾§æ¯è½¦ |
| | | |
| | | AGVStation Ziche3 = _agvStationService.GetZicheDeep(aGVStation.HCJStorageaddress); //å
ä¾§å车 |
| | | |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | int motherCarAddress2 = GetDeviceAddress.GetEquipmentlocation(Muche2.ChildPosiDeviceCode); |
| | | int ZiCarAddress3 = GetDeviceAddress.GetEquipmentlocation(Ziche3.ChildPosiDeviceCode); |
| | | // 妿æ¯è½¦ä¸å¨é¢æä½ç½®ï¼ä¸åç§»å¨ä»»å¡ |
| | | if (motherCarAddress != Muche.Motherinlaw) |
| | | { |
| | | RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); |
| | | } |
| | | if (motherCarAddress2 != Muche2.Motherinlaw) |
| | | { |
| | | RGVMovetask(Muche2.Motherinlaw, Muche2.ChildPosiDeviceCode); |
| | | } |
| | | if(ZiCarAddress3== Ziche3.HCJStorageaddress) |
| | | { |
| | | //å¤æç®æ ç«å°æ¯å
¥åºå°å å·å åæº |
| | | if (_Task.TargetAddress == "3") //å
¥åºè³3å·å åæº |
| | | { |
| | | //夿å¤ä¾§æ¯è½¦ä½ç½®ï¼2åºåï¼ |
| | | AGVStation MucheN = _agvStationService.GetMothervehicle(Ziche3.MotherCarDeviceCode); //å¤ä¾§æ¯è½¦ |
| | | int motNCarAddress = GetDeviceAddress.GetEquipmentlocation(MucheN.ChildPosiDeviceCode); //è·åå°æ¯è½¦å½åä½ç½® |
| | | if(MucheN.ZicheMotherinlaw== motNCarAddress) |
| | | { |
| | | RGVMovetask(Ziche3.MotherCarDeviceCode, Ziche3.ChildPosiDeviceCode); |
| | | } |
| | | else |
| | | { |
| | | RGVMovetask(MucheN.ZicheMotherinlaw, MucheN.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | else if (_Task.TargetAddress == "4") //å
¥åºè³4å·å åæº |
| | | { |
| | | //夿å¤ä¾§æ¯è½¦ä½ç½®ï¼2åºåï¼ |
| | | AGVStation MucheN = _agvStationService.GetMothervehicle(Ziche3.MotherCarDeviceCode); //å¤ä¾§æ¯è½¦ |
| | | int motNCarAddress = GetDeviceAddress.GetEquipmentlocation(MucheN.ChildPosiDeviceCode); //è·åå°æ¯è½¦å½åä½ç½® |
| | | if (MucheN.Motherinlaw != motNCarAddress) |
| | | { |
| | | RGVMovetask(MucheN.Motherinlaw, MucheN.ChildPosiDeviceCode); |
| | | } |
| | | AGVStation MucheN2 = _agvStationService.GetMothervehicle(Ziche3.MotherCardeputy); //å¤ä¾§æ¯è½¦ |
| | | int motNCarAddress2 = GetDeviceAddress.GetEquipmentlocation(MucheN2.ChildPosiDeviceCode); //è·åå°æ¯è½¦å½åä½ç½® |
| | | if (MucheN2.ZicheMotherinlaw != motNCarAddress2) |
| | | { |
| | | RGVMovetask(MucheN2.ZicheMotherinlaw, MucheN2.ChildPosiDeviceCode); |
| | | } |
| | | |
| | | if(MucheN.Motherinlaw == motNCarAddress && MucheN2.ZicheMotherinlaw == motNCarAddress2) |
| | | { |
| | | RGVMovetask(Ziche3.MotherCardeputy, Ziche3.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (motherCarAddress == Muche.Motherinlaw && motherCarAddress2 == Muche2.Motherinlaw && ZiCarAddress3 != Ziche3.HCJStorageaddress) return _Task; |
| | | // æ¯è½¦å·²å¨æ£ç¡®ä½ç½® |
| | | return null; |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¯è½¦ç§»å¨è³å
¥åºå£ |
| | | private Dt_Task? HandleZicheMoveFinish(Dt_Task task) |
| | | { |
| | | AGVStation aGVStation = _agvStationService.GetAllStationByDeviceCode(int.Parse(task.CurrentAddress)); |
| | | int zicheAddress = GetZichelocation(task, task.CurrentAddress); |
| | | int curradder = int.Parse(task.CurrentAddress); |
| | | AGVStation GdZiche = _agvStationService.GetMotheaisle(curradder); |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(GdZiche.ChildPosiDeviceCode); |
| | | if (motherCarAddress != curradder) return task; |
| | | RGVMovetask(GdZiche.Motherinlaw, GdZiche.ChildPosiDeviceCode); |
| | | return null; |
| | | } |
| | | #endregion |
| | | |
| | | //妿åè½¦å¨æ¯è½¦ä¸ï¼åéè¦ç§»åºæ¯è½¦ï¼å¾
ä¼åï¼ |
| | | return zicheAddress != int.Parse(aGVStation.ZicheMotherinlaw) ? task : null; |
| | | #endregion |
| | | |
| | | |
| | | #region åºåºæ¹æ³ |
| | | |
| | | #region å¤ä¾§å°è½¦åå½å°èµ·å§ç¹ä½ |
| | | /// <summary> |
| | | /// 夿æ¾ç¬¬äºä¸ªæ¯è½¦ä½ç½® |
| | | /// </summary> |
| | | /// <param name="_Task"></param> |
| | | /// <param name="aGVStation"></param> |
| | | /// <returns></returns> |
| | | private void OutNMotherCar(int MotherCarDeviceCode) |
| | | { |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(MotherCarDeviceCode); //å¤ä¾§æ¯è½¦ |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | if (motherCarAddress != Muche.Motherinlaw) |
| | | { |
| | | RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | private void OutHCJMotherCar(AGVStation aGVStation) |
| | | { |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(aGVStation.MotherCarDeviceCode); //å¤ä¾§æ¯è½¦ |
| | | AGVStation Muche2 = _agvStationService.GetMothervehicle(aGVStation.MotherCardeputy); //å
ä¾§æ¯è½¦ |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | int motherCarAddress2 = GetDeviceAddress.GetEquipmentlocation(Muche2.ChildPosiDeviceCode); |
| | | // 妿æ¯è½¦ä¸å¨é¢æä½ç½®ï¼ä¸åç§»å¨ä»»å¡ |
| | | if (motherCarAddress != Muche.Motherinlaw) |
| | | { |
| | | RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); |
| | | } |
| | | if (motherCarAddress2 != Muche2.Motherinlaw) |
| | | { |
| | | RGVMovetask(Muche2.Motherinlaw, Muche2.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | //åºåä¸å¤ææ¯è½¦æ¯å¦å°ä½ï¼å¯ç«å³æ¾è´§ |
| | | private bool MotherCarMoves(Dt_Task _Task, AGVStation aGVStation) |
| | | #region å¤ä¾§å°è½¦åå½å°èµ·å§ç¹ä½ |
| | | /// <summary> |
| | | /// å¨ç¬¬ä¸ä¸ªä½ç½®ï¼å夿å¤ä¾§å车æ¯å¦å¨HCJç«å°ä¸é¢ |
| | | /// </summary> |
| | | /// <param name="_Task"></param> |
| | | /// <param name="aGVStation"></param> |
| | | /// <returns></returns> |
| | | private void OutinnerSideNMotherCar(AGVStation aGVStation) |
| | | { |
| | | int mcadder = GetMothercarlocation(_Task.TaskNum, aGVStation.Motherinlaw); //è·åå°æ¯è½¦å¤ä¾§ä½ç½® |
| | | if(mcadder != 0) |
| | | AGVStation Ziche3 = _agvStationService.GetZicheDeep(aGVStation.HCJStorageaddress); //å
ä¾§å车 |
| | | int ZiCarAddress3 = GetDeviceAddress.GetEquipmentlocation(Ziche3.ChildPosiDeviceCode); |
| | | if (ZiCarAddress3 == Ziche3.HCJStorageaddress) |
| | | { |
| | | if (mcadder == int.Parse(_Task.CurrentAddress)) |
| | | { |
| | | return true; |
| | | } |
| | | RGVMovetask(_Task.CurrentAddress, aGVStation.ChildPosiDeviceCode,_Task.TaskId); |
| | | |
| | | } |
| | | return false; |
| | | else |
| | | { |
| | | //RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | private void OutinnerSideMotherCar(AGVStation aGVStation) |
| | | { |
| | | AGVStation Muche = _agvStationService.GetMothervehicle(aGVStation.MotherCarDeviceCode); //å¤ä¾§æ¯è½¦ |
| | | AGVStation Muche2 = _agvStationService.GetMothervehicle(aGVStation.MotherCardeputy); //å
ä¾§æ¯è½¦ |
| | | int motherCarAddress = GetDeviceAddress.GetEquipmentlocation(Muche.ChildPosiDeviceCode); |
| | | int motherCarAddress2 = GetDeviceAddress.GetEquipmentlocation(Muche2.ChildPosiDeviceCode); |
| | | // 妿æ¯è½¦ä¸å¨é¢æä½ç½®ï¼ä¸åç§»å¨ä»»å¡ |
| | | if (motherCarAddress != Muche.Motherinlaw) |
| | | { |
| | | RGVMovetask(Muche.Motherinlaw, Muche.ChildPosiDeviceCode); |
| | | } |
| | | if (motherCarAddress2 != Muche2.Motherinlaw) |
| | | { |
| | | RGVMovetask(Muche2.Motherinlaw, Muche2.ChildPosiDeviceCode); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #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> |
| | |
| | | short locaticurr = task.RGVTaskType switch |
| | | { |
| | | _ when task.RGVTaskType == (short)RGVTaskTypeEnum.PickingUp || |
| | | task.RGVTaskType == (short)RGVTaskTypeEnum.TravelingOnly |
| | | (task.RGVTaskType == (short)RGVTaskTypeEnum.TravelingOnly && task.TaskType != (int)TaskInStatusEnum.RGV_InZichemoveFinish) |
| | | => short.Parse(task.CurrentAddress), |
| | | _ when task.RGVTaskType == (short)RGVTaskTypeEnum.Placing |
| | | _ when task.RGVTaskType == (short)RGVTaskTypeEnum.Placing || (task.RGVTaskType == (short)RGVTaskTypeEnum.TravelingOnly && task.TaskType== (int)TaskInStatusEnum.RGV_InZichemoveFinish) |
| | | => short.Parse(task.NextAddress), |
| | | _ => (short)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 |
| | | 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; |
| | | |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, DeviceCode, "RGV_Rgvtaskstutas"); |
| | | int MCGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress); |
| | | DeviceProDTO? deviceProDTO = GetDeviceAddress.GetDeviceProDTO(Commonstacker, DeviceCode, "RGV_Rgvtaskstutas"); |
| | | int MCGStatus = GetDeviceAddress.GetLine(Commonstacker, deviceProDTO.DeviceProAddress); |
| | | if (Commonstacker.IsConnected) |
| | | { |
| | | if (MCGStatus == (int)RgvJobCraneStatus.Ready) |