/// <summary> /// 高速堆垛机的下发给PLC的调用函数 /// 由于只有一个叉,动作类型暂时保留固定写单叉动作。 /// </summary> /// <param name="stocker">堆垛机编码</param> /// <param name="plc">对应写入PLC的OPC连接</param> /// <param name="taskMode">任务模型</param> /// <param name="forkTaskFlag">取货任务的任务类型</param> /// <param name="forkRow">取货的行(2,1,3,4)</param> /// <param name="forkColumn">取货的列</param> /// <param name="forkLayer">取货的层</param> /// <param name="forkStation">取货的站台</param> /// <param name="forkTaskFlag2">放货的任务类型</param> /// <param name="forkRow2">放货的行(2,1,3,4)</param> /// <param name="forkColumn2">放货的列</param> /// <param name="forkLayer2">放货的层</param> /// <param name="forkStation2">放货的站台</param> /// <param name="taskNo">任务号</param> /// <param name="taskAccount">任务过账 </param> /// <returns></returns> public BllResult SendTaskToStocker(Equipment stocker, IPLC plc, SuperSRMTaskMode taskMode, SRMForkTaskFlag forkTaskFlag, string forkRow, string forkColumn, string forkLayer, string forkStation, SRMForkTaskFlag forkTaskFlag2, string forkRow2, string forkColumn2, string forkLayer2, string forkStation2, string taskNo, TaskAccount taskAccount) { try { List <EquipmentProp> propsToWriter = new List <EquipmentProp>(); var props = stocker.EquipmentProps; var action = props.Find(t => t.EquipmentTypeTemplateCode == "WCSForkTaskMode"); action.Value = taskMode.GetIndexString(); var taskFlag = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1TaskFlag"); taskFlag.Value = forkTaskFlag.GetIndexString(); var row = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1Row"); row.Value = forkRow; var column = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1Column"); column.Value = forkColumn; var layer = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1Layer"); layer.Value = forkLayer; var station = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1Station"); station.Value = forkStation; var taskFlag2 = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1TaskFlag2"); taskFlag2.Value = forkTaskFlag2.GetIndexString(); var row2 = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1Row2"); row2.Value = forkRow2; var column2 = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1Column2"); column2.Value = forkColumn2; var layer2 = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1Layer2"); layer2.Value = forkLayer2; var station2 = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1Station2"); station2.Value = forkStation2; var task = props.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1Task"); task.Value = taskNo; var account = props.Find(t => t.EquipmentTypeTemplateCode == "WCSTaskAccount"); account.Value = taskAccount.GetIndexString(); propsToWriter.AddRange(new List <EquipmentProp>() { action, taskFlag, row, column, layer, station, taskFlag2, row2, column2, layer2, station2, task, account }); return(plc.Writes(propsToWriter)); } catch (Exception ex) { Logger.Log($"PLC写入信息错误:" + ex.Message, LogLevel.Exception); return(BllResultFactory.Error($"下发任务出现异常:{ex.Message}")); } }
/// <summary> /// 清理WCS交换区 /// </summary> /// <param name="stocker"></param> /// <param name="plc"></param> /// <returns></returns> public BllResult ClearWCSData(Equipment stocker, IPLC plc, TaskAccount account) { //表示堆垛机已经收到WCS发送给他的任务完成信号,此时WCS可以清除自己的交换区地址 BllResult sendResult = SendTaskToStocker(stocker, plc, SuperSRMTaskMode.无, SRMForkTaskFlag.无任务, "0", "0", "0", "0", SRMForkTaskFlag.无任务, "0", "0", "0", "0", "0", account); if (sendResult.Success) { Logger.Log($"任务完成后,清除堆垛机{stocker.Name}交换区地址成功", LogLevel.Info); return(BllResultFactory.Sucess()); } else { Logger.Log($"任务完成后,清除堆垛机{stocker.Name}交换区地址失败", LogLevel.Error); return(BllResultFactory.Error()); } }