/// <summary> /// 写入或清除 ECS允许焊接机器人翻转,True为写入,False为清除 /// </summary> /// <param name="plc"></param> /// <param name="cutter">机器人</param> /// <param name="allow">是否允许翻转,true为允许,false为清除</param> /// <param name="result"></param> /// <returns></returns> protected BllResult SendCutToPlc(Equipment cutter, CutFlag cutFlag, IPLC plc) { var operate = cutFlag == CutFlag.默认 ? "清除" : "写入"; var WCS_Allow_Flip = cutter.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.WCSAllowFlip.ToString()); WCS_Allow_Flip.Value = cutFlag.ToString(); BllResult plcResult = plc.Write(WCS_Allow_Flip); if (plcResult.Success) { Logger.Log($"{operate}设备【{cutter.Name}】ECS允许翻转信号成功", LogLevel.Success); } else { Logger.Log($"{operate}设备【{cutter.Name}】ECS允许翻转信号失败,写入PLC失败:原因:{plcResult.Msg}", LogLevel.Error); } return(plcResult); }
/// <summary> /// 切割请求处理 /// </summary> /// <param name="machine">切割机</param> /// <param name="cutFlag">是否允许切割</param> /// <param name="wcsCutTaskId">管段任务号</param> /// <param name="wcsCutMaterial">管段材料</param> /// <param name="wcsCutLength">管段长度</param> /// <param name="wcsCutDiameter">管段直径</param> /// <param name="wcsCutThickness">管段壁厚</param> /// <param name="plc"></param> /// <returns></returns> protected BllResult SendCutToPlc(Equipment machine, IPLC plc, CutFlag cutFlag, string wcsCutTaskId, string wcsCutMaterial, string wcsCutLength, string wcsCutDiameter, string wcsCutThickness) { wcsCutDiameter = (Convert.ToInt32(decimal.Parse(wcsCutDiameter) * 10)).ToString(); wcsCutThickness = (Convert.ToInt32(decimal.Parse(wcsCutThickness) * 10)).ToString(); List <EquipmentProp> props = null; var prop1 = machine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.WCSAllowCut.ToString()); prop1.Value = cutFlag.GetIndexString(); var prop2 = machine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.WCSCutTaskId.ToString()); prop2.Value = wcsCutTaskId; var prop3 = machine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.WCSCutMaterial.ToString()); prop3.Value = wcsCutMaterial; var prop4 = machine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.WCSCutLength.ToString()); prop4.Value = wcsCutLength; var prop5 = machine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.WCSCutDiameter.ToString()); prop5.Value = wcsCutDiameter; var prop6 = machine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.WCSCutThickness.ToString()); prop6.Value = wcsCutThickness; if (cutFlag == CutFlag.默认) { props = new List <EquipmentProp> { prop1, prop2, prop3, prop4, prop5, prop6 }; } else { props = new List <EquipmentProp> { prop2, prop3, prop4, prop5, prop6, prop1 }; } BllResult plcResult = plc.Writes(props); return(plcResult); }