已重命名1个文件
已修改6个文件
已删除9个文件
已添加7个文件
| | |
| | | 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åè´§ä¸ |
| | | /// </summary> |
| | | [Description("AGVåè´§ä¸")] |
| | | AGV_Takeing =305, |
| | | AGV_Takeing = 305, |
| | | /// <summary> |
| | | /// AGVæ§è¡ä¸ |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | [Description("AGV宿")] |
| | | 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> |
| | | /// ä»»å¡å®æ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Diagnostics; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | |
| | | if (taskTypeGroup == TaskTypeGroup.InboundGroup) |
| | | { |
| | | stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress); |
| | | if (stationManger==null && task.TaskType==TaskTypeEnum.InProduct.ObjToInt()) |
| | | { |
| | | stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode==task.SourceAddress); |
| | | //è½¬æ¢æåä»èµ·ç¹ç«å° |
| | | item.SourceAddress = stationManger.StationCode; |
| | | task.CurrentAddress = stationManger.StationCode; |
| | | task.SourceAddress = stationManger.StationCode; |
| | | } |
| | | //if (stationManger==null && task.TaskType==TaskTypeEnum.InProduct.ObjToInt()) |
| | | //{ |
| | | // stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode==task.SourceAddress); |
| | | // //è½¬æ¢æåä»èµ·ç¹ç«å° |
| | | // item.SourceAddress = stationManger.StationCode; |
| | | // task.CurrentAddress = stationManger.StationCode; |
| | | // task.SourceAddress = stationManger.StationCode; |
| | | //} |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (routers.Count == 1) |
| | | { |
| | | if (taskTypeGroup == TaskTypeGroup.InboundGroup && item.TargetAddress == stationManger.StackerCraneCode) |
| | | if (taskTypeGroup == TaskTypeGroup.InboundGroup) |
| | | { |
| | | task.CurrentAddress = router.StartPosi; |
| | | task.NextAddress = router.NextPosi; |
| | | task.DeviceCode = stationManger.StationDeviceCode; |
| | | task.DeviceCode = router.ChildPosiDeviceCode; |
| | | } |
| | | else if (item.TaskType == TaskTypeEnum.MesMatReturn.ObjToInt() && !router.IsEnd) |
| | | { |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | //string address = AppSettings.Get("WMSApiAddress"); |
| | | //if (string.IsNullOrEmpty(address)) |
| | | //{ |
| | | // return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | //} |
| | | //string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}"); |
| | | //WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | //if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | //{ |
| | | // WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString()); |
| | | // if (taskDTO != null) |
| | | // { |
| | | WMSTaskDTO? taskDTO = new WMSTaskDTO() |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}"); |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString()); |
| | | if (taskDTO != null) |
| | | { |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | } |
| | | Id = 1, |
| | | TaskNum = DateTime.Now.ToString("mmss").ObjToInt(), |
| | | PalletCode="", |
| | | RoadWay="", |
| | | TaskType=TaskTypeEnum.InProduct.ObjToInt(), |
| | | TaskStatus=TaskStatusEnum.New.ObjToInt(), |
| | | SourceAddress= sourceAddress, |
| | | TargetAddress="", |
| | | WarehouseId=1, |
| | | Grade=0, |
| | | }; |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | // } |
| | | //} |
| | | |
| | | } |
| | | catch (Exception ex) |
| | |
| | | |
| | | BaseDal.UpdateData(task); |
| | | |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (!string.IsNullOrEmpty(address)) |
| | | { |
| | | HttpHelper.Post($"{address}/api/Task/UpdateTaskInfo", task.Serialize()); |
| | | } |
| | | //string address = AppSettings.Get("WMSApiAddress"); |
| | | //if (!string.IsNullOrEmpty(address)) |
| | | //{ |
| | | // HttpHelper.Post($"{address}/api/Task/UpdateTaskInfo", task.Serialize()); |
| | | //} |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, stringBuilder.ToString()); |
| | | } |
| | | } |
| | |
| | | |
| | | public int TaskNum { get; set; } |
| | | } |
| | | |
| | | |
| | | public class R_ConveyorLineInfo : DeviceCommand |
| | | { |
| | | /// <summary> |
| | | /// ç«å°ç¼å· |
| | | /// </summary> |
| | | public short ConveyorNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¶æ |
| | | /// </summary> |
| | | public byte Status { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public byte Undefined { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | public int TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èµ·å§å°å |
| | | /// </summary> |
| | | public short StartPos { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç®æ å°å |
| | | /// </summary> |
| | | public short EndPos { get; set; } |
| | | |
| | | /// <summary> |
| | | /// éé |
| | | /// </summary> |
| | | public short GoodsWeight { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ç©ç±»å |
| | | /// </summary> |
| | | public short GoodsType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 0鿢1åè¿2åé3ä¸å/顺æ¶éæè½¬4ä¸é/éæ¶éæè½¬ |
| | | /// </summary> |
| | | public short RunStatus { get; set; } |
| | | |
| | | private string _barcode; |
| | | /// <summary> |
| | | /// æ¡ç |
| | | /// </summary> |
| | | [DataLength(20)] |
| | | public string Barcode |
| | | { |
| | | get { return _barcode; } |
| | | set { _barcode = value.Replace("\0", "").Replace("\\0", ""); } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Spare1 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Spare2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 交äºä¿¡å· |
| | | /// </summary> |
| | | public byte Signal { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public byte Undefined2 { get; set; } |
| | | } |
| | | public class R_ConveyorLineCPInfo : DeviceCommand |
| | | { |
| | | /// <summary> |
| | | /// å°ä½æä»¤ |
| | | /// å¿è·³ |
| | | /// </summary> |
| | | public short ConveyArrivaled { get; set; } |
| | | |
| | | public short Heart { get; set; } |
| | | /// <summary> |
| | | /// èµ·å§å°å |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short StartPos { get; set; } |
| | | |
| | | public short Reserve { get; set; } |
| | | /// <summary> |
| | | /// ç»ç¹å°å |
| | | /// ç¶æ |
| | | /// </summary> |
| | | public short EndPos { get; set; } |
| | | |
| | | public short StatusPV { get; set; } |
| | | /// <summary> |
| | | /// å½ä»¤ |
| | | /// </summary> |
| | | public short Command { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | public int TaskNo { get; set; } |
| | | /// <summary> |
| | | /// æçå· |
| | | /// </summary> |
| | | /// <summary> |
| | | |
| | | [DataLength(20)] |
| | | public string Barcode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | [DataLength(20)] |
| | | public string TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç±»å |
| | | /// </summary> |
| | | public short WorkType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¨¡å¼ |
| | | /// </summary> |
| | | public short WorkMode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ ¡éªä½ |
| | | /// </summary> |
| | | public short CheckPos { get; set; } |
| | | [DataLength(10)] |
| | | public string PalletCode { get; set; } |
| | | } |
| | | public class R_ConveyorLineGMInfo : DeviceCommand |
| | | public class R_RGVCPInfo : DeviceCommand |
| | | { |
| | | /// <summary> |
| | | /// ç®±å· |
| | | /// 模å¼<br/> |
| | | /// 1æå¨<br/> |
| | | /// 2ç»´ä¿®<br/> |
| | | /// 3åèªå¨<br/> |
| | | /// 4èªå¨<br/> |
| | | /// 5èæºèªå¨<br/> |
| | | /// </summary> |
| | | public short Mode { get; set; } |
| | | /// <summary> |
| | | [DataLength(120)] |
| | | public string Boxcode { get; set; } |
| | | } |
| | | public class R_ConveyorLineFLInfo : DeviceCommand |
| | | { |
| | | /// <summary> |
| | | /// æçå· |
| | | /// ç¶æ<br/> |
| | | /// 0空é²<br/> |
| | | /// 1æä»»å¡<br/> |
| | | /// </summary> |
| | | public short State { get; set; } |
| | | /// <summary> |
| | | |
| | | [DataLength(20)] |
| | | public string Barcode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// RGVæ¥æ¶ä»»å¡å·<br/> |
| | | /// </summary> |
| | | [DataLength(20)] |
| | | public string TaskNum { get; set; } |
| | | } |
| | | public class R_ConveyorLineStatus |
| | | { |
| | | public short RgvTask { get; set; } |
| | | /// <summary> |
| | | /// æ¡æä¿¡å· |
| | | /// RGVç»æä»»å¡å·<br/> |
| | | /// </summary> |
| | | [BoolIndex(0)] |
| | | public bool HandShake { get; set; } |
| | | |
| | | public short RgvEndTask { get; set; } |
| | | /// <summary> |
| | | /// 1èæº 0è±æº |
| | | /// RGV䏿¬¡ä»»å¡å·<br/> |
| | | /// </summary> |
| | | [BoolIndex(1)] |
| | | public bool Online { get; set; } |
| | | |
| | | public short RgvLastTask { get; set; } |
| | | /// <summary> |
| | | /// 1ç©ºé² 0ç¹å¿ |
| | | /// ä»»å¡ç¶æåé¦<br/> |
| | | /// </summary> |
| | | [BoolIndex(2)] |
| | | public bool Free { get; set; } |
| | | |
| | | public short TaskDone { get; set; } |
| | | /// <summary> |
| | | /// 1æè´§ 0æ è´§ |
| | | /// å¿è·³<br/> |
| | | /// </summary> |
| | | [BoolIndex(3)] |
| | | public bool Goods { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 1æ
é 0æ£å¸¸ |
| | | /// </summary> |
| | | [BoolIndex(4)] |
| | | public bool Alarm { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 1请æ±è¡¥ç 0æ |
| | | /// </summary> |
| | | [BoolIndex(5)] |
| | | public bool RequestPakcPallet { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 1è¯·æ±æç 0æ |
| | | /// </summary> |
| | | [BoolIndex(6)] |
| | | public bool RequestUnpackPellet { get; set; } |
| | | } |
| | | |
| | | public class ConveyorLineSignal |
| | | { |
| | | /// <summary> |
| | | /// 请æ±ä¿¡å· |
| | | /// </summary> |
| | | [BoolIndex(0)] |
| | | public bool STB { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ååºä¿¡å· |
| | | /// </summary> |
| | | [BoolIndex(1)] |
| | | public bool ACK { get; set; } |
| | | } |
| | | |
| | | public class W_ConveyorLineInfo : DeviceCommand |
| | | { |
| | | |
| | | /// <summary> |
| | | /// ç«å°ç¼å· |
| | | /// </summary> |
| | | public short ConveyorNo { get; set; } |
| | | |
| | | public byte Operate { get; set; } |
| | | |
| | | public byte Undefined { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | public int TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èµ·å§å°å |
| | | /// </summary> |
| | | public short StartPos { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç®æ å°å |
| | | /// </summary> |
| | | public short EndPos { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ç©ç±»å |
| | | /// </summary> |
| | | public short GoodsType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Spare1 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Spare2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 交äºä¿¡å· |
| | | /// </summary> |
| | | public byte Signal { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public byte Undefined2 { get; set; } |
| | | } |
| | | |
| | | public class W_ConveyorLineOperate |
| | | { |
| | | /// <summary> |
| | | /// æ¡æä¿¡å· |
| | | /// </summary> |
| | | [BoolIndex(0)] |
| | | public bool HandShake { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¤ä½æ¥è¦ |
| | | /// </summary> |
| | | [BoolIndex(1)] |
| | | public bool ClearAlarm { get; set; } |
| | | |
| | | /// <summary> |
| | | /// éå |
| | | /// </summary> |
| | | [BoolIndex(2)] |
| | | public bool Return { get; set; } |
| | | public short HeartBeat { get; set; } |
| | | } |
| | | } |
| | |
| | | public enum R_ConveyorLineCPDB |
| | | { |
| | | /// <summary> |
| | | /// å°ä½æä»¤ |
| | | /// å½ä»¤ |
| | | /// </summary> |
| | | ConveyArrivaled, |
| | | Command, |
| | | /// <summary> |
| | | /// èµ·å§å°å |
| | | /// ç®æ å°å |
| | | /// </summary> |
| | | StartPos, |
| | | /// <summary> |
| | | /// ç»ç¹å°å |
| | | /// </summary> |
| | | EndPos, |
| | | /// <summary> |
| | | /// æçå· |
| | | /// </summary> |
| | | Barcode, |
| | | StatusPV, |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | TaskNum, |
| | | TaskNo, |
| | | /// <summary> |
| | | /// ç±»å |
| | | /// é¢ç |
| | | /// </summary> |
| | | WorkType, |
| | | Reserve, |
| | | /// <summary> |
| | | /// æ¨¡å¼ |
| | | /// 1å
¥åºæ¨¡å¼ |
| | | /// 2çäº§æ¨¡å¼ |
| | | /// å¿è·³ |
| | | /// </summary> |
| | | WorkMode, |
| | | Heart, |
| | | /// <summary> |
| | | /// æ ¡éªä½ |
| | | /// æçæ¡ç |
| | | /// </summary> |
| | | CheckPos |
| | | PalletCode |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Tasks.ConveyorLineJob |
| | | { |
| | | public enum R_RgvCPDB |
| | | { |
| | | /// <summary> |
| | | /// 模å¼<br/> |
| | | /// 1æå¨<br/> |
| | | /// 2ç»´ä¿®<br/> |
| | | /// 3åèªå¨<br/> |
| | | /// 4èªå¨<br/> |
| | | /// 5èæºèªå¨<br/> |
| | | /// </summary> |
| | | Mode, |
| | | /// <summary> |
| | | /// ç¶æ<br/> |
| | | /// 0空é²<br/> |
| | | /// 1æä»»å¡<br/> |
| | | /// </summary> |
| | | State, |
| | | /// <summary> |
| | | /// RGVæ¥æ¶ä»»å¡å·<br/> |
| | | /// </summary> |
| | | RgvTask, |
| | | /// <summary> |
| | | /// RGVç»æä»»å¡å·<br/> |
| | | /// </summary> |
| | | RgvEndTask, |
| | | /// <summary> |
| | | /// RGV䏿¬¡ä»»å¡å·<br/> |
| | | /// </summary> |
| | | RgvLastTask, |
| | | /// <summary> |
| | | /// ä»»å¡ç¶æåé¦<br/> |
| | | /// </summary> |
| | | TaskDone, |
| | | /// <summary> |
| | | /// å¿è·³<br/> |
| | | /// </summary> |
| | | HeartBeat |
| | | } |
| | | } |
| | |
| | | public enum W_ConveyorLineCPDB |
| | | { |
| | | /// <summary> |
| | | /// ç§»å¨æä»¤ |
| | | /// å½ä»¤ |
| | | /// </summary> |
| | | ConveyArrival, |
| | | Command, |
| | | /// <summary> |
| | | /// èµ·å§å°å |
| | | /// ç®æ å°å |
| | | /// </summary> |
| | | StartPos, |
| | | /// <summary> |
| | | /// ç»ç¹å°å |
| | | /// </summary> |
| | | EndPos, |
| | | /// <summary> |
| | | /// æçå· |
| | | /// </summary> |
| | | Barcode, |
| | | TargetAddress, |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | TaskNum, |
| | | TaskNo, |
| | | /// <summary> |
| | | /// ç±»å |
| | | /// é¢ç |
| | | /// </summary> |
| | | WorkType, |
| | | Reserve, |
| | | /// <summary> |
| | | /// åæç±»å |
| | | /// å¿è·³ |
| | | /// </summary> |
| | | WorkMode, |
| | | /// <summary> |
| | | /// æ ¡éªä½ |
| | | /// </summary> |
| | | CheckPos |
| | | Heart |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Tasks.ConveyorLineJob |
| | | { |
| | | public enum W_RgvCPDB |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡å·<br/> |
| | | /// </summary> |
| | | WcsTask, |
| | | /// <summary> |
| | | /// ä»»å¡ç±»å<br/> |
| | | /// 1å®ä½<br/> |
| | | /// 2åè´§<br/> |
| | | /// 3æ¾è´§<br/> |
| | | /// 4åæ¾è´§<br/> |
| | | /// </summary> |
| | | TaskType, |
| | | /// <summary> |
| | | /// æ§è¡å·¥ä½<br/> |
| | | /// 1:1å·¥ä½<br/> |
| | | /// 2:2å·¥ä½<br/> |
| | | /// 3:3å·¥ä½<br/> |
| | | /// 4:12å·¥ä½<br/> |
| | | /// 5:13å·¥ä½<br/> |
| | | /// 6:23å·¥ä½<br/> |
| | | /// 7:123å·¥ä½<br/> |
| | | /// </summary> |
| | | WorkStation, |
| | | /// <summary> |
| | | /// åè´§å°å1<br/> |
| | | /// </summary> |
| | | Qu1, |
| | | /// <summary> |
| | | /// åè´§å°å2<br/> |
| | | /// </summary> |
| | | Qu2, |
| | | /// <summary> |
| | | /// åè´§å°å2<br/> |
| | | /// </summary> |
| | | Qu3, |
| | | /// <summary> |
| | | /// æ¾è´§å°å1<br/> |
| | | /// </summary> |
| | | Fang1, |
| | | /// <summary> |
| | | /// æ¾è´§å°å2<br/> |
| | | /// </summary> |
| | | Fang2, |
| | | /// <summary> |
| | | /// æ¾è´§å°å3<br/> |
| | | /// </summary> |
| | | Fang3, |
| | | /// <summary> |
| | | /// å¿è·³<br/> |
| | | /// </summary> |
| | | HearBeat, |
| | | /// <summary> |
| | | /// ä¸å/宿任塿 è¯<br/> |
| | | /// 1确认任å¡ä¸å<br/> |
| | | /// 2确认任å¡å®æ<br/> |
| | | /// </summary> |
| | | TaskReceivedDone, |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using SqlSugar.Extensions; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class ConveyorLineJob_CPA : 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 ConveyorLineJob_CPA(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<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList(); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | 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(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (deviceProRead != null) |
| | | { |
| | | R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); |
| | | if (conveyorLineInfoRead.Command == 2 && conveyorLineInfoRead.TaskNo > 0) |
| | | { |
| | | 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 = "SC01_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); |
| | | WriteError(item.StationName, $"ä»»å¡å·:{task.TaskNum}è¿è¡å åæºå
¥åº"); |
| | | //string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, "AGV_CP"); |
| | | //if (string.IsNullOrEmpty(locationCode) && task.TaskType != TaskTypeEnum.EmptyProductBack.ObjToInt()) |
| | | //{ |
| | | // WriteError(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | // continue; |
| | | //} |
| | | |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°è®¾å¤åç¼å·{item.StationCode}çå议信æ¯"); |
| | | } |
| | | } |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using SqlSugar.Extensions; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class ConveyorLineJob_CPB : 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 ConveyorLineJob_CPB(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<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).Distinct().ToList(); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | 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(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (deviceProRead != null && deviceProWrite!=null) |
| | | { |
| | | R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); |
| | | if (conveyorLineInfoRead.Command == 6 && conveyorLineInfoRead.TaskNo>0 && !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode)) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x =>x.TaskNum== conveyorLineInfoRead.TaskNo && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode==device.DeviceCode); |
| | | if (task != null) |
| | | { |
| | | //åé
å··é åå
¥æçæ°æ® |
| | | |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, "SC01_CP", 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.TargetAddress, router.NextPosi, item.StationCode); |
| | | device.SetValue(W_ConveyorLineCPDB.TaskNo, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineCPDB.Command, 1, item.StationCode); |
| | | task.NextAddress=router.NextPosi; |
| | | task.PalletType = 1; |
| | | task.PalletCode = conveyorLineInfoRead.PalletCode; |
| | | task.Roadway = "SC01_CP"; |
| | | task.DeviceCode = router.ChildPosiDeviceCode; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | WriteError(item.StationName, $"ä»»å¡å·{conveyorLineInfoRead.TaskNo}ä¸ä¸æ¥"); |
| | | //string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, "AGV_CP"); |
| | | //if (string.IsNullOrEmpty(locationCode) && task.TaskType != TaskTypeEnum.EmptyProductBack.ObjToInt()) |
| | | //{ |
| | | // WriteError(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | // continue; |
| | | //} |
| | | |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°è®¾å¤åç¼å·{item.StationCode}çå议信æ¯"); |
| | | } |
| | | } |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using SqlSugar.Extensions; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class ConveyorLineJob_CPC : 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 ConveyorLineJob_CPC(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<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).Distinct().ToList(); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | 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(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null) |
| | | { |
| | | R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); |
| | | if (conveyorLineInfoRead.StatusPV == 3 && conveyorLineInfoRead.Command == 11) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && (x.TaskState == TaskStatusEnum.RGV_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.RGV_Executing.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt())); |
| | | if (task == null) |
| | | { |
| | | //è·åç«å° |
| | | WebResponseContent content = _taskService.RequestWMSTaskSimple("", item.StationCode); |
| | | //string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, "AGV_CP"); |
| | | //if (string.IsNullOrEmpty(locationCode) && task.TaskType != TaskTypeEnum.EmptyProductBack.ObjToInt()) |
| | | //{ |
| | | // WriteError(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | // continue; |
| | | //} |
| | | if (content.Status) |
| | | { |
| | | Dt_Task taskNew = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && (x.TaskState == TaskStatusEnum.New.ObjToInt())); |
| | | if (taskNew != null) |
| | | { |
| | | _taskService.UpdateTask(taskNew, TaskStatusEnum.RGV_Execute); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using SqlSugar.Extensions; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class ConveyorLineJob_CPD : 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 ConveyorLineJob_CPD(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<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList(); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | 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(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | } |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Microsoft.IdentityModel.Tokens; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.Helper; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class RGVJob_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 RGVJob_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; |
| | | |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == device.DeviceCode && x.DeviceProParamType == nameof(R_RgvCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == device.DeviceCode && x.DeviceProParamType == nameof(W_RgvCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | Console.WriteLine(DateTime.Now.ToString("yyyy-mm-ddd HH:mm:ss")); |
| | | if (deviceProRead != null && deviceProWrite != null) |
| | | { |
| | | R_RGVCPInfo rgvInfoRead = device.Communicator.ReadCustomer<R_RGVCPInfo>(deviceProRead.DeviceProAddress); |
| | | if (rgvInfoRead.Mode==4 && rgvInfoRead.State == 0 && rgvInfoRead.TaskDone==1) |
| | | { |
| | | //è·åä»»å¡ |
| | | Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.RGV_Execute.ObjToInt() && x.DeviceCode==device.DeviceCode); |
| | | if (task != null) |
| | | { |
| | | device.SetValue(W_RgvCPDB.WcsTask, task.TaskNum); |
| | | device.SetValue(W_RgvCPDB.TaskType, 4); |
| | | device.SetValue(W_RgvCPDB.WorkStation, 1); |
| | | device.SetValue(W_RgvCPDB.Qu1, task.CurrentAddress); |
| | | device.SetValue(W_RgvCPDB.Fang1, task.NextAddress); |
| | | device.SetValue(W_RgvCPDB.TaskReceivedDone, 1); |
| | | Thread.Sleep(1000); |
| | | //å¤ä½ä¿¡å· |
| | | device.SetValue(W_RgvCPDB.TaskReceivedDone, 0); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.RGV_Executing); |
| | | } |
| | | } |
| | | else if(rgvInfoRead.Mode == 4 && rgvInfoRead.State == 1 && rgvInfoRead.TaskDone == 3) |
| | | { |
| | | //è·åä»»å¡ |
| | | Dt_Task task = _taskRepository.QueryFirst(x =>x.TaskNum==rgvInfoRead.RgvEndTask && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.RGV_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode); |
| | | if (task != null) |
| | | { |
| | | //è·åä¸ä¸ä¸ªèç¹çè·¯ç± |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress); |
| | | task.CurrentAddress = task.NextAddress; |
| | | task.NextAddress = ""; |
| | | task.DeviceCode = stationManger.StationDeviceCode; |
| | | device.SetValue(W_RgvCPDB.TaskReceivedDone, 2); |
| | | Thread.Sleep(1000); |
| | | //å¤ä½ä¿¡å· |
| | | device.SetValue(W_RgvCPDB.TaskReceivedDone, 0); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute); |
| | | WriteError(device.DeviceName, $"RGVä»»å¡å®æ,ä»»å¡å·{rgvInfoRead.RgvEndTask}"); |
| | | } |
| | | else |
| | | { |
| | | WriteError(device.DeviceName, $"æªæ¾å°RGV对åºçç»æä»»å¡{rgvInfoRead.RgvEndTask}"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteError(device.DeviceName, $"æªæ¾å°è®¾å¤åç¼å·{device.DeviceCode}çå议信æ¯"); |
| | | } |
| | | } |
| | | |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
| ÎļþÃû´Ó ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/³ÉÆ·²Ö/StackerCraneJob_CP1.cs ÐÞ¸Ä |
| | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class StackerCraneJob_CP1 : JobBase, IJob |
| | | public class StackerCraneJob_CP : JobBase, IJob |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | |
| | | private readonly IRouterService _routerService; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | |
| | | public StackerCraneJob_CP1(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) |
| | | public StackerCraneJob_CP(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(StackerCraneJob_CP1), ex.Message, ex); |
| | | WriteError(nameof(StackerCraneJob_CP), ex.Message, ex); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | |
| | | if (device != null) |
| | | { |
| | | OtherDevice client = (OtherDevice)device; |
| | | if (!client.GetValue<R_ConveyorLineDB, bool>(R_ConveyorLineDB.Goods, stationManger.StationCode))//åºåºç«å°æªè¢«å ç¨ |
| | | if (client.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode)==3)//åºåºç«å°æªè¢«å ç¨ |
| | | { |
| | | task.NextAddress = stationManger.StackerCraneStationCode; |
| | | _taskRepository.UpdateData(task); |